source: proto/pabloj/trunk/input/test/pabloS/py2pablo/CtCDPI_prescan.pablos.exclude @ 2834

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

Migrated pablo to pabloj/trunk.

File size: 4.6 KB
Line 
1
2
3function void Parse_CtCDPI(struct Lex lex, struct Marker marker, struct CtCDPI_Callouts ctCDPI_Callouts, struct Check_streams check_streams) {
4    ctCDPI_Callouts.Ct_starts = 0;
5    ctCDPI_Callouts.Ct_ends = 0;
6    ctCDPI_Callouts.CD_starts = 0;
7    ctCDPI_Callouts.CD_ends = 0;
8    ctCDPI_Callouts.PI_starts = 0;
9    ctCDPI_Callouts.PI_name_starts = 0;
10    ctCDPI_Callouts.PI_name_ends = 0;
11    ctCDPI_Callouts.PI_ends = 0;
12    var stream<1> CtCDPI_starts = 0;
13    var stream<1> CtCDPI_ends = 0;
14    var stream<1> ctCDPI_mask = 0;
15    var stream<1> v = (lex.LAngle | lex.Hyphen);
16    var stream<1> w = (lex.Hyphen | lex.QMark);
17    var stream<1> v1 = pablo.Advance(v);
18    var stream<1> w1 = pablo.Advance(w);
19    var stream<1> LAngle_scope = (v1 & (~ w1));
20    var stream<1> PI_opener = (LAngle_scope & lex.QMark);
21    var stream<1> CtCD_opener = (LAngle_scope & lex.Exclam);
22    var stream<1> CtCDPI_opener = (PI_opener | CtCD_opener);
23    var stream<1> CD_closer = 0;
24    var stream<1> DoubleHyphen = ((v1 & w1) & lex.Hyphen);
25    if (lex.RBracket) {
26        var stream<1> DoubleRBracket = (pablo.Advance(lex.RBracket) & lex.RBracket);
27        CD_closer = (pablo.Advance(DoubleRBracket) & lex.RAngle);
28    }
29    var stream<1> PI_closer = ((w1 & (~ v1)) & lex.RAngle);
30    var stream<1> CtCDPI_Cursor = pablo.ScanToFirst(CtCDPI_opener);
31    while (CtCDPI_Cursor) {
32        CtCDPI_starts |= CtCDPI_Cursor;
33        var stream<1> PI_Cursor = (CtCDPI_Cursor & PI_opener);
34        var stream<1> CD_Ct_Cursor = pablo.Advance((CtCDPI_Cursor & (~ PI_Cursor)));
35        var stream<1> CD_Cursor = (CD_Ct_Cursor & lex.LBracket);
36        var stream<1> Ct_Cursor = (CD_Ct_Cursor & lex.Hyphen);
37        if (PI_Cursor) {
38            ctCDPI_Callouts.PI_starts |= PI_Cursor;
39            PI_Cursor = pablo.AdvanceThenScanTo(PI_Cursor, PI_closer);
40            ctCDPI_Callouts.PI_ends |= PI_Cursor;
41            CtCDPI_ends |= PI_Cursor;
42        }
43        if (CD_Cursor) {
44            ctCDPI_Callouts.CD_starts |= CD_Cursor;
45            CD_Cursor = pablo.ScanTo(CD_Cursor, CD_closer);
46            ctCDPI_Callouts.CD_ends |= CD_Cursor;
47            CtCDPI_ends |= CD_Cursor;
48        }
49        if (Ct_Cursor) {
50            ctCDPI_Callouts.Ct_starts |= Ct_Cursor;
51            Ct_Cursor = pablo.Advance(Ct_Cursor);
52            Ct_Cursor = pablo.Advance(pablo.Advance(Ct_Cursor));
53            Ct_Cursor = pablo.Advance(pablo.ScanTo(Ct_Cursor, DoubleHyphen));
54            ctCDPI_Callouts.Ct_ends |= Ct_Cursor;
55            CtCDPI_ends |= Ct_Cursor;
56        }
57        CtCDPI_Cursor = ((PI_Cursor | CD_Cursor) | Ct_Cursor);
58        CtCDPI_Cursor = pablo.ScanTo(CtCDPI_Cursor, CtCDPI_opener);
59    }
60    if (((CtCDPI_starts | ctCDPI_Callouts.Ct_starts) | ctCDPI_Callouts.Ct_ends)) {
61        ctCDPI_mask = pablo.InclusiveSpan(CtCDPI_starts, CtCDPI_ends);
62        var stream<1> ctCDPI_error = pablo.atEOF(ctCDPI_mask);
63        if (ctCDPI_error) {
64            error_tracker.NoteError("Error in comment, CDATA or processing instruction syntax", ctCDPI_error);
65        }
66        if (ctCDPI_Callouts.PI_starts) {
67            ctCDPI_Callouts.PI_name_starts = pablo.Advance(ctCDPI_Callouts.PI_starts);
68            ctCDPI_Callouts.PI_name_ends = pablo.ScanThru(ctCDPI_Callouts.PI_name_starts, lex.NameScan);
69            var stream<1> no_PI_name = (ctCDPI_Callouts.PI_name_starts & ctCDPI_Callouts.PI_name_ends);
70            if (no_PI_name) {
71                error_tracker.NoteError("Error in PI syntax", no_PI_name);
72            }
73            var stream<1> check_for_PI_closer = (ctCDPI_Callouts.PI_name_ends & (~ lex.WS));
74            if (check_for_PI_closer) {
75                var stream<1> PI_error = (pablo.Advance(check_for_PI_closer) & (~ PI_closer));
76                if (PI_error) {
77                    error_tracker.NoteError("Error in PI syntax", PI_error);
78                }
79            }
80        }
81        if (ctCDPI_Callouts.Ct_starts) {
82            var stream<1> Ct_error = (pablo.Advance(ctCDPI_Callouts.Ct_starts) & (~ lex.Hyphen));
83            if (Ct_error) {
84                error_tracker.NoteError("Error in comment opener", Ct_error);
85            }
86        }
87        if ((ctCDPI_Callouts.Ct_ends & (~ lex.RAngle))) {
88            error_tracker.NoteError("Error in comment syntax", (ctCDPI_Callouts.Ct_ends & (~ lex.RAngle)));
89        }
90    }
91    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);
92    marker.LAngle_scope = (LAngle_scope & (~ ctCDPI_mask));
93    marker.Ref_opener = (lex.RefStart & (~ ctCDPI_mask));
94    marker.CD_closer = (CD_closer & (~ ctCDPI_mask));
95}
Note: See TracBrowser for help on using the repository browser.