]>
git.saurik.com Git - wxWidgets.git/blob - src/common/dosyacc.c
1 /* include platform.h first to get __WIN32__ definition */
2 #include "wx/platform.h"
3 #if defined(__WIN32__) || defined(__GNUWIN32__)
4 /* all Win32 compilers can handle C++ comments, and C++ comments
5 is the only C++ in setup.h */
9 #if !defined(wxUSE_PROLOGIO) || wxUSE_PROLOGIO
12 static char yysccsid
[] = "@(#)yaccpar 1.7 (Berkeley) 09/09/90";
17 #if defined(_MSC_VER) || defined(__VISAGECPP__)
23 #define __EXTERN_C__ 1
26 #if defined(__cplusplus) || defined(__STDC__)
27 #if defined(__cplusplus) && defined(__EXTERN_C__)
34 int yyback(int *, int);
36 /* You may need to put /DLEX_SCANNER in your makefile
37 * if you're using LEX!
40 /* int yyoutput(int); */
46 #if defined(__cplusplus) || defined(__STDC__)
47 #if defined(__cplusplus) && defined(__EXTERN_C__)
54 /* struct pexpr *expr; */
67 #define CLOSE_SQUARE 10
72 0, 0, 1, 1, 1, 2, 2, 2, 3, 3,
73 3, 4, 4, 5, 5, 5, 5, 5, 5, 5,
76 0, 2, 2, 2, 2, 4, 2, 3, 0, 1,
77 3, 3, 1, 1, 1, 1, 3, 3, 5, 1,
79 short yydefred
[] = { 1,
80 0, 0, 0, 0, 2, 0, 5, 3, 0, 0,
81 0, 15, 7, 20, 0, 0, 13, 4, 0, 0,
82 0, 0, 8, 0, 6, 0, 18, 0, 12, 11,
85 short yydgoto
[] = { 1,
88 short yysindex
[] = { 0,
89 -2, 9, 2, 1, 0, 10, 0, 0, 11, -5,
90 17, 0, 0, 0, 14, -1, 0, 0, 33, 38,
91 41, 16, 0, 11, 0, 29, 0, 40, 0, 0,
94 short yyrindex
[] = { 0,
95 0, 0, 0, 0, 0, 0, 0, 0, 42, 21,
96 24, 0, 0, 0, 0, 30, 0, 0, 0, 0,
97 0, 0, 0, 31, 0, 27, 0, 24, 0, 0,
100 short yygindex
[] = { 0,
103 #define YYTABLESIZE 254
104 short yytable
[] = { 3,
105 19, 10, 11, 12, 24, 9, 4, 20, 21, 4,
106 13, 10, 11, 12, 8, 30, 10, 28, 12, 4,
107 9, 7, 18, 23, 4, 16, 16, 22, 14, 14,
108 16, 17, 17, 14, 10, 9, 17, 25, 26, 10,
109 9, 27, 31, 9, 32, 6, 9, 29, 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,
128 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
129 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
132 short yycheck
[] = { 2,
133 9, 1, 2, 3, 6, 4, 9, 13, 14, 9,
134 10, 1, 2, 3, 13, 24, 1, 2, 3, 9,
135 4, 13, 13, 10, 9, 5, 6, 11, 5, 6,
136 10, 5, 6, 10, 5, 5, 10, 5, 1, 10,
137 10, 1, 14, 4, 1, 1, 5, 22, -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,
156 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
157 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
164 #define YYMAXTOKEN 14
167 "end-of-file","INTEGER","WORD","STRING","OPEN","CLOSE","COMMA","NEWLINE",
168 "ERROR","OPEN_SQUARE","CLOSE_SQUARE","EQUALS",0,"PERIOD","EXP",
171 "$accept : commands",
173 "commands : commands command",
174 "command : WORD PERIOD",
175 "command : expr PERIOD",
176 "command : error PERIOD",
177 "expr : WORD OPEN arglist CLOSE",
178 "expr : OPEN_SQUARE CLOSE_SQUARE",
179 "expr : OPEN_SQUARE arglist CLOSE_SQUARE",
182 "arglist : arg COMMA arglist",
183 "arg : WORD EQUALS arg1",
188 "arg1 : INTEGER PERIOD INTEGER",
189 "arg1 : INTEGER EXP INTEGER",
190 "arg1 : INTEGER PERIOD INTEGER EXP INTEGER",
194 #define yyclearin (yychar=(-1))
195 #define yyerrok (yyerrflag=0)
198 #define YYMAXDEPTH YYSTACKSIZE
202 #define YYSTACKSIZE YYMAXDEPTH
204 #define YYSTACKSIZE 600
205 #define YYMAXDEPTH 600
216 short yyss
[YYSTACKSIZE
];
217 YYSTYPE yyvs
[YYSTACKSIZE
];
218 #define yystacksize YYSTACKSIZE
222 #include "../common/doslex.c"
224 #include "../common/lex_yy.c"
235 /* Ansi prototype. If this doesn't work for you... uncomment
239 void yyerror(char *s
)
245 * Unfortunately, my DOS version of FLEX
246 * requires yywrap to be #def'ed, whereas
247 * the UNIX flex expects a proper function.
250 /* Not sure if __SC__ is the appropriate thing
260 # if !(defined(__VISAGECPP__) && __IBMC__ >= 400)
261 /* VA 4.0 thinks this is multiply defined (in lex_yy.c) */
262 int yywrap() { return 1; }
267 #define YYABORT goto yyabort
268 #define YYACCEPT goto yyaccept
269 #define YYERROR goto yyerrlab
273 register int yym
, yyn
, yystate
;
276 extern char *getenv();
278 yys
= getenv("YYDEBUG");
282 if (yyn
>= '0' && yyn
<= '9')
293 *yyssp
= yystate
= 0;
296 yyn
= yydefred
[yystate
];
297 if (yyn
!= 0) goto yyreduce
;
300 if ((yychar
= yylex()) < 0) yychar
= 0;
305 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
306 if (!yys
) yys
= "illegal-symbol";
307 printf("yydebug: state %d, reading %d (%s)\n", yystate
,
312 if ((yyn
= yysindex
[yystate
]) && (yyn
+= yychar
) >= 0 &&
313 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yychar
)
317 printf("yydebug: state %d, shifting to state %d\n",
318 yystate
, yytable
[yyn
]);
320 if (yyssp
>= yyss
+ yystacksize
- 1)
324 *++yyssp
= yystate
= yytable
[yyn
];
327 if (yyerrflag
> 0) --yyerrflag
;
330 if ((yyn
= yyrindex
[yystate
]) && (yyn
+= yychar
) >= 0 &&
331 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yychar
)
336 if (yyerrflag
) goto yyinrecovery
;
341 yyerror("syntax error");
353 if ((yyn
= yysindex
[*yyssp
]) && (yyn
+= YYERRCODE
) >= 0 &&
354 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == YYERRCODE
)
358 printf("yydebug: state %d, error recovery shifting\
359 to state %d\n", *yyssp
, yytable
[yyn
]);
361 if (yyssp
>= yyss
+ yystacksize
- 1)
365 *++yyssp
= yystate
= yytable
[yyn
];
373 printf("yydebug: error recovery discarding state %d\n",
376 if (yyssp
<= yyss
) goto yyabort
;
384 if (yychar
== 0) goto yyabort
;
389 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
390 if (!yys
) yys
= "illegal-symbol";
391 printf("yydebug: state %d, error recovery discards token %d (%s)\n",
392 yystate
, yychar
, yys
);
401 printf("yydebug: state %d, reducing by rule %d (%s)\n",
402 yystate
, yyn
, yyrule
[yyn
]);
405 yyval
= yyvsp
[1-yym
];
410 {process_command(proio_cons(wxmake_word(yyvsp
[-1].s
), NULL
)); free(yyvsp
[-1].s
);}
414 {process_command(yyvsp
[-1].s
);}
418 {syntax_error("Unrecognized command.");}
422 {yyval
.s
= proio_cons(wxmake_word(yyvsp
[-3].s
), yyvsp
[-1].s
); free(yyvsp
[-3].s
);}
426 {yyval
.s
= proio_cons(NULL
, NULL
);}
430 {yyval
.s
= yyvsp
[-1].s
; }
438 {yyval
.s
= proio_cons(yyvsp
[0].s
, NULL
);}
442 {yyval
.s
= proio_cons(yyvsp
[-2].s
, yyvsp
[0].s
);}
446 {yyval
.s
= proio_cons(wxmake_word("="), proio_cons(wxmake_word(yyvsp
[-2].s
), proio_cons(yyvsp
[0].s
, NULL
)));
451 {yyval
.s
= yyvsp
[0].s
; }
455 {yyval
.s
= wxmake_word(yyvsp
[0].s
); free(yyvsp
[0].s
);}
459 {yyval
.s
= wxmake_string(yyvsp
[0].s
); free(yyvsp
[0].s
);}
463 {yyval
.s
= wxmake_integer(yyvsp
[0].s
); free(yyvsp
[0].s
);}
467 {yyval
.s
= wxmake_real(yyvsp
[-2].s
, yyvsp
[0].s
); free(yyvsp
[-2].s
); free(yyvsp
[0].s
); }
471 {yyval
.s
= wxmake_exp(yyvsp
[-2].s
, yyvsp
[0].s
); free(yyvsp
[-2].s
); free(yyvsp
[0].s
); }
475 {yyval
.s
= wxmake_exp2(yyvsp
[-4].s
, yyvsp
[-2].s
, yyvsp
[0].s
); free(yyvsp
[-4].s
); free(yyvsp
[-2].s
);
480 {yyval
.s
= yyvsp
[0].s
;}
488 if (yystate
== 0 && yym
== 0)
492 printf("yydebug: after reduction, shifting from state 0 to\
493 state %d\n", YYFINAL
);
500 if ((yychar
= yylex()) < 0) yychar
= 0;
505 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
506 if (!yys
) yys
= "illegal-symbol";
507 printf("yydebug: state %d, reading %d (%s)\n",
508 YYFINAL
, yychar
, yys
);
512 if (yychar
== 0) goto yyaccept
;
515 if ((yyn
= yygindex
[yym
]) && (yyn
+= yystate
) >= 0 &&
516 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yystate
)
517 yystate
= yytable
[yyn
];
519 yystate
= yydgoto
[yym
];
522 printf("yydebug: after reduction, shifting from state %d \
523 to state %d\n", *yyssp
, yystate
);
525 if (yyssp
>= yyss
+ yystacksize
- 1)
533 yyerror("yacc stack overflow");
540 #endif /* wxUSE_PROLOGIO */