]>
git.saurik.com Git - wxWidgets.git/blob - src/common/dosyacc.c
1 #if defined(__WIN32__) || defined(__GNUWIN32__)
2 /* all Win32 compilers can handle C++ comments, and C++ comments
3 is the only C++ in setup.h */
7 #if !defined(wxUSE_PROLOGIO) || wxUSE_PROLOGIO
10 static char yysccsid
[] = "@(#)yaccpar 1.7 (Berkeley) 09/09/90";
15 #if defined(_MSC_VER) || defined(__VISAGECPP__)
21 #define __EXTERN_C__ 1
24 #if defined(__cplusplus) || defined(__STDC__)
25 #if defined(__cplusplus) && defined(__EXTERN_C__)
32 int yyback(int *, int);
34 /* You may need to put /DLEX_SCANNER in your makefile
35 * if you're using LEX!
38 /* int yyoutput(int); */
44 #if defined(__cplusplus) || defined(__STDC__)
45 #if defined(__cplusplus) && defined(__EXTERN_C__)
52 /* struct pexpr *expr; */
65 #define CLOSE_SQUARE 10
70 0, 0, 1, 1, 1, 2, 2, 2, 3, 3,
71 3, 4, 4, 5, 5, 5, 5, 5, 5, 5,
74 0, 2, 2, 2, 2, 4, 2, 3, 0, 1,
75 3, 3, 1, 1, 1, 1, 3, 3, 5, 1,
77 short yydefred
[] = { 1,
78 0, 0, 0, 0, 2, 0, 5, 3, 0, 0,
79 0, 15, 7, 20, 0, 0, 13, 4, 0, 0,
80 0, 0, 8, 0, 6, 0, 18, 0, 12, 11,
83 short yydgoto
[] = { 1,
86 short yysindex
[] = { 0,
87 -2, 9, 2, 1, 0, 10, 0, 0, 11, -5,
88 17, 0, 0, 0, 14, -1, 0, 0, 33, 38,
89 41, 16, 0, 11, 0, 29, 0, 40, 0, 0,
92 short yyrindex
[] = { 0,
93 0, 0, 0, 0, 0, 0, 0, 0, 42, 21,
94 24, 0, 0, 0, 0, 30, 0, 0, 0, 0,
95 0, 0, 0, 31, 0, 27, 0, 24, 0, 0,
98 short yygindex
[] = { 0,
101 #define YYTABLESIZE 254
102 short yytable
[] = { 3,
103 19, 10, 11, 12, 24, 9, 4, 20, 21, 4,
104 13, 10, 11, 12, 8, 30, 10, 28, 12, 4,
105 9, 7, 18, 23, 4, 16, 16, 22, 14, 14,
106 16, 17, 17, 14, 10, 9, 17, 25, 26, 10,
107 9, 27, 31, 9, 32, 6, 9, 29, 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,
120 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
121 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
122 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
123 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
124 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
125 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
126 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
127 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
130 short yycheck
[] = { 2,
131 9, 1, 2, 3, 6, 4, 9, 13, 14, 9,
132 10, 1, 2, 3, 13, 24, 1, 2, 3, 9,
133 4, 13, 13, 10, 9, 5, 6, 11, 5, 6,
134 10, 5, 6, 10, 5, 5, 10, 5, 1, 10,
135 10, 1, 14, 4, 1, 1, 5, 22, -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,
148 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
149 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
150 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
151 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
152 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
153 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
154 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
155 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
162 #define YYMAXTOKEN 14
165 "end-of-file","INTEGER","WORD","STRING","OPEN","CLOSE","COMMA","NEWLINE",
166 "ERROR","OPEN_SQUARE","CLOSE_SQUARE","EQUALS",0,"PERIOD","EXP",
169 "$accept : commands",
171 "commands : commands command",
172 "command : WORD PERIOD",
173 "command : expr PERIOD",
174 "command : error PERIOD",
175 "expr : WORD OPEN arglist CLOSE",
176 "expr : OPEN_SQUARE CLOSE_SQUARE",
177 "expr : OPEN_SQUARE arglist CLOSE_SQUARE",
180 "arglist : arg COMMA arglist",
181 "arg : WORD EQUALS arg1",
186 "arg1 : INTEGER PERIOD INTEGER",
187 "arg1 : INTEGER EXP INTEGER",
188 "arg1 : INTEGER PERIOD INTEGER EXP INTEGER",
192 #define yyclearin (yychar=(-1))
193 #define yyerrok (yyerrflag=0)
196 #define YYMAXDEPTH YYSTACKSIZE
200 #define YYSTACKSIZE YYMAXDEPTH
202 #define YYSTACKSIZE 600
203 #define YYMAXDEPTH 600
214 short yyss
[YYSTACKSIZE
];
215 YYSTYPE yyvs
[YYSTACKSIZE
];
216 #define yystacksize YYSTACKSIZE
220 #include "../common/doslex.c"
222 #include "../common/lex_yy.c"
233 /* Ansi prototype. If this doesn't work for you... uncomment
237 void yyerror(char *s
)
243 * Unfortunately, my DOS version of FLEX
244 * requires yywrap to be #def'ed, whereas
245 * the UNIX flex expects a proper function.
248 /* Not sure if __SC__ is the appropriate thing
258 # if !(defined(__VISAGECPP__) && __IBMC__ >= 400)
259 /* VA 4.0 thinks this is multiply defined (in lex_yy.c) */
260 int yywrap() { return 1; }
265 #define YYABORT goto yyabort
266 #define YYACCEPT goto yyaccept
267 #define YYERROR goto yyerrlab
271 register int yym
, yyn
, yystate
;
274 extern char *getenv();
276 yys
= getenv("YYDEBUG");
280 if (yyn
>= '0' && yyn
<= '9')
291 *yyssp
= yystate
= 0;
294 yyn
= yydefred
[yystate
];
295 if (yyn
!= 0) goto yyreduce
;
298 if ((yychar
= yylex()) < 0) yychar
= 0;
303 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
304 if (!yys
) yys
= "illegal-symbol";
305 printf("yydebug: state %d, reading %d (%s)\n", yystate
,
310 if ((yyn
= yysindex
[yystate
]) && (yyn
+= yychar
) >= 0 &&
311 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yychar
)
315 printf("yydebug: state %d, shifting to state %d\n",
316 yystate
, yytable
[yyn
]);
318 if (yyssp
>= yyss
+ yystacksize
- 1)
322 *++yyssp
= yystate
= yytable
[yyn
];
325 if (yyerrflag
> 0) --yyerrflag
;
328 if ((yyn
= yyrindex
[yystate
]) && (yyn
+= yychar
) >= 0 &&
329 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yychar
)
334 if (yyerrflag
) goto yyinrecovery
;
339 yyerror("syntax error");
351 if ((yyn
= yysindex
[*yyssp
]) && (yyn
+= YYERRCODE
) >= 0 &&
352 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == YYERRCODE
)
356 printf("yydebug: state %d, error recovery shifting\
357 to state %d\n", *yyssp
, yytable
[yyn
]);
359 if (yyssp
>= yyss
+ yystacksize
- 1)
363 *++yyssp
= yystate
= yytable
[yyn
];
371 printf("yydebug: error recovery discarding state %d\n",
374 if (yyssp
<= yyss
) goto yyabort
;
382 if (yychar
== 0) goto yyabort
;
387 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
388 if (!yys
) yys
= "illegal-symbol";
389 printf("yydebug: state %d, error recovery discards token %d (%s)\n",
390 yystate
, yychar
, yys
);
399 printf("yydebug: state %d, reducing by rule %d (%s)\n",
400 yystate
, yyn
, yyrule
[yyn
]);
403 yyval
= yyvsp
[1-yym
];
408 {process_command(proio_cons(wxmake_word(yyvsp
[-1].s
), NULL
)); free(yyvsp
[-1].s
);}
412 {process_command(yyvsp
[-1].s
);}
416 {syntax_error("Unrecognized command.");}
420 {yyval
.s
= proio_cons(wxmake_word(yyvsp
[-3].s
), yyvsp
[-1].s
); free(yyvsp
[-3].s
);}
424 {yyval
.s
= proio_cons(NULL
, NULL
);}
428 {yyval
.s
= yyvsp
[-1].s
; }
436 {yyval
.s
= proio_cons(yyvsp
[0].s
, NULL
);}
440 {yyval
.s
= proio_cons(yyvsp
[-2].s
, yyvsp
[0].s
);}
444 {yyval
.s
= proio_cons(wxmake_word("="), proio_cons(wxmake_word(yyvsp
[-2].s
), proio_cons(yyvsp
[0].s
, NULL
)));
449 {yyval
.s
= yyvsp
[0].s
; }
453 {yyval
.s
= wxmake_word(yyvsp
[0].s
); free(yyvsp
[0].s
);}
457 {yyval
.s
= wxmake_string(yyvsp
[0].s
); free(yyvsp
[0].s
);}
461 {yyval
.s
= wxmake_integer(yyvsp
[0].s
); free(yyvsp
[0].s
);}
465 {yyval
.s
= wxmake_real(yyvsp
[-2].s
, yyvsp
[0].s
); free(yyvsp
[-2].s
); free(yyvsp
[0].s
); }
469 {yyval
.s
= wxmake_exp(yyvsp
[-2].s
, yyvsp
[0].s
); free(yyvsp
[-2].s
); free(yyvsp
[0].s
); }
473 {yyval
.s
= wxmake_exp2(yyvsp
[-4].s
, yyvsp
[-2].s
, yyvsp
[0].s
); free(yyvsp
[-4].s
); free(yyvsp
[-2].s
);
478 {yyval
.s
= yyvsp
[0].s
;}
486 if (yystate
== 0 && yym
== 0)
490 printf("yydebug: after reduction, shifting from state 0 to\
491 state %d\n", YYFINAL
);
498 if ((yychar
= yylex()) < 0) yychar
= 0;
503 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
504 if (!yys
) yys
= "illegal-symbol";
505 printf("yydebug: state %d, reading %d (%s)\n",
506 YYFINAL
, yychar
, yys
);
510 if (yychar
== 0) goto yyaccept
;
513 if ((yyn
= yygindex
[yym
]) && (yyn
+= yystate
) >= 0 &&
514 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yystate
)
515 yystate
= yytable
[yyn
];
517 yystate
= yydgoto
[yym
];
520 printf("yydebug: after reduction, shifting from state %d \
521 to state %d\n", *yyssp
, yystate
);
523 if (yyssp
>= yyss
+ yystacksize
- 1)
531 yyerror("yacc stack overflow");
538 #endif /* wxUSE_PROLOGIO */