source: proto/RE/output/re_pablo.py

Last change on this file was 3784, checked in by cameron, 5 years ago

Revert changes so demos work

File size: 1.2 KB
Line 
1# -*- coding: utf-8 -*-
2#
3# prototype.py template
4#
5# Ken Herdy
6# April 20, 2010
7#
8#----------------------------------------------------------------------------
9#
10# (at)lex_strms - Lexical Item Streams.
11# (at)cc_code   - Character Class compiler equations.
12# (at)pbs_code  - Parallel bit stream equations.
13# (at)pbs_debug - Parallel bit stream debug statements.
14#
15#----------------------------------------------------------------------------
16
17#import sys
18#import bitutil
19
20
21class Basis_bits():
22        bit_0 = 0
23        bit_1 = 0
24        bit_2 = 0
25        bit_3 = 0 
26        bit_4 = 0
27        bit_5 = 0
28        bit_6 = 0
29        bit_7 = 0 
30 
31class Lex():
32
33        cc0 = (0)
34        cc1 = (0)
35        LF = (0) 
36
37class Output():
38        matches = (0)
39
40def Classify_bytes(basis_bits,lex):
41@cc_code
42
43def Demo(lex, output):
44        m0=0
45        m1=0
46        m2=0
47        m3=0
48        m4=0
49        m0=~0
50        m1 = m0
51        m1 = pablo.Advance((m1 & lex.cc0))
52        m0 = m1
53        m0 = pablo.MatchStar(m0, lex.cc0)
54        m0 = pablo.Advance((m0 & lex.cc1))
55        m3 = m0
56        m3 = pablo.Advance((m3 & lex.cc0))
57        m0 = m3
58        m0 = pablo.MatchStar(m0, lex.cc0)
59        output.matches = 0
60        all_matches = m0
61        if all_matches:
62                # Find the last match on each line and filter out all others
63                output.matches = pablo.MatchStar(all_matches, ~lex.LF) & lex.LF
64       
65def Main(u8data, lex, output):
66        Classify_bytes(basis_bits,lex)
67        Demo(lex,output)
68
Note: See TracBrowser for help on using the repository browser.