]>
git.saurik.com Git - wxWidgets.git/blob - src/common/dosyacc.c
2 static char yysccsid
[] = "@(#)yaccpar 1.7 (Berkeley) 09/09/90";
10 #define __EXTERN_C__ 1
13 #if defined(__cplusplus) || defined(__STDC__)
14 #if defined(__cplusplus) && defined(__EXTERN_C__)
21 int yyback(int *, int);
23 /* You may need to put /DLEX_SCANNER in your makefile
24 * if you're using LEX!
25 Last change: JS 13 Jul 97 6:12 pm
28 /* int yyoutput(int); */
34 #if defined(__cplusplus) || defined(__STDC__)
35 #if defined(__cplusplus) && defined(__EXTERN_C__)
42 /* struct pexpr *expr; */
55 #define CLOSE_SQUARE 10
60 0, 0, 1, 1, 1, 2, 2, 2, 3, 3,
61 3, 4, 4, 5, 5, 5, 5, 5, 5, 5,
64 0, 2, 2, 2, 2, 4, 2, 3, 0, 1,
65 3, 3, 1, 1, 1, 1, 3, 3, 5, 1,
67 short yydefred
[] = { 1,
68 0, 0, 0, 0, 2, 0, 5, 3, 0, 0,
69 0, 15, 7, 20, 0, 0, 13, 4, 0, 0,
70 0, 0, 8, 0, 6, 0, 18, 0, 12, 11,
73 short yydgoto
[] = { 1,
76 short yysindex
[] = { 0,
77 -2, 9, 2, 1, 0, 10, 0, 0, 11, -5,
78 17, 0, 0, 0, 14, -1, 0, 0, 33, 38,
79 41, 16, 0, 11, 0, 29, 0, 40, 0, 0,
82 short yyrindex
[] = { 0,
83 0, 0, 0, 0, 0, 0, 0, 0, 42, 21,
84 24, 0, 0, 0, 0, 30, 0, 0, 0, 0,
85 0, 0, 0, 31, 0, 27, 0, 24, 0, 0,
88 short yygindex
[] = { 0,
91 #define YYTABLESIZE 254
92 short yytable
[] = { 3,
93 19, 10, 11, 12, 24, 9, 4, 20, 21, 4,
94 13, 10, 11, 12, 8, 30, 10, 28, 12, 4,
95 9, 7, 18, 23, 4, 16, 16, 22, 14, 14,
96 16, 17, 17, 14, 10, 9, 17, 25, 26, 10,
97 9, 27, 31, 9, 32, 6, 9, 29, 0, 0,
98 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
99 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
100 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
101 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
102 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
103 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
104 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
105 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
106 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
107 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
108 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
109 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
110 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
111 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
112 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
113 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
114 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
115 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
116 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
117 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
120 short yycheck
[] = { 2,
121 9, 1, 2, 3, 6, 4, 9, 13, 14, 9,
122 10, 1, 2, 3, 13, 24, 1, 2, 3, 9,
123 4, 13, 13, 10, 9, 5, 6, 11, 5, 6,
124 10, 5, 6, 10, 5, 5, 10, 5, 1, 10,
125 10, 1, 14, 4, 1, 1, 5, 22, -1, -1,
126 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
127 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
128 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
129 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
130 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
131 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
132 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
133 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
134 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
135 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
136 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
137 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
138 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
139 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
140 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
141 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
142 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
143 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
144 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
145 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
152 #define YYMAXTOKEN 14
155 "end-of-file","INTEGER","WORD","STRING","OPEN","CLOSE","COMMA","NEWLINE",
156 "ERROR","OPEN_SQUARE","CLOSE_SQUARE","EQUALS",0,"PERIOD","EXP",
159 "$accept : commands",
161 "commands : commands command",
162 "command : WORD PERIOD",
163 "command : expr PERIOD",
164 "command : error PERIOD",
165 "expr : WORD OPEN arglist CLOSE",
166 "expr : OPEN_SQUARE CLOSE_SQUARE",
167 "expr : OPEN_SQUARE arglist CLOSE_SQUARE",
170 "arglist : arg COMMA arglist",
171 "arg : WORD EQUALS arg1",
176 "arg1 : INTEGER PERIOD INTEGER",
177 "arg1 : INTEGER EXP INTEGER",
178 "arg1 : INTEGER PERIOD INTEGER EXP INTEGER",
182 #define yyclearin (yychar=(-1))
183 #define yyerrok (yyerrflag=0)
186 #define YYMAXDEPTH YYSTACKSIZE
190 #define YYSTACKSIZE YYMAXDEPTH
192 #define YYSTACKSIZE 600
193 #define YYMAXDEPTH 600
204 short yyss
[YYSTACKSIZE
];
205 YYSTYPE yyvs
[YYSTACKSIZE
];
206 #define yystacksize YYSTACKSIZE
209 #include "../common/lex_yy.c"
219 /* Ansi prototype. If this doesn't work for you... uncomment
223 void yyerror(char *s
)
229 * Unfortunately, my DOS version of FLEX
230 * requires yywrap to be #def'ed, whereas
231 * the UNIX flex expects a proper function.
234 /* Not sure if __SC__ is the appropriate thing
244 int yywrap() { return 1; }
248 #define YYABORT goto yyabort
249 #define YYACCEPT goto yyaccept
250 #define YYERROR goto yyerrlab
254 register int yym
, yyn
, yystate
;
257 extern char *getenv();
259 if (yys
= getenv("YYDEBUG"))
262 if (yyn
>= '0' && yyn
<= '9')
273 *yyssp
= yystate
= 0;
276 if (yyn
= yydefred
[yystate
]) goto yyreduce
;
279 if ((yychar
= yylex()) < 0) yychar
= 0;
284 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
285 if (!yys
) yys
= "illegal-symbol";
286 printf("yydebug: state %d, reading %d (%s)\n", yystate
,
291 if ((yyn
= yysindex
[yystate
]) && (yyn
+= yychar
) >= 0 &&
292 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yychar
)
296 printf("yydebug: state %d, shifting to state %d\n",
297 yystate
, yytable
[yyn
]);
299 if (yyssp
>= yyss
+ yystacksize
- 1)
303 *++yyssp
= yystate
= yytable
[yyn
];
306 if (yyerrflag
> 0) --yyerrflag
;
309 if ((yyn
= yyrindex
[yystate
]) && (yyn
+= yychar
) >= 0 &&
310 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yychar
)
315 if (yyerrflag
) goto yyinrecovery
;
320 yyerror("syntax error");
332 if ((yyn
= yysindex
[*yyssp
]) && (yyn
+= YYERRCODE
) >= 0 &&
333 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == YYERRCODE
)
337 printf("yydebug: state %d, error recovery shifting\
338 to state %d\n", *yyssp
, yytable
[yyn
]);
340 if (yyssp
>= yyss
+ yystacksize
- 1)
344 *++yyssp
= yystate
= yytable
[yyn
];
352 printf("yydebug: error recovery discarding state %d\n",
355 if (yyssp
<= yyss
) goto yyabort
;
363 if (yychar
== 0) goto yyabort
;
368 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
369 if (!yys
) yys
= "illegal-symbol";
370 printf("yydebug: state %d, error recovery discards token %d (%s)\n",
371 yystate
, yychar
, yys
);
380 printf("yydebug: state %d, reducing by rule %d (%s)\n",
381 yystate
, yyn
, yyrule
[yyn
]);
384 yyval
= yyvsp
[1-yym
];
389 {process_command(proio_cons(make_word(yyvsp
[-1].s
), NULL
)); free(yyvsp
[-1].s
);}
393 {process_command(yyvsp
[-1].s
);}
397 {syntax_error("Unrecognized command.");}
401 {yyval
.s
= proio_cons(make_word(yyvsp
[-3].s
), yyvsp
[-1].s
); free(yyvsp
[-3].s
);}
405 {yyval
.s
= proio_cons(NULL
, NULL
);}
409 {yyval
.s
= yyvsp
[-1].s
; }
417 {yyval
.s
= proio_cons(yyvsp
[0].s
, NULL
);}
421 {yyval
.s
= proio_cons(yyvsp
[-2].s
, yyvsp
[0].s
);}
425 {yyval
.s
= proio_cons(make_word("="), proio_cons(make_word(yyvsp
[-2].s
), proio_cons(yyvsp
[0].s
, NULL
)));
430 {yyval
.s
= yyvsp
[0].s
; }
434 {yyval
.s
= make_word(yyvsp
[0].s
); free(yyvsp
[0].s
);}
438 {yyval
.s
= make_string(yyvsp
[0].s
); free(yyvsp
[0].s
);}
442 {yyval
.s
= make_integer(yyvsp
[0].s
); free(yyvsp
[0].s
);}
446 {yyval
.s
= make_real(yyvsp
[-2].s
, yyvsp
[0].s
); free(yyvsp
[-2].s
); free(yyvsp
[0].s
); }
450 {yyval
.s
= make_exp(yyvsp
[-2].s
, yyvsp
[0].s
); free(yyvsp
[-2].s
); free(yyvsp
[0].s
); }
454 {yyval
.s
= make_exp2(yyvsp
[-4].s
, yyvsp
[-2].s
, yyvsp
[0].s
); free(yyvsp
[-4].s
); free(yyvsp
[-2].s
);
459 {yyval
.s
= yyvsp
[0].s
;}
467 if (yystate
== 0 && yym
== 0)
471 printf("yydebug: after reduction, shifting from state 0 to\
472 state %d\n", YYFINAL
);
479 if ((yychar
= yylex()) < 0) yychar
= 0;
484 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
485 if (!yys
) yys
= "illegal-symbol";
486 printf("yydebug: state %d, reading %d (%s)\n",
487 YYFINAL
, yychar
, yys
);
491 if (yychar
== 0) goto yyaccept
;
494 if ((yyn
= yygindex
[yym
]) && (yyn
+= yystate
) >= 0 &&
495 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yystate
)
496 yystate
= yytable
[yyn
];
498 yystate
= yydgoto
[yym
];
501 printf("yydebug: after reduction, shifting from state %d \
502 to state %d\n", *yyssp
, yystate
);
504 if (yyssp
>= yyss
+ yystacksize
- 1)
512 yyerror("yacc stack overflow");