1/* This file generated automatically using
2 * @Id: skel2c,v 1.3 2014/04/06 19:48:04 tom Exp @
3 */
4
5/* @Id: btyaccpar.skel,v 1.1 2014/04/02 22:44:41 tom Exp @ */
6
7#include "defs.h"
8
--- 4 unchanged lines hidden (view full) ---
13/* useful in subsequent code. The macros #defined in the header or */
14/* the body either are not useful outside of semantic actions or */
15/* are conditional. */
16
17const char *const banner[] =
18{
19 "/* original parser id follows */",
20 "/* yysccsid[] = \"@(#)yaccpar 1.9 (Berkeley) 02/21/93\" */",
21 "/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */",
22 "",
23 "#define YYBYACC 1",
24 CONCAT1("#define YYMAJOR ", YYMAJOR),
25 CONCAT1("#define YYMINOR ", YYMINOR),
26#ifdef YYPATCH
27 CONCAT1("#define YYPATCH ", YYPATCH),
28#endif
29 "",
--- 21 unchanged lines hidden (view full) ---
51 "extern const YYINT yystos[];",
52 "extern const YYINT yydgoto[];",
53 "extern const YYINT yysindex[];",
54 "extern const YYINT yyrindex[];",
55#if defined(YYBTYACC)
56 "#if YYBTYACC",
57 "extern const YYINT yycindex[];",
58 "#endif /* YYBTYACC */",
59#endif /* defined(YYBTYACC) */
60 "extern const YYINT yygindex[];",
61 "extern const YYINT yytable[];",
62 "extern const YYINT yycheck[];",
63#if defined(YYBTYACC)
64 "#if YYBTYACC",
65 "extern const YYINT yyctable[];",
66 "#endif /* YYBTYACC */",
67#endif /* defined(YYBTYACC) */
68 "",
69 "#if YYDEBUG",
70 "extern const char *const yyname[];",
71 "extern const char *const yyrule[];",
72 "#endif",
73 0
74};
75
--- 46 unchanged lines hidden (view full) ---
122 "#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */",
123#if defined(YYBTYACC)
124 "#if YYBTYACC",
125 "",
126 "#ifndef YYLVQUEUEGROWTH",
127 "#define YYLVQUEUEGROWTH 32",
128 "#endif",
129 "#endif /* YYBTYACC */",
130#endif /* defined(YYBTYACC) */
131 "",
132 "/* define the initial stack-sizes */",
133 "#ifdef YYSTACKSIZE",
134 "#undef YYMAXDEPTH",
135 "#define YYMAXDEPTH YYSTACKSIZE",
136 "#else",
137 "#ifdef YYMAXDEPTH",
138 "#define YYSTACKSIZE YYMAXDEPTH",
--- 28 unchanged lines hidden (view full) ---
167 " YYSTACKDATA yystack; /* saved parser stack */",
168 " int state; /* saved parser state */",
169 " int errflag; /* saved error recovery status */",
170 " int lexeme; /* saved index of the conflict lexeme in the lexical queue */",
171 " YYINT ctry; /* saved index in yyctable[] for this conflict */",
172 "};",
173 "typedef struct YYParseState_s YYParseState;",
174 "#endif /* YYBTYACC */",
175#endif /* defined(YYBTYACC) */
176 0
177};
178
179const char *const hdr_vars[] =
180{
181 "/* variables for the parser stack */",
182 "static YYSTACKDATA yystack;",
183#if defined(YYBTYACC)
--- 31 unchanged lines hidden (view full) ---
215 "static YYLTYPE *yylplim = 0;",
216 "#endif",
217 "",
218 "/* Current position at lexical token queue */",
219 "static short *yylexp = 0;",
220 "",
221 "static short *yylexemes = 0;",
222 "#endif /* YYBTYACC */",
223#endif /* defined(YYBTYACC) */
224 0
225};
226
227const char *const body_vars[] =
228{
229 " int yyerrflag;",
230 " int yychar;",
231 " YYSTYPE yyval;",
--- 40 unchanged lines hidden (view full) ---
272 " static YYLTYPE *yylplim = 0;",
273 "#endif",
274 "",
275 " /* Current position at lexical token queue */",
276 " static short *yylexp = 0;",
277 "",
278 " static short *yylexemes = 0;",
279 "#endif /* YYBTYACC */",
280#endif /* defined(YYBTYACC) */
281 0
282};
283
284const char *const body_1[] =
285{
286 "",
287 "/* For use in generated program */",
288 "#define yydepth (int)(yystack.s_mark - yystack.s_base)",
289#if defined(YYBTYACC)
290 "#if YYBTYACC",
291 "#define yytrial (yyps->save)",
292 "#endif /* YYBTYACC */",
293#endif /* defined(YYBTYACC) */
294 "",
295 "#if YYDEBUG",
296 "#include <stdio.h> /* needed for printf */",
297 "#endif",
298 "",
299 "#include <stdlib.h> /* needed for malloc, etc */",
300 "#include <string.h> /* needed for memset */",
301 "",
302 "/* allocate initial stack or double stack size, up to YYMAXDEPTH */",
303 "static int yygrowstack(YYSTACKDATA *data)",
304 "{",
305 " int i;",
306 " unsigned newsize;",
307 " short *newss;",
308 " YYSTYPE *newvs;",
--- 90 unchanged lines hidden (view full) ---
399 "",
400 "static void",
401 "yyFreeState(YYParseState *p)",
402 "{",
403 " yyfreestack(&p->yystack);",
404 " free(p);",
405 "}",
406 "#endif /* YYBTYACC */",
407#endif /* defined(YYBTYACC) */
408 "",
409 "#define YYABORT goto yyabort",
410 "#define YYREJECT goto yyabort",
411 "#define YYACCEPT goto yyaccept",
412 "#define YYERROR goto yyerrlab",
413#if defined(YYBTYACC)
414 "#if YYBTYACC",
415 "#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)",
416 "#define YYVALID_NESTED do { if (yyps->save && \\",
417 " yyps->save->save == 0) goto yyvalid; } while(0)",
418 "#endif /* YYBTYACC */",
419#endif /* defined(YYBTYACC) */
420 "",
421 "int",
422 "YYPARSE_DECL()",
423 "{",
424 0
425};
426
427const char *const body_2[] =
428{
429 " int yym, yyn, yystate, yyresult;",
430#if defined(YYBTYACC)
431 "#if YYBTYACC",
432 " int yynewerrflag;",
433 " YYParseState *yyerrctx = NULL;",
434 "#endif /* YYBTYACC */",
435#endif /* defined(YYBTYACC) */
436 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
437 " YYLTYPE yyerror_loc_range[2]; /* position of error start & end */",
438 "#endif",
439 "#if YYDEBUG",
440 " const char *yys;",
441 "",
442 " if ((yys = getenv(\"YYDEBUG\")) != 0)",
443 " {",
--- 5 unchanged lines hidden (view full) ---
449 " fprintf(stderr, \"%sdebug[<# of symbols on state stack>]\\n\", YYPREFIX);",
450 "#endif",
451 "",
452#if defined(YYBTYACC)
453 "#if YYBTYACC",
454 " yyps = yyNewState(0); if (yyps == 0) goto yyenomem;",
455 " yyps->save = 0;",
456 "#endif /* YYBTYACC */",
457#endif /* defined(YYBTYACC) */
458 " yynerrs = 0;",
459 " yyerrflag = 0;",
460 " yychar = YYEMPTY;",
461 " yystate = 0;",
462 "",
463 "#if YYPURE",
464 " memset(&yystack, 0, sizeof(yystack));",
465 "#endif",
--- 24 unchanged lines hidden (view full) ---
490 " yychar = *yylexp++;",
491 " break;",
492 " }",
493 " if (yyps->save)",
494 " {",
495 " /* in trial mode; save scanner results for future parse attempts */",
496 " if (yylvp == yylvlim)",
497 " { /* Enlarge lexical value queue */",
498 " size_t p = (size_t) (yylvp - yylvals);",
499 " size_t s = (size_t) (yylvlim - yylvals);",
500 "",
501 " s += YYLVQUEUEGROWTH;",
502 " if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;",
503 " if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;",
504 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
505 " if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;",
506 "#endif",
507 " yylvp = yylve = yylvals + p;",
--- 11 unchanged lines hidden (view full) ---
519 " *yylpp++ = yylloc;",
520 " yylpe++;",
521 "#endif",
522 " yychar = *yylexp++;",
523 " break;",
524 " }",
525 " /* normal operation, no conflict encountered */",
526 "#endif /* YYBTYACC */",
527#endif /* defined(YYBTYACC) */
528 " yychar = YYLEX;",
529#if defined(YYBTYACC)
530 "#if YYBTYACC",
531 " } while (0);",
532 "#endif /* YYBTYACC */",
533#endif /* defined(YYBTYACC) */
534 " if (yychar < 0) yychar = YYEOF;",
535 " /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */",
536 "#if YYDEBUG",
537 " if (yydebug)",
538 " {",
539 " yys = yyname[YYTRANSLATE(yychar)];",
540 " fprintf(stderr, \"%s[%d]: state %d, reading token %d (%s)\",",
541 " YYDEBUGSTR, yydepth, yystate, yychar, yys);",
542 "#ifdef YYSTYPE_TOSTRING",
543#if defined(YYBTYACC)
544 "#if YYBTYACC",
545 " if (!yytrial)",
546 "#endif /* YYBTYACC */",
547#endif /* defined(YYBTYACC) */
548 " fprintf(stderr, \" <%s>\", YYSTYPE_TOSTRING(yychar, yylval));",
549 "#endif",
550 " fputc('\\n', stderr);",
551 " }",
552 "#endif",
553 " }",
554#if defined(YYBTYACC)
555 "#if YYBTYACC",
--- 37 unchanged lines hidden (view full) ---
593 " }",
594 "#endif",
595 " save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));",
596 " if (save == NULL) goto yyenomem;",
597 " save->save = yyps->save;",
598 " save->state = yystate;",
599 " save->errflag = yyerrflag;",
600 " save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);",
601 " memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));",
602 " save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);",
603 " memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));",
604 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
605 " save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);",
606 " memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));",
607 "#endif",
608 " ctry = yytable[yyn];",
609 " if (yyctable[ctry] == -1)",
610 " {",
611 "#if YYDEBUG",
612 " if (yydebug && yychar >= YYEOF)",
613 " fprintf(stderr, \"%s[%d]: backtracking 1 token\\n\", YYDEBUGSTR, yydepth);",
614 "#endif",
--- 38 unchanged lines hidden (view full) ---
653 " {",
654 " yylvp--;",
655 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
656 " yylpp--;",
657 "#endif",
658 " yylexp--;",
659 " yychar = YYEMPTY;",
660 " }",
661 " save->lexeme = (int) (yylvp - yylvals);",
662 " yyps->save = save;",
663 " }",
664 " if (yytable[yyn] == ctry)",
665 " {",
666 "#if YYDEBUG",
667 " if (yydebug)",
668 " fprintf(stderr, \"%s[%d]: state %d, shifting to state %d\\n\",",
669 " YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);",
--- 20 unchanged lines hidden (view full) ---
690 " }",
691 " else",
692 " {",
693 " yyn = yyctable[ctry];",
694 " goto yyreduce;",
695 " }",
696 " } /* End of code dealing with conflicts */",
697 "#endif /* YYBTYACC */",
698#endif /* defined(YYBTYACC) */
699 " if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&",
700 " yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)",
701 " {",
702 "#if YYDEBUG",
703 " if (yydebug)",
704 " fprintf(stderr, \"%s[%d]: state %d, shifting to state %d\\n\",",
705 " YYDEBUGSTR, yydepth, yystate, yytable[yyn]);",
706 "#endif",
--- 42 unchanged lines hidden (view full) ---
749 " if (yyerrctx) yyFreeState(yyerrctx);",
750 " /* Create and fill out new saved error context state */",
751 " yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));",
752 " if (yyerrctx == NULL) goto yyenomem;",
753 " yyerrctx->save = yyps->save;",
754 " yyerrctx->state = yystate;",
755 " yyerrctx->errflag = yyerrflag;",
756 " yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);",
757 " memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));",
758 " yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);",
759 " memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));",
760 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
761 " yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);",
762 " memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));",
763 "#endif",
764 " yyerrctx->lexeme = (int) (yylvp - yylvals);",
765 " }",
766 " yylvp = yylvals + save->lexeme;",
767 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
768 " yylpp = yylpsns + save->lexeme;",
769 "#endif",
770 " yylexp = yylexemes + save->lexeme;",
771 " yychar = YYEMPTY;",
772 " yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);",
773 " memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));",
774 " yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);",
775 " memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));",
776 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
777 " yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);",
778 " memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));",
779 "#endif",
780 " ctry = ++save->ctry;",
781 " yystate = save->state;",
782 " /* We tried shift, try reduce now */",
783 " if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;",
784 " yyps->save = save->save;",
785 " save->save = NULL;",
786 " yyFreeState(save);",
--- 13 unchanged lines hidden (view full) ---
800 "#endif",
801 " yylexp = yylexemes + yyerrctx->lexeme;",
802 " yychar = yylexp[-1];",
803 " yylval = yylvp[-1];",
804 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
805 " yylloc = yylpp[-1];",
806 "#endif",
807 " yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);",
808 " memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));",
809 " yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);",
810 " memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));",
811 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
812 " yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);",
813 " memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));",
814 "#endif",
815 " yystate = yyerrctx->state;",
816 " yyFreeState(yyerrctx);",
817 " yyerrctx = NULL;",
818 " }",
819 " yynewerrflag = 1;",
820 " }",
821 " if (yynewerrflag == 0) goto yyinrecovery;",
822 "#endif /* YYBTYACC */",
823#endif /* defined(YYBTYACC) */
824 "",
825 " YYERROR_CALL(\"syntax error\");",
826 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
827 " yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */",
828 "#endif",
829 "",
830 "#if !YYBTYACC",
831 " goto yyerrlab;",
--- 39 unchanged lines hidden (view full) ---
871 " /* the current TOS position is the error start position */",
872 " yyerror_loc_range[0] = *yystack.p_mark;",
873 "#endif",
874 "#if defined(YYDESTRUCT_CALL)",
875#if defined(YYBTYACC)
876 "#if YYBTYACC",
877 " if (!yytrial)",
878 "#endif /* YYBTYACC */",
879#endif /* defined(YYBTYACC) */
880 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
881 " YYDESTRUCT_CALL(\"error: discarding state\",",
882 " yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);",
883 "#else",
884 " YYDESTRUCT_CALL(\"error: discarding state\",",
885 " yystos[*yystack.s_mark], yystack.l_mark);",
886 "#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */",
887 "#endif /* defined(YYDESTRUCT_CALL) */",
--- 16 unchanged lines hidden (view full) ---
904 " YYDEBUGSTR, yydepth, yystate, yychar, yys);",
905 " }",
906 "#endif",
907 "#if defined(YYDESTRUCT_CALL)",
908#if defined(YYBTYACC)
909 "#if YYBTYACC",
910 " if (!yytrial)",
911 "#endif /* YYBTYACC */",
912#endif /* defined(YYBTYACC) */
913 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
914 " YYDESTRUCT_CALL(\"error: discarding token\", yychar, &yylval, &yylloc);",
915 "#else",
916 " YYDESTRUCT_CALL(\"error: discarding token\", yychar, &yylval);",
917 "#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */",
918 "#endif /* defined(YYDESTRUCT_CALL) */",
919 " yychar = YYEMPTY;",
920 " goto yyloop;",
--- 6 unchanged lines hidden (view full) ---
927 " {",
928 " fprintf(stderr, \"%s[%d]: state %d, reducing by rule %d (%s)\",",
929 " YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);",
930 "#ifdef YYSTYPE_TOSTRING",
931#if defined(YYBTYACC)
932 "#if YYBTYACC",
933 " if (!yytrial)",
934 "#endif /* YYBTYACC */",
935#endif /* defined(YYBTYACC) */
936 " if (yym > 0)",
937 " {",
938 " int i;",
939 " fputc('<', stderr);",
940 " for (i = yym; i > 0; i--)",
941 " {",
942 " if (i != yym) fputs(\", \", stderr);",
943 " fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],",
--- 12 unchanged lines hidden (view full) ---
956 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
957 "",
958 " /* Perform position reduction */",
959 " memset(&yyloc, 0, sizeof(yyloc));",
960#if defined(YYBTYACC)
961 "#if YYBTYACC",
962 " if (!yytrial)",
963 "#endif /* YYBTYACC */",
964#endif /* defined(YYBTYACC) */
965 " {",
966 " YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);",
967 " /* just in case YYERROR is invoked within the action, save",
968 " the start of the rhs as the error start position */",
969 " yyerror_loc_range[0] = yystack.p_mark[1-yym];",
970 " }",
971 "#endif",
972 "",
--- 20 unchanged lines hidden (view full) ---
993 " if (yydebug)",
994 " {",
995 " fprintf(stderr, \"%s[%d]: after reduction, \", YYDEBUGSTR, yydepth);",
996 "#ifdef YYSTYPE_TOSTRING",
997#if defined(YYBTYACC)
998 "#if YYBTYACC",
999 " if (!yytrial)",
1000 "#endif /* YYBTYACC */",
1001#endif /* defined(YYBTYACC) */
1002 " fprintf(stderr, \"result is <%s>, \", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));",
1003 "#endif",
1004 " fprintf(stderr, \"shifting from state 0 to final state %d\\n\", YYFINAL);",
1005 " }",
1006 "#endif",
1007 " yystate = YYFINAL;",
1008 " *++yystack.s_mark = YYFINAL;",
1009 " *++yystack.l_mark = yyval;",
--- 15 unchanged lines hidden (view full) ---
1025 " yychar = *yylexp++;",
1026 " break;",
1027 " }",
1028 " if (yyps->save)",
1029 " {",
1030 " /* in trial mode; save scanner results for future parse attempts */",
1031 " if (yylvp == yylvlim)",
1032 " { /* Enlarge lexical value queue */",
1033 " size_t p = (size_t) (yylvp - yylvals);",
1034 " size_t s = (size_t) (yylvlim - yylvals);",
1035 "",
1036 " s += YYLVQUEUEGROWTH;",
1037 " if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)",
1038 " goto yyenomem;",
1039 " if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)",
1040 " goto yyenomem;",
1041 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
1042 " if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)",
--- 14 unchanged lines hidden (view full) ---
1057 " *yylpp++ = yylloc;",
1058 " yylpe++;",
1059 "#endif",
1060 " yychar = *yylexp++;",
1061 " break;",
1062 " }",
1063 " /* normal operation, no conflict encountered */",
1064 "#endif /* YYBTYACC */",
1065#endif /* defined(YYBTYACC) */
1066 " yychar = YYLEX;",
1067#if defined(YYBTYACC)
1068 "#if YYBTYACC",
1069 " } while (0);",
1070 "#endif /* YYBTYACC */",
1071#endif /* defined(YYBTYACC) */
1072 " if (yychar < 0) yychar = YYEOF;",
1073 " /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */",
1074 "#if YYDEBUG",
1075 " if (yydebug)",
1076 " {",
1077 " yys = yyname[YYTRANSLATE(yychar)];",
1078 " fprintf(stderr, \"%s[%d]: state %d, reading %d (%s)\\n\",",
1079 " YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);",
--- 12 unchanged lines hidden (view full) ---
1092 " if (yydebug)",
1093 " {",
1094 " fprintf(stderr, \"%s[%d]: after reduction, \", YYDEBUGSTR, yydepth);",
1095 "#ifdef YYSTYPE_TOSTRING",
1096#if defined(YYBTYACC)
1097 "#if YYBTYACC",
1098 " if (!yytrial)",
1099 "#endif /* YYBTYACC */",
1100#endif /* defined(YYBTYACC) */
1101 " fprintf(stderr, \"result is <%s>, \", YYSTYPE_TOSTRING(yystos[yystate], yyval));",
1102 "#endif",
1103 " fprintf(stderr, \"shifting from state %d to state %d\\n\", *yystack.s_mark, yystate);",
1104 " }",
1105 "#endif",
1106 " if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;",
1107 " *++yystack.s_mark = (short) yystate;",
1108 " *++yystack.l_mark = yyval;",
--- 26 unchanged lines hidden (view full) ---
1135 " }",
1136 " yylvp = yylvals + yypath->lexeme;",
1137 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
1138 " yylpp = yylpsns + yypath->lexeme;",
1139 "#endif",
1140 " yylexp = yylexemes + yypath->lexeme;",
1141 " yychar = YYEMPTY;",
1142 " yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);",
1143 " memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));",
1144 " yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);",
1145 " memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));",
1146 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
1147 " yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);",
1148 " memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));",
1149 "#endif",
1150 " yystate = yypath->state;",
1151 " goto yyloop;",
1152 "#endif /* YYBTYACC */",
1153#endif /* defined(YYBTYACC) */
1154 "",
1155 "yyoverflow:",
1156 " YYERROR_CALL(\"yacc stack overflow\");",
1157#if defined(YYBTYACC)
1158 "#if YYBTYACC",
1159 " goto yyabort_nomem;",
1160 "yyenomem:",
1161 " YYERROR_CALL(\"memory exhausted\");",
1162 "yyabort_nomem:",
1163 "#endif /* YYBTYACC */",
1164#endif /* defined(YYBTYACC) */
1165 " yyresult = 2;",
1166 " goto yyreturn;",
1167 "",
1168 "yyabort:",
1169 " yyresult = 1;",
1170 " goto yyreturn;",
1171 "",
1172 "yyaccept:",
1173#if defined(YYBTYACC)
1174 "#if YYBTYACC",
1175 " if (yyps->save) goto yyvalid;",
1176 "#endif /* YYBTYACC */",
1177#endif /* defined(YYBTYACC) */
1178 " yyresult = 0;",
1179 "",
1180 "yyreturn:",
1181 "#if defined(YYDESTRUCT_CALL)",
1182 " if (yychar != YYEOF && yychar != YYEMPTY)",
1183 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
1184 " YYDESTRUCT_CALL(\"cleanup: discarding token\", yychar, &yylval, &yylloc);",
1185 "#else",
--- 33 unchanged lines hidden (view full) ---
1219 " while (yypath)",
1220 " {",
1221 " YYParseState *save = yypath;",
1222 " yypath = save->save;",
1223 " save->save = NULL;",
1224 " yyFreeState(save);",
1225 " }",
1226 "#endif /* YYBTYACC */",
1227#endif /* defined(YYBTYACC) */
1228 " yyfreestack(&yystack);",
1229 " return (yyresult);",
1230 "}",
1231 0
1232};
1233
1234void
1235write_section(FILE * fp, const char *const section[])
1236{
1237 int i;
1238 const char *s;
1239
1240 for (i = 0; (s = section[i]) != 0; ++i)
1241 {
1242 if (fp == code_file)
1243 ++outline;
1244 fprintf(fp, "%s\n", s);
1245 }
1246}
2 * @Id: skel2c,v 1.3 2014/04/06 19:48:04 tom Exp @
3 */
4
5/* @Id: btyaccpar.skel,v 1.1 2014/04/02 22:44:41 tom Exp @ */
6
7#include "defs.h"
8
--- 4 unchanged lines hidden (view full) ---
13/* useful in subsequent code. The macros #defined in the header or */
14/* the body either are not useful outside of semantic actions or */
15/* are conditional. */
16
17const char *const banner[] =
18{
19 "/* original parser id follows */",
20 "/* yysccsid[] = \"@(#)yaccpar 1.9 (Berkeley) 02/21/93\" */",
21 "/* (use YYMAJOR/YYMINOR for ifdefs dependent of parser version) */",
22 "",
23 "#define YYBYACC 1",
24 CONCAT1("#define YYMAJOR ", YYMAJOR),
25 CONCAT1("#define YYMINOR ", YYMINOR),
26#ifdef YYPATCH
27 CONCAT1("#define YYPATCH ", YYPATCH),
28#endif
29 "",
--- 21 unchanged lines hidden (view full) ---
51 "extern const YYINT yystos[];",
52 "extern const YYINT yydgoto[];",
53 "extern const YYINT yysindex[];",
54 "extern const YYINT yyrindex[];",
55#if defined(YYBTYACC)
56 "#if YYBTYACC",
57 "extern const YYINT yycindex[];",
58 "#endif /* YYBTYACC */",
59#endif /* defined(YYBTYACC) */
60 "extern const YYINT yygindex[];",
61 "extern const YYINT yytable[];",
62 "extern const YYINT yycheck[];",
63#if defined(YYBTYACC)
64 "#if YYBTYACC",
65 "extern const YYINT yyctable[];",
66 "#endif /* YYBTYACC */",
67#endif /* defined(YYBTYACC) */
68 "",
69 "#if YYDEBUG",
70 "extern const char *const yyname[];",
71 "extern const char *const yyrule[];",
72 "#endif",
73 0
74};
75
--- 46 unchanged lines hidden (view full) ---
122 "#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */",
123#if defined(YYBTYACC)
124 "#if YYBTYACC",
125 "",
126 "#ifndef YYLVQUEUEGROWTH",
127 "#define YYLVQUEUEGROWTH 32",
128 "#endif",
129 "#endif /* YYBTYACC */",
130#endif /* defined(YYBTYACC) */
131 "",
132 "/* define the initial stack-sizes */",
133 "#ifdef YYSTACKSIZE",
134 "#undef YYMAXDEPTH",
135 "#define YYMAXDEPTH YYSTACKSIZE",
136 "#else",
137 "#ifdef YYMAXDEPTH",
138 "#define YYSTACKSIZE YYMAXDEPTH",
--- 28 unchanged lines hidden (view full) ---
167 " YYSTACKDATA yystack; /* saved parser stack */",
168 " int state; /* saved parser state */",
169 " int errflag; /* saved error recovery status */",
170 " int lexeme; /* saved index of the conflict lexeme in the lexical queue */",
171 " YYINT ctry; /* saved index in yyctable[] for this conflict */",
172 "};",
173 "typedef struct YYParseState_s YYParseState;",
174 "#endif /* YYBTYACC */",
175#endif /* defined(YYBTYACC) */
176 0
177};
178
179const char *const hdr_vars[] =
180{
181 "/* variables for the parser stack */",
182 "static YYSTACKDATA yystack;",
183#if defined(YYBTYACC)
--- 31 unchanged lines hidden (view full) ---
215 "static YYLTYPE *yylplim = 0;",
216 "#endif",
217 "",
218 "/* Current position at lexical token queue */",
219 "static short *yylexp = 0;",
220 "",
221 "static short *yylexemes = 0;",
222 "#endif /* YYBTYACC */",
223#endif /* defined(YYBTYACC) */
224 0
225};
226
227const char *const body_vars[] =
228{
229 " int yyerrflag;",
230 " int yychar;",
231 " YYSTYPE yyval;",
--- 40 unchanged lines hidden (view full) ---
272 " static YYLTYPE *yylplim = 0;",
273 "#endif",
274 "",
275 " /* Current position at lexical token queue */",
276 " static short *yylexp = 0;",
277 "",
278 " static short *yylexemes = 0;",
279 "#endif /* YYBTYACC */",
280#endif /* defined(YYBTYACC) */
281 0
282};
283
284const char *const body_1[] =
285{
286 "",
287 "/* For use in generated program */",
288 "#define yydepth (int)(yystack.s_mark - yystack.s_base)",
289#if defined(YYBTYACC)
290 "#if YYBTYACC",
291 "#define yytrial (yyps->save)",
292 "#endif /* YYBTYACC */",
293#endif /* defined(YYBTYACC) */
294 "",
295 "#if YYDEBUG",
296 "#include <stdio.h> /* needed for printf */",
297 "#endif",
298 "",
299 "#include <stdlib.h> /* needed for malloc, etc */",
300 "#include <string.h> /* needed for memset */",
301 "",
302 "/* allocate initial stack or double stack size, up to YYMAXDEPTH */",
303 "static int yygrowstack(YYSTACKDATA *data)",
304 "{",
305 " int i;",
306 " unsigned newsize;",
307 " short *newss;",
308 " YYSTYPE *newvs;",
--- 90 unchanged lines hidden (view full) ---
399 "",
400 "static void",
401 "yyFreeState(YYParseState *p)",
402 "{",
403 " yyfreestack(&p->yystack);",
404 " free(p);",
405 "}",
406 "#endif /* YYBTYACC */",
407#endif /* defined(YYBTYACC) */
408 "",
409 "#define YYABORT goto yyabort",
410 "#define YYREJECT goto yyabort",
411 "#define YYACCEPT goto yyaccept",
412 "#define YYERROR goto yyerrlab",
413#if defined(YYBTYACC)
414 "#if YYBTYACC",
415 "#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)",
416 "#define YYVALID_NESTED do { if (yyps->save && \\",
417 " yyps->save->save == 0) goto yyvalid; } while(0)",
418 "#endif /* YYBTYACC */",
419#endif /* defined(YYBTYACC) */
420 "",
421 "int",
422 "YYPARSE_DECL()",
423 "{",
424 0
425};
426
427const char *const body_2[] =
428{
429 " int yym, yyn, yystate, yyresult;",
430#if defined(YYBTYACC)
431 "#if YYBTYACC",
432 " int yynewerrflag;",
433 " YYParseState *yyerrctx = NULL;",
434 "#endif /* YYBTYACC */",
435#endif /* defined(YYBTYACC) */
436 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
437 " YYLTYPE yyerror_loc_range[2]; /* position of error start & end */",
438 "#endif",
439 "#if YYDEBUG",
440 " const char *yys;",
441 "",
442 " if ((yys = getenv(\"YYDEBUG\")) != 0)",
443 " {",
--- 5 unchanged lines hidden (view full) ---
449 " fprintf(stderr, \"%sdebug[<# of symbols on state stack>]\\n\", YYPREFIX);",
450 "#endif",
451 "",
452#if defined(YYBTYACC)
453 "#if YYBTYACC",
454 " yyps = yyNewState(0); if (yyps == 0) goto yyenomem;",
455 " yyps->save = 0;",
456 "#endif /* YYBTYACC */",
457#endif /* defined(YYBTYACC) */
458 " yynerrs = 0;",
459 " yyerrflag = 0;",
460 " yychar = YYEMPTY;",
461 " yystate = 0;",
462 "",
463 "#if YYPURE",
464 " memset(&yystack, 0, sizeof(yystack));",
465 "#endif",
--- 24 unchanged lines hidden (view full) ---
490 " yychar = *yylexp++;",
491 " break;",
492 " }",
493 " if (yyps->save)",
494 " {",
495 " /* in trial mode; save scanner results for future parse attempts */",
496 " if (yylvp == yylvlim)",
497 " { /* Enlarge lexical value queue */",
498 " size_t p = (size_t) (yylvp - yylvals);",
499 " size_t s = (size_t) (yylvlim - yylvals);",
500 "",
501 " s += YYLVQUEUEGROWTH;",
502 " if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;",
503 " if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;",
504 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
505 " if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;",
506 "#endif",
507 " yylvp = yylve = yylvals + p;",
--- 11 unchanged lines hidden (view full) ---
519 " *yylpp++ = yylloc;",
520 " yylpe++;",
521 "#endif",
522 " yychar = *yylexp++;",
523 " break;",
524 " }",
525 " /* normal operation, no conflict encountered */",
526 "#endif /* YYBTYACC */",
527#endif /* defined(YYBTYACC) */
528 " yychar = YYLEX;",
529#if defined(YYBTYACC)
530 "#if YYBTYACC",
531 " } while (0);",
532 "#endif /* YYBTYACC */",
533#endif /* defined(YYBTYACC) */
534 " if (yychar < 0) yychar = YYEOF;",
535 " /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */",
536 "#if YYDEBUG",
537 " if (yydebug)",
538 " {",
539 " yys = yyname[YYTRANSLATE(yychar)];",
540 " fprintf(stderr, \"%s[%d]: state %d, reading token %d (%s)\",",
541 " YYDEBUGSTR, yydepth, yystate, yychar, yys);",
542 "#ifdef YYSTYPE_TOSTRING",
543#if defined(YYBTYACC)
544 "#if YYBTYACC",
545 " if (!yytrial)",
546 "#endif /* YYBTYACC */",
547#endif /* defined(YYBTYACC) */
548 " fprintf(stderr, \" <%s>\", YYSTYPE_TOSTRING(yychar, yylval));",
549 "#endif",
550 " fputc('\\n', stderr);",
551 " }",
552 "#endif",
553 " }",
554#if defined(YYBTYACC)
555 "#if YYBTYACC",
--- 37 unchanged lines hidden (view full) ---
593 " }",
594 "#endif",
595 " save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));",
596 " if (save == NULL) goto yyenomem;",
597 " save->save = yyps->save;",
598 " save->state = yystate;",
599 " save->errflag = yyerrflag;",
600 " save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);",
601 " memcpy (save->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));",
602 " save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);",
603 " memcpy (save->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));",
604 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
605 " save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);",
606 " memcpy (save->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));",
607 "#endif",
608 " ctry = yytable[yyn];",
609 " if (yyctable[ctry] == -1)",
610 " {",
611 "#if YYDEBUG",
612 " if (yydebug && yychar >= YYEOF)",
613 " fprintf(stderr, \"%s[%d]: backtracking 1 token\\n\", YYDEBUGSTR, yydepth);",
614 "#endif",
--- 38 unchanged lines hidden (view full) ---
653 " {",
654 " yylvp--;",
655 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
656 " yylpp--;",
657 "#endif",
658 " yylexp--;",
659 " yychar = YYEMPTY;",
660 " }",
661 " save->lexeme = (int) (yylvp - yylvals);",
662 " yyps->save = save;",
663 " }",
664 " if (yytable[yyn] == ctry)",
665 " {",
666 "#if YYDEBUG",
667 " if (yydebug)",
668 " fprintf(stderr, \"%s[%d]: state %d, shifting to state %d\\n\",",
669 " YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);",
--- 20 unchanged lines hidden (view full) ---
690 " }",
691 " else",
692 " {",
693 " yyn = yyctable[ctry];",
694 " goto yyreduce;",
695 " }",
696 " } /* End of code dealing with conflicts */",
697 "#endif /* YYBTYACC */",
698#endif /* defined(YYBTYACC) */
699 " if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&",
700 " yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)",
701 " {",
702 "#if YYDEBUG",
703 " if (yydebug)",
704 " fprintf(stderr, \"%s[%d]: state %d, shifting to state %d\\n\",",
705 " YYDEBUGSTR, yydepth, yystate, yytable[yyn]);",
706 "#endif",
--- 42 unchanged lines hidden (view full) ---
749 " if (yyerrctx) yyFreeState(yyerrctx);",
750 " /* Create and fill out new saved error context state */",
751 " yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));",
752 " if (yyerrctx == NULL) goto yyenomem;",
753 " yyerrctx->save = yyps->save;",
754 " yyerrctx->state = yystate;",
755 " yyerrctx->errflag = yyerrflag;",
756 " yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);",
757 " memcpy (yyerrctx->yystack.s_base, yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));",
758 " yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);",
759 " memcpy (yyerrctx->yystack.l_base, yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));",
760 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
761 " yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);",
762 " memcpy (yyerrctx->yystack.p_base, yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));",
763 "#endif",
764 " yyerrctx->lexeme = (int) (yylvp - yylvals);",
765 " }",
766 " yylvp = yylvals + save->lexeme;",
767 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
768 " yylpp = yylpsns + save->lexeme;",
769 "#endif",
770 " yylexp = yylexemes + save->lexeme;",
771 " yychar = YYEMPTY;",
772 " yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);",
773 " memcpy (yystack.s_base, save->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));",
774 " yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);",
775 " memcpy (yystack.l_base, save->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));",
776 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
777 " yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);",
778 " memcpy (yystack.p_base, save->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));",
779 "#endif",
780 " ctry = ++save->ctry;",
781 " yystate = save->state;",
782 " /* We tried shift, try reduce now */",
783 " if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;",
784 " yyps->save = save->save;",
785 " save->save = NULL;",
786 " yyFreeState(save);",
--- 13 unchanged lines hidden (view full) ---
800 "#endif",
801 " yylexp = yylexemes + yyerrctx->lexeme;",
802 " yychar = yylexp[-1];",
803 " yylval = yylvp[-1];",
804 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
805 " yylloc = yylpp[-1];",
806 "#endif",
807 " yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);",
808 " memcpy (yystack.s_base, yyerrctx->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));",
809 " yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);",
810 " memcpy (yystack.l_base, yyerrctx->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));",
811 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
812 " yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);",
813 " memcpy (yystack.p_base, yyerrctx->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));",
814 "#endif",
815 " yystate = yyerrctx->state;",
816 " yyFreeState(yyerrctx);",
817 " yyerrctx = NULL;",
818 " }",
819 " yynewerrflag = 1;",
820 " }",
821 " if (yynewerrflag == 0) goto yyinrecovery;",
822 "#endif /* YYBTYACC */",
823#endif /* defined(YYBTYACC) */
824 "",
825 " YYERROR_CALL(\"syntax error\");",
826 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
827 " yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */",
828 "#endif",
829 "",
830 "#if !YYBTYACC",
831 " goto yyerrlab;",
--- 39 unchanged lines hidden (view full) ---
871 " /* the current TOS position is the error start position */",
872 " yyerror_loc_range[0] = *yystack.p_mark;",
873 "#endif",
874 "#if defined(YYDESTRUCT_CALL)",
875#if defined(YYBTYACC)
876 "#if YYBTYACC",
877 " if (!yytrial)",
878 "#endif /* YYBTYACC */",
879#endif /* defined(YYBTYACC) */
880 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
881 " YYDESTRUCT_CALL(\"error: discarding state\",",
882 " yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);",
883 "#else",
884 " YYDESTRUCT_CALL(\"error: discarding state\",",
885 " yystos[*yystack.s_mark], yystack.l_mark);",
886 "#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */",
887 "#endif /* defined(YYDESTRUCT_CALL) */",
--- 16 unchanged lines hidden (view full) ---
904 " YYDEBUGSTR, yydepth, yystate, yychar, yys);",
905 " }",
906 "#endif",
907 "#if defined(YYDESTRUCT_CALL)",
908#if defined(YYBTYACC)
909 "#if YYBTYACC",
910 " if (!yytrial)",
911 "#endif /* YYBTYACC */",
912#endif /* defined(YYBTYACC) */
913 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
914 " YYDESTRUCT_CALL(\"error: discarding token\", yychar, &yylval, &yylloc);",
915 "#else",
916 " YYDESTRUCT_CALL(\"error: discarding token\", yychar, &yylval);",
917 "#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */",
918 "#endif /* defined(YYDESTRUCT_CALL) */",
919 " yychar = YYEMPTY;",
920 " goto yyloop;",
--- 6 unchanged lines hidden (view full) ---
927 " {",
928 " fprintf(stderr, \"%s[%d]: state %d, reducing by rule %d (%s)\",",
929 " YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);",
930 "#ifdef YYSTYPE_TOSTRING",
931#if defined(YYBTYACC)
932 "#if YYBTYACC",
933 " if (!yytrial)",
934 "#endif /* YYBTYACC */",
935#endif /* defined(YYBTYACC) */
936 " if (yym > 0)",
937 " {",
938 " int i;",
939 " fputc('<', stderr);",
940 " for (i = yym; i > 0; i--)",
941 " {",
942 " if (i != yym) fputs(\", \", stderr);",
943 " fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],",
--- 12 unchanged lines hidden (view full) ---
956 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
957 "",
958 " /* Perform position reduction */",
959 " memset(&yyloc, 0, sizeof(yyloc));",
960#if defined(YYBTYACC)
961 "#if YYBTYACC",
962 " if (!yytrial)",
963 "#endif /* YYBTYACC */",
964#endif /* defined(YYBTYACC) */
965 " {",
966 " YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);",
967 " /* just in case YYERROR is invoked within the action, save",
968 " the start of the rhs as the error start position */",
969 " yyerror_loc_range[0] = yystack.p_mark[1-yym];",
970 " }",
971 "#endif",
972 "",
--- 20 unchanged lines hidden (view full) ---
993 " if (yydebug)",
994 " {",
995 " fprintf(stderr, \"%s[%d]: after reduction, \", YYDEBUGSTR, yydepth);",
996 "#ifdef YYSTYPE_TOSTRING",
997#if defined(YYBTYACC)
998 "#if YYBTYACC",
999 " if (!yytrial)",
1000 "#endif /* YYBTYACC */",
1001#endif /* defined(YYBTYACC) */
1002 " fprintf(stderr, \"result is <%s>, \", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));",
1003 "#endif",
1004 " fprintf(stderr, \"shifting from state 0 to final state %d\\n\", YYFINAL);",
1005 " }",
1006 "#endif",
1007 " yystate = YYFINAL;",
1008 " *++yystack.s_mark = YYFINAL;",
1009 " *++yystack.l_mark = yyval;",
--- 15 unchanged lines hidden (view full) ---
1025 " yychar = *yylexp++;",
1026 " break;",
1027 " }",
1028 " if (yyps->save)",
1029 " {",
1030 " /* in trial mode; save scanner results for future parse attempts */",
1031 " if (yylvp == yylvlim)",
1032 " { /* Enlarge lexical value queue */",
1033 " size_t p = (size_t) (yylvp - yylvals);",
1034 " size_t s = (size_t) (yylvlim - yylvals);",
1035 "",
1036 " s += YYLVQUEUEGROWTH;",
1037 " if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)",
1038 " goto yyenomem;",
1039 " if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)",
1040 " goto yyenomem;",
1041 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
1042 " if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)",
--- 14 unchanged lines hidden (view full) ---
1057 " *yylpp++ = yylloc;",
1058 " yylpe++;",
1059 "#endif",
1060 " yychar = *yylexp++;",
1061 " break;",
1062 " }",
1063 " /* normal operation, no conflict encountered */",
1064 "#endif /* YYBTYACC */",
1065#endif /* defined(YYBTYACC) */
1066 " yychar = YYLEX;",
1067#if defined(YYBTYACC)
1068 "#if YYBTYACC",
1069 " } while (0);",
1070 "#endif /* YYBTYACC */",
1071#endif /* defined(YYBTYACC) */
1072 " if (yychar < 0) yychar = YYEOF;",
1073 " /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */",
1074 "#if YYDEBUG",
1075 " if (yydebug)",
1076 " {",
1077 " yys = yyname[YYTRANSLATE(yychar)];",
1078 " fprintf(stderr, \"%s[%d]: state %d, reading %d (%s)\\n\",",
1079 " YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);",
--- 12 unchanged lines hidden (view full) ---
1092 " if (yydebug)",
1093 " {",
1094 " fprintf(stderr, \"%s[%d]: after reduction, \", YYDEBUGSTR, yydepth);",
1095 "#ifdef YYSTYPE_TOSTRING",
1096#if defined(YYBTYACC)
1097 "#if YYBTYACC",
1098 " if (!yytrial)",
1099 "#endif /* YYBTYACC */",
1100#endif /* defined(YYBTYACC) */
1101 " fprintf(stderr, \"result is <%s>, \", YYSTYPE_TOSTRING(yystos[yystate], yyval));",
1102 "#endif",
1103 " fprintf(stderr, \"shifting from state %d to state %d\\n\", *yystack.s_mark, yystate);",
1104 " }",
1105 "#endif",
1106 " if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;",
1107 " *++yystack.s_mark = (short) yystate;",
1108 " *++yystack.l_mark = yyval;",
--- 26 unchanged lines hidden (view full) ---
1135 " }",
1136 " yylvp = yylvals + yypath->lexeme;",
1137 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
1138 " yylpp = yylpsns + yypath->lexeme;",
1139 "#endif",
1140 " yylexp = yylexemes + yypath->lexeme;",
1141 " yychar = YYEMPTY;",
1142 " yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);",
1143 " memcpy (yystack.s_base, yypath->yystack.s_base, (size_t) (yystack.s_mark - yystack.s_base + 1) * sizeof(short));",
1144 " yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);",
1145 " memcpy (yystack.l_base, yypath->yystack.l_base, (size_t) (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));",
1146 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
1147 " yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);",
1148 " memcpy (yystack.p_base, yypath->yystack.p_base, (size_t) (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));",
1149 "#endif",
1150 " yystate = yypath->state;",
1151 " goto yyloop;",
1152 "#endif /* YYBTYACC */",
1153#endif /* defined(YYBTYACC) */
1154 "",
1155 "yyoverflow:",
1156 " YYERROR_CALL(\"yacc stack overflow\");",
1157#if defined(YYBTYACC)
1158 "#if YYBTYACC",
1159 " goto yyabort_nomem;",
1160 "yyenomem:",
1161 " YYERROR_CALL(\"memory exhausted\");",
1162 "yyabort_nomem:",
1163 "#endif /* YYBTYACC */",
1164#endif /* defined(YYBTYACC) */
1165 " yyresult = 2;",
1166 " goto yyreturn;",
1167 "",
1168 "yyabort:",
1169 " yyresult = 1;",
1170 " goto yyreturn;",
1171 "",
1172 "yyaccept:",
1173#if defined(YYBTYACC)
1174 "#if YYBTYACC",
1175 " if (yyps->save) goto yyvalid;",
1176 "#endif /* YYBTYACC */",
1177#endif /* defined(YYBTYACC) */
1178 " yyresult = 0;",
1179 "",
1180 "yyreturn:",
1181 "#if defined(YYDESTRUCT_CALL)",
1182 " if (yychar != YYEOF && yychar != YYEMPTY)",
1183 "#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)",
1184 " YYDESTRUCT_CALL(\"cleanup: discarding token\", yychar, &yylval, &yylloc);",
1185 "#else",
--- 33 unchanged lines hidden (view full) ---
1219 " while (yypath)",
1220 " {",
1221 " YYParseState *save = yypath;",
1222 " yypath = save->save;",
1223 " save->save = NULL;",
1224 " yyFreeState(save);",
1225 " }",
1226 "#endif /* YYBTYACC */",
1227#endif /* defined(YYBTYACC) */
1228 " yyfreestack(&yystack);",
1229 " return (yyresult);",
1230 "}",
1231 0
1232};
1233
1234void
1235write_section(FILE * fp, const char *const section[])
1236{
1237 int i;
1238 const char *s;
1239
1240 for (i = 0; (s = section[i]) != 0; ++i)
1241 {
1242 if (fp == code_file)
1243 ++outline;
1244 fprintf(fp, "%s\n", s);
1245 }
1246}