]>
git.saurik.com Git - wxWidgets.git/blob - contrib/src/deprecated/dosyacc.c
1 /* Copyright: (c) Julian Smart */
2 /* Licence: wxWindows Licence */
3 /* include platform.h first to get __WIN32__ definition */
5 #include "wx/platform.h"
7 #include "wx/deprecated/setup.h"
9 #if !defined(wxUSE_PROLOGIO) || wxUSE_PROLOGIO
13 #pragma warning(disable:4244) /* warning C4244: '=' : conversion from 'A' to 'B', possible loss of data */
16 #if !defined(lint) && 0
17 static char yysccsid
[] = "@(#)yaccpar 1.7 (Berkeley) 09/09/90";
22 #if defined(_MSC_VER) || defined(__VISAGECPP__)
25 #include "wx/deprecated/expr.h"
28 #define __EXTERN_C__ 1
31 #if defined(__cplusplus) || defined(__STDC__)
32 #if defined(__cplusplus) && defined(__EXTERN_C__)
39 int yyback(int *, int);
41 /* You may need to put /DLEX_SCANNER in your makefile
42 * if you're using LEX!
45 /* int yyoutput(int); */
51 #if defined(__cplusplus) || defined(__STDC__)
52 #if defined(__cplusplus) && defined(__EXTERN_C__)
56 // #line 36 "parser.y"
59 /* struct pexpr *expr; */
72 #define CLOSE_SQUARE 10
77 0, 0, 1, 1, 1, 2, 2, 2, 3, 3,
78 3, 4, 4, 5, 5, 5, 5, 5, 5, 5,
81 0, 2, 2, 2, 2, 4, 2, 3, 0, 1,
82 3, 3, 1, 1, 1, 1, 3, 3, 5, 1,
84 short yydefred
[] = { 1,
85 0, 0, 0, 0, 2, 0, 5, 3, 0, 0,
86 0, 15, 7, 20, 0, 0, 13, 4, 0, 0,
87 0, 0, 8, 0, 6, 0, 18, 0, 12, 11,
90 short yydgoto
[] = { 1,
93 short yysindex
[] = { 0,
94 -2, 9, 2, 1, 0, 10, 0, 0, 11, -5,
95 17, 0, 0, 0, 14, -1, 0, 0, 33, 38,
96 41, 16, 0, 11, 0, 29, 0, 40, 0, 0,
99 short yyrindex
[] = { 0,
100 0, 0, 0, 0, 0, 0, 0, 0, 42, 21,
101 24, 0, 0, 0, 0, 30, 0, 0, 0, 0,
102 0, 0, 0, 31, 0, 27, 0, 24, 0, 0,
105 short yygindex
[] = { 0,
108 #define YYTABLESIZE 254
109 short yytable
[] = { 3,
110 19, 10, 11, 12, 24, 9, 4, 20, 21, 4,
111 13, 10, 11, 12, 8, 30, 10, 28, 12, 4,
112 9, 7, 18, 23, 4, 16, 16, 22, 14, 14,
113 16, 17, 17, 14, 10, 9, 17, 25, 26, 10,
114 9, 27, 31, 9, 32, 6, 9, 29, 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,
128 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
129 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
130 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
131 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
132 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
133 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
134 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
137 short yycheck
[] = { 2,
138 9, 1, 2, 3, 6, 4, 9, 13, 14, 9,
139 10, 1, 2, 3, 13, 24, 1, 2, 3, 9,
140 4, 13, 13, 10, 9, 5, 6, 11, 5, 6,
141 10, 5, 6, 10, 5, 5, 10, 5, 1, 10,
142 10, 1, 14, 4, 1, 1, 5, 22, -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,
156 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
157 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
158 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
159 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
160 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
161 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
162 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
169 #define YYMAXTOKEN 14
172 "end-of-file","INTEGER","WORD","STRING","OPEN","CLOSE","COMMA","NEWLINE",
173 "ERROR","OPEN_SQUARE","CLOSE_SQUARE","EQUALS",0,"PERIOD","EXP",
176 "$accept : commands",
178 "commands : commands command",
179 "command : WORD PERIOD",
180 "command : expr PERIOD",
181 "command : error PERIOD",
182 "expr : WORD OPEN arglist CLOSE",
183 "expr : OPEN_SQUARE CLOSE_SQUARE",
184 "expr : OPEN_SQUARE arglist CLOSE_SQUARE",
187 "arglist : arg COMMA arglist",
188 "arg : WORD EQUALS arg1",
193 "arg1 : INTEGER PERIOD INTEGER",
194 "arg1 : INTEGER EXP INTEGER",
195 "arg1 : INTEGER PERIOD INTEGER EXP INTEGER",
199 #define yyclearin (yychar=(-1))
200 #define yyerrok (yyerrflag=0)
203 #define YYMAXDEPTH YYSTACKSIZE
207 #define YYSTACKSIZE YYMAXDEPTH
209 #define YYSTACKSIZE 600
210 #define YYMAXDEPTH 600
221 short yyss
[YYSTACKSIZE
];
222 YYSTYPE yyvs
[YYSTACKSIZE
];
223 #define yystacksize YYSTACKSIZE
224 // #line 118 "parser.y"
236 /* Ansi prototype. If this doesn't work for you... uncomment
240 void yyerror(char *s
)
246 * Unfortunately, my DOS version of FLEX
247 * requires yywrap to be #def'ed, whereas
248 * the UNIX flex expects a proper function.
251 /* Not sure if __SC__ is the appropriate thing
255 #if 0 /* VS: doesn't work... */
262 # if !(defined(__VISAGECPP__) && __IBMC__ >= 400)
263 /* VA 4.0 thinks this is multiply defined (in lex_yy.c) */
264 int yywrap() { return 1; }
270 // #line 247 "y_tab.c"
271 #define YYABORT goto yyabort
272 #define YYACCEPT goto yyaccept
273 #define YYERROR goto yyerrlab
277 register int yym
, yyn
, yystate
;
280 extern char *getenv();
282 yys
= getenv("YYDEBUG");
286 if (yyn
>= '0' && yyn
<= '9')
297 *yyssp
= yystate
= 0;
300 yyn
= yydefred
[yystate
];
301 if (yyn
!= 0) goto yyreduce
;
304 if ((yychar
= yylex()) < 0) yychar
= 0;
309 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
310 if (!yys
) yys
= "illegal-symbol";
311 printf("yydebug: state %d, reading %d (%s)\n", yystate
,
316 yyn
= yysindex
[yystate
];
317 if ((yyn
) && (yyn
+= yychar
) >= 0 &&
318 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yychar
)
322 printf("yydebug: state %d, shifting to state %d\n",
323 yystate
, yytable
[yyn
]);
325 if (yyssp
>= yyss
+ yystacksize
- 1)
329 *++yyssp
= yystate
= yytable
[yyn
];
332 if (yyerrflag
> 0) --yyerrflag
;
335 yyn
= yyrindex
[yystate
];
336 if ((yyn
) && (yyn
+= yychar
) >= 0 &&
337 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yychar
)
342 if (yyerrflag
) goto yyinrecovery
;
347 yyerror("syntax error");
359 yyn
= yysindex
[*yyssp
];
360 if ((yyn
) && (yyn
+= YYERRCODE
) >= 0 &&
361 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == YYERRCODE
)
365 printf("yydebug: state %d, error recovery shifting\
366 to state %d\n", *yyssp
, yytable
[yyn
]);
368 if (yyssp
>= yyss
+ yystacksize
- 1)
372 *++yyssp
= yystate
= yytable
[yyn
];
380 printf("yydebug: error recovery discarding state %d\n",
383 if (yyssp
<= yyss
) goto yyabort
;
391 if (yychar
== 0) goto yyabort
;
396 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
397 if (!yys
) yys
= "illegal-symbol";
398 printf("yydebug: state %d, error recovery discards token %d (%s)\n",
399 yystate
, yychar
, yys
);
408 printf("yydebug: state %d, reducing by rule %d (%s)\n",
409 yystate
, yyn
, yyrule
[yyn
]);
412 yyval
= yyvsp
[1-yym
];
416 // #line 68 "parser.y"
417 {process_command(proio_cons(wxmake_word(yyvsp
[-1].s
), NULL
)); free(yyvsp
[-1].s
);}
420 // #line 70 "parser.y"
421 {process_command(yyvsp
[-1].s
);}
424 // #line 72 "parser.y"
425 {syntax_error("Unrecognized command.");}
428 // #line 76 "parser.y"
429 {yyval
.s
= proio_cons(wxmake_word(yyvsp
[-3].s
), yyvsp
[-1].s
); free(yyvsp
[-3].s
);}
432 // #line 78 "parser.y"
433 {yyval
.s
= proio_cons(NULL
, NULL
);}
436 // #line 80 "parser.y"
437 {yyval
.s
= yyvsp
[-1].s
; }
440 // #line 84 "parser.y"
444 // #line 86 "parser.y"
445 {yyval
.s
= proio_cons(yyvsp
[0].s
, NULL
);}
448 // #line 89 "parser.y"
449 {yyval
.s
= proio_cons(yyvsp
[-2].s
, yyvsp
[0].s
);}
452 // #line 93 "parser.y"
453 {yyval
.s
= proio_cons(wxmake_word("="), proio_cons(wxmake_word(yyvsp
[-2].s
), proio_cons(yyvsp
[0].s
, NULL
)));
457 // #line 96 "parser.y"
458 {yyval
.s
= yyvsp
[0].s
; }
461 // #line 99 "parser.y"
462 {yyval
.s
= wxmake_word(yyvsp
[0].s
); free(yyvsp
[0].s
);}
465 // #line 101 "parser.y"
466 {yyval
.s
= wxmake_string(yyvsp
[0].s
); free(yyvsp
[0].s
);}
469 // #line 103 "parser.y"
470 {yyval
.s
= wxmake_integer(yyvsp
[0].s
); free(yyvsp
[0].s
);}
473 // #line 105 "parser.y"
474 {yyval
.s
= wxmake_real(yyvsp
[-2].s
, yyvsp
[0].s
); free(yyvsp
[-2].s
); free(yyvsp
[0].s
); }
477 // #line 107 "parser.y"
478 {yyval
.s
= wxmake_exp(yyvsp
[-2].s
, yyvsp
[0].s
); free(yyvsp
[-2].s
); free(yyvsp
[0].s
); }
481 // #line 110 "parser.y"
482 {yyval
.s
= wxmake_exp2(yyvsp
[-4].s
, yyvsp
[-2].s
, yyvsp
[0].s
); free(yyvsp
[-4].s
); free(yyvsp
[-2].s
);
486 // #line 114 "parser.y"
487 {yyval
.s
= yyvsp
[0].s
;}
489 // #line 461 "y_tab.c"
495 if (yystate
== 0 && yym
== 0)
499 printf("yydebug: after reduction, shifting from state 0 to\
500 state %d\n", YYFINAL
);
507 if ((yychar
= yylex()) < 0) yychar
= 0;
512 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
513 if (!yys
) yys
= "illegal-symbol";
514 printf("yydebug: state %d, reading %d (%s)\n",
515 YYFINAL
, yychar
, yys
);
519 if (yychar
== 0) goto yyaccept
;
523 if ((yyn
) && (yyn
+= yystate
) >= 0 &&
524 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yystate
)
525 yystate
= yytable
[yyn
];
527 yystate
= yydgoto
[yym
];
530 printf("yydebug: after reduction, shifting from state %d \
531 to state %d\n", *yyssp
, yystate
);
533 if (yyssp
>= yyss
+ yystacksize
- 1)
541 yyerror("yacc stack overflow");
552 #endif /* wxUSE_PROLOGIO */