]>
git.saurik.com Git - wxWidgets.git/blob - src/common/dosyacc.c
2 static char yysccsid
[] = "@(#)yaccpar 1.7 (Berkeley) 09/09/90";
13 #define __EXTERN_C__ 1
16 #if defined(__cplusplus) || defined(__STDC__)
17 #if defined(__cplusplus) && defined(__EXTERN_C__)
24 int yyback(int *, int);
26 /* You may need to put /DLEX_SCANNER in your makefile
27 * if you're using LEX!
30 /* int yyoutput(int); */
36 #if defined(__cplusplus) || defined(__STDC__)
37 #if defined(__cplusplus) && defined(__EXTERN_C__)
44 /* struct pexpr *expr; */
57 #define CLOSE_SQUARE 10
62 0, 0, 1, 1, 1, 2, 2, 2, 3, 3,
63 3, 4, 4, 5, 5, 5, 5, 5, 5, 5,
66 0, 2, 2, 2, 2, 4, 2, 3, 0, 1,
67 3, 3, 1, 1, 1, 1, 3, 3, 5, 1,
69 short yydefred
[] = { 1,
70 0, 0, 0, 0, 2, 0, 5, 3, 0, 0,
71 0, 15, 7, 20, 0, 0, 13, 4, 0, 0,
72 0, 0, 8, 0, 6, 0, 18, 0, 12, 11,
75 short yydgoto
[] = { 1,
78 short yysindex
[] = { 0,
79 -2, 9, 2, 1, 0, 10, 0, 0, 11, -5,
80 17, 0, 0, 0, 14, -1, 0, 0, 33, 38,
81 41, 16, 0, 11, 0, 29, 0, 40, 0, 0,
84 short yyrindex
[] = { 0,
85 0, 0, 0, 0, 0, 0, 0, 0, 42, 21,
86 24, 0, 0, 0, 0, 30, 0, 0, 0, 0,
87 0, 0, 0, 31, 0, 27, 0, 24, 0, 0,
90 short yygindex
[] = { 0,
93 #define YYTABLESIZE 254
94 short yytable
[] = { 3,
95 19, 10, 11, 12, 24, 9, 4, 20, 21, 4,
96 13, 10, 11, 12, 8, 30, 10, 28, 12, 4,
97 9, 7, 18, 23, 4, 16, 16, 22, 14, 14,
98 16, 17, 17, 14, 10, 9, 17, 25, 26, 10,
99 9, 27, 31, 9, 32, 6, 9, 29, 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,
118 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
119 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
122 short yycheck
[] = { 2,
123 9, 1, 2, 3, 6, 4, 9, 13, 14, 9,
124 10, 1, 2, 3, 13, 24, 1, 2, 3, 9,
125 4, 13, 13, 10, 9, 5, 6, 11, 5, 6,
126 10, 5, 6, 10, 5, 5, 10, 5, 1, 10,
127 10, 1, 14, 4, 1, 1, 5, 22, -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,
146 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
147 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
154 #define YYMAXTOKEN 14
157 "end-of-file","INTEGER","WORD","STRING","OPEN","CLOSE","COMMA","NEWLINE",
158 "ERROR","OPEN_SQUARE","CLOSE_SQUARE","EQUALS",0,"PERIOD","EXP",
161 "$accept : commands",
163 "commands : commands command",
164 "command : WORD PERIOD",
165 "command : expr PERIOD",
166 "command : error PERIOD",
167 "expr : WORD OPEN arglist CLOSE",
168 "expr : OPEN_SQUARE CLOSE_SQUARE",
169 "expr : OPEN_SQUARE arglist CLOSE_SQUARE",
172 "arglist : arg COMMA arglist",
173 "arg : WORD EQUALS arg1",
178 "arg1 : INTEGER PERIOD INTEGER",
179 "arg1 : INTEGER EXP INTEGER",
180 "arg1 : INTEGER PERIOD INTEGER EXP INTEGER",
184 #define yyclearin (yychar=(-1))
185 #define yyerrok (yyerrflag=0)
188 #define YYMAXDEPTH YYSTACKSIZE
192 #define YYSTACKSIZE YYMAXDEPTH
194 #define YYSTACKSIZE 600
195 #define YYMAXDEPTH 600
206 short yyss
[YYSTACKSIZE
];
207 YYSTYPE yyvs
[YYSTACKSIZE
];
208 #define yystacksize YYSTACKSIZE
212 #include "../common/doslex.c"
214 #include "../common/lex_yy.c"
225 /* Ansi prototype. If this doesn't work for you... uncomment
229 void yyerror(char *s
)
235 * Unfortunately, my DOS version of FLEX
236 * requires yywrap to be #def'ed, whereas
237 * the UNIX flex expects a proper function.
240 /* Not sure if __SC__ is the appropriate thing
250 int yywrap() { return 1; }
254 #define YYABORT goto yyabort
255 #define YYACCEPT goto yyaccept
256 #define YYERROR goto yyerrlab
260 register int yym
, yyn
, yystate
;
263 extern char *getenv();
265 if (yys
= getenv("YYDEBUG"))
268 if (yyn
>= '0' && yyn
<= '9')
279 *yyssp
= yystate
= 0;
282 if (yyn
= yydefred
[yystate
]) goto yyreduce
;
285 if ((yychar
= yylex()) < 0) yychar
= 0;
290 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
291 if (!yys
) yys
= "illegal-symbol";
292 printf("yydebug: state %d, reading %d (%s)\n", yystate
,
297 if ((yyn
= yysindex
[yystate
]) && (yyn
+= yychar
) >= 0 &&
298 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yychar
)
302 printf("yydebug: state %d, shifting to state %d\n",
303 yystate
, yytable
[yyn
]);
305 if (yyssp
>= yyss
+ yystacksize
- 1)
309 *++yyssp
= yystate
= yytable
[yyn
];
312 if (yyerrflag
> 0) --yyerrflag
;
315 if ((yyn
= yyrindex
[yystate
]) && (yyn
+= yychar
) >= 0 &&
316 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yychar
)
321 if (yyerrflag
) goto yyinrecovery
;
326 yyerror("syntax error");
338 if ((yyn
= yysindex
[*yyssp
]) && (yyn
+= YYERRCODE
) >= 0 &&
339 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == YYERRCODE
)
343 printf("yydebug: state %d, error recovery shifting\
344 to state %d\n", *yyssp
, yytable
[yyn
]);
346 if (yyssp
>= yyss
+ yystacksize
- 1)
350 *++yyssp
= yystate
= yytable
[yyn
];
358 printf("yydebug: error recovery discarding state %d\n",
361 if (yyssp
<= yyss
) goto yyabort
;
369 if (yychar
== 0) goto yyabort
;
374 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
375 if (!yys
) yys
= "illegal-symbol";
376 printf("yydebug: state %d, error recovery discards token %d (%s)\n",
377 yystate
, yychar
, yys
);
386 printf("yydebug: state %d, reducing by rule %d (%s)\n",
387 yystate
, yyn
, yyrule
[yyn
]);
390 yyval
= yyvsp
[1-yym
];
395 {process_command(proio_cons(wxmake_word(yyvsp
[-1].s
), NULL
)); free(yyvsp
[-1].s
);}
399 {process_command(yyvsp
[-1].s
);}
403 {syntax_error("Unrecognized command.");}
407 {yyval
.s
= proio_cons(wxmake_word(yyvsp
[-3].s
), yyvsp
[-1].s
); free(yyvsp
[-3].s
);}
411 {yyval
.s
= proio_cons(NULL
, NULL
);}
415 {yyval
.s
= yyvsp
[-1].s
; }
423 {yyval
.s
= proio_cons(yyvsp
[0].s
, NULL
);}
427 {yyval
.s
= proio_cons(yyvsp
[-2].s
, yyvsp
[0].s
);}
431 {yyval
.s
= proio_cons(wxmake_word("="), proio_cons(wxmake_word(yyvsp
[-2].s
), proio_cons(yyvsp
[0].s
, NULL
)));
436 {yyval
.s
= yyvsp
[0].s
; }
440 {yyval
.s
= wxmake_word(yyvsp
[0].s
); free(yyvsp
[0].s
);}
444 {yyval
.s
= wxmake_string(yyvsp
[0].s
); free(yyvsp
[0].s
);}
448 {yyval
.s
= wxmake_integer(yyvsp
[0].s
); free(yyvsp
[0].s
);}
452 {yyval
.s
= wxmake_real(yyvsp
[-2].s
, yyvsp
[0].s
); free(yyvsp
[-2].s
); free(yyvsp
[0].s
); }
456 {yyval
.s
= wxmake_exp(yyvsp
[-2].s
, yyvsp
[0].s
); free(yyvsp
[-2].s
); free(yyvsp
[0].s
); }
460 {yyval
.s
= wxmake_exp2(yyvsp
[-4].s
, yyvsp
[-2].s
, yyvsp
[0].s
); free(yyvsp
[-4].s
); free(yyvsp
[-2].s
);
465 {yyval
.s
= yyvsp
[0].s
;}
473 if (yystate
== 0 && yym
== 0)
477 printf("yydebug: after reduction, shifting from state 0 to\
478 state %d\n", YYFINAL
);
485 if ((yychar
= yylex()) < 0) yychar
= 0;
490 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
491 if (!yys
) yys
= "illegal-symbol";
492 printf("yydebug: state %d, reading %d (%s)\n",
493 YYFINAL
, yychar
, yys
);
497 if (yychar
== 0) goto yyaccept
;
500 if ((yyn
= yygindex
[yym
]) && (yyn
+= yystate
) >= 0 &&
501 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yystate
)
502 yystate
= yytable
[yyn
];
504 yystate
= yydgoto
[yym
];
507 printf("yydebug: after reduction, shifting from state %d \
508 to state %d\n", *yyssp
, yystate
);
510 if (yyssp
>= yyss
+ yystacksize
- 1)
518 yyerror("yacc stack overflow");