Debian Codegraph @

parser/inc/regexoreof

raw
1 _decimal:
2 DECIMAL
3 {
4 $$ = d_matched;
5 }
6 ;
7
8 _interval:
9 _decimal
10 {
11 $$ = Interval::exact($1);
12 }
13 |
14 _decimal ',' _decimal
15 {
16 $$ = Interval::range($1, $3);
17 }
18 |
19 _decimal ','
20 {
21 $$ = Interval::lowerBound($1);
22 }
23 ;
24
25 _single_char:
26 CHAR
27 |
28 combi_chars
29 ;
30
31 _open_paren:
32 '('
33 {
34 ++d_parentheses;
35 }
36 ;
37
38 _close_paren:
39 ')'
40 {
41 --d_parentheses;
42 }
43 ;
44
45 _open_curly:
46 '{'
47 {
48 d_scanner.acceptMulti();
49 }
50 ;
51
52 _unit:
53 '^'
54 {
55 $$ = boln();
56 }
57 |
58 '$'
59 {
60 $$ = dollar();
61 }
62 |
63 DOLLAR
64 {
65 $$ = eolnDollar();
66 }
67 |
68 STRING
69 {
70 $$ = str();
71 }
72 |
73 RAWSTRING
74 {
75 $$ = rawText(d_scanner.rawStringContent());
76 }
77 |
78 QUOTES
79 {
80 $$ = quotes();
81 }
82 |
83 ESCAPE_SEQUENCE
84 {
85 $$ = escape();
86 }
87 |
88 '.'
89 {
90 $$ = FPattern::dot(d_states);
91 }
92 |
93 _single_char
94 {
95 $$ = rawText();
96 }
97 |
98 characterclass
99 {
100 $$ = FPattern::characterClass(d_states, $1);
101 }
102 ;
103
104 _quantifier:
105 '*'
106 |
107 '+'
108 |
109 '?'
110 ;
111
112 _regex_unit:
113 _unit
114 {
115 Options::regexCall("unit");
116 $$ = $1; //FBB
117 }
118 |
119 _regex_unit _open_curly _interval '}'
120 {
121 $$ = interval($1, $3);
122 }
123 |
124 _regex_unit _quantifier
125 {
126 $$ = FPattern::quantifier(d_states, $1, d_matched[0]);
127 }
128 |
129 _open_paren _regex _close_paren
130 {
131 $$ = $2;
132 }
133 |
134 _regex_unit _regex_unit %prec CHAR
135 {
136 $$ = FPattern::concatenate(d_states, $1, $2);
137 }
138 ;
139
140 // a regex is a regex, possibly with LA operator
141 // the handler must verify whether the regex contains ^ and $ symbols
142 // within the regex, for which a warning must be issue: ^, $ treated as
143 // normal characters
144 // regex returns an FPattern, embedded in a spSemUnion
145 _regex:
146 _regex_unit
147 {
148 Options::regexCall("regex-unit");
149 $$ = $1;
150 }
151 |
152 _regex '|' _regex
153 {
154 $$ = FPattern::alternatives(d_states, $1, $3);
155 }
156 |
157 _regex '/' _regex
158 {
159 $$ = lookahead($1, $3);
160 }
161 ;
162
163 regexOrEOF:
164 _regex
165 {
166 $$ = $1;
167 }
168 |
169 EOF_PATTERN
170 {
171 $$ = FPattern::eof(d_states);
172 }
173 ;