source: proto/pabloj/branches/refactor-experimental/input/test/pabloS/test.pablos @ 3175

Last change on this file since 3175 was 3175, checked in by ksherdy, 6 years ago

Modified test files for pabloS grammar.

File size: 23.1 KB
Line 
1struct BasisBits {
2        stream<1> b1;
3        stream<1> b2;
4        stream<1> b3;
5        stream<1> b4;
6};
7struct BasisBits {
8        stream<1> b1;
9        stream<1> b2;
10        stream<1> b3;
11        stream<1> b4;
12};
13
14function void Foo() {
15
16}struct B
17{
18        stream<1> a;
19        stream<1> a;
20        stream<1> a;
21        stream<1> a;
22};
23
24function struct B Foo() { }
25struct bb {
26        stream<1> a;
27
28};
29
30/*
31function stream<1> Function(stream<1> a, stream<1> b, stream<1> c) {
32
33
34};
35*/
36function struct Lex ClassifyBytes(struct BasisBit basis) {};
37// PabloS version of parabix2_pablo.py generated with py2pabloS.py
38
39struct Basis_bits{
40    stream bit_0;
41    stream bit_1;
42    stream bit_2;
43    stream bit_3;
44    stream bit_4;
45    stream bit_5;
46    stream bit_6;
47    stream bit_7;
48};
49
50struct U8{
51    stream unibyte;
52    stream prefix;
53    stream prefix2;
54    stream prefix3;
55    stream prefix4;
56    stream suffix;
57    stream badprefix;
58    stream xE0;
59    stream xED;
60    stream xF0;
61    stream xF4;
62    stream xA0_xBF;
63    stream x80_x9F;
64    stream x90_xBF;
65    stream x80_x8F;
66    stream xEF;
67    stream xBF;
68    stream xBE;
69    stream scope22;
70    stream scope32;
71    stream scope33;
72    stream scope42;
73    stream scope43;
74    stream scope44;
75    stream xE0_scope;
76    stream xED_scope;
77    stream xF0_scope;
78    stream xF4_scope;
79    stream xEF_scope;
80};
81
82struct Lex{
83    stream CR;
84    stream LF;
85    stream HT;
86    stream SP;
87    stream CRLF;
88    stream RefStart;
89    stream Semicolon;
90    stream Colon;
91    stream LAngle;
92    stream RAngle;
93    stream LBracket;
94    stream RBracket;
95    stream Exclam;
96    stream QMark;
97    stream Hyphen;
98    stream Equals;
99    stream SQuote;
100    stream DQuote;
101    stream Slash;
102    stream Hash;
103    stream x;
104    stream ASCII_name_start;
105    stream ASCII_name_char;
106    stream NameScan;
107    stream Digit;
108    stream Hex;
109    stream WS;
110};
111
112struct Marker{
113    stream LAngle_scope;
114    stream Ref_opener;
115    stream CD_closer;
116};
117
118struct CtCDPI_Callouts{
119    stream Ct_starts;
120    stream Ct_ends;
121    stream CD_starts;
122    stream CD_ends;
123    stream PI_starts;
124    stream PI_name_starts;
125    stream PI_name_ends;
126    stream PI_ends;
127};
128
129struct Ref_Callouts{
130    stream GenRef_starts;
131    stream GenRef_ends;
132    stream DecRef_starts;
133    stream DecRef_ends;
134    stream HexRef_starts;
135    stream HexRef_ends;
136};
137
138struct Tag_Callouts{
139    stream ElemName_starts;
140    stream ElemName_ends;
141    stream AttName_starts;
142    stream AttName_ends;
143    stream AttVal_starts;
144    stream AttVal_ends;
145    stream AttVal_spans;
146    stream EmptyTag_marks;
147    stream EndTag_marks;
148};
149
150struct Check_streams{
151    stream misc_mask;
152    stream non_ascii_name_starts;
153    stream non_ascii_names;
154    stream tag_marks;
155    stream name_follows;
156    stream att_refs;
157};
158
159function void Classify_bytes_Validate_utf8(struct Basis_bits basis_bits, struct Lex lex, struct U8 u8) {
160    stream temp1 = (basis_bits.bit_0 | basis_bits.bit_1);
161    stream temp2 = (basis_bits.bit_2 & (~ basis_bits.bit_3));
162    stream temp3 = (temp2 & (~ temp1));
163    stream temp4 = (basis_bits.bit_5 & (~ basis_bits.bit_4));
164    stream temp5 = (basis_bits.bit_6 & (~ basis_bits.bit_7));
165    stream temp6 = (temp4 & temp5);
166    lex.RefStart = (temp3 & temp6);
167    stream temp7 = (basis_bits.bit_2 & basis_bits.bit_3);
168    stream temp8 = (temp7 & (~ temp1));
169    stream temp9 = (basis_bits.bit_4 & (~ basis_bits.bit_5));
170    stream temp10 = (basis_bits.bit_6 & basis_bits.bit_7);
171    stream temp11 = (temp9 & temp10);
172    lex.Semicolon = (temp8 & temp11);
173    stream temp12 = (basis_bits.bit_4 & basis_bits.bit_5);
174    stream temp13 = (basis_bits.bit_6 | basis_bits.bit_7);
175    stream temp14 = (temp12 & (~ temp13));
176    lex.LAngle = (temp8 & temp14);
177    stream temp15 = (temp12 & temp5);
178    lex.RAngle = (temp8 & temp15);
179    stream temp16 = (basis_bits.bit_1 & (~ basis_bits.bit_0));
180    stream temp17 = (basis_bits.bit_3 & (~ basis_bits.bit_2));
181    stream temp18 = (temp16 & temp17);
182    lex.LBracket = (temp18 & temp11);
183    stream temp19 = (basis_bits.bit_7 & (~ basis_bits.bit_6));
184    stream temp20 = (temp12 & temp19);
185    lex.RBracket = (temp18 & temp20);
186    stream temp21 = (basis_bits.bit_4 | basis_bits.bit_5);
187    stream temp22 = (temp19 & (~ temp21));
188    lex.Exclam = (temp3 & temp22);
189    stream temp23 = (temp12 & temp10);
190    lex.QMark = (temp8 & temp23);
191    lex.Hyphen = (temp3 & temp20);
192    lex.Equals = (temp8 & temp20);
193    stream temp24 = (temp4 & temp10);
194    lex.SQuote = (temp3 & temp24);
195    stream temp25 = (temp5 & (~ temp21));
196    lex.DQuote = (temp3 & temp25);
197    lex.Slash = (temp3 & temp23);
198    stream temp26 = (temp10 & (~ temp21));
199    lex.Hash = (temp3 & temp26);
200    stream temp27 = (temp16 & temp7);
201    stream temp28 = (temp9 & (~ temp13));
202    lex.x = (temp27 & temp28);
203    stream temp29 = (temp9 & temp5);
204    lex.Colon = (temp8 & temp29);
205    stream temp30 = (temp18 & temp23);
206    stream temp31 = (temp30 | lex.Colon);
207    stream temp32 = (temp16 & (~ basis_bits.bit_2));
208    stream temp33 = (basis_bits.bit_5 | temp10);
209    stream temp34 = (basis_bits.bit_4 & temp33);
210    stream temp35 = (~ temp34);
211    stream temp36 = (temp21 | temp13);
212    stream temp37 = ((basis_bits.bit_3 & temp35) | ((~ basis_bits.bit_3) & temp36));
213    stream temp38 = (temp32 & temp37);
214    stream temp39 = (temp31 | temp38);
215    stream temp40 = (temp16 & basis_bits.bit_2);
216    stream temp41 = (temp40 & temp37);
217    lex.ASCII_name_start = (temp39 | temp41);
218    stream temp42 = (temp30 | lex.Hyphen);
219    stream temp43 = (temp3 & temp15);
220    stream temp44 = (temp42 | temp43);
221    stream temp45 = (temp8 & (~ temp34));
222    stream temp46 = (temp44 | temp45);
223    stream temp47 = (temp46 | temp38);
224    lex.ASCII_name_char = (temp47 | temp41);
225    lex.NameScan = (lex.ASCII_name_char | basis_bits.bit_0);
226    stream temp48 = (temp1 | basis_bits.bit_2);
227    stream x00_x1F = (~ temp48);
228    stream temp49 = (basis_bits.bit_2 | basis_bits.bit_3);
229    stream temp50 = (temp1 | temp49);
230    lex.CR = (temp20 & (~ temp50));
231    lex.LF = (temp29 & (~ temp50));
232    stream temp51 = (temp9 & temp19);
233    lex.HT = (temp51 & (~ temp50));
234    lex.SP = (temp3 & (~ temp36));
235    stream temp52 = (temp20 | temp29);
236    stream temp53 = (temp52 | temp51);
237    stream temp54 = (temp53 & (~ temp50));
238    lex.WS = (temp54 | lex.SP);
239    stream temp55 = (basis_bits.bit_5 | basis_bits.bit_6);
240    stream temp56 = (basis_bits.bit_4 & temp55);
241    lex.Digit = (temp8 & (~ temp56));
242    stream temp57 = (temp16 & (~ temp49));
243    stream temp58 = (temp57 & (~ basis_bits.bit_4));
244    stream temp59 = (~ temp10);
245    stream temp60 = ((basis_bits.bit_5 & temp59) | ((~ basis_bits.bit_5) & temp13));
246    stream temp61 = (temp58 & temp60);
247    stream temp62 = (lex.Digit | temp61);
248    stream temp63 = (temp16 & temp2);
249    stream temp64 = (temp63 & (~ basis_bits.bit_4));
250    stream temp65 = (temp64 & temp60);
251    lex.Hex = (temp62 | temp65);
252    stream lex_error = (x00_x1F & (~ lex.WS));
253    pablo.assert_0(pablo.inFile(lex_error), "Error: illegal character");
254    u8.unibyte = (~ basis_bits.bit_0);
255    u8.suffix = pablo.Mask(1,0);
256    stream u8_error = pablo.Mask(1,0);
257    stream u8_FFFE_FFFF = pablo.Mask(1,0);
258    stream u8anyscope = pablo.Mask(1,0);
259    if (basis_bits.bit_0) {
260        u8.prefix = (basis_bits.bit_0 & basis_bits.bit_1);
261        u8.prefix2 = (u8.prefix & (~ basis_bits.bit_2));
262        u8.prefix3 = (u8.prefix & temp2);
263        u8.prefix4 = (u8.prefix & temp7);
264        u8.suffix = (basis_bits.bit_0 & (~ basis_bits.bit_1));
265        stream temp66 = (u8.prefix & (~ temp49));
266        stream temp67 = (temp21 | basis_bits.bit_6);
267        stream temp68 = (temp66 & (~ temp67));
268        stream temp69 = (basis_bits.bit_5 & temp13);
269        stream temp70 = (basis_bits.bit_4 | temp69);
270        stream temp71 = (u8.prefix4 & temp70);
271        u8.badprefix = (temp68 | temp71);
272        u8_error = u8.badprefix;
273        u8.scope22 = pablo.Advance(u8.prefix2);
274        u8anyscope = u8.scope22;
275        if ((u8.prefix3 | u8.prefix4)) {
276            stream xE0 = (u8.prefix3 & (~ temp36));
277            stream xED = (u8.prefix3 & temp20);
278            stream xF0 = (u8.prefix4 & (~ temp36));
279            stream temp72 = (temp4 & (~ temp13));
280            stream xF4 = (u8.prefix4 & temp72);
281            u8.xA0_xBF = (u8.suffix & basis_bits.bit_2);
282            u8.x80_x9F = (u8.suffix & (~ basis_bits.bit_2));
283            u8.x90_xBF = (u8.suffix & temp49);
284            u8.x80_x8F = (u8.suffix & (~ temp49));
285            stream xEF = (u8.prefix3 & temp23);
286            stream temp73 = (u8.suffix & temp7);
287            u8.xBF = (temp73 & temp23);
288            u8.xBE = (temp73 & temp15);
289            u8.scope32 = pablo.Advance(u8.prefix3);
290            u8.scope33 = pablo.Advance(u8.scope32);
291            u8.scope42 = pablo.Advance(u8.prefix4);
292            u8.scope43 = pablo.Advance(u8.scope42);
293            u8.scope44 = pablo.Advance(u8.scope43);
294            stream E0_F0_scope = pablo.Advance((xE0 | xF0));
295            stream ED_F4_scope = pablo.Advance((xED | xF4));
296            u8.xE0_scope = (u8.scope32 & E0_F0_scope);
297            u8.xED_scope = (u8.scope32 & ED_F4_scope);
298            u8.xF0_scope = (u8.scope42 & E0_F0_scope);
299            u8.xF4_scope = (u8.scope42 & ED_F4_scope);
300            u8.xEF_scope = pablo.Advance(xEF);
301            stream u8lastscope = ((u8.scope22 | u8.scope33) | u8.scope44);
302            u8anyscope = (((u8lastscope | u8.scope32) | u8.scope42) | u8.scope43);
303            stream u8error1 = (u8.xE0_scope & u8.x80_x9F);
304            stream u8error2 = (u8.xED_scope & u8.xA0_xBF);
305            stream u8error3 = (u8.xF0_scope & u8.x80_x8F);
306            stream u8error4 = (u8.xF4_scope & u8.x90_xBF);
307            u8_error |= (((u8error1 | u8error2) | u8error3) | u8error4);
308            stream EF_BF_pending = pablo.Advance((u8.xEF_scope & u8.xBF));
309            u8_FFFE_FFFF = (EF_BF_pending & (u8.xBE | u8.xBF));
310        }
311        stream u8mismatch = (u8anyscope ^ u8.suffix);
312        pablo.assert_0(((u8_error | u8mismatch) | u8_FFFE_FFFF), "UTF-8 error found");
313    }
314}
315
316function void Parse_CtCDPI(struct Lex lex, struct Marker marker, struct CtCDPI_Callouts ctCDPI_Callouts, struct Check_streams check_streams) {
317    ctCDPI_Callouts.Ct_starts = pablo.Mask(1,0);
318    ctCDPI_Callouts.Ct_ends = pablo.Mask(1,0);
319    ctCDPI_Callouts.CD_starts = pablo.Mask(1,0);
320    ctCDPI_Callouts.CD_ends = pablo.Mask(1,0);
321    ctCDPI_Callouts.PI_starts = pablo.Mask(1,0);
322    ctCDPI_Callouts.PI_name_starts = pablo.Mask(1,0);
323    ctCDPI_Callouts.PI_name_ends = pablo.Mask(1,0);
324    ctCDPI_Callouts.PI_ends = pablo.Mask(1,0);
325    stream CtCDPI_starts = pablo.Mask(1,0);
326    stream CtCDPI_ends = pablo.Mask(1,0);
327    stream ctCDPI_mask = pablo.Mask(1,0);
328    stream v = (lex.LAngle | lex.Hyphen);
329    stream w = (lex.Hyphen | lex.QMark);
330    stream v1 = pablo.Advance(v, 1);
331    stream w1 = pablo.Advance(w, 1);
332    stream LAngle_scope = (v1 & (~ w1));
333    stream PI_opener = (LAngle_scope & lex.QMark);
334    stream CtCD_opener = (LAngle_scope & lex.Exclam);
335    stream CtCDPI_opener = (PI_opener | CtCD_opener);
336    stream CD_closer = pablo.Mask(1,0);
337    stream DoubleHyphen = ((v1 & w1) & lex.Hyphen);
338    if (lex.RBracket) {
339        stream DoubleRBracket = (pablo.Advance(lex.RBracket) & lex.RBracket);
340        CD_closer = (pablo.Advance(DoubleRBracket) & lex.RAngle);
341    }
342    stream PI_closer = ((w1 & (~ v1)) & lex.RAngle);
343    stream CtCDPI_Cursor = pablo.ScanToFirst(CtCDPI_opener);
344    while (CtCDPI_Cursor) {
345        CtCDPI_starts |= CtCDPI_Cursor;
346        stream PI_Cursor = (CtCDPI_Cursor & PI_opener);
347        stream CD_Ct_Cursor = pablo.Advance((CtCDPI_Cursor & (~ PI_Cursor)));
348        stream CD_Cursor = (CD_Ct_Cursor & lex.LBracket);
349        stream Ct_Cursor = (CD_Ct_Cursor & lex.Hyphen);
350        if (PI_Cursor) {
351            ctCDPI_Callouts.PI_starts |= PI_Cursor;
352            PI_Cursor = pablo.Advance(PI_Cursor);
353            ctCDPI_Callouts.PI_name_starts |= PI_Cursor;
354            stream PI_name_end = pablo.ScanThru(PI_Cursor, lex.NameScan);
355            stream PI_error = (PI_Cursor & PI_name_end);
356            stream PI_noWS = (PI_name_end & (~ lex.WS));
357            PI_error |= ((PI_noWS & (~ lex.QMark)) | (pablo.Advance(PI_noWS) & (~ PI_closer)));
358            pablo.assert_0(PI_error, "Error in PI syntax");
359            ctCDPI_Callouts.PI_name_ends |= PI_name_end;
360            PI_Cursor = pablo.ScanTo(PI_name_end, PI_closer);
361            ctCDPI_Callouts.PI_ends |= PI_Cursor;
362            CtCDPI_ends |= PI_Cursor;
363        }
364        if (CD_Cursor) {
365            ctCDPI_Callouts.CD_starts |= CD_Cursor;
366            CD_Cursor = pablo.ScanTo(CD_Cursor, CD_closer);
367            ctCDPI_Callouts.CD_ends |= CD_Cursor;
368            CtCDPI_ends |= CD_Cursor;
369        }
370        if (Ct_Cursor) {
371            ctCDPI_Callouts.Ct_starts |= Ct_Cursor;
372            Ct_Cursor = pablo.Advance(Ct_Cursor);
373            stream Ct_error = (Ct_Cursor & (~ lex.Hyphen));
374            Ct_Cursor = pablo.Advance(pablo.Advance(Ct_Cursor));
375            Ct_Cursor = pablo.Advance(pablo.ScanTo(Ct_Cursor, DoubleHyphen));
376            pablo.assert_0((Ct_error | (Ct_Cursor & (~ lex.RAngle))), "Error in comment syntax");
377            ctCDPI_Callouts.Ct_ends |= Ct_Cursor;
378            CtCDPI_ends |= Ct_Cursor;
379        }
380        CtCDPI_Cursor = ((PI_Cursor | CD_Cursor) | Ct_Cursor);
381        ctCDPI_mask = pablo.InclusiveSpan(CtCDPI_starts, CtCDPI_ends);
382        pablo.assert_0(pablo.atEOF(ctCDPI_mask), "Error in comment, CDATA or processing instruction syntax");
383        CtCDPI_Cursor = pablo.ScanTo(CtCDPI_Cursor, CtCDPI_opener);
384    }
385    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);
386    marker.LAngle_scope = (LAngle_scope & (~ ctCDPI_mask));
387    marker.Ref_opener = (lex.RefStart & (~ ctCDPI_mask));
388    marker.CD_closer = (CD_closer & (~ ctCDPI_mask));
389}
390
391function void Parse_tags(struct Lex lex, struct Marker marker, struct Tag_Callouts tag_Callouts) {
392    stream EqExpected = pablo.Mask(1,0);
393    stream AttListEnd = pablo.Mask(1,0);
394    stream DQuoteDelim = (lex.DQuote | lex.LAngle);
395    stream SQuoteDelim = (lex.SQuote | lex.LAngle);
396    stream AttListDelim = (lex.Slash | lex.RAngle);
397    tag_Callouts.ElemName_starts = (marker.LAngle_scope & (~ lex.Slash));
398    tag_Callouts.EndTag_marks = (marker.LAngle_scope & lex.Slash);
399    tag_Callouts.ElemName_ends = pablo.ScanThru(tag_Callouts.ElemName_starts, lex.NameScan);
400    stream ParseError = (tag_Callouts.ElemName_starts & tag_Callouts.ElemName_ends);
401    tag_Callouts.AttName_starts = pablo.Mask(1,0);
402    tag_Callouts.AttName_ends = pablo.Mask(1,0);
403    tag_Callouts.AttVal_starts = pablo.Mask(1,0);
404    tag_Callouts.AttVal_ends = pablo.Mask(1,0);
405    if ((tag_Callouts.ElemName_ends & lex.WS)) {
406        stream AfterWS = pablo.ScanThru(tag_Callouts.ElemName_ends, lex.WS);
407        AttListEnd = (AfterWS & AttListDelim);
408        stream AttNameStart = (AfterWS & (~ AttListDelim));
409        while (AttNameStart) {
410            ParseError |= (AttNameStart & (~ lex.NameScan));
411            tag_Callouts.AttName_starts |= AttNameStart;
412            stream AttNameFollow = pablo.ScanThru(AttNameStart, lex.NameScan);
413            tag_Callouts.AttName_ends |= AttNameFollow;
414            if ((AttNameFollow & lex.WS)) {
415                EqExpected = pablo.ScanThru(AttNameFollow, lex.WS);
416            }
417            else {
418                EqExpected = AttNameFollow;
419            }
420            ParseError |= (EqExpected & (~ lex.Equals));
421            stream AttValPos = pablo.AdvanceThenScanThru(EqExpected, lex.WS);
422            tag_Callouts.AttVal_starts |= AttValPos;
423            stream DQuoteAttVal = (AttValPos & lex.DQuote);
424            stream SQuoteAttVal = (AttValPos & lex.SQuote);
425            stream DQuoteAttEnd = pablo.AdvanceThenScanTo(DQuoteAttVal, DQuoteDelim);
426            stream SQuoteAttEnd = pablo.AdvanceThenScanTo(SQuoteAttVal, SQuoteDelim);
427            stream AttValEnd = (DQuoteAttEnd | SQuoteAttEnd);
428            ParseError |= ((AttValPos | AttValEnd) & (~ (lex.DQuote | lex.SQuote)));
429            stream AttValFollow = pablo.Advance(AttValEnd);
430            tag_Callouts.AttVal_ends |= AttValFollow;
431            if ((AttValFollow & lex.WS)) {
432                AfterWS = pablo.ScanThru(AttValFollow, lex.WS);
433                AttListEnd |= (AfterWS & AttListDelim);
434                AttNameStart = (AfterWS & (~ AttListDelim));
435            }
436            else {
437                AttListEnd |= (AttValFollow & AttListDelim);
438                AttNameStart = (AttValFollow & (~ AttListDelim));
439            }
440            ParseError |= (AttValFollow & AttNameStart);
441        }
442    }
443    else {
444        AttListEnd = (tag_Callouts.ElemName_ends & AttListDelim);
445        ParseError |= (tag_Callouts.ElemName_ends & (~ AttListDelim));
446    }
447    stream STagEnds = (AttListEnd & lex.RAngle);
448    tag_Callouts.EmptyTag_marks = pablo.Advance((AttListEnd & lex.Slash));
449    ParseError |= (tag_Callouts.EmptyTag_marks & (~ lex.RAngle));
450    stream EndTagEnds = pablo.AdvanceThenScanThru(tag_Callouts.EndTag_marks, lex.NameScan);
451    if ((EndTagEnds & lex.WS)) {
452        EndTagEnds = pablo.ScanThru(EndTagEnds, lex.WS);
453    }
454    ParseError |= (EndTagEnds & (~ lex.RAngle));
455    pablo.assert_0(ParseError, "Tag parsing error found");
456    tag_Callouts.AttVal_spans = pablo.SpanUpTo(tag_Callouts.AttVal_starts, tag_Callouts.AttVal_ends);
457}
458
459function void Parse_refs(struct Lex lex, struct Marker marker, struct Ref_Callouts ref_Callouts) {
460    ref_Callouts.GenRef_starts = pablo.Mask(1,0);
461    ref_Callouts.GenRef_ends = pablo.Mask(1,0);
462    ref_Callouts.DecRef_starts = pablo.Mask(1,0);
463    ref_Callouts.DecRef_ends = pablo.Mask(1,0);
464    ref_Callouts.HexRef_starts = pablo.Mask(1,0);
465    ref_Callouts.HexRef_ends = pablo.Mask(1,0);
466    stream ref_error = pablo.Mask(1,0);
467    if (marker.Ref_opener) {
468        stream Ref_scope = pablo.Advance(marker.Ref_opener);
469        stream NumRef2 = (Ref_scope & lex.Hash);
470        ref_Callouts.GenRef_starts = (Ref_scope & (~ lex.Hash));
471        stream NumRef3 = pablo.Advance(NumRef2);
472        stream HexRef3 = (NumRef3 & lex.x);
473        ref_Callouts.DecRef_starts = (NumRef3 & (~ lex.x));
474        ref_Callouts.HexRef_starts = pablo.Advance(HexRef3);
475        ref_Callouts.GenRef_ends = pablo.ScanThru(ref_Callouts.GenRef_starts, lex.NameScan);
476        ref_Callouts.DecRef_ends = pablo.ScanThru(ref_Callouts.DecRef_starts, lex.Digit);
477        ref_Callouts.HexRef_ends = pablo.ScanThru(ref_Callouts.HexRef_starts, lex.Hex);
478        stream ref_error1 = (ref_Callouts.DecRef_starts & (~ lex.Digit));
479        stream ref_error2 = (ref_Callouts.HexRef_starts & (~ lex.Hex));
480        stream ref_ends = ((ref_Callouts.GenRef_ends | ref_Callouts.DecRef_ends) | ref_Callouts.HexRef_ends);
481        stream ref_error3 = (ref_ends & (~ lex.Semicolon));
482        pablo.assert_0(((ref_error1 | ref_error2) | ref_error3), "Reference error found");
483    }
484}
485
486function 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) {
487    stream PI_names = pablo.SpanUpTo(ctCDPI_Callouts.PI_name_starts, ctCDPI_Callouts.PI_name_ends);
488    stream GenRefs = pablo.SpanUpTo(ref_Callouts.GenRef_starts, ref_Callouts.GenRef_ends);
489    stream ElemNames = pablo.SpanUpTo(tag_Callouts.ElemName_starts, tag_Callouts.ElemName_ends);
490    stream AttNames = pablo.SpanUpTo(tag_Callouts.AttName_starts, tag_Callouts.AttName_ends);
491    stream qname_stream = (ElemNames | AttNames);
492    stream ncname_stream = (PI_names | GenRefs);
493    stream name_stream = (qname_stream | ncname_stream);
494    stream name_start = (name_stream & (~ pablo.Advance(name_stream)));
495    stream name_cursor = (name_stream & (~ pablo.Advance(name_stream)));
496    stream void_prefix_err = (name_cursor & lex.Colon);
497    stream namespace_sep = (pablo.ScanThru(name_cursor, (lex.NameScan & (~ lex.Colon))) & lex.Colon);
498    stream local_part_start = pablo.Advance(namespace_sep);
499    stream local_part_err = (local_part_start & (~ lex.NameScan));
500    stream colon2_err = (pablo.ScanThru(local_part_start, (lex.NameScan & (~ lex.Colon))) & lex.Colon);
501    stream ncname_err = (ncname_stream & lex.Colon);
502    pablo.assert_0((((void_prefix_err | local_part_err) | colon2_err) | ncname_err), "name syntax error");
503    check_streams.non_ascii_name_starts = (name_start & (~ lex.ASCII_name_start));
504    check_streams.non_ascii_names = (((name_stream & (~ name_start)) & (~ lex.ASCII_name_char)) & (~ u8.suffix));
505}
506
507function void Do_check_streams(struct Marker marker, struct Tag_Callouts tag_Callouts, struct Check_streams check_streams) {
508    pablo.assert_0((marker.CD_closer & (~ tag_Callouts.AttVal_spans)), "Error: ]]> in text");
509    check_streams.tag_marks = (((tag_Callouts.EmptyTag_marks | tag_Callouts.ElemName_starts) | tag_Callouts.EndTag_marks) | tag_Callouts.AttName_starts);
510    check_streams.name_follows = (tag_Callouts.ElemName_ends | tag_Callouts.AttName_ends);
511    check_streams.att_refs = (tag_Callouts.AttVal_spans & marker.Ref_opener);
512}
513function void While() {
514                       
515        stream<1> cursor = 1;
516       
517        while (cursor) {
518          cursor = pablo.Advance(cursor);
519        }
520}
521function void Function() {     
522        stream<1> cursor1;
523       
524        while (cursor1) {
525                stream<1> cursor2;
526                while(cursor2) {
527                        cursor = pablo.Advance(cursor);
528                        // cursor = cursor &~ terminator;
529                }
530        }
531}
532function void While() {
533       
534        stream<1> cursor;
535       
536        while (cursor) {
537                cursor = pablo.Advance(cursor);
538                cursor = cursor &~ terminator;
539        }
540}
541function void Function(struct TagCallouts tagCallouts, struct Lex lex) {       
542
543        stream<1> starts_accum = 0;
544        stream<1> ends_accum = 0;       
545        stream<1> cursor = pablo.ScanToFirst(lex.opener);
546       
547        while (cursor) {
548                starts_accum |= cursor;
549                cursor = pablo.ScanTo(cursor, lex.marker &~ cursor);
550                ends_accum |= cursor;
551                cursor = pablo.ScanTo(cursor, (lex.marker | lex.terminator) &~ cursor);
552                cursor = cursor & lex.marker;
553        }
554};
555function void Function() {     
556       
557        stream cursor;
558       
559        if(cursor & a) {
560
561        } else {
562
563        }
564       
565}
566function void Function() {     
567       
568        stream cursor;
569       
570        if(cursor & a) {
571                if(cursor & b) {
572               
573                } else {
574               
575                }
576
577        } else {
578
579        }
580       
581}
582function void Function() {     
583       
584        stream cursor;
585       
586        if(cursor & a) {
587                if(cursor & b) {
588               
589                }
590        }
591       
592}
593function void Function() {             
594        stream cursor;
595        if(cursor) {
596
597        }
598}
599function void Assignments() {
600        stream<1> s;
601        s = 0;
602};function void Assignments() {
603        stream<1> s;
604        stream<1> a;
605        stream<1> b;
606        stream<1> c;
607        //s |= 0;
608        //s = a | b | c;
609        s |= a;
610        s |= a | b;
611        s |= a | b | c;
612        s |= a | b | c | d;
613        // s = s | a | b | c;
614};function void StreamStructs() {
615
616        // records
617        temp4 = temp1.temp2;
618        temp4 = temp1.temp2.temp3;
619       
620        temp1.temp2 = temp4;
621        temp1.temp2.temp3 = temp4;
622               
623};function void AssignmentExpressions() {       
624        temp4 = temp;
625        temp4 &= temp1 | temp2;
626        temp4 |= temp1 ^ temp2;
627        temp4 ^= temp1 & temp2;
628};function void BasicExpressions() {
629
630        temp4 = temp;
631        temp4 = temp1 | temp2;
632        temp4 = temp1 ^ temp2;
633        temp4 = temp1 & temp2;
634        temp4 = temp1 ^ temp2 | temp3;
635        temp4 = temp1 | temp2 ^ temp3;
636        temp4 = temp1 & temp2 | temp3;
637        temp4 = temp1 | temp2 & temp3;
638        temp4 = temp1 & (temp2 | temp3);
639        temp4 = (temp1 | temp2) & temp3;
640//      temp4 = ~temp;
641       
642};
643
644function struct A FunctionExpressions() {
645         stream<1> a = b.Advance();
646};
647function void localDecl() {
648
649        struct BasisBits A;
650
651} function void localDecl() {
652
653        struct BasisBits A;
654        struct BasisBits A;
655        struct BasisBits A;
656       
657
658};function void localDecl() {
659        stream<1> A;
660        stream B;
661}function void Assignments2() {
662        stream a;
663        stream<1> s = a;
664}
Note: See TracBrowser for help on using the repository browser.