File: nullable_loop.c

package info (click to toggle)
re2c 4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 50,052 kB
  • sloc: cpp: 32,477; ml: 8,279; sh: 5,265; makefile: 968; haskell: 612; python: 428; ansic: 227; javascript: 111; java: 3
file content (302 lines) | stat: -rw-r--r-- 5,095 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
/* Generated by re2c */
// re2c $INPUT -o $OUTPUT -i
#include <assert.h>
#include <string.h>



int lex1(const char *s)
{
    const char *YYCURSOR = s, *YYLIMIT = s + strlen(s), *YYMARKER;
    do {
    
{
	char yych;
	yych = *YYCURSOR;
	switch (yych) {
		case 'a': goto yy2;
		default:
			if (YYLIMIT <= YYCURSOR) goto yy4;
			goto yy1;
	}
yy1:
	yych = *++YYCURSOR;
	switch (yych) {
		case 'a': goto yy2;
		default:
			if (YYLIMIT <= YYCURSOR) goto yy5;
			goto yy1;
	}
yy2:
	yych = *(YYMARKER = ++YYCURSOR);
	switch (yych) {
		case 'a': goto yy2;
		default:
			if (YYLIMIT <= YYCURSOR) goto yy3;
			goto yy1;
	}
yy3:
	{ continue; }
yy4:
	{ return 0; }
yy5:
	YYCURSOR = YYMARKER;
	goto yy3;
}

    } while (1);
}

int lex2(const char *s)
{
    const char *YYCURSOR = s, *YYLIMIT = s + strlen(s), *YYMARKER;
    do {
    
{
	char yych;
	yych = *YYCURSOR;
	switch (yych) {
		case '\n': goto yy7;
		case 'a': goto yy9;
		default:
			if (YYLIMIT <= YYCURSOR) goto yy11;
			goto yy8;
	}
yy7:
	YYCURSOR = YYMARKER;
	goto yy10;
yy8:
	yych = *++YYCURSOR;
	switch (yych) {
		case '\n': goto yy7;
		case 'a': goto yy9;
		default:
			if (YYLIMIT <= YYCURSOR) goto yy7;
			goto yy8;
	}
yy9:
	yych = *(YYMARKER = ++YYCURSOR);
	switch (yych) {
		case '\n': goto yy10;
		case 'a': goto yy9;
		default:
			if (YYLIMIT <= YYCURSOR) goto yy10;
			goto yy8;
	}
yy10:
	{ continue; }
yy11:
	{ return 0; }
}

    } while (1);
}

int lex3(const char *s)
{
    const char *YYCURSOR = s, *YYLIMIT = s + strlen(s), *YYMARKER;
    do {
    
{
	char yych;
	unsigned int yyaccept = 0;
	yych = *YYCURSOR;
	switch (yych) {
		case '\n': goto yy15;
		case 'a': goto yy16;
		default:
			if (YYLIMIT <= YYCURSOR) goto yy21;
			goto yy13;
	}
yy13:
	yyaccept = 0;
	yych = *(YYMARKER = ++YYCURSOR);
	switch (yych) {
		case 0x00:
			if (YYLIMIT <= YYCURSOR) goto yy14;
			goto yy18;
		case '\n': goto yy14;
		default: goto yy19;
	}
yy14:
	{ return 1; }
yy15:
	++YYCURSOR;
	goto yy14;
yy16:
	yyaccept = 1;
	yych = *(YYMARKER = ++YYCURSOR);
	switch (yych) {
		case '\n': goto yy17;
		case 'a': goto yy16;
		default:
			if (YYLIMIT <= YYCURSOR) goto yy17;
			goto yy18;
	}
yy17:
	{ continue; }
yy18:
	yych = *++YYCURSOR;
yy19:
	switch (yych) {
		case '\n': goto yy20;
		case 'a': goto yy16;
		default:
			if (YYLIMIT <= YYCURSOR) goto yy20;
			goto yy18;
	}
yy20:
	YYCURSOR = YYMARKER;
	if (yyaccept == 0) goto yy14;
	else goto yy17;
yy21:
	{ return 0; }
}

    } while (1);
}

