1 /* A recursive-descent parser generated by peg 0.1.15 */
2
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include <string.h>
6 #define YYRULECOUNT 38
7
8 # include "tree.h"
9 # include "version.h"
10
11 # include <stdio.h>
12 # include <stdlib.h>
13 # include <unistd.h>
14 # include <string.h>
15 # include <libgen.h>
16 # include <assert.h>
17
18 typedef struct Header Header;
19
20 struct Header {
21 char *text;
22 Header *next;
23 };
24
25 FILE *input= 0;
26
27 int verboseFlag= 0;
28
29 static int lineNumber= 0;
30 static char *fileName= 0;
31 static char *trailer= 0;
32 static Header *headers= 0;
33
34 void makeHeader(char *text);
35 void makeTrailer(char *text);
36
37 void yyerror(char *message);
38
39 # define YY_INPUT(buf, result, max) \
40 { \
41 int c= getc(input); \
42 if ('\n' == c || '\r' == c) ++lineNumber; \
43 result= (EOF == c) ? 0 : (*(buf)= c, 1); \
44 }
45
46 # define YY_LOCAL(T) static T
47 # define YY_RULE(T) static T
48
49 #ifndef YY_MALLOC
50 #define YY_MALLOC(C, N) malloc(N)
51 #endif
52 #ifndef YY_REALLOC
53 #define YY_REALLOC(C, P, N) realloc(P, N)
54 #endif
55 #ifndef YY_FREE
56 #define YY_FREE(C, P) free(P)
57 #endif
58 #ifndef YY_LOCAL
59 #define YY_LOCAL(T) static T
60 #endif
61 #ifndef YY_ACTION
62 #define YY_ACTION(T) static T
63 #endif
64 #ifndef YY_RULE
65 #define YY_RULE(T) static T
66 #endif
67 #ifndef YY_PARSE
68 #define YY_PARSE(T) T
69 #endif
70 #ifndef YYPARSE
71 #define YYPARSE yyparse
72 #endif
73 #ifndef YYPARSEFROM
74 #define YYPARSEFROM yyparsefrom
75 #endif
76 #ifndef YYRELEASE
77 #define YYRELEASE yyrelease
78 #endif
79 #ifndef YY_BEGIN
80 #define YY_BEGIN ( yy->__begin= yy->__pos, 1)
81 #endif
82 #ifndef YY_END
83 #define YY_END ( yy->__end= yy->__pos, 1)
84 #endif
85 #ifdef YY_DEBUG
86 # define yyprintf(args) fprintf args
87 #else
88 # define yyprintf(args)
89 #endif
90 #ifndef YYSTYPE
91 #define YYSTYPE int
92 #endif
93 #ifndef YY_STACK_SIZE
94 #define YY_STACK_SIZE 128
95 #endif
96
97 #ifndef YY_BUFFER_SIZE
98 #define YY_BUFFER_SIZE 1024
99 #endif
100
101 #ifndef YY_PART
102
103 typedef struct _yycontext yycontext;
104 typedef void (*yyaction)(yycontext *yy, char *yytext, int yyleng);
105 typedef struct _yythunk { int begin, end; yyaction action; struct _yythunk *next; } yythunk;
106
107 struct _yycontext {
108 char *__buf;
109 int __buflen;
110 int __pos;
111 int __limit;
112 char *__text;
113 int __textlen;
114 int __begin;
115 int __end;
116 int __textmax;
117 yythunk *__thunks;
118 int __thunkslen;
119 int __thunkpos;
120 YYSTYPE __;
121 YYSTYPE *__val;
122 YYSTYPE *__vals;
123 int __valslen;
124 #ifdef YY_CTX_MEMBERS
125 YY_CTX_MEMBERS
126 #endif
127 };
128
129 #ifdef YY_CTX_LOCAL
130 #define YY_CTX_PARAM_ yycontext *yyctx,
131 #define YY_CTX_PARAM yycontext *yyctx
132 #define YY_CTX_ARG_ yyctx,
133 #define YY_CTX_ARG yyctx
134 #ifndef YY_INPUT
135 #define YY_INPUT(yy, buf, result, max_size) \
136 { \
137 int yyc= getchar(); \
138 result= (EOF == yyc) ? 0 : (*(buf)= yyc, 1); \
139 yyprintf((stderr, "<%c>", yyc)); \
140 }
141 #endif
142 #else
143 #define YY_CTX_PARAM_
144 #define YY_CTX_PARAM
145 #define YY_CTX_ARG_
146 #define YY_CTX_ARG
147 yycontext _yyctx= { 0, 0 };
148 yycontext *yyctx= &_yyctx;
149 #ifndef YY_INPUT
150 #define YY_INPUT(buf, result, max_size) \
151 { \
152 int yyc= getchar(); \
153 result= (EOF == yyc) ? 0 : (*(buf)= yyc, 1); \
154 yyprintf((stderr, "<%c>", yyc)); \
155 }
156 #endif
157 #endif
158
yyrefill(yycontext * yy)159 YY_LOCAL(int) yyrefill(yycontext *yy)
160 {
161 int yyn;
162 while (yy->__buflen - yy->__pos < 512)
163 {
164 yy->__buflen *= 2;
165 yy->__buf= (char *)YY_REALLOC(yy, yy->__buf, yy->__buflen);
166 }
167 #ifdef YY_CTX_LOCAL
168 YY_INPUT(yy, (yy->__buf + yy->__pos), yyn, (yy->__buflen - yy->__pos));
169 #else
170 YY_INPUT((yy->__buf + yy->__pos), yyn, (yy->__buflen - yy->__pos));
171 #endif
172 if (!yyn) return 0;
173 yy->__limit += yyn;
174 return 1;
175 }
176
yymatchDot(yycontext * yy)177 YY_LOCAL(int) yymatchDot(yycontext *yy)
178 {
179 if (yy->__pos >= yy->__limit && !yyrefill(yy)) return 0;
180 ++yy->__pos;
181 return 1;
182 }
183
yymatchChar(yycontext * yy,int c)184 YY_LOCAL(int) yymatchChar(yycontext *yy, int c)
185 {
186 if (yy->__pos >= yy->__limit && !yyrefill(yy)) return 0;
187 if ((unsigned char)yy->__buf[yy->__pos] == c)
188 {
189 ++yy->__pos;
190 yyprintf((stderr, " ok yymatchChar(yy, %c) @ %s\n", c, yy->__buf+yy->__pos));
191 return 1;
192 }
193 yyprintf((stderr, " fail yymatchChar(yy, %c) @ %s\n", c, yy->__buf+yy->__pos));
194 return 0;
195 }
196
yymatchString(yycontext * yy,const char * s)197 YY_LOCAL(int) yymatchString(yycontext *yy, const char *s)
198 {
199 int yysav= yy->__pos;
200 while (*s)
201 {
202 if (yy->__pos >= yy->__limit && !yyrefill(yy)) return 0;
203 if (yy->__buf[yy->__pos] != *s)
204 {
205 yy->__pos= yysav;
206 return 0;
207 }
208 ++s;
209 ++yy->__pos;
210 }
211 return 1;
212 }
213
yymatchClass(yycontext * yy,unsigned char * bits)214 YY_LOCAL(int) yymatchClass(yycontext *yy, unsigned char *bits)
215 {
216 int c;
217 if (yy->__pos >= yy->__limit && !yyrefill(yy)) return 0;
218 c= (unsigned char)yy->__buf[yy->__pos];
219 if (bits[c >> 3] & (1 << (c & 7)))
220 {
221 ++yy->__pos;
222 yyprintf((stderr, " ok yymatchClass @ %s\n", yy->__buf+yy->__pos));
223 return 1;
224 }
225 yyprintf((stderr, " fail yymatchClass @ %s\n", yy->__buf+yy->__pos));
226 return 0;
227 }
228
yyDo(yycontext * yy,yyaction action,int begin,int end)229 YY_LOCAL(void) yyDo(yycontext *yy, yyaction action, int begin, int end)
230 {
231 while (yy->__thunkpos >= yy->__thunkslen)
232 {
233 yy->__thunkslen *= 2;
234 yy->__thunks= (yythunk *)YY_REALLOC(yy, yy->__thunks, sizeof(yythunk) * yy->__thunkslen);
235 }
236 yy->__thunks[yy->__thunkpos].begin= begin;
237 yy->__thunks[yy->__thunkpos].end= end;
238 yy->__thunks[yy->__thunkpos].action= action;
239 ++yy->__thunkpos;
240 }
241
yyText(yycontext * yy,int begin,int end)242 YY_LOCAL(int) yyText(yycontext *yy, int begin, int end)
243 {
244 int yyleng= end - begin;
245 if (yyleng <= 0)
246 yyleng= 0;
247 else
248 {
249 while (yy->__textlen < (yyleng + 1))
250 {
251 yy->__textlen *= 2;
252 yy->__text= (char *)YY_REALLOC(yy, yy->__text, yy->__textlen);
253 }
254 memcpy(yy->__text, yy->__buf + begin, yyleng);
255 }
256 yy->__text[yyleng]= '\0';
257 return yyleng;
258 }
259
yyDone(yycontext * yy)260 YY_LOCAL(void) yyDone(yycontext *yy)
261 {
262 int pos;
263 for (pos= 0; pos < yy->__thunkpos; ++pos)
264 {
265 yythunk *thunk= &yy->__thunks[pos];
266 int yyleng= thunk->end ? yyText(yy, thunk->begin, thunk->end) : thunk->begin;
267 yyprintf((stderr, "DO [%d] %p %s\n", pos, thunk->action, yy->__text));
268 thunk->action(yy, yy->__text, yyleng);
269 }
270 yy->__thunkpos= 0;
271 }
272
yyCommit(yycontext * yy)273 YY_LOCAL(void) yyCommit(yycontext *yy)
274 {
275 if ((yy->__limit -= yy->__pos))
276 {
277 memmove(yy->__buf, yy->__buf + yy->__pos, yy->__limit);
278 }
279 yy->__begin -= yy->__pos;
280 yy->__end -= yy->__pos;
281 yy->__pos= yy->__thunkpos= 0;
282 }
283
yyAccept(yycontext * yy,int tp0)284 YY_LOCAL(int) yyAccept(yycontext *yy, int tp0)
285 {
286 if (tp0)
287 {
288 fprintf(stderr, "accept denied at %d\n", tp0);
289 return 0;
290 }
291 else
292 {
293 yyDone(yy);
294 yyCommit(yy);
295 }
296 return 1;
297 }
298
yyPush(yycontext * yy,char * text,int count)299 YY_LOCAL(void) yyPush(yycontext *yy, char *text, int count)
300 {
301 yy->__val += count;
302 while (yy->__valslen <= yy->__val - yy->__vals)
303 {
304 long offset= yy->__val - yy->__vals;
305 yy->__valslen *= 2;
306 yy->__vals= (YYSTYPE *)YY_REALLOC(yy, yy->__vals, sizeof(YYSTYPE) * yy->__valslen);
307 yy->__val= yy->__vals + offset;
308 }
309 }
yyPop(yycontext * yy,char * text,int count)310 YY_LOCAL(void) yyPop(yycontext *yy, char *text, int count) { yy->__val -= count; }
yySet(yycontext * yy,char * text,int count)311 YY_LOCAL(void) yySet(yycontext *yy, char *text, int count) { yy->__val[count]= yy->__; }
312
313 #endif /* YY_PART */
314
315 #define YYACCEPT yyAccept(yy, yythunkpos0)
316
317 YY_RULE(int) yy_end_of_line(yycontext *yy); /* 38 */
318 YY_RULE(int) yy_comment(yycontext *yy); /* 37 */
319 YY_RULE(int) yy_space(yycontext *yy); /* 36 */
320 YY_RULE(int) yy_braces(yycontext *yy); /* 35 */
321 YY_RULE(int) yy_range(yycontext *yy); /* 34 */
322 YY_RULE(int) yy_char(yycontext *yy); /* 33 */
323 YY_RULE(int) yy_END(yycontext *yy); /* 32 */
324 YY_RULE(int) yy_BEGIN(yycontext *yy); /* 31 */
325 YY_RULE(int) yy_DOT(yycontext *yy); /* 30 */
326 YY_RULE(int) yy_class(yycontext *yy); /* 29 */
327 YY_RULE(int) yy_literal(yycontext *yy); /* 28 */
328 YY_RULE(int) yy_CLOSE(yycontext *yy); /* 27 */
329 YY_RULE(int) yy_OPEN(yycontext *yy); /* 26 */
330 YY_RULE(int) yy_COLON(yycontext *yy); /* 25 */
331 YY_RULE(int) yy_PLUS(yycontext *yy); /* 24 */
332 YY_RULE(int) yy_STAR(yycontext *yy); /* 23 */
333 YY_RULE(int) yy_QUESTION(yycontext *yy); /* 22 */
334 YY_RULE(int) yy_primary(yycontext *yy); /* 21 */
335 YY_RULE(int) yy_NOT(yycontext *yy); /* 20 */
336 YY_RULE(int) yy_suffix(yycontext *yy); /* 19 */
337 YY_RULE(int) yy_AND(yycontext *yy); /* 18 */
338 YY_RULE(int) yy_action(yycontext *yy); /* 17 */
339 YY_RULE(int) yy_TILDE(yycontext *yy); /* 16 */
340 YY_RULE(int) yy_prefix(yycontext *yy); /* 15 */
341 YY_RULE(int) yy_error(yycontext *yy); /* 14 */
342 YY_RULE(int) yy_BAR(yycontext *yy); /* 13 */
343 YY_RULE(int) yy_sequence(yycontext *yy); /* 12 */
344 YY_RULE(int) yy_SEMICOLON(yycontext *yy); /* 11 */
345 YY_RULE(int) yy_expression(yycontext *yy); /* 10 */
346 YY_RULE(int) yy_EQUAL(yycontext *yy); /* 9 */
347 YY_RULE(int) yy_identifier(yycontext *yy); /* 8 */
348 YY_RULE(int) yy_RPERCENT(yycontext *yy); /* 7 */
349 YY_RULE(int) yy_end_of_file(yycontext *yy); /* 6 */
350 YY_RULE(int) yy_trailer(yycontext *yy); /* 5 */
351 YY_RULE(int) yy_definition(yycontext *yy); /* 4 */
352 YY_RULE(int) yy_declaration(yycontext *yy); /* 3 */
353 YY_RULE(int) yy__(yycontext *yy); /* 2 */
354 YY_RULE(int) yy_grammar(yycontext *yy); /* 1 */
355
yy_9_primary(yycontext * yy,char * yytext,int yyleng)356 YY_ACTION(void) yy_9_primary(yycontext *yy, char *yytext, int yyleng)
357 {
358 #define __ yy->__
359 #define yypos yy->__pos
360 #define yythunkpos yy->__thunkpos
361 yyprintf((stderr, "do yy_9_primary\n"));
362 {
363 push(makePredicate("YY_END")); ;
364 }
365 #undef yythunkpos
366 #undef yypos
367 #undef yy
368 }
yy_8_primary(yycontext * yy,char * yytext,int yyleng)369 YY_ACTION(void) yy_8_primary(yycontext *yy, char *yytext, int yyleng)
370 {
371 #define __ yy->__
372 #define yypos yy->__pos
373 #define yythunkpos yy->__thunkpos
374 yyprintf((stderr, "do yy_8_primary\n"));
375 {
376 push(makePredicate("YY_BEGIN")); ;
377 }
378 #undef yythunkpos
379 #undef yypos
380 #undef yy
381 }
yy_7_primary(yycontext * yy,char * yytext,int yyleng)382 YY_ACTION(void) yy_7_primary(yycontext *yy, char *yytext, int yyleng)
383 {
384 #define __ yy->__
385 #define yypos yy->__pos
386 #define yythunkpos yy->__thunkpos
387 yyprintf((stderr, "do yy_7_primary\n"));
388 {
389 push(makeAction(yytext)); ;
390 }
391 #undef yythunkpos
392 #undef yypos
393 #undef yy
394 }
yy_6_primary(yycontext * yy,char * yytext,int yyleng)395 YY_ACTION(void) yy_6_primary(yycontext *yy, char *yytext, int yyleng)
396 {
397 #define __ yy->__
398 #define yypos yy->__pos
399 #define yythunkpos yy->__thunkpos
400 yyprintf((stderr, "do yy_6_primary\n"));
401 {
402 push(makeDot()); ;
403 }
404 #undef yythunkpos
405 #undef yypos
406 #undef yy
407 }
yy_5_primary(yycontext * yy,char * yytext,int yyleng)408 YY_ACTION(void) yy_5_primary(yycontext *yy, char *yytext, int yyleng)
409 {
410 #define __ yy->__
411 #define yypos yy->__pos
412 #define yythunkpos yy->__thunkpos
413 yyprintf((stderr, "do yy_5_primary\n"));
414 {
415 push(makeClass(yytext)); ;
416 }
417 #undef yythunkpos
418 #undef yypos
419 #undef yy
420 }
yy_4_primary(yycontext * yy,char * yytext,int yyleng)421 YY_ACTION(void) yy_4_primary(yycontext *yy, char *yytext, int yyleng)
422 {
423 #define __ yy->__
424 #define yypos yy->__pos
425 #define yythunkpos yy->__thunkpos
426 yyprintf((stderr, "do yy_4_primary\n"));
427 {
428 push(makeString(yytext)); ;
429 }
430 #undef yythunkpos
431 #undef yypos
432 #undef yy
433 }
yy_3_primary(yycontext * yy,char * yytext,int yyleng)434 YY_ACTION(void) yy_3_primary(yycontext *yy, char *yytext, int yyleng)
435 {
436 #define __ yy->__
437 #define yypos yy->__pos
438 #define yythunkpos yy->__thunkpos
439 yyprintf((stderr, "do yy_3_primary\n"));
440 {
441 push(makeName(findRule(yytext))); ;
442 }
443 #undef yythunkpos
444 #undef yypos
445 #undef yy
446 }
yy_2_primary(yycontext * yy,char * yytext,int yyleng)447 YY_ACTION(void) yy_2_primary(yycontext *yy, char *yytext, int yyleng)
448 {
449 #define __ yy->__
450 #define yypos yy->__pos
451 #define yythunkpos yy->__thunkpos
452 yyprintf((stderr, "do yy_2_primary\n"));
453 {
454 Node *name= makeName(findRule(yytext)); name->name.variable= pop(); push(name); ;
455 }
456 #undef yythunkpos
457 #undef yypos
458 #undef yy
459 }
yy_1_primary(yycontext * yy,char * yytext,int yyleng)460 YY_ACTION(void) yy_1_primary(yycontext *yy, char *yytext, int yyleng)
461 {
462 #define __ yy->__
463 #define yypos yy->__pos
464 #define yythunkpos yy->__thunkpos
465 yyprintf((stderr, "do yy_1_primary\n"));
466 {
467 push(makeVariable(yytext)); ;
468 }
469 #undef yythunkpos
470 #undef yypos
471 #undef yy
472 }
yy_3_suffix(yycontext * yy,char * yytext,int yyleng)473 YY_ACTION(void) yy_3_suffix(yycontext *yy, char *yytext, int yyleng)
474 {
475 #define __ yy->__
476 #define yypos yy->__pos
477 #define yythunkpos yy->__thunkpos
478 yyprintf((stderr, "do yy_3_suffix\n"));
479 {
480 push(makePlus (pop())); ;
481 }
482 #undef yythunkpos
483 #undef yypos
484 #undef yy
485 }
yy_2_suffix(yycontext * yy,char * yytext,int yyleng)486 YY_ACTION(void) yy_2_suffix(yycontext *yy, char *yytext, int yyleng)
487 {
488 #define __ yy->__
489 #define yypos yy->__pos
490 #define yythunkpos yy->__thunkpos
491 yyprintf((stderr, "do yy_2_suffix\n"));
492 {
493 push(makeStar (pop())); ;
494 }
495 #undef yythunkpos
496 #undef yypos
497 #undef yy
498 }
yy_1_suffix(yycontext * yy,char * yytext,int yyleng)499 YY_ACTION(void) yy_1_suffix(yycontext *yy, char *yytext, int yyleng)
500 {
501 #define __ yy->__
502 #define yypos yy->__pos
503 #define yythunkpos yy->__thunkpos
504 yyprintf((stderr, "do yy_1_suffix\n"));
505 {
506 push(makeQuery(pop())); ;
507 }
508 #undef yythunkpos
509 #undef yypos
510 #undef yy
511 }
yy_3_prefix(yycontext * yy,char * yytext,int yyleng)512 YY_ACTION(void) yy_3_prefix(yycontext *yy, char *yytext, int yyleng)
513 {
514 #define __ yy->__
515 #define yypos yy->__pos
516 #define yythunkpos yy->__thunkpos
517 yyprintf((stderr, "do yy_3_prefix\n"));
518 {
519 push(makePeekNot(pop())); ;
520 }
521 #undef yythunkpos
522 #undef yypos
523 #undef yy
524 }
yy_2_prefix(yycontext * yy,char * yytext,int yyleng)525 YY_ACTION(void) yy_2_prefix(yycontext *yy, char *yytext, int yyleng)
526 {
527 #define __ yy->__
528 #define yypos yy->__pos
529 #define yythunkpos yy->__thunkpos
530 yyprintf((stderr, "do yy_2_prefix\n"));
531 {
532 push(makePeekFor(pop())); ;
533 }
534 #undef yythunkpos
535 #undef yypos
536 #undef yy
537 }
yy_1_prefix(yycontext * yy,char * yytext,int yyleng)538 YY_ACTION(void) yy_1_prefix(yycontext *yy, char *yytext, int yyleng)
539 {
540 #define __ yy->__
541 #define yypos yy->__pos
542 #define yythunkpos yy->__thunkpos
543 yyprintf((stderr, "do yy_1_prefix\n"));
544 {
545 push(makePredicate(yytext)); ;
546 }
547 #undef yythunkpos
548 #undef yypos
549 #undef yy
550 }
yy_1_error(yycontext * yy,char * yytext,int yyleng)551 YY_ACTION(void) yy_1_error(yycontext *yy, char *yytext, int yyleng)
552 {
553 #define __ yy->__
554 #define yypos yy->__pos
555 #define yythunkpos yy->__thunkpos
556 yyprintf((stderr, "do yy_1_error\n"));
557 {
558 push(makeError(pop(), yytext)); ;
559 }
560 #undef yythunkpos
561 #undef yypos
562 #undef yy
563 }
yy_1_sequence(yycontext * yy,char * yytext,int yyleng)564 YY_ACTION(void) yy_1_sequence(yycontext *yy, char *yytext, int yyleng)
565 {
566 #define __ yy->__
567 #define yypos yy->__pos
568 #define yythunkpos yy->__thunkpos
569 yyprintf((stderr, "do yy_1_sequence\n"));
570 {
571 Node *f= pop(); push(Sequence_append(pop(), f)); ;
572 }
573 #undef yythunkpos
574 #undef yypos
575 #undef yy
576 }
yy_1_expression(yycontext * yy,char * yytext,int yyleng)577 YY_ACTION(void) yy_1_expression(yycontext *yy, char *yytext, int yyleng)
578 {
579 #define __ yy->__
580 #define yypos yy->__pos
581 #define yythunkpos yy->__thunkpos
582 yyprintf((stderr, "do yy_1_expression\n"));
583 {
584 Node *f= pop(); push(Alternate_append(pop(), f)); ;
585 }
586 #undef yythunkpos
587 #undef yypos
588 #undef yy
589 }
yy_2_definition(yycontext * yy,char * yytext,int yyleng)590 YY_ACTION(void) yy_2_definition(yycontext *yy, char *yytext, int yyleng)
591 {
592 #define __ yy->__
593 #define yypos yy->__pos
594 #define yythunkpos yy->__thunkpos
595 yyprintf((stderr, "do yy_2_definition\n"));
596 {
597 Node *e= pop(); Rule_setExpression(pop(), e); ;
598 }
599 #undef yythunkpos
600 #undef yypos
601 #undef yy
602 }
yy_1_definition(yycontext * yy,char * yytext,int yyleng)603 YY_ACTION(void) yy_1_definition(yycontext *yy, char *yytext, int yyleng)
604 {
605 #define __ yy->__
606 #define yypos yy->__pos
607 #define yythunkpos yy->__thunkpos
608 yyprintf((stderr, "do yy_1_definition\n"));
609 {
610 if (push(beginRule(findRule(yytext)))->rule.expression)
611 fprintf(stderr, "rule '%s' redefined\n", yytext); ;
612 }
613 #undef yythunkpos
614 #undef yypos
615 #undef yy
616 }
yy_1_trailer(yycontext * yy,char * yytext,int yyleng)617 YY_ACTION(void) yy_1_trailer(yycontext *yy, char *yytext, int yyleng)
618 {
619 #define __ yy->__
620 #define yypos yy->__pos
621 #define yythunkpos yy->__thunkpos
622 yyprintf((stderr, "do yy_1_trailer\n"));
623 {
624 makeTrailer(yytext); ;
625 }
626 #undef yythunkpos
627 #undef yypos
628 #undef yy
629 }
yy_1_declaration(yycontext * yy,char * yytext,int yyleng)630 YY_ACTION(void) yy_1_declaration(yycontext *yy, char *yytext, int yyleng)
631 {
632 #define __ yy->__
633 #define yypos yy->__pos
634 #define yythunkpos yy->__thunkpos
635 yyprintf((stderr, "do yy_1_declaration\n"));
636 {
637 makeHeader(yytext); ;
638 }
639 #undef yythunkpos
640 #undef yypos
641 #undef yy
642 }
643
yy_end_of_line(yycontext * yy)644 YY_RULE(int) yy_end_of_line(yycontext *yy)
645 { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
646 yyprintf((stderr, "%s\n", "end_of_line"));
647 { int yypos2= yy->__pos, yythunkpos2= yy->__thunkpos; if (!yymatchString(yy, "\r\n")) goto l3; goto l2;
648 l3:; yy->__pos= yypos2; yy->__thunkpos= yythunkpos2; if (!yymatchChar(yy, '\n')) goto l4; goto l2;
649 l4:; yy->__pos= yypos2; yy->__thunkpos= yythunkpos2; if (!yymatchChar(yy, '\r')) goto l1;
650 }
651 l2:;
652 yyprintf((stderr, " ok %s @ %s\n", "end_of_line", yy->__buf+yy->__pos));
653 return 1;
654 l1:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
655 yyprintf((stderr, " fail %s @ %s\n", "end_of_line", yy->__buf+yy->__pos));
656 return 0;
657 }
yy_comment(yycontext * yy)658 YY_RULE(int) yy_comment(yycontext *yy)
659 { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
660 yyprintf((stderr, "%s\n", "comment")); if (!yymatchChar(yy, '#')) goto l5;
661 l6:;
662 { int yypos7= yy->__pos, yythunkpos7= yy->__thunkpos;
663 { int yypos8= yy->__pos, yythunkpos8= yy->__thunkpos; if (!yy_end_of_line(yy)) goto l8; goto l7;
664 l8:; yy->__pos= yypos8; yy->__thunkpos= yythunkpos8;
665 } if (!yymatchDot(yy)) goto l7; goto l6;
666 l7:; yy->__pos= yypos7; yy->__thunkpos= yythunkpos7;
667 } if (!yy_end_of_line(yy)) goto l5;
668 yyprintf((stderr, " ok %s @ %s\n", "comment", yy->__buf+yy->__pos));
669 return 1;
670 l5:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
671 yyprintf((stderr, " fail %s @ %s\n", "comment", yy->__buf+yy->__pos));
672 return 0;
673 }
yy_space(yycontext * yy)674 YY_RULE(int) yy_space(yycontext *yy)
675 { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
676 yyprintf((stderr, "%s\n", "space"));
677 { int yypos10= yy->__pos, yythunkpos10= yy->__thunkpos; if (!yymatchChar(yy, ' ')) goto l11; goto l10;
678 l11:; yy->__pos= yypos10; yy->__thunkpos= yythunkpos10; if (!yymatchChar(yy, '\t')) goto l12; goto l10;
679 l12:; yy->__pos= yypos10; yy->__thunkpos= yythunkpos10; if (!yy_end_of_line(yy)) goto l9;
680 }
681 l10:;
682 yyprintf((stderr, " ok %s @ %s\n", "space", yy->__buf+yy->__pos));
683 return 1;
684 l9:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
685 yyprintf((stderr, " fail %s @ %s\n", "space", yy->__buf+yy->__pos));
686 return 0;
687 }
yy_braces(yycontext * yy)688 YY_RULE(int) yy_braces(yycontext *yy)
689 { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
690 yyprintf((stderr, "%s\n", "braces"));
691 { int yypos14= yy->__pos, yythunkpos14= yy->__thunkpos; if (!yymatchChar(yy, '{')) goto l15;
692 l16:;
693 { int yypos17= yy->__pos, yythunkpos17= yy->__thunkpos; if (!yy_braces(yy)) goto l17; goto l16;
694 l17:; yy->__pos= yypos17; yy->__thunkpos= yythunkpos17;
695 } if (!yymatchChar(yy, '}')) goto l15; goto l14;
696 l15:; yy->__pos= yypos14; yy->__thunkpos= yythunkpos14;
697 { int yypos18= yy->__pos, yythunkpos18= yy->__thunkpos; if (!yymatchChar(yy, '}')) goto l18; goto l13;
698 l18:; yy->__pos= yypos18; yy->__thunkpos= yythunkpos18;
699 } if (!yymatchDot(yy)) goto l13;
700 }
701 l14:;
702 yyprintf((stderr, " ok %s @ %s\n", "braces", yy->__buf+yy->__pos));
703 return 1;
704 l13:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
705 yyprintf((stderr, " fail %s @ %s\n", "braces", yy->__buf+yy->__pos));
706 return 0;
707 }
yy_range(yycontext * yy)708 YY_RULE(int) yy_range(yycontext *yy)
709 { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
710 yyprintf((stderr, "%s\n", "range"));
711 { int yypos20= yy->__pos, yythunkpos20= yy->__thunkpos; if (!yy_char(yy)) goto l21; if (!yymatchChar(yy, '-')) goto l21; if (!yy_char(yy)) goto l21; goto l20;
712 l21:; yy->__pos= yypos20; yy->__thunkpos= yythunkpos20; if (!yy_char(yy)) goto l19;
713 }
714 l20:;
715 yyprintf((stderr, " ok %s @ %s\n", "range", yy->__buf+yy->__pos));
716 return 1;
717 l19:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
718 yyprintf((stderr, " fail %s @ %s\n", "range", yy->__buf+yy->__pos));
719 return 0;
720 }
yy_char(yycontext * yy)721 YY_RULE(int) yy_char(yycontext *yy)
722 { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
723 yyprintf((stderr, "%s\n", "char"));
724 { int yypos23= yy->__pos, yythunkpos23= yy->__thunkpos; if (!yymatchChar(yy, '\\')) goto l24; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\204\040\000\000\000\000\000\070\146\100\124\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l24; goto l23;
725 l24:; yy->__pos= yypos23; yy->__thunkpos= yythunkpos23; if (!yymatchChar(yy, '\\')) goto l25; if (!yymatchChar(yy, 'x')) goto l25; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\377\003\176\000\000\000\176\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l25; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\377\003\176\000\000\000\176\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l25; goto l23;
726 l25:; yy->__pos= yypos23; yy->__thunkpos= yythunkpos23; if (!yymatchChar(yy, '\\')) goto l26; if (!yymatchChar(yy, 'x')) goto l26; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\377\003\176\000\000\000\176\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l26; goto l23;
727 l26:; yy->__pos= yypos23; yy->__thunkpos= yythunkpos23; if (!yymatchChar(yy, '\\')) goto l27; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\017\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l27; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\377\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l27; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\377\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l27; goto l23;
728 l27:; yy->__pos= yypos23; yy->__thunkpos= yythunkpos23; if (!yymatchChar(yy, '\\')) goto l28; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\377\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l28;
729 { int yypos29= yy->__pos, yythunkpos29= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\377\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l29; goto l30;
730 l29:; yy->__pos= yypos29; yy->__thunkpos= yythunkpos29;
731 }
732 l30:; goto l23;
733 l28:; yy->__pos= yypos23; yy->__thunkpos= yythunkpos23;
734 { int yypos31= yy->__pos, yythunkpos31= yy->__thunkpos; if (!yymatchChar(yy, '\\')) goto l31; goto l22;
735 l31:; yy->__pos= yypos31; yy->__thunkpos= yythunkpos31;
736 } if (!yymatchDot(yy)) goto l22;
737 }
738 l23:;
739 yyprintf((stderr, " ok %s @ %s\n", "char", yy->__buf+yy->__pos));
740 return 1;
741 l22:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
742 yyprintf((stderr, " fail %s @ %s\n", "char", yy->__buf+yy->__pos));
743 return 0;
744 }
yy_END(yycontext * yy)745 YY_RULE(int) yy_END(yycontext *yy)
746 { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
747 yyprintf((stderr, "%s\n", "END")); if (!yymatchChar(yy, '>')) goto l32; if (!yy__(yy)) goto l32;
748 yyprintf((stderr, " ok %s @ %s\n", "END", yy->__buf+yy->__pos));
749 return 1;
750 l32:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
751 yyprintf((stderr, " fail %s @ %s\n", "END", yy->__buf+yy->__pos));
752 return 0;
753 }
yy_BEGIN(yycontext * yy)754 YY_RULE(int) yy_BEGIN(yycontext *yy)
755 { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
756 yyprintf((stderr, "%s\n", "BEGIN")); if (!yymatchChar(yy, '<')) goto l33; if (!yy__(yy)) goto l33;
757 yyprintf((stderr, " ok %s @ %s\n", "BEGIN", yy->__buf+yy->__pos));
758 return 1;
759 l33:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
760 yyprintf((stderr, " fail %s @ %s\n", "BEGIN", yy->__buf+yy->__pos));
761 return 0;
762 }
yy_DOT(yycontext * yy)763 YY_RULE(int) yy_DOT(yycontext *yy)
764 { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
765 yyprintf((stderr, "%s\n", "DOT")); if (!yymatchChar(yy, '.')) goto l34; if (!yy__(yy)) goto l34;
766 yyprintf((stderr, " ok %s @ %s\n", "DOT", yy->__buf+yy->__pos));
767 return 1;
768 l34:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
769 yyprintf((stderr, " fail %s @ %s\n", "DOT", yy->__buf+yy->__pos));
770 return 0;
771 }
yy_class(yycontext * yy)772 YY_RULE(int) yy_class(yycontext *yy)
773 { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
774 yyprintf((stderr, "%s\n", "class")); if (!yymatchChar(yy, '[')) goto l35; yyText(yy, yy->__begin, yy->__end); {
775 #define yytext yy->__text
776 #define yyleng yy->__textlen
777 if (!(YY_BEGIN)) goto l35;
778 #undef yytext
779 #undef yyleng
780 }
781 l36:;
782 { int yypos37= yy->__pos, yythunkpos37= yy->__thunkpos;
783 { int yypos38= yy->__pos, yythunkpos38= yy->__thunkpos; if (!yymatchChar(yy, ']')) goto l38; goto l37;
784 l38:; yy->__pos= yypos38; yy->__thunkpos= yythunkpos38;
785 } if (!yy_range(yy)) goto l37; goto l36;
786 l37:; yy->__pos= yypos37; yy->__thunkpos= yythunkpos37;
787 } yyText(yy, yy->__begin, yy->__end); {
788 #define yytext yy->__text
789 #define yyleng yy->__textlen
790 if (!(YY_END)) goto l35;
791 #undef yytext
792 #undef yyleng
793 } if (!yymatchChar(yy, ']')) goto l35; if (!yy__(yy)) goto l35;
794 yyprintf((stderr, " ok %s @ %s\n", "class", yy->__buf+yy->__pos));
795 return 1;
796 l35:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
797 yyprintf((stderr, " fail %s @ %s\n", "class", yy->__buf+yy->__pos));
798 return 0;
799 }
yy_literal(yycontext * yy)800 YY_RULE(int) yy_literal(yycontext *yy)
801 { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
802 yyprintf((stderr, "%s\n", "literal"));
803 { int yypos40= yy->__pos, yythunkpos40= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l41; yyText(yy, yy->__begin, yy->__end); {
804 #define yytext yy->__text
805 #define yyleng yy->__textlen
806 if (!(YY_BEGIN)) goto l41;
807 #undef yytext
808 #undef yyleng
809 }
810 l42:;
811 { int yypos43= yy->__pos, yythunkpos43= yy->__thunkpos;
812 { int yypos44= yy->__pos, yythunkpos44= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l44; goto l43;
813 l44:; yy->__pos= yypos44; yy->__thunkpos= yythunkpos44;
814 } if (!yy_char(yy)) goto l43; goto l42;
815 l43:; yy->__pos= yypos43; yy->__thunkpos= yythunkpos43;
816 } yyText(yy, yy->__begin, yy->__end); {
817 #define yytext yy->__text
818 #define yyleng yy->__textlen
819 if (!(YY_END)) goto l41;
820 #undef yytext
821 #undef yyleng
822 } if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l41; if (!yy__(yy)) goto l41; goto l40;
823 l41:; yy->__pos= yypos40; yy->__thunkpos= yythunkpos40; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l39; yyText(yy, yy->__begin, yy->__end); {
824 #define yytext yy->__text
825 #define yyleng yy->__textlen
826 if (!(YY_BEGIN)) goto l39;
827 #undef yytext
828 #undef yyleng
829 }
830 l45:;
831 { int yypos46= yy->__pos, yythunkpos46= yy->__thunkpos;
832 { int yypos47= yy->__pos, yythunkpos47= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l47; goto l46;
833 l47:; yy->__pos= yypos47; yy->__thunkpos= yythunkpos47;
834 } if (!yy_char(yy)) goto l46; goto l45;
835 l46:; yy->__pos= yypos46; yy->__thunkpos= yythunkpos46;
836 } yyText(yy, yy->__begin, yy->__end); {
837 #define yytext yy->__text
838 #define yyleng yy->__textlen
839 if (!(YY_END)) goto l39;
840 #undef yytext
841 #undef yyleng
842 } if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l39; if (!yy__(yy)) goto l39;
843 }
844 l40:;
845 yyprintf((stderr, " ok %s @ %s\n", "literal", yy->__buf+yy->__pos));
846 return 1;
847 l39:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
848 yyprintf((stderr, " fail %s @ %s\n", "literal", yy->__buf+yy->__pos));
849 return 0;
850 }
yy_CLOSE(yycontext * yy)851 YY_RULE(int) yy_CLOSE(yycontext *yy)
852 { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
853 yyprintf((stderr, "%s\n", "CLOSE")); if (!yymatchChar(yy, ')')) goto l48; if (!yy__(yy)) goto l48;
854 yyprintf((stderr, " ok %s @ %s\n", "CLOSE", yy->__buf+yy->__pos));
855 return 1;
856 l48:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
857 yyprintf((stderr, " fail %s @ %s\n", "CLOSE", yy->__buf+yy->__pos));
858 return 0;
859 }
yy_OPEN(yycontext * yy)860 YY_RULE(int) yy_OPEN(yycontext *yy)
861 { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
862 yyprintf((stderr, "%s\n", "OPEN")); if (!yymatchChar(yy, '(')) goto l49; if (!yy__(yy)) goto l49;
863 yyprintf((stderr, " ok %s @ %s\n", "OPEN", yy->__buf+yy->__pos));
864 return 1;
865 l49:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
866 yyprintf((stderr, " fail %s @ %s\n", "OPEN", yy->__buf+yy->__pos));
867 return 0;
868 }
yy_COLON(yycontext * yy)869 YY_RULE(int) yy_COLON(yycontext *yy)
870 { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
871 yyprintf((stderr, "%s\n", "COLON")); if (!yymatchChar(yy, ':')) goto l50; if (!yy__(yy)) goto l50;
872 yyprintf((stderr, " ok %s @ %s\n", "COLON", yy->__buf+yy->__pos));
873 return 1;
874 l50:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
875 yyprintf((stderr, " fail %s @ %s\n", "COLON", yy->__buf+yy->__pos));
876 return 0;
877 }
yy_PLUS(yycontext * yy)878 YY_RULE(int) yy_PLUS(yycontext *yy)
879 { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
880 yyprintf((stderr, "%s\n", "PLUS")); if (!yymatchChar(yy, '+')) goto l51; if (!yy__(yy)) goto l51;
881 yyprintf((stderr, " ok %s @ %s\n", "PLUS", yy->__buf+yy->__pos));
882 return 1;
883 l51:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
884 yyprintf((stderr, " fail %s @ %s\n", "PLUS", yy->__buf+yy->__pos));
885 return 0;
886 }
yy_STAR(yycontext * yy)887 YY_RULE(int) yy_STAR(yycontext *yy)
888 { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
889 yyprintf((stderr, "%s\n", "STAR")); if (!yymatchChar(yy, '*')) goto l52; if (!yy__(yy)) goto l52;
890 yyprintf((stderr, " ok %s @ %s\n", "STAR", yy->__buf+yy->__pos));
891 return 1;
892 l52:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
893 yyprintf((stderr, " fail %s @ %s\n", "STAR", yy->__buf+yy->__pos));
894 return 0;
895 }
yy_QUESTION(yycontext * yy)896 YY_RULE(int) yy_QUESTION(yycontext *yy)
897 { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
898 yyprintf((stderr, "%s\n", "QUESTION")); if (!yymatchChar(yy, '?')) goto l53; if (!yy__(yy)) goto l53;
899 yyprintf((stderr, " ok %s @ %s\n", "QUESTION", yy->__buf+yy->__pos));
900 return 1;
901 l53:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
902 yyprintf((stderr, " fail %s @ %s\n", "QUESTION", yy->__buf+yy->__pos));
903 return 0;
904 }
yy_primary(yycontext * yy)905 YY_RULE(int) yy_primary(yycontext *yy)
906 { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
907 yyprintf((stderr, "%s\n", "primary"));
908 { int yypos55= yy->__pos, yythunkpos55= yy->__thunkpos; if (!yy_identifier(yy)) goto l56; yyDo(yy, yy_1_primary, yy->__begin, yy->__end); if (!yy_COLON(yy)) goto l56; if (!yy_identifier(yy)) goto l56;
909 { int yypos57= yy->__pos, yythunkpos57= yy->__thunkpos; if (!yy_EQUAL(yy)) goto l57; goto l56;
910 l57:; yy->__pos= yypos57; yy->__thunkpos= yythunkpos57;
911 } yyDo(yy, yy_2_primary, yy->__begin, yy->__end); goto l55;
912 l56:; yy->__pos= yypos55; yy->__thunkpos= yythunkpos55; if (!yy_identifier(yy)) goto l58;
913 { int yypos59= yy->__pos, yythunkpos59= yy->__thunkpos; if (!yy_EQUAL(yy)) goto l59; goto l58;
914 l59:; yy->__pos= yypos59; yy->__thunkpos= yythunkpos59;
915 } yyDo(yy, yy_3_primary, yy->__begin, yy->__end); goto l55;
916 l58:; yy->__pos= yypos55; yy->__thunkpos= yythunkpos55; if (!yy_OPEN(yy)) goto l60; if (!yy_expression(yy)) goto l60; if (!yy_CLOSE(yy)) goto l60; goto l55;
917 l60:; yy->__pos= yypos55; yy->__thunkpos= yythunkpos55; if (!yy_literal(yy)) goto l61; yyDo(yy, yy_4_primary, yy->__begin, yy->__end); goto l55;
918 l61:; yy->__pos= yypos55; yy->__thunkpos= yythunkpos55; if (!yy_class(yy)) goto l62; yyDo(yy, yy_5_primary, yy->__begin, yy->__end); goto l55;
919 l62:; yy->__pos= yypos55; yy->__thunkpos= yythunkpos55; if (!yy_DOT(yy)) goto l63; yyDo(yy, yy_6_primary, yy->__begin, yy->__end); goto l55;
920 l63:; yy->__pos= yypos55; yy->__thunkpos= yythunkpos55; if (!yy_action(yy)) goto l64; yyDo(yy, yy_7_primary, yy->__begin, yy->__end); goto l55;
921 l64:; yy->__pos= yypos55; yy->__thunkpos= yythunkpos55; if (!yy_BEGIN(yy)) goto l65; yyDo(yy, yy_8_primary, yy->__begin, yy->__end); goto l55;
922 l65:; yy->__pos= yypos55; yy->__thunkpos= yythunkpos55; if (!yy_END(yy)) goto l54; yyDo(yy, yy_9_primary, yy->__begin, yy->__end);
923 }
924 l55:;
925 yyprintf((stderr, " ok %s @ %s\n", "primary", yy->__buf+yy->__pos));
926 return 1;
927 l54:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
928 yyprintf((stderr, " fail %s @ %s\n", "primary", yy->__buf+yy->__pos));
929 return 0;
930 }
yy_NOT(yycontext * yy)931 YY_RULE(int) yy_NOT(yycontext *yy)
932 { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
933 yyprintf((stderr, "%s\n", "NOT")); if (!yymatchChar(yy, '!')) goto l66; if (!yy__(yy)) goto l66;
934 yyprintf((stderr, " ok %s @ %s\n", "NOT", yy->__buf+yy->__pos));
935 return 1;
936 l66:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
937 yyprintf((stderr, " fail %s @ %s\n", "NOT", yy->__buf+yy->__pos));
938 return 0;
939 }
yy_suffix(yycontext * yy)940 YY_RULE(int) yy_suffix(yycontext *yy)
941 { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
942 yyprintf((stderr, "%s\n", "suffix")); if (!yy_primary(yy)) goto l67;
943 { int yypos68= yy->__pos, yythunkpos68= yy->__thunkpos;
944 { int yypos70= yy->__pos, yythunkpos70= yy->__thunkpos; if (!yy_QUESTION(yy)) goto l71; yyDo(yy, yy_1_suffix, yy->__begin, yy->__end); goto l70;
945 l71:; yy->__pos= yypos70; yy->__thunkpos= yythunkpos70; if (!yy_STAR(yy)) goto l72; yyDo(yy, yy_2_suffix, yy->__begin, yy->__end); goto l70;
946 l72:; yy->__pos= yypos70; yy->__thunkpos= yythunkpos70; if (!yy_PLUS(yy)) goto l68; yyDo(yy, yy_3_suffix, yy->__begin, yy->__end);
947 }
948 l70:; goto l69;
949 l68:; yy->__pos= yypos68; yy->__thunkpos= yythunkpos68;
950 }
951 l69:;
952 yyprintf((stderr, " ok %s @ %s\n", "suffix", yy->__buf+yy->__pos));
953 return 1;
954 l67:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
955 yyprintf((stderr, " fail %s @ %s\n", "suffix", yy->__buf+yy->__pos));
956 return 0;
957 }
yy_AND(yycontext * yy)958 YY_RULE(int) yy_AND(yycontext *yy)
959 { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
960 yyprintf((stderr, "%s\n", "AND")); if (!yymatchChar(yy, '&')) goto l73; if (!yy__(yy)) goto l73;
961 yyprintf((stderr, " ok %s @ %s\n", "AND", yy->__buf+yy->__pos));
962 return 1;
963 l73:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
964 yyprintf((stderr, " fail %s @ %s\n", "AND", yy->__buf+yy->__pos));
965 return 0;
966 }
yy_action(yycontext * yy)967 YY_RULE(int) yy_action(yycontext *yy)
968 { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
969 yyprintf((stderr, "%s\n", "action")); if (!yymatchChar(yy, '{')) goto l74; yyText(yy, yy->__begin, yy->__end); {
970 #define yytext yy->__text
971 #define yyleng yy->__textlen
972 if (!(YY_BEGIN)) goto l74;
973 #undef yytext
974 #undef yyleng
975 }
976 l75:;
977 { int yypos76= yy->__pos, yythunkpos76= yy->__thunkpos; if (!yy_braces(yy)) goto l76; goto l75;
978 l76:; yy->__pos= yypos76; yy->__thunkpos= yythunkpos76;
979 } yyText(yy, yy->__begin, yy->__end); {
980 #define yytext yy->__text
981 #define yyleng yy->__textlen
982 if (!(YY_END)) goto l74;
983 #undef yytext
984 #undef yyleng
985 } if (!yymatchChar(yy, '}')) goto l74; if (!yy__(yy)) goto l74;
986 yyprintf((stderr, " ok %s @ %s\n", "action", yy->__buf+yy->__pos));
987 return 1;
988 l74:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
989 yyprintf((stderr, " fail %s @ %s\n", "action", yy->__buf+yy->__pos));
990 return 0;
991 }
yy_TILDE(yycontext * yy)992 YY_RULE(int) yy_TILDE(yycontext *yy)
993 { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
994 yyprintf((stderr, "%s\n", "TILDE")); if (!yymatchChar(yy, '~')) goto l77; if (!yy__(yy)) goto l77;
995 yyprintf((stderr, " ok %s @ %s\n", "TILDE", yy->__buf+yy->__pos));
996 return 1;
997 l77:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
998 yyprintf((stderr, " fail %s @ %s\n", "TILDE", yy->__buf+yy->__pos));
999 return 0;
1000 }
yy_prefix(yycontext * yy)1001 YY_RULE(int) yy_prefix(yycontext *yy)
1002 { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
1003 yyprintf((stderr, "%s\n", "prefix"));
1004 { int yypos79= yy->__pos, yythunkpos79= yy->__thunkpos; if (!yy_AND(yy)) goto l80; if (!yy_action(yy)) goto l80; yyDo(yy, yy_1_prefix, yy->__begin, yy->__end); goto l79;
1005 l80:; yy->__pos= yypos79; yy->__thunkpos= yythunkpos79; if (!yy_AND(yy)) goto l81; if (!yy_suffix(yy)) goto l81; yyDo(yy, yy_2_prefix, yy->__begin, yy->__end); goto l79;
1006 l81:; yy->__pos= yypos79; yy->__thunkpos= yythunkpos79; if (!yy_NOT(yy)) goto l82; if (!yy_suffix(yy)) goto l82; yyDo(yy, yy_3_prefix, yy->__begin, yy->__end); goto l79;
1007 l82:; yy->__pos= yypos79; yy->__thunkpos= yythunkpos79; if (!yy_suffix(yy)) goto l78;
1008 }
1009 l79:;
1010 yyprintf((stderr, " ok %s @ %s\n", "prefix", yy->__buf+yy->__pos));
1011 return 1;
1012 l78:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
1013 yyprintf((stderr, " fail %s @ %s\n", "prefix", yy->__buf+yy->__pos));
1014 return 0;
1015 }
yy_error(yycontext * yy)1016 YY_RULE(int) yy_error(yycontext *yy)
1017 { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
1018 yyprintf((stderr, "%s\n", "error")); if (!yy_prefix(yy)) goto l83;
1019 { int yypos84= yy->__pos, yythunkpos84= yy->__thunkpos; if (!yy_TILDE(yy)) goto l84; if (!yy_action(yy)) goto l84; yyDo(yy, yy_1_error, yy->__begin, yy->__end); goto l85;
1020 l84:; yy->__pos= yypos84; yy->__thunkpos= yythunkpos84;
1021 }
1022 l85:;
1023 yyprintf((stderr, " ok %s @ %s\n", "error", yy->__buf+yy->__pos));
1024 return 1;
1025 l83:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
1026 yyprintf((stderr, " fail %s @ %s\n", "error", yy->__buf+yy->__pos));
1027 return 0;
1028 }
yy_BAR(yycontext * yy)1029 YY_RULE(int) yy_BAR(yycontext *yy)
1030 { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
1031 yyprintf((stderr, "%s\n", "BAR")); if (!yymatchChar(yy, '|')) goto l86; if (!yy__(yy)) goto l86;
1032 yyprintf((stderr, " ok %s @ %s\n", "BAR", yy->__buf+yy->__pos));
1033 return 1;
1034 l86:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
1035 yyprintf((stderr, " fail %s @ %s\n", "BAR", yy->__buf+yy->__pos));
1036 return 0;
1037 }
yy_sequence(yycontext * yy)1038 YY_RULE(int) yy_sequence(yycontext *yy)
1039 { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
1040 yyprintf((stderr, "%s\n", "sequence")); if (!yy_error(yy)) goto l87;
1041 l88:;
1042 { int yypos89= yy->__pos, yythunkpos89= yy->__thunkpos; if (!yy_error(yy)) goto l89; yyDo(yy, yy_1_sequence, yy->__begin, yy->__end); goto l88;
1043 l89:; yy->__pos= yypos89; yy->__thunkpos= yythunkpos89;
1044 }
1045 yyprintf((stderr, " ok %s @ %s\n", "sequence", yy->__buf+yy->__pos));
1046 return 1;
1047 l87:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
1048 yyprintf((stderr, " fail %s @ %s\n", "sequence", yy->__buf+yy->__pos));
1049 return 0;
1050 }
yy_SEMICOLON(yycontext * yy)1051 YY_RULE(int) yy_SEMICOLON(yycontext *yy)
1052 { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
1053 yyprintf((stderr, "%s\n", "SEMICOLON")); if (!yymatchChar(yy, ';')) goto l90; if (!yy__(yy)) goto l90;
1054 yyprintf((stderr, " ok %s @ %s\n", "SEMICOLON", yy->__buf+yy->__pos));
1055 return 1;
1056 l90:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
1057 yyprintf((stderr, " fail %s @ %s\n", "SEMICOLON", yy->__buf+yy->__pos));
1058 return 0;
1059 }
yy_expression(yycontext * yy)1060 YY_RULE(int) yy_expression(yycontext *yy)
1061 { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
1062 yyprintf((stderr, "%s\n", "expression")); if (!yy_sequence(yy)) goto l91;
1063 l92:;
1064 { int yypos93= yy->__pos, yythunkpos93= yy->__thunkpos; if (!yy_BAR(yy)) goto l93; if (!yy_sequence(yy)) goto l93; yyDo(yy, yy_1_expression, yy->__begin, yy->__end); goto l92;
1065 l93:; yy->__pos= yypos93; yy->__thunkpos= yythunkpos93;
1066 }
1067 yyprintf((stderr, " ok %s @ %s\n", "expression", yy->__buf+yy->__pos));
1068 return 1;
1069 l91:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
1070 yyprintf((stderr, " fail %s @ %s\n", "expression", yy->__buf+yy->__pos));
1071 return 0;
1072 }
yy_EQUAL(yycontext * yy)1073 YY_RULE(int) yy_EQUAL(yycontext *yy)
1074 { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
1075 yyprintf((stderr, "%s\n", "EQUAL")); if (!yymatchChar(yy, '=')) goto l94; if (!yy__(yy)) goto l94;
1076 yyprintf((stderr, " ok %s @ %s\n", "EQUAL", yy->__buf+yy->__pos));
1077 return 1;
1078 l94:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
1079 yyprintf((stderr, " fail %s @ %s\n", "EQUAL", yy->__buf+yy->__pos));
1080 return 0;
1081 }
yy_identifier(yycontext * yy)1082 YY_RULE(int) yy_identifier(yycontext *yy)
1083 { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
1084 yyprintf((stderr, "%s\n", "identifier")); yyText(yy, yy->__begin, yy->__end); {
1085 #define yytext yy->__text
1086 #define yyleng yy->__textlen
1087 if (!(YY_BEGIN)) goto l95;
1088 #undef yytext
1089 #undef yyleng
1090 } if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\040\000\000\376\377\377\207\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l95;
1091 l96:;
1092 { int yypos97= yy->__pos, yythunkpos97= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\040\377\003\376\377\377\207\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l97; goto l96;
1093 l97:; yy->__pos= yypos97; yy->__thunkpos= yythunkpos97;
1094 } yyText(yy, yy->__begin, yy->__end); {
1095 #define yytext yy->__text
1096 #define yyleng yy->__textlen
1097 if (!(YY_END)) goto l95;
1098 #undef yytext
1099 #undef yyleng
1100 } if (!yy__(yy)) goto l95;
1101 yyprintf((stderr, " ok %s @ %s\n", "identifier", yy->__buf+yy->__pos));
1102 return 1;
1103 l95:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
1104 yyprintf((stderr, " fail %s @ %s\n", "identifier", yy->__buf+yy->__pos));
1105 return 0;
1106 }
yy_RPERCENT(yycontext * yy)1107 YY_RULE(int) yy_RPERCENT(yycontext *yy)
1108 { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
1109 yyprintf((stderr, "%s\n", "RPERCENT")); if (!yymatchString(yy, "%}")) goto l98; if (!yy__(yy)) goto l98;
1110 yyprintf((stderr, " ok %s @ %s\n", "RPERCENT", yy->__buf+yy->__pos));
1111 return 1;
1112 l98:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
1113 yyprintf((stderr, " fail %s @ %s\n", "RPERCENT", yy->__buf+yy->__pos));
1114 return 0;
1115 }
yy_end_of_file(yycontext * yy)1116 YY_RULE(int) yy_end_of_file(yycontext *yy)
1117 { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
1118 yyprintf((stderr, "%s\n", "end_of_file"));
1119 { int yypos100= yy->__pos, yythunkpos100= yy->__thunkpos; if (!yymatchDot(yy)) goto l100; goto l99;
1120 l100:; yy->__pos= yypos100; yy->__thunkpos= yythunkpos100;
1121 }
1122 yyprintf((stderr, " ok %s @ %s\n", "end_of_file", yy->__buf+yy->__pos));
1123 return 1;
1124 l99:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
1125 yyprintf((stderr, " fail %s @ %s\n", "end_of_file", yy->__buf+yy->__pos));
1126 return 0;
1127 }
yy_trailer(yycontext * yy)1128 YY_RULE(int) yy_trailer(yycontext *yy)
1129 { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
1130 yyprintf((stderr, "%s\n", "trailer")); if (!yymatchString(yy, "%%")) goto l101; yyText(yy, yy->__begin, yy->__end); {
1131 #define yytext yy->__text
1132 #define yyleng yy->__textlen
1133 if (!(YY_BEGIN)) goto l101;
1134 #undef yytext
1135 #undef yyleng
1136 }
1137 l102:;
1138 { int yypos103= yy->__pos, yythunkpos103= yy->__thunkpos; if (!yymatchDot(yy)) goto l103; goto l102;
1139 l103:; yy->__pos= yypos103; yy->__thunkpos= yythunkpos103;
1140 } yyText(yy, yy->__begin, yy->__end); {
1141 #define yytext yy->__text
1142 #define yyleng yy->__textlen
1143 if (!(YY_END)) goto l101;
1144 #undef yytext
1145 #undef yyleng
1146 } yyDo(yy, yy_1_trailer, yy->__begin, yy->__end);
1147 yyprintf((stderr, " ok %s @ %s\n", "trailer", yy->__buf+yy->__pos));
1148 return 1;
1149 l101:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
1150 yyprintf((stderr, " fail %s @ %s\n", "trailer", yy->__buf+yy->__pos));
1151 return 0;
1152 }
yy_definition(yycontext * yy)1153 YY_RULE(int) yy_definition(yycontext *yy)
1154 { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
1155 yyprintf((stderr, "%s\n", "definition")); if (!yy_identifier(yy)) goto l104; yyDo(yy, yy_1_definition, yy->__begin, yy->__end); if (!yy_EQUAL(yy)) goto l104; if (!yy_expression(yy)) goto l104; yyDo(yy, yy_2_definition, yy->__begin, yy->__end);
1156 { int yypos105= yy->__pos, yythunkpos105= yy->__thunkpos; if (!yy_SEMICOLON(yy)) goto l105; goto l106;
1157 l105:; yy->__pos= yypos105; yy->__thunkpos= yythunkpos105;
1158 }
1159 l106:;
1160 yyprintf((stderr, " ok %s @ %s\n", "definition", yy->__buf+yy->__pos));
1161 return 1;
1162 l104:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
1163 yyprintf((stderr, " fail %s @ %s\n", "definition", yy->__buf+yy->__pos));
1164 return 0;
1165 }
yy_declaration(yycontext * yy)1166 YY_RULE(int) yy_declaration(yycontext *yy)
1167 { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
1168 yyprintf((stderr, "%s\n", "declaration")); if (!yymatchString(yy, "%{")) goto l107; yyText(yy, yy->__begin, yy->__end); {
1169 #define yytext yy->__text
1170 #define yyleng yy->__textlen
1171 if (!(YY_BEGIN)) goto l107;
1172 #undef yytext
1173 #undef yyleng
1174 }
1175 l108:;
1176 { int yypos109= yy->__pos, yythunkpos109= yy->__thunkpos;
1177 { int yypos110= yy->__pos, yythunkpos110= yy->__thunkpos; if (!yymatchString(yy, "%}")) goto l110; goto l109;
1178 l110:; yy->__pos= yypos110; yy->__thunkpos= yythunkpos110;
1179 } if (!yymatchDot(yy)) goto l109; goto l108;
1180 l109:; yy->__pos= yypos109; yy->__thunkpos= yythunkpos109;
1181 } yyText(yy, yy->__begin, yy->__end); {
1182 #define yytext yy->__text
1183 #define yyleng yy->__textlen
1184 if (!(YY_END)) goto l107;
1185 #undef yytext
1186 #undef yyleng
1187 } if (!yy_RPERCENT(yy)) goto l107; yyDo(yy, yy_1_declaration, yy->__begin, yy->__end);
1188 yyprintf((stderr, " ok %s @ %s\n", "declaration", yy->__buf+yy->__pos));
1189 return 1;
1190 l107:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
1191 yyprintf((stderr, " fail %s @ %s\n", "declaration", yy->__buf+yy->__pos));
1192 return 0;
1193 }
yy__(yycontext * yy)1194 YY_RULE(int) yy__(yycontext *yy)
1195 {
1196 yyprintf((stderr, "%s\n", "_"));
1197 l112:;
1198 { int yypos113= yy->__pos, yythunkpos113= yy->__thunkpos;
1199 { int yypos114= yy->__pos, yythunkpos114= yy->__thunkpos; if (!yy_space(yy)) goto l115; goto l114;
1200 l115:; yy->__pos= yypos114; yy->__thunkpos= yythunkpos114; if (!yy_comment(yy)) goto l113;
1201 }
1202 l114:; goto l112;
1203 l113:; yy->__pos= yypos113; yy->__thunkpos= yythunkpos113;
1204 }
1205 yyprintf((stderr, " ok %s @ %s\n", "_", yy->__buf+yy->__pos));
1206 return 1;
1207 }
yy_grammar(yycontext * yy)1208 YY_RULE(int) yy_grammar(yycontext *yy)
1209 { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos;
1210 yyprintf((stderr, "%s\n", "grammar")); if (!yy__(yy)) goto l116;
1211 { int yypos119= yy->__pos, yythunkpos119= yy->__thunkpos; if (!yy_declaration(yy)) goto l120; goto l119;
1212 l120:; yy->__pos= yypos119; yy->__thunkpos= yythunkpos119; if (!yy_definition(yy)) goto l116;
1213 }
1214 l119:;
1215 l117:;
1216 { int yypos118= yy->__pos, yythunkpos118= yy->__thunkpos;
1217 { int yypos121= yy->__pos, yythunkpos121= yy->__thunkpos; if (!yy_declaration(yy)) goto l122; goto l121;
1218 l122:; yy->__pos= yypos121; yy->__thunkpos= yythunkpos121; if (!yy_definition(yy)) goto l118;
1219 }
1220 l121:; goto l117;
1221 l118:; yy->__pos= yypos118; yy->__thunkpos= yythunkpos118;
1222 }
1223 { int yypos123= yy->__pos, yythunkpos123= yy->__thunkpos; if (!yy_trailer(yy)) goto l123; goto l124;
1224 l123:; yy->__pos= yypos123; yy->__thunkpos= yythunkpos123;
1225 }
1226 l124:; if (!yy_end_of_file(yy)) goto l116;
1227 yyprintf((stderr, " ok %s @ %s\n", "grammar", yy->__buf+yy->__pos));
1228 return 1;
1229 l116:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
1230 yyprintf((stderr, " fail %s @ %s\n", "grammar", yy->__buf+yy->__pos));
1231 return 0;
1232 }
1233
1234 #ifndef YY_PART
1235
1236 typedef int (*yyrule)(yycontext *yy);
1237
YYPARSEFROM(YY_CTX_PARAM_ yyrule yystart)1238 YY_PARSE(int) YYPARSEFROM(YY_CTX_PARAM_ yyrule yystart)
1239 {
1240 int yyok;
1241 if (!yyctx->__buflen)
1242 {
1243 yyctx->__buflen= YY_BUFFER_SIZE;
1244 yyctx->__buf= (char *)YY_MALLOC(yyctx, yyctx->__buflen);
1245 yyctx->__textlen= YY_BUFFER_SIZE;
1246 yyctx->__text= (char *)YY_MALLOC(yyctx, yyctx->__textlen);
1247 yyctx->__thunkslen= YY_STACK_SIZE;
1248 yyctx->__thunks= (yythunk *)YY_MALLOC(yyctx, sizeof(yythunk) * yyctx->__thunkslen);
1249 yyctx->__valslen= YY_STACK_SIZE;
1250 yyctx->__vals= (YYSTYPE *)YY_MALLOC(yyctx, sizeof(YYSTYPE) * yyctx->__valslen);
1251 yyctx->__begin= yyctx->__end= yyctx->__pos= yyctx->__limit= yyctx->__thunkpos= 0;
1252 }
1253 yyctx->__begin= yyctx->__end= yyctx->__pos;
1254 yyctx->__thunkpos= 0;
1255 yyctx->__val= yyctx->__vals;
1256 yyok= yystart(yyctx);
1257 if (yyok) yyDone(yyctx);
1258 yyCommit(yyctx);
1259 return yyok;
1260 }
1261
YYPARSE(YY_CTX_PARAM)1262 YY_PARSE(int) YYPARSE(YY_CTX_PARAM)
1263 {
1264 return YYPARSEFROM(YY_CTX_ARG_ yy_grammar);
1265 }
1266
YYRELEASE(yycontext * yyctx)1267 YY_PARSE(yycontext *) YYRELEASE(yycontext *yyctx)
1268 {
1269 if (yyctx->__buflen)
1270 {
1271 yyctx->__buflen= 0;
1272 YY_FREE(yyctx, yyctx->__buf);
1273 YY_FREE(yyctx, yyctx->__text);
1274 YY_FREE(yyctx, yyctx->__thunks);
1275 YY_FREE(yyctx, yyctx->__vals);
1276 }
1277 return yyctx;
1278 }
1279
1280 #endif
1281
1282
yyerror(char * message)1283 void yyerror(char *message)
1284 {
1285 fprintf(stderr, "%s:%d: %s", fileName, lineNumber, message);
1286 if (yyctx->__text[0]) fprintf(stderr, " near token '%s'", yyctx->__text);
1287 if (yyctx->__pos < yyctx->__limit || !feof(input))
1288 {
1289 yyctx->__buf[yyctx->__limit]= '\0';
1290 fprintf(stderr, " before text \"");
1291 while (yyctx->__pos < yyctx->__limit)
1292 {
1293 if ('\n' == yyctx->__buf[yyctx->__pos] || '\r' == yyctx->__buf[yyctx->__pos]) break;
1294 fputc(yyctx->__buf[yyctx->__pos++], stderr);
1295 }
1296 if (yyctx->__pos == yyctx->__limit)
1297 {
1298 int c;
1299 while (EOF != (c= fgetc(input)) && '\n' != c && '\r' != c)
1300 fputc(c, stderr);
1301 }
1302 fputc('\"', stderr);
1303 }
1304 fprintf(stderr, "\n");
1305 exit(1);
1306 }
1307
makeHeader(char * text)1308 void makeHeader(char *text)
1309 {
1310 Header *header= (Header *)malloc(sizeof(Header));
1311 header->text= strdup(text);
1312 header->next= headers;
1313 headers= header;
1314 }
1315
makeTrailer(char * text)1316 void makeTrailer(char *text)
1317 {
1318 trailer= strdup(text);
1319 }
1320
version(char * name)1321 static void version(char *name)
1322 {
1323 printf("%s version %d.%d.%d\n", name, PEG_MAJOR, PEG_MINOR, PEG_LEVEL);
1324 }
1325
usage(char * name)1326 static void usage(char *name)
1327 {
1328 version(name);
1329 fprintf(stderr, "usage: %s [<option>...] [<file>...]\n", name);
1330 fprintf(stderr, "where <option> can be\n");
1331 fprintf(stderr, " -h print this help information\n");
1332 fprintf(stderr, " -o <ofile> write output to <ofile>\n");
1333 fprintf(stderr, " -v be verbose\n");
1334 fprintf(stderr, " -V print version number and exit\n");
1335 fprintf(stderr, "if no <file> is given, input is read from stdin\n");
1336 fprintf(stderr, "if no <ofile> is given, output is written to stdout\n");
1337 exit(1);
1338 }
1339
main(int argc,char ** argv)1340 int main(int argc, char **argv)
1341 {
1342 Node *n;
1343 int c;
1344
1345 output= stdout;
1346 input= stdin;
1347 lineNumber= 1;
1348 fileName= "<stdin>";
1349
1350 while (-1 != (c= getopt(argc, argv, "Vho:v")))
1351 {
1352 switch (c)
1353 {
1354 case 'V':
1355 version(basename(argv[0]));
1356 exit(0);
1357
1358 case 'h':
1359 usage(basename(argv[0]));
1360 break;
1361
1362 case 'o':
1363 if (!(output= fopen(optarg, "w")))
1364 {
1365 perror(optarg);
1366 exit(1);
1367 }
1368 break;
1369
1370 case 'v':
1371 verboseFlag= 1;
1372 break;
1373
1374 default:
1375 fprintf(stderr, "for usage try: %s -h\n", argv[0]);
1376 exit(1);
1377 }
1378 }
1379 argc -= optind;
1380 argv += optind;
1381
1382 if (argc)
1383 {
1384 for (; argc; --argc, ++argv)
1385 {
1386 if (!strcmp(*argv, "-"))
1387 {
1388 input= stdin;
1389 fileName= "<stdin>";
1390 }
1391 else
1392 {
1393 if (!(input= fopen(*argv, "r")))
1394 {
1395 perror(*argv);
1396 exit(1);
1397 }
1398 fileName= *argv;
1399 }
1400 lineNumber= 1;
1401 if (!yyparse())
1402 yyerror("syntax error");
1403 if (input != stdin)
1404 fclose(input);
1405 }
1406 }
1407 else
1408 if (!yyparse())
1409 yyerror("syntax error");
1410
1411 if (verboseFlag)
1412 for (n= rules; n; n= n->any.next)
1413 Rule_print(n);
1414
1415 Rule_compile_c_header();
1416
1417 for (; headers; headers= headers->next)
1418 fprintf(output, "%s\n", headers->text);
1419
1420 if (rules)
1421 Rule_compile_c(rules);
1422
1423 if (trailer)
1424 fprintf(output, "%s\n", trailer);
1425
1426 return 0;
1427 }
1428
1429