Changeset 3082 for proto


Ignore:
Timestamp:
Apr 27, 2013, 1:25:42 AM (6 years ago)
Author:
ksherdy
Message:

Added test for complex identifier.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/pabloj/trunk/input/test/pabloS/test.pablos

    r3011 r3082  
    1 // PabloS version of parabix2_pablo.py generated with py2pabloS.py
    2 
    3 struct Basis_bits{
    4     stream<1> bit_0;
    5     stream<1> bit_1;
    6     stream<1> bit_2;
    7     stream<1> bit_3;
    8     stream<1> bit_4;
    9     stream<1> bit_5;
    10     stream<1> bit_6;
    11     stream<1> bit_7;
     1function void Test() {
     2        a.b;
    123};
    13 
    14 struct U8{
    15     stream<1> unibyte;
    16     stream<1> prefix;
    17     stream<1> prefix2;
    18     stream<1> prefix3;
    19     stream<1> prefix4;
    20     stream<1> suffix;
    21     stream<1> badprefix;
    22     stream<1> xE0;
    23     stream<1> xED;
    24     stream<1> xF0;
    25     stream<1> xF4;
    26     stream<1> xA0_xBF;
    27     stream<1> x80_x9F;
    28     stream<1> x90_xBF;
    29     stream<1> x80_x8F;
    30     stream<1> xEF;
    31     stream<1> xBF;
    32     stream<1> xBE;
    33     stream<1> scope22;
    34     stream<1> scope32;
    35     stream<1> scope33;
    36     stream<1> scope42;
    37     stream<1> scope43;
    38     stream<1> scope44;
    39     stream<1> xE0_scope;
    40     stream<1> xED_scope;
    41     stream<1> xF0_scope;
    42     stream<1> xF4_scope;
    43     stream<1> xEF_scope;
    44 };
    45 
    46 struct Lex{
    47     stream<1> CR;
    48     stream<1> LF;
    49     stream<1> HT;
    50     stream<1> SP;
    51     stream<1> CRLF;
    52     stream<1> RefStart;
    53     stream<1> Semicolon;
    54     stream<1> Colon;
    55     stream<1> LAngle;
    56     stream<1> RAngle;
    57     stream<1> LBracket;
    58     stream<1> RBracket;
    59     stream<1> Exclam;
    60     stream<1> QMark;
    61     stream<1> Hyphen;
    62     stream<1> Equals;
    63     stream<1> SQuote;
    64     stream<1> DQuote;
    65     stream<1> Slash;
    66     stream<1> Hash;
    67     stream<1> x;
    68     stream<1> ASCII_name_start;
    69     stream<1> ASCII_name_char;
    70     stream<1> NameScan;
    71     stream<1> Digit;
    72     stream<1> Hex;
    73     stream<1> WS;
    74 };
    75 
    76 struct Marker{
    77     stream<1> LAngle_scope;
    78     stream<1> Ref_opener;
    79     stream<1> CD_closer;
    80 };
    81 
    82 struct CtCDPI_Callouts{
    83     stream<1> Ct_starts;
    84     stream<1> Ct_ends;
    85     stream<1> CD_starts;
    86     stream<1> CD_ends;
    87     stream<1> PI_starts;
    88     stream<1> PI_name_starts;
    89     stream<1> PI_name_ends;
    90     stream<1> PI_ends;
    91 };
    92 
    93 struct Ref_Callouts{
    94     stream<1> GenRef_starts;
    95     stream<1> GenRef_ends;
    96     stream<1> DecRef_starts;
    97     stream<1> DecRef_ends;
    98     stream<1> HexRef_starts;
    99     stream<1> HexRef_ends;
    100 };
    101 
    102 struct Tag_Callouts{
    103     stream<1> ElemName_starts;
    104     stream<1> ElemName_ends;
    105     stream<1> AttName_starts;
    106     stream<1> AttName_ends;
    107     stream<1> AttVal_starts;
    108     stream<1> AttVal_ends;
    109     stream<1> AttVal_spans;
    110     stream<1> EmptyTag_marks;
    111     stream<1> EndTag_marks;
    112 };
    113 
    114 struct Check_streams{
    115     stream<1> misc_mask;
    116     stream<1> non_ascii_name_starts;
    117     stream<1> non_ascii_names;
    118     stream<1> tag_marks;
    119     stream<1> name_follows;
    120     stream<1> att_refs;
    121 };
    122 
    123 function void Classify_bytes_Validate_utf8(struct Basis_bits basis_bits, struct Lex lex, struct U8 u8) {
    124     var stream<1> temp1 = (basis_bits.bit_0 | basis_bits.bit_1);
    125     var stream<1> temp2 = (basis_bits.bit_2 & (~ basis_bits.bit_3));
    126     var stream<1> temp3 = (temp2 & (~ temp1));
    127     var stream<1> temp4 = (basis_bits.bit_5 & (~ basis_bits.bit_4));
    128     var stream<1> temp5 = (basis_bits.bit_6 & (~ basis_bits.bit_7));
    129     var stream<1> temp6 = (temp4 & temp5);
    130     lex.RefStart = (temp3 & temp6);
    131     var stream<1> temp7 = (basis_bits.bit_2 & basis_bits.bit_3);
    132     var stream<1> temp8 = (temp7 & (~ temp1));
    133     var stream<1> temp9 = (basis_bits.bit_4 & (~ basis_bits.bit_5));
    134     var stream<1> temp10 = (basis_bits.bit_6 & basis_bits.bit_7);
    135     var stream<1> temp11 = (temp9 & temp10);
    136     lex.Semicolon = (temp8 & temp11);
    137     var stream<1> temp12 = (basis_bits.bit_4 & basis_bits.bit_5);
    138     var stream<1> temp13 = (basis_bits.bit_6 | basis_bits.bit_7);
    139     var stream<1> temp14 = (temp12 & (~ temp13));
    140     lex.LAngle = (temp8 & temp14);
    141     var stream<1> temp15 = (temp12 & temp5);
    142     lex.RAngle = (temp8 & temp15);
    143     var stream<1> temp16 = (basis_bits.bit_1 & (~ basis_bits.bit_0));
    144     var stream<1> temp17 = (basis_bits.bit_3 & (~ basis_bits.bit_2));
    145     var stream<1> temp18 = (temp16 & temp17);
    146     lex.LBracket = (temp18 & temp11);
    147     var stream<1> temp19 = (basis_bits.bit_7 & (~ basis_bits.bit_6));
    148     var stream<1> temp20 = (temp12 & temp19);
    149     lex.RBracket = (temp18 & temp20);
    150     var stream<1> temp21 = (basis_bits.bit_4 | basis_bits.bit_5);
    151     var stream<1> temp22 = (temp19 & (~ temp21));
    152     lex.Exclam = (temp3 & temp22);
    153     var stream<1> temp23 = (temp12 & temp10);
    154     lex.QMark = (temp8 & temp23);
    155     lex.Hyphen = (temp3 & temp20);
    156     lex.Equals = (temp8 & temp20);
    157     var stream<1> temp24 = (temp4 & temp10);
    158     lex.SQuote = (temp3 & temp24);
    159     var stream<1> temp25 = (temp5 & (~ temp21));
    160     lex.DQuote = (temp3 & temp25);
    161     lex.Slash = (temp3 & temp23);
    162     var stream<1> temp26 = (temp10 & (~ temp21));
    163     lex.Hash = (temp3 & temp26);
    164     var stream<1> temp27 = (temp16 & temp7);
    165     var stream<1> temp28 = (temp9 & (~ temp13));
    166     lex.x = (temp27 & temp28);
    167     var stream<1> temp29 = (temp9 & temp5);
    168     lex.Colon = (temp8 & temp29);
    169     var stream<1> temp30 = (temp18 & temp23);
    170     var stream<1> temp31 = (temp30 | lex.Colon);
    171     var stream<1> temp32 = (temp16 & (~ basis_bits.bit_2));
    172     var stream<1> temp33 = (basis_bits.bit_5 | temp10);
    173     var stream<1> temp34 = (basis_bits.bit_4 & temp33);
    174     var stream<1> temp35 = (~ temp34);
    175     var stream<1> temp36 = (temp21 | temp13);
    176     var stream<1> temp37 = ((basis_bits.bit_3 & temp35) | ((~ basis_bits.bit_3) & temp36));
    177     var stream<1> temp38 = (temp32 & temp37);
    178     var stream<1> temp39 = (temp31 | temp38);
    179     var stream<1> temp40 = (temp16 & basis_bits.bit_2);
    180     var stream<1> temp41 = (temp40 & temp37);
    181     lex.ASCII_name_start = (temp39 | temp41);
    182     var stream<1> temp42 = (temp30 | lex.Hyphen);
    183     var stream<1> temp43 = (temp3 & temp15);
    184     var stream<1> temp44 = (temp42 | temp43);
    185     var stream<1> temp45 = (temp8 & (~ temp34));
    186     var stream<1> temp46 = (temp44 | temp45);
    187     var stream<1> temp47 = (temp46 | temp38);
    188     lex.ASCII_name_char = (temp47 | temp41);
    189     lex.NameScan = (lex.ASCII_name_char | basis_bits.bit_0);
    190     var stream<1> temp48 = (temp1 | basis_bits.bit_2);
    191     var stream<1> x00_x1F = (~ temp48);
    192     var stream<1> temp49 = (basis_bits.bit_2 | basis_bits.bit_3);
    193     var stream<1> temp50 = (temp1 | temp49);
    194     lex.CR = (temp20 & (~ temp50));
    195     lex.LF = (temp29 & (~ temp50));
    196     var stream<1> temp51 = (temp9 & temp19);
    197     lex.HT = (temp51 & (~ temp50));
    198     lex.SP = (temp3 & (~ temp36));
    199     var stream<1> temp52 = (temp20 | temp29);
    200     var stream<1> temp53 = (temp52 | temp51);
    201     var stream<1> temp54 = (temp53 & (~ temp50));
    202     lex.WS = (temp54 | lex.SP);
    203     var stream<1> temp55 = (basis_bits.bit_5 | basis_bits.bit_6);
    204     var stream<1> temp56 = (basis_bits.bit_4 & temp55);
    205     lex.Digit = (temp8 & (~ temp56));
    206     var stream<1> temp57 = (temp16 & (~ temp49));
    207     var stream<1> temp58 = (temp57 & (~ basis_bits.bit_4));
    208     var stream<1> temp59 = (~ temp10);
    209     var stream<1> temp60 = ((basis_bits.bit_5 & temp59) | ((~ basis_bits.bit_5) & temp13));
    210     var stream<1> temp61 = (temp58 & temp60);
    211     var stream<1> temp62 = (lex.Digit | temp61);
    212     var stream<1> temp63 = (temp16 & temp2);
    213     var stream<1> temp64 = (temp63 & (~ basis_bits.bit_4));
    214     var stream<1> temp65 = (temp64 & temp60);
    215     lex.Hex = (temp62 | temp65);
    216     var stream<1> lex_error = (x00_x1F & (~ lex.WS));
    217     pablo.assert_0(pablo.inFile(lex_error), "Error: illegal character");
    218     u8.unibyte = (~ basis_bits.bit_0);
    219     u8.suffix = pablo.Mask(1,0);
    220     var stream<1> u8_error = pablo.Mask(1,0);
    221     var stream<1> u8_FFFE_FFFF = pablo.Mask(1,0);
    222     var stream<1> u8anyscope = pablo.Mask(1,0);
    223     if (basis_bits.bit_0) {
    224         u8.prefix = (basis_bits.bit_0 & basis_bits.bit_1);
    225         u8.prefix2 = (u8.prefix & (~ basis_bits.bit_2));
    226         u8.prefix3 = (u8.prefix & temp2);
    227         u8.prefix4 = (u8.prefix & temp7);
    228         u8.suffix = (basis_bits.bit_0 & (~ basis_bits.bit_1));
    229         var stream<1> temp66 = (u8.prefix & (~ temp49));
    230         var stream<1> temp67 = (temp21 | basis_bits.bit_6);
    231         var stream<1> temp68 = (temp66 & (~ temp67));
    232         var stream<1> temp69 = (basis_bits.bit_5 & temp13);
    233         var stream<1> temp70 = (basis_bits.bit_4 | temp69);
    234         var stream<1> temp71 = (u8.prefix4 & temp70);
    235         u8.badprefix = (temp68 | temp71);
    236         u8_error = u8.badprefix;
    237         u8.scope22 = pablo.Advance(u8.prefix2);
    238         u8anyscope = u8.scope22;
    239         if ((u8.prefix3 | u8.prefix4)) {
    240             var stream<1> xE0 = (u8.prefix3 & (~ temp36));
    241             var stream<1> xED = (u8.prefix3 & temp20);
    242             var stream<1> xF0 = (u8.prefix4 & (~ temp36));
    243             var stream<1> temp72 = (temp4 & (~ temp13));
    244             var stream<1> xF4 = (u8.prefix4 & temp72);
    245             u8.xA0_xBF = (u8.suffix & basis_bits.bit_2);
    246             u8.x80_x9F = (u8.suffix & (~ basis_bits.bit_2));
    247             u8.x90_xBF = (u8.suffix & temp49);
    248             u8.x80_x8F = (u8.suffix & (~ temp49));
    249             var stream<1> xEF = (u8.prefix3 & temp23);
    250             var stream<1> temp73 = (u8.suffix & temp7);
    251             u8.xBF = (temp73 & temp23);
    252             u8.xBE = (temp73 & temp15);
    253             u8.scope32 = pablo.Advance(u8.prefix3);
    254             u8.scope33 = pablo.Advance(u8.scope32);
    255             u8.scope42 = pablo.Advance(u8.prefix4);
    256             u8.scope43 = pablo.Advance(u8.scope42);
    257             u8.scope44 = pablo.Advance(u8.scope43);
    258             var stream<1> E0_F0_scope = pablo.Advance((xE0 | xF0));
    259             var stream<1> ED_F4_scope = pablo.Advance((xED | xF4));
    260             u8.xE0_scope = (u8.scope32 & E0_F0_scope);
    261             u8.xED_scope = (u8.scope32 & ED_F4_scope);
    262             u8.xF0_scope = (u8.scope42 & E0_F0_scope);
    263             u8.xF4_scope = (u8.scope42 & ED_F4_scope);
    264             u8.xEF_scope = pablo.Advance(xEF);
    265             var stream<1> u8lastscope = ((u8.scope22 | u8.scope33) | u8.scope44);
    266             u8anyscope = (((u8lastscope | u8.scope32) | u8.scope42) | u8.scope43);
    267             var stream<1> u8error1 = (u8.xE0_scope & u8.x80_x9F);
    268             var stream<1> u8error2 = (u8.xED_scope & u8.xA0_xBF);
    269             var stream<1> u8error3 = (u8.xF0_scope & u8.x80_x8F);
    270             var stream<1> u8error4 = (u8.xF4_scope & u8.x90_xBF);
    271             u8_error |= (((u8error1 | u8error2) | u8error3) | u8error4);
    272             var stream<1> EF_BF_pending = pablo.Advance((u8.xEF_scope & u8.xBF));
    273             u8_FFFE_FFFF = (EF_BF_pending & (u8.xBE | u8.xBF));
    274         }
    275         var stream<1> u8mismatch = (u8anyscope ^ u8.suffix);
    276         pablo.assert_0(((u8_error | u8mismatch) | u8_FFFE_FFFF), "UTF-8 error found");
    277     }
    278 }
    279 
    280 function void Parse_CtCDPI(struct Lex lex, struct Marker marker, struct CtCDPI_Callouts ctCDPI_Callouts, struct Check_streams check_streams) {
    281     ctCDPI_Callouts.Ct_starts = pablo.Mask(1,0);
    282     ctCDPI_Callouts.Ct_ends = pablo.Mask(1,0);
    283     ctCDPI_Callouts.CD_starts = pablo.Mask(1,0);
    284     ctCDPI_Callouts.CD_ends = pablo.Mask(1,0);
    285     ctCDPI_Callouts.PI_starts = pablo.Mask(1,0);
    286     ctCDPI_Callouts.PI_name_starts = pablo.Mask(1,0);
    287     ctCDPI_Callouts.PI_name_ends = pablo.Mask(1,0);
    288     ctCDPI_Callouts.PI_ends = pablo.Mask(1,0);
    289     var stream<1> CtCDPI_starts = pablo.Mask(1,0);
    290     var stream<1> CtCDPI_ends = pablo.Mask(1,0);
    291     var stream<1> ctCDPI_mask = pablo.Mask(1,0);
    292     var stream<1> v = (lex.LAngle | lex.Hyphen);
    293     var stream<1> w = (lex.Hyphen | lex.QMark);
    294     var stream<1> v1 = pablo.Advance(v, 1);
    295     var stream<1> w1 = pablo.Advance(w, 1);
    296     var stream<1> LAngle_scope = (v1 & (~ w1));
    297     var stream<1> PI_opener = (LAngle_scope & lex.QMark);
    298     var stream<1> CtCD_opener = (LAngle_scope & lex.Exclam);
    299     var stream<1> CtCDPI_opener = (PI_opener | CtCD_opener);
    300     var stream<1> CD_closer = pablo.Mask(1,0);
    301     var stream<1> DoubleHyphen = ((v1 & w1) & lex.Hyphen);
    302     if (lex.RBracket) {
    303         var stream<1> DoubleRBracket = (pablo.Advance(lex.RBracket) & lex.RBracket);
    304         CD_closer = (pablo.Advance(DoubleRBracket) & lex.RAngle);
    305     }
    306     var stream<1> PI_closer = ((w1 & (~ v1)) & lex.RAngle);
    307     var stream<1> CtCDPI_Cursor = pablo.ScanToFirst(CtCDPI_opener);
    308     while (CtCDPI_Cursor) {
    309         CtCDPI_starts |= CtCDPI_Cursor;
    310         var stream<1> PI_Cursor = (CtCDPI_Cursor & PI_opener);
    311         var stream<1> CD_Ct_Cursor = pablo.Advance((CtCDPI_Cursor & (~ PI_Cursor)));
    312         var stream<1> CD_Cursor = (CD_Ct_Cursor & lex.LBracket);
    313         var stream<1> Ct_Cursor = (CD_Ct_Cursor & lex.Hyphen);
    314         if (PI_Cursor) {
    315             ctCDPI_Callouts.PI_starts |= PI_Cursor;
    316             PI_Cursor = pablo.Advance(PI_Cursor);
    317             ctCDPI_Callouts.PI_name_starts |= PI_Cursor;
    318             var stream<1> PI_name_end = pablo.ScanThru(PI_Cursor, lex.NameScan);
    319             var stream<1> PI_error = (PI_Cursor & PI_name_end);
    320             var stream<1> PI_noWS = (PI_name_end & (~ lex.WS));
    321             PI_error |= ((PI_noWS & (~ lex.QMark)) | (pablo.Advance(PI_noWS) & (~ PI_closer)));
    322             pablo.assert_0(PI_error, "Error in PI syntax");
    323             ctCDPI_Callouts.PI_name_ends |= PI_name_end;
    324             PI_Cursor = pablo.ScanTo(PI_name_end, PI_closer);
    325             ctCDPI_Callouts.PI_ends |= PI_Cursor;
    326             CtCDPI_ends |= PI_Cursor;
    327         }
    328         if (CD_Cursor) {
    329             ctCDPI_Callouts.CD_starts |= CD_Cursor;
    330             CD_Cursor = pablo.ScanTo(CD_Cursor, CD_closer);
    331             ctCDPI_Callouts.CD_ends |= CD_Cursor;
    332             CtCDPI_ends |= CD_Cursor;
    333         }
    334         if (Ct_Cursor) {
    335             ctCDPI_Callouts.Ct_starts |= Ct_Cursor;
    336             Ct_Cursor = pablo.Advance(Ct_Cursor);
    337             var stream<1> Ct_error = (Ct_Cursor & (~ lex.Hyphen));
    338             Ct_Cursor = pablo.Advance(pablo.Advance(Ct_Cursor));
    339             Ct_Cursor = pablo.Advance(pablo.ScanTo(Ct_Cursor, DoubleHyphen));
    340             pablo.assert_0((Ct_error | (Ct_Cursor & (~ lex.RAngle))), "Error in comment syntax");
    341             ctCDPI_Callouts.Ct_ends |= Ct_Cursor;
    342             CtCDPI_ends |= Ct_Cursor;
    343         }
    344         CtCDPI_Cursor = ((PI_Cursor | CD_Cursor) | Ct_Cursor);
    345         ctCDPI_mask = pablo.InclusiveSpan(CtCDPI_starts, CtCDPI_ends);
    346         pablo.assert_0(pablo.atEOF(ctCDPI_mask), "Error in comment, CDATA or processing instruction syntax");
    347         CtCDPI_Cursor = pablo.ScanTo(CtCDPI_Cursor, CtCDPI_opener);
    348     }
    349     check_streams.misc_mask = ((((lex.WS | lex.LAngle) | pablo.InclusiveSpan((ctCDPI_Callouts.Ct_starts | ctCDPI_Callouts.PI_starts), (ctCDPI_Callouts.Ct_ends | ctCDPI_Callouts.PI_ends))) | CtCDPI_starts) & EOF_mask);
    350     marker.LAngle_scope = (LAngle_scope & (~ ctCDPI_mask));
    351     marker.Ref_opener = (lex.RefStart & (~ ctCDPI_mask));
    352     marker.CD_closer = (CD_closer & (~ ctCDPI_mask));
    353 }
    354 
    355 function void Parse_tags(struct Lex lex, struct Marker marker, struct Tag_Callouts tag_Callouts) {
    356     var stream<1> EqExpected = pablo.Mask(1,0);
    357     var stream<1> AttListEnd = pablo.Mask(1,0);
    358     var stream<1> DQuoteDelim = (lex.DQuote | lex.LAngle);
    359     var stream<1> SQuoteDelim = (lex.SQuote | lex.LAngle);
    360     var stream<1> AttListDelim = (lex.Slash | lex.RAngle);
    361     tag_Callouts.ElemName_starts = (marker.LAngle_scope & (~ lex.Slash));
    362     tag_Callouts.EndTag_marks = (marker.LAngle_scope & lex.Slash);
    363     tag_Callouts.ElemName_ends = pablo.ScanThru(tag_Callouts.ElemName_starts, lex.NameScan);
    364     var stream<1> ParseError = (tag_Callouts.ElemName_starts & tag_Callouts.ElemName_ends);
    365     tag_Callouts.AttName_starts = pablo.Mask(1,0);
    366     tag_Callouts.AttName_ends = pablo.Mask(1,0);
    367     tag_Callouts.AttVal_starts = pablo.Mask(1,0);
    368     tag_Callouts.AttVal_ends = pablo.Mask(1,0);
    369     if ((tag_Callouts.ElemName_ends & lex.WS)) {
    370         var stream<1> AfterWS = pablo.ScanThru(tag_Callouts.ElemName_ends, lex.WS);
    371         AttListEnd = (AfterWS & AttListDelim);
    372         var stream<1> AttNameStart = (AfterWS & (~ AttListDelim));
    373         while (AttNameStart) {
    374             ParseError |= (AttNameStart & (~ lex.NameScan));
    375             tag_Callouts.AttName_starts |= AttNameStart;
    376             var stream<1> AttNameFollow = pablo.ScanThru(AttNameStart, lex.NameScan);
    377             tag_Callouts.AttName_ends |= AttNameFollow;
    378             if ((AttNameFollow & lex.WS)) {
    379                 EqExpected = pablo.ScanThru(AttNameFollow, lex.WS);
    380             }
    381             else {
    382                 EqExpected = AttNameFollow;
    383             }
    384             ParseError |= (EqExpected & (~ lex.Equals));
    385             var stream<1> AttValPos = pablo.AdvanceThenScanThru(EqExpected, lex.WS);
    386             tag_Callouts.AttVal_starts |= AttValPos;
    387             var stream<1> DQuoteAttVal = (AttValPos & lex.DQuote);
    388             var stream<1> SQuoteAttVal = (AttValPos & lex.SQuote);
    389             var stream<1> DQuoteAttEnd = pablo.AdvanceThenScanTo(DQuoteAttVal, DQuoteDelim);
    390             var stream<1> SQuoteAttEnd = pablo.AdvanceThenScanTo(SQuoteAttVal, SQuoteDelim);
    391             var stream<1> AttValEnd = (DQuoteAttEnd | SQuoteAttEnd);
    392             ParseError |= ((AttValPos | AttValEnd) & (~ (lex.DQuote | lex.SQuote)));
    393             var stream<1> AttValFollow = pablo.Advance(AttValEnd);
    394             tag_Callouts.AttVal_ends |= AttValFollow;
    395             if ((AttValFollow & lex.WS)) {
    396                 AfterWS = pablo.ScanThru(AttValFollow, lex.WS);
    397                 AttListEnd |= (AfterWS & AttListDelim);
    398                 AttNameStart = (AfterWS & (~ AttListDelim));
    399             }
    400             else {
    401                 AttListEnd |= (AttValFollow & AttListDelim);
    402                 AttNameStart = (AttValFollow & (~ AttListDelim));
    403             }
    404             ParseError |= (AttValFollow & AttNameStart);
    405         }
    406     }
    407     else {
    408         AttListEnd = (tag_Callouts.ElemName_ends & AttListDelim);
    409         ParseError |= (tag_Callouts.ElemName_ends & (~ AttListDelim));
    410     }
    411     var stream<1> STagEnds = (AttListEnd & lex.RAngle);
    412     tag_Callouts.EmptyTag_marks = pablo.Advance((AttListEnd & lex.Slash));
    413     ParseError |= (tag_Callouts.EmptyTag_marks & (~ lex.RAngle));
    414     var stream<1> EndTagEnds = pablo.AdvanceThenScanThru(tag_Callouts.EndTag_marks, lex.NameScan);
    415     if ((EndTagEnds & lex.WS)) {
    416         EndTagEnds = pablo.ScanThru(EndTagEnds, lex.WS);
    417     }
    418     ParseError |= (EndTagEnds & (~ lex.RAngle));
    419     pablo.assert_0(ParseError, "Tag parsing error found");
    420     tag_Callouts.AttVal_spans = pablo.SpanUpTo(tag_Callouts.AttVal_starts, tag_Callouts.AttVal_ends);
    421 }
    422 
    423 function void Parse_refs(struct Lex lex, struct Marker marker, struct Ref_Callouts ref_Callouts) {
    424     ref_Callouts.GenRef_starts = pablo.Mask(1,0);
    425     ref_Callouts.GenRef_ends = pablo.Mask(1,0);
    426     ref_Callouts.DecRef_starts = pablo.Mask(1,0);
    427     ref_Callouts.DecRef_ends = pablo.Mask(1,0);
    428     ref_Callouts.HexRef_starts = pablo.Mask(1,0);
    429     ref_Callouts.HexRef_ends = pablo.Mask(1,0);
    430     var stream<1> ref_error = pablo.Mask(1,0);
    431     if (marker.Ref_opener) {
    432         var stream<1> Ref_scope = pablo.Advance(marker.Ref_opener);
    433         var stream<1> NumRef2 = (Ref_scope & lex.Hash);
    434         ref_Callouts.GenRef_starts = (Ref_scope & (~ lex.Hash));
    435         var stream<1> NumRef3 = pablo.Advance(NumRef2);
    436         var stream<1> HexRef3 = (NumRef3 & lex.x);
    437         ref_Callouts.DecRef_starts = (NumRef3 & (~ lex.x));
    438         ref_Callouts.HexRef_starts = pablo.Advance(HexRef3);
    439         ref_Callouts.GenRef_ends = pablo.ScanThru(ref_Callouts.GenRef_starts, lex.NameScan);
    440         ref_Callouts.DecRef_ends = pablo.ScanThru(ref_Callouts.DecRef_starts, lex.Digit);
    441         ref_Callouts.HexRef_ends = pablo.ScanThru(ref_Callouts.HexRef_starts, lex.Hex);
    442         var stream<1> ref_error1 = (ref_Callouts.DecRef_starts & (~ lex.Digit));
    443         var stream<1> ref_error2 = (ref_Callouts.HexRef_starts & (~ lex.Hex));
    444         var stream<1> ref_ends = ((ref_Callouts.GenRef_ends | ref_Callouts.DecRef_ends) | ref_Callouts.HexRef_ends);
    445         var stream<1> ref_error3 = (ref_ends & (~ lex.Semicolon));
    446         pablo.assert_0(((ref_error1 | ref_error2) | ref_error3), "Reference error found");
    447     }
    448 }
    449 
    450 function void Validate_xml_names(struct CtCDPI_Callouts ctCDPI_Callouts, struct Ref_Callouts ref_Callouts, struct Tag_Callouts tag_Callouts, struct Lex lex, struct U8 u8, struct Check_streams check_streams) {
    451     var stream<1> PI_names = pablo.SpanUpTo(ctCDPI_Callouts.PI_name_starts, ctCDPI_Callouts.PI_name_ends);
    452     var stream<1> GenRefs = pablo.SpanUpTo(ref_Callouts.GenRef_starts, ref_Callouts.GenRef_ends);
    453     var stream<1> ElemNames = pablo.SpanUpTo(tag_Callouts.ElemName_starts, tag_Callouts.ElemName_ends);
    454     var stream<1> AttNames = pablo.SpanUpTo(tag_Callouts.AttName_starts, tag_Callouts.AttName_ends);
    455     var stream<1> qname_stream = (ElemNames | AttNames);
    456     var stream<1> ncname_stream = (PI_names | GenRefs);
    457     var stream<1> name_stream = (qname_stream | ncname_stream);
    458     var stream<1> name_start = (name_stream & (~ pablo.Advance(name_stream)));
    459     var stream<1> name_cursor = (name_stream & (~ pablo.Advance(name_stream)));
    460     var stream<1> void_prefix_err = (name_cursor & lex.Colon);
    461     var stream<1> namespace_sep = (pablo.ScanThru(name_cursor, (lex.NameScan & (~ lex.Colon))) & lex.Colon);
    462     var stream<1> local_part_start = pablo.Advance(namespace_sep);
    463     var stream<1> local_part_err = (local_part_start & (~ lex.NameScan));
    464     var stream<1> colon2_err = (pablo.ScanThru(local_part_start, (lex.NameScan & (~ lex.Colon))) & lex.Colon);
    465     var stream<1> ncname_err = (ncname_stream & lex.Colon);
    466     pablo.assert_0((((void_prefix_err | local_part_err) | colon2_err) | ncname_err), "name syntax error");
    467     check_streams.non_ascii_name_starts = (name_start & (~ lex.ASCII_name_start));
    468     check_streams.non_ascii_names = (((name_stream & (~ name_start)) & (~ lex.ASCII_name_char)) & (~ u8.suffix));
    469 }
    470 
    471 function void Do_check_streams(struct Marker marker, struct Tag_Callouts tag_Callouts, struct Check_streams check_streams) {
    472     pablo.assert_0((marker.CD_closer & (~ tag_Callouts.AttVal_spans)), "Error: ]]> in text");
    473     check_streams.tag_marks = (((tag_Callouts.EmptyTag_marks | tag_Callouts.ElemName_starts) | tag_Callouts.EndTag_marks) | tag_Callouts.AttName_starts);
    474     check_streams.name_follows = (tag_Callouts.ElemName_ends | tag_Callouts.AttName_ends);
    475     check_streams.att_refs = (tag_Callouts.AttVal_spans & marker.Ref_opener);
    476 }
Note: See TracChangeset for help on using the changeset viewer.