int lex4(const char *s)
{
    const char *YYCURSOR = s, *YYLIMIT = s + strlen(s), *YYMARKER;
    do {
    
{
	char yych;
	unsigned int yyaccept = 0;
	yych = *(YYMARKER = YYCURSOR);
	switch (yych) {
		case '\n': goto yy23;
		case 'a': goto yy26;
		default:
			if (YYLIMIT <= YYCURSOR) goto yy28;
			goto yy24;
	}
yy23:
	{ return 1; }
yy24:
	yych = *++YYCURSOR;
	switch (yych) {
		case '\n': goto yy25;
		case 'a': goto yy26;
		default:
			if (YYLIMIT <= YYCURSOR) goto yy25;
			goto yy24;
	}
yy25:
	YYCURSOR = YYMARKER;
	if (yyaccept == 0) goto yy23;
	else goto yy27;
yy26:
	yyaccept = 1;
	yych = *(YYMARKER = ++YYCURSOR);
	switch (yych) {
		case '\n': goto yy27;
		case 'a': goto yy26;
		default:
			if (YYLIMIT <= YYCURSOR) goto yy27;
			goto yy24;
	}
yy27:
	{ continue; }
yy28:
	{ return 0; }
}

    } while (1);
}

int lex5(const char *s)
{
    const char *YYCURSOR = s, *YYLIMIT = s + strlen(s), *YYMARKER;
    do {
    
{
	char yych;
	unsigned int yyaccept = 0;
	yych = *YYCURSOR;
	switch (yych) {
		case '\n': goto yy32;
		case 'a': goto yy33;
		default:
			if (YYLIMIT <= YYCURSOR) goto yy38;
			goto yy30;
	}
yy30:
	yyaccept = 0;
	yych = *(YYMARKER = ++YYCURSOR);
	switch (yych) {
		case 0x00:
			if (YYLIMIT <= YYCURSOR) goto yy31;
			goto yy35;
		case '\n': goto yy31;
		default: goto yy36;
	}
yy31:
	{ return 2; }
yy32:
	++YYCURSOR;
	goto yy31;
yy33:
	yyaccept = 1;
	yych = *(YYMARKER = ++YYCURSOR);
	switch (yych) {
		case '\n': goto yy34;
		case 'a': goto yy33;
		default:
			if (YYLIMIT <= YYCURSOR) goto yy34;
			goto yy35;
	}
yy34:
	{ continue; }
yy35:
	yych = *++YYCURSOR;
yy36:
	switch (yych) {
		case '\n': goto yy37;
		case 'a': goto yy33;
		default:
			if (YYLIMIT <= YYCURSOR) goto yy37;
			goto yy35;
	}
yy37:
	YYCURSOR = YYMARKER;
	if (yyaccept == 0) goto yy31;
	else goto yy34;
yy38:
	{ return 0; }
}

    } while (1);
}

int main()
{
    assert(lex1("") == 0);
    assert(lex1("a") == 0);

    assert(lex2("") == 0);
    assert(lex2("a") == 0);

    assert(lex3("") == 0);
    assert(lex3("a") == 0);
    assert(lex3("a\n") == 1);
    assert(lex3("b") == 1);

    assert(lex4("") == 0);
    assert(lex4("a") == 0);
    assert(lex4("a\n") == 1);
    assert(lex4("b") == 1);

    assert(lex5("") == 0);
    assert(lex5("a") == 0);
    assert(lex5("a\n") == 2);
    assert(lex5("b") == 2);

    return 0;
}
eof/nullable_loop.re:16:4: warning: control flow is undefined for strings that match '[\x0-\x60\x62-\xFF]', use default rule '*' [-Wundefined-control-flow]
eof/nullable_loop.re:27:4: warning: control flow is undefined for strings that match 
	'[\x0-\x9\xB-\x60\x62-\xFF]'
	'\xA'
, use default rule '*' [-Wundefined-control-flow]