Mercurial > vba-clojure
view src/sdl/expr.cpp @ 324:7876781520ea
fixed set-cursor so that moving the cursor backwards works
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Wed, 04 Apr 2012 01:04:06 -0500 |
parents | f9f4f1b99eed |
children |
line wrap: on
line source
2 /* A Bison parser, made from expr.y3 by GNU Bison version 1.28 */5 #define YYBISON 1 /* Identify Bison output. */7 #define TOKEN_IDENTIFIER 2578 #define TOKEN_DOT 2589 #define TOKEN_STAR 25910 #define TOKEN_ARROW 26011 #define TOKEN_ADDR 26112 #define TOKEN_SIZEOF 26213 #define TOKEN_NUMBER 26315 #line 1 "expr.y"17 namespace std {18 #include <stdio.h>19 #include <memory.h>20 #include <stdlib.h>21 #include <string.h>22 }24 using namespace std;26 #include "../common/System.h"27 #include "../gba/elf.h"28 #include "exprNode.h"30 extern int yyerror(char *);31 extern int yylex();32 extern char *yytext;35 //#define YYERROR_VERBOSE 136 //#define YYDEBUG 138 Node *result = NULL;39 #ifndef YYSTYPE40 #define YYSTYPE int41 #endif42 #include <stdio.h>44 #ifndef __cplusplus45 #ifndef __STDC__46 #define const47 #endif48 #endif52 #define YYFINAL 2653 #define YYFLAG -3276854 #define YYNTBASE 1456 #define YYTRANSLATE(x) ((unsigned)(x) <= 263 ? yytranslate[x] : 19)58 static const char yytranslate[] = { 0,59 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,60 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,61 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,62 2, 2, 2, 2, 2, 2, 2, 2, 2, 11,63 12, 2, 2, 2, 2, 2, 2, 2, 2, 2,64 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,65 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,66 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,67 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,68 10, 2, 13, 2, 2, 2, 2, 2, 2, 2,69 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,70 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,71 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,72 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,73 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,74 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,75 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,76 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,77 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,78 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,79 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,80 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,81 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,82 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,83 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,84 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,85 7, 8, 986 };88 #if YYDEBUG != 089 static const short yyprhs[] = { 0,90 0, 2, 4, 8, 12, 16, 21, 23, 26, 29,91 34, 3692 };94 static const short yyrhs[] = { 15,95 0, 16, 0, 11, 15, 12, 0, 15, 4, 18,96 0, 15, 6, 18, 0, 15, 10, 17, 13, 0,97 18, 0, 5, 15, 0, 7, 15, 0, 8, 11,98 15, 12, 0, 9, 0, 3, 099 };101 #endif103 #if YYDEBUG != 0104 static const short yyrline[] = { 0,105 32, 35, 36, 37, 38, 39, 42, 43, 44, 45,106 49, 53107 };108 #endif111 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)113 static const char * const yytname[] = { "$","error","$undefined.","TOKEN_IDENTIFIER",114 "TOKEN_DOT","TOKEN_STAR","TOKEN_ARROW","TOKEN_ADDR","TOKEN_SIZEOF","TOKEN_NUMBER",115 "'['","'('","')'","']'","final","expression","simple_expression","number","ident", NULL116 };117 #endif119 static const short yyr1[] = { 0,120 14, 15, 15, 15, 15, 15, 16, 16, 16, 16,121 17, 18122 };124 static const short yyr2[] = { 0,125 1, 1, 3, 3, 3, 4, 1, 2, 2, 4,126 1, 1127 };129 static const short yydefact[] = { 0,130 12, 0, 0, 0, 0, 1, 2, 7, 8, 9,131 0, 0, 0, 0, 0, 0, 3, 4, 5, 11,132 0, 10, 6, 0, 0, 0133 };135 static const short yydefgoto[] = { 24,136 6, 7, 21, 8137 };139 static const short yypact[] = { -1,140 -32768, -1, -1, -6, -1, 17,-32768,-32768, 17, 17,141 -1, 7, 5, 5, 13, 8,-32768,-32768,-32768,-32768,142 11,-32768,-32768, 25, 26,-32768143 };145 static const short yypgoto[] = {-32768,146 -2,-32768,-32768, 2147 };150 #define YYLAST 27153 static const short yytable[] = { 9,154 10, 1, 12, 2, 11, 3, 4, 1, 16, 5,155 13, 13, 14, 14, 18, 19, 15, 15, 17, 22,156 13, 20, 14, 23, 25, 26, 15157 };159 static const short yycheck[] = { 2,160 3, 3, 5, 5, 11, 7, 8, 3, 11, 11,161 4, 4, 6, 6, 13, 14, 10, 10, 12, 12,162 4, 9, 6, 13, 0, 0, 10163 };164 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */165 #line 3 "/usr/lib/bison.simple"166 /* This file comes from bison-1.28. */168 /* Skeleton output parser for bison,169 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.171 This program is free software; you can redistribute it and/or modify172 it under the terms of the GNU General Public License as published by173 the Free Software Foundation; either version 2, or (at your option)174 any later version.176 This program is distributed in the hope that it will be useful,177 but WITHOUT ANY WARRANTY; without even the implied warranty of178 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the179 GNU General Public License for more details.181 You should have received a copy of the GNU General Public License182 along with this program; if not, write to the Free Software183 Foundation, Inc., 59 Temple Place - Suite 330,184 Boston, MA 02111-1307, USA. */186 /* As a special exception, when this file is copied by Bison into a187 Bison output file, you may use that output file without restriction.188 This special exception was added by the Free Software Foundation189 in version 1.24 of Bison. */191 /* This is the parser code that is written into each bison parser192 when the %semantic_parser declaration is not specified in the grammar.193 It was written by Richard Stallman by simplifying the hairy parser194 used when %semantic_parser is specified. */196 #ifndef YYSTACK_USE_ALLOCA197 #ifdef alloca198 #define YYSTACK_USE_ALLOCA199 #else /* alloca not defined */200 #ifdef __GNUC__201 #define YYSTACK_USE_ALLOCA202 #define alloca __builtin_alloca203 #else /* not GNU C. */204 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))205 #define YYSTACK_USE_ALLOCA206 #include <alloca.h>207 #else /* not sparc */208 /* We think this test detects Watcom and Microsoft C. */209 /* This used to test MSDOS, but that is a bad idea210 since that symbol is in the user namespace. */211 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)212 #if 0 /* No need for malloc.h, which pollutes the namespace;213 instead, just don't use alloca. */214 #include <malloc.h>215 #endif216 #else /* not MSDOS, or __TURBOC__ */217 #if defined(_AIX)218 /* I don't know what this was needed for, but it pollutes the namespace.219 So I turned it off. rms, 2 May 1997. */220 /* #include <malloc.h> */221 #pragma alloca222 #define YYSTACK_USE_ALLOCA223 #else /* not MSDOS, or __TURBOC__, or _AIX */224 #if 0225 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,226 and on HPUX 10. Eventually we can turn this on. */227 #define YYSTACK_USE_ALLOCA228 #define alloca __builtin_alloca229 #endif /* __hpux */230 #endif231 #endif /* not _AIX */232 #endif /* not MSDOS, or __TURBOC__ */233 #endif /* not sparc */234 #endif /* not GNU C */235 #endif /* alloca not defined */236 #endif /* YYSTACK_USE_ALLOCA not defined */238 #ifdef YYSTACK_USE_ALLOCA239 #define YYSTACK_ALLOC alloca240 #else241 #define YYSTACK_ALLOC malloc242 #endif244 /* Note: there must be only one dollar sign in this file.245 It is replaced by the list of actions, each action246 as one case of the switch. */248 #define yyerrok (yyerrstatus = 0)249 #define yyclearin (yychar = YYEMPTY)250 #define YYEMPTY -2251 #define YYEOF 0252 #define YYACCEPT goto yyacceptlab253 #define YYABORT goto yyabortlab254 #define YYERROR goto yyerrlab1255 /* Like YYERROR except do call yyerror.256 This remains here temporarily to ease the257 transition to the new meaning of YYERROR, for GCC.258 Once GCC version 2 has supplanted version 1, this can go. */259 #define YYFAIL goto yyerrlab260 #define YYRECOVERING() (!!yyerrstatus)261 #define YYBACKUP(token, value) \262 do \263 if (yychar == YYEMPTY && yylen == 1) \264 { yychar = (token), yylval = (value); \265 yychar1 = YYTRANSLATE (yychar); \266 YYPOPSTACK; \267 goto yybackup; \268 } \269 else \270 { yyerror ("syntax error: cannot back up"); YYERROR; } \271 while (0)273 #define YYTERROR 1274 #define YYERRCODE 256276 #ifndef YYPURE277 #define YYLEX yylex()278 #endif280 #ifdef YYPURE281 #ifdef YYLSP_NEEDED282 #ifdef YYLEX_PARAM283 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)284 #else285 #define YYLEX yylex(&yylval, &yylloc)286 #endif287 #else /* not YYLSP_NEEDED */288 #ifdef YYLEX_PARAM289 #define YYLEX yylex(&yylval, YYLEX_PARAM)290 #else291 #define YYLEX yylex(&yylval)292 #endif293 #endif /* not YYLSP_NEEDED */294 #endif296 /* If nonreentrant, generate the variables here */298 #ifndef YYPURE300 int yychar; /* the lookahead symbol */301 YYSTYPE yylval; /* the semantic value of the */302 /* lookahead symbol */304 #ifdef YYLSP_NEEDED305 YYLTYPE yylloc; /* location data for the lookahead */306 /* symbol */307 #endif309 int yynerrs; /* number of parse errors so far */310 #endif /* not YYPURE */312 #if YYDEBUG != 0313 int yydebug; /* nonzero means print parse trace */314 /* Since this is uninitialized, it does not stop multiple parsers315 from coexisting. */316 #endif318 /* YYINITDEPTH indicates the initial size of the parser's stacks */320 #ifndef YYINITDEPTH321 #define YYINITDEPTH 200322 #endif324 /* YYMAXDEPTH is the maximum size the stacks can grow to325 (effective only if the built-in stack extension method is used). */327 #if YYMAXDEPTH == 0328 #undef YYMAXDEPTH329 #endif331 #ifndef YYMAXDEPTH332 #define YYMAXDEPTH 10000333 #endif335 /* Define __yy_memcpy. Note that the size argument336 should be passed with type unsigned int, because that is what the non-GCC337 definitions require. With GCC, __builtin_memcpy takes an arg338 of type size_t, but it can handle unsigned int. */340 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */341 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)342 #else /* not GNU C or C++ */343 #ifndef __cplusplus345 /* This is the most reliable way to avoid incompatibilities346 in available built-in functions on various systems. */347 static void348 __yy_memcpy (to, from, count)349 char *to;350 char *from;351 unsigned int count;352 {353 register char *f = from;354 register char *t = to;355 register int i = count;357 while (i-- > 0)358 *t++ = *f++;359 }361 #else /* __cplusplus */363 /* This is the most reliable way to avoid incompatibilities364 in available built-in functions on various systems. */365 static void366 __yy_memcpy (char *to, char *from, unsigned int count)367 {368 register char *t = to;369 register char *f = from;370 register int i = count;372 while (i-- > 0)373 *t++ = *f++;374 }376 #endif377 #endif379 #line 217 "/usr/lib/bison.simple"381 /* The user can define YYPARSE_PARAM as the name of an argument to be passed382 into yyparse. The argument should have type void *.383 It should actually point to an object.384 Grammar actions can access the variable by casting it385 to the proper pointer type. */387 #ifdef YYPARSE_PARAM388 #ifdef __cplusplus389 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM390 #define YYPARSE_PARAM_DECL391 #else /* not __cplusplus */392 #define YYPARSE_PARAM_ARG YYPARSE_PARAM393 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;394 #endif /* not __cplusplus */395 #else /* not YYPARSE_PARAM */396 #define YYPARSE_PARAM_ARG397 #define YYPARSE_PARAM_DECL398 #endif /* not YYPARSE_PARAM */400 /* Prevent warning if -Wstrict-prototypes. */401 #ifdef __GNUC__402 #ifdef YYPARSE_PARAM403 int yyparse (void *);404 #else405 int yyparse (void);406 #endif407 #endif409 int410 yyparse(YYPARSE_PARAM_ARG)411 YYPARSE_PARAM_DECL412 {413 register int yystate;414 register int yyn;415 register short *yyssp;416 register YYSTYPE *yyvsp;417 int yyerrstatus; /* number of tokens to shift before error messages enabled */418 int yychar1 = 0; /* lookahead token as an internal (translated) token number */420 short yyssa[YYINITDEPTH]; /* the state stack */421 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */423 short *yyss = yyssa; /* refer to the stacks thru separate pointers */424 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */426 #ifdef YYLSP_NEEDED427 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */428 YYLTYPE *yyls = yylsa;429 YYLTYPE *yylsp;431 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)432 #else433 #define YYPOPSTACK (yyvsp--, yyssp--)434 #endif436 int yystacksize = YYINITDEPTH;437 int yyfree_stacks = 0;439 #ifdef YYPURE440 int yychar;441 YYSTYPE yylval;442 int yynerrs;443 #ifdef YYLSP_NEEDED444 YYLTYPE yylloc;445 #endif446 #endif448 YYSTYPE yyval; /* the variable used to return */449 /* semantic values from the action */450 /* routines */452 int yylen;454 #if YYDEBUG != 0455 if (yydebug)456 fprintf(stderr, "Starting parse\n");457 #endif459 yystate = 0;460 yyerrstatus = 0;461 yynerrs = 0;462 yychar = YYEMPTY; /* Cause a token to be read. */464 /* Initialize stack pointers.465 Waste one element of value and location stack466 so that they stay on the same level as the state stack.467 The wasted elements are never initialized. */469 yyssp = yyss - 1;470 yyvsp = yyvs;471 #ifdef YYLSP_NEEDED472 yylsp = yyls;473 #endif475 /* Push a new state, which is found in yystate . */476 /* In all cases, when you get here, the value and location stacks477 have just been pushed. so pushing a state here evens the stacks. */478 yynewstate:480 *++yyssp = yystate;482 if (yyssp >= yyss + yystacksize - 1)483 {484 /* Give user a chance to reallocate the stack */485 /* Use copies of these so that the &'s don't force the real ones into memory. */486 YYSTYPE *yyvs1 = yyvs;487 short *yyss1 = yyss;488 #ifdef YYLSP_NEEDED489 YYLTYPE *yyls1 = yyls;490 #endif492 /* Get the current used size of the three stacks, in elements. */493 int size = yyssp - yyss + 1;495 #ifdef yyoverflow496 /* Each stack pointer address is followed by the size of497 the data in use in that stack, in bytes. */498 #ifdef YYLSP_NEEDED499 /* This used to be a conditional around just the two extra args,500 but that might be undefined if yyoverflow is a macro. */501 yyoverflow("parser stack overflow",502 &yyss1, size * sizeof (*yyssp),503 &yyvs1, size * sizeof (*yyvsp),504 &yyls1, size * sizeof (*yylsp),505 &yystacksize);506 #else507 yyoverflow("parser stack overflow",508 &yyss1, size * sizeof (*yyssp),509 &yyvs1, size * sizeof (*yyvsp),510 &yystacksize);511 #endif513 yyss = yyss1; yyvs = yyvs1;514 #ifdef YYLSP_NEEDED515 yyls = yyls1;516 #endif517 #else /* no yyoverflow */518 /* Extend the stack our own way. */519 if (yystacksize >= YYMAXDEPTH)520 {521 yyerror("parser stack overflow");522 if (yyfree_stacks)523 {524 free (yyss);525 free (yyvs);526 #ifdef YYLSP_NEEDED527 free (yyls);528 #endif529 }530 return 2;531 }532 yystacksize *= 2;533 if (yystacksize > YYMAXDEPTH)534 yystacksize = YYMAXDEPTH;535 #ifndef YYSTACK_USE_ALLOCA536 yyfree_stacks = 1;537 #endif538 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));539 __yy_memcpy ((char *)yyss, (char *)yyss1,540 size * (unsigned int) sizeof (*yyssp));541 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));542 __yy_memcpy ((char *)yyvs, (char *)yyvs1,543 size * (unsigned int) sizeof (*yyvsp));544 #ifdef YYLSP_NEEDED545 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));546 __yy_memcpy ((char *)yyls, (char *)yyls1,547 size * (unsigned int) sizeof (*yylsp));548 #endif549 #endif /* no yyoverflow */551 yyssp = yyss + size - 1;552 yyvsp = yyvs + size - 1;553 #ifdef YYLSP_NEEDED554 yylsp = yyls + size - 1;555 #endif557 #if YYDEBUG != 0558 if (yydebug)559 fprintf(stderr, "Stack size increased to %d\n", yystacksize);560 #endif562 if (yyssp >= yyss + yystacksize - 1)563 YYABORT;564 }566 #if YYDEBUG != 0567 if (yydebug)568 fprintf(stderr, "Entering state %d\n", yystate);569 #endif571 goto yybackup;572 yybackup:574 /* Do appropriate processing given the current state. */575 /* Read a lookahead token if we need one and don't already have one. */576 /* yyresume: */578 /* First try to decide what to do without reference to lookahead token. */580 yyn = yypact[yystate];581 if (yyn == YYFLAG)582 goto yydefault;584 /* Not known => get a lookahead token if don't already have one. */586 /* yychar is either YYEMPTY or YYEOF587 or a valid token in external form. */589 if (yychar == YYEMPTY)590 {591 #if YYDEBUG != 0592 if (yydebug)593 fprintf(stderr, "Reading a token: ");594 #endif595 yychar = YYLEX;596 }598 /* Convert token to internal form (in yychar1) for indexing tables with */600 if (yychar <= 0) /* This means end of input. */601 {602 yychar1 = 0;603 yychar = YYEOF; /* Don't call YYLEX any more */605 #if YYDEBUG != 0606 if (yydebug)607 fprintf(stderr, "Now at end of input.\n");608 #endif609 }610 else611 {612 yychar1 = YYTRANSLATE(yychar);614 #if YYDEBUG != 0615 if (yydebug)616 {617 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);618 /* Give the individual parser a way to print the precise meaning619 of a token, for further debugging info. */620 #ifdef YYPRINT621 YYPRINT (stderr, yychar, yylval);622 #endif623 fprintf (stderr, ")\n");624 }625 #endif626 }628 yyn += yychar1;629 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)630 goto yydefault;632 yyn = yytable[yyn];634 /* yyn is what to do for this token type in this state.635 Negative => reduce, -yyn is rule number.636 Positive => shift, yyn is new state.637 New state is final state => don't bother to shift,638 just return success.639 0, or most negative number => error. */641 if (yyn < 0)642 {643 if (yyn == YYFLAG)644 goto yyerrlab;645 yyn = -yyn;646 goto yyreduce;647 }648 else if (yyn == 0)649 goto yyerrlab;651 if (yyn == YYFINAL)652 YYACCEPT;654 /* Shift the lookahead token. */656 #if YYDEBUG != 0657 if (yydebug)658 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);659 #endif661 /* Discard the token being shifted unless it is eof. */662 if (yychar != YYEOF)663 yychar = YYEMPTY;665 *++yyvsp = yylval;666 #ifdef YYLSP_NEEDED667 *++yylsp = yylloc;668 #endif670 /* count tokens shifted since error; after three, turn off error status. */671 if (yyerrstatus) yyerrstatus--;673 yystate = yyn;674 goto yynewstate;676 /* Do the default action for the current state. */677 yydefault:679 yyn = yydefact[yystate];680 if (yyn == 0)681 goto yyerrlab;683 /* Do a reduction. yyn is the number of a rule to reduce with. */684 yyreduce:685 yylen = yyr2[yyn];686 if (yylen > 0)687 yyval = yyvsp[1-yylen]; /* implement default value of the action */689 #if YYDEBUG != 0690 if (yydebug)691 {692 int i;694 fprintf (stderr, "Reducing via rule %d (line %d), ",695 yyn, yyrline[yyn]);697 /* Print the symbols being reduced, and their result. */698 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)699 fprintf (stderr, "%s ", yytname[yyrhs[i]]);700 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);701 }702 #endif705 switch (yyn) {707 case 1:708 #line 32 "expr.y"709 { result = yyvsp[0]; ;710 break;}711 case 2:712 #line 36 "expr.y"713 { yyval = yyvsp[0]; ;714 break;}715 case 3:716 #line 37 "expr.y"717 { yyval = yyvsp[-1]; ;718 break;}719 case 4:720 #line 38 "expr.y"721 { yyval = exprNodeDot(yyvsp[-2], yyvsp[0]); ;722 break;}723 case 5:724 #line 39 "expr.y"725 { yyval = exprNodeArrow(yyvsp[-2], yyvsp[0]); ;726 break;}727 case 6:728 #line 40 "expr.y"729 { yyval = exprNodeArray(yyvsp[-3], yyvsp[-1]); ;730 break;}731 case 7:732 #line 43 "expr.y"733 { yyval = yyvsp[0]; ;734 break;}735 case 8:736 #line 44 "expr.y"737 { yyval = exprNodeStar(yyvsp[0]); ;738 break;}739 case 9:740 #line 45 "expr.y"741 { yyval = exprNodeAddr(yyvsp[0]); ;742 break;}743 case 10:744 #line 46 "expr.y"745 { yyval = exprNodeSizeof(yyvsp[-1]); ;746 break;}747 case 11:748 #line 50 "expr.y"749 { yyval = exprNodeNumber(); ;750 break;}751 case 12:752 #line 54 "expr.y"753 {yyval = exprNodeIdentifier(); ;754 break;}755 }756 /* the action file gets copied in in place of this dollarsign */757 #line 543 "/usr/lib/bison.simple"759 yyvsp -= yylen;760 yyssp -= yylen;761 #ifdef YYLSP_NEEDED762 yylsp -= yylen;763 #endif765 #if YYDEBUG != 0766 if (yydebug)767 {768 short *ssp1 = yyss - 1;769 fprintf (stderr, "state stack now");770 while (ssp1 != yyssp)771 fprintf (stderr, " %d", *++ssp1);772 fprintf (stderr, "\n");773 }774 #endif776 *++yyvsp = yyval;778 #ifdef YYLSP_NEEDED779 yylsp++;780 if (yylen == 0)781 {782 yylsp->first_line = yylloc.first_line;783 yylsp->first_column = yylloc.first_column;784 yylsp->last_line = (yylsp-1)->last_line;785 yylsp->last_column = (yylsp-1)->last_column;786 yylsp->text = 0;787 }788 else789 {790 yylsp->last_line = (yylsp+yylen-1)->last_line;791 yylsp->last_column = (yylsp+yylen-1)->last_column;792 }793 #endif795 /* Now "shift" the result of the reduction.796 Determine what state that goes to,797 based on the state we popped back to798 and the rule number reduced by. */800 yyn = yyr1[yyn];802 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;803 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)804 yystate = yytable[yystate];805 else806 yystate = yydefgoto[yyn - YYNTBASE];808 goto yynewstate;810 yyerrlab: /* here on detecting error */812 if (! yyerrstatus)813 /* If not already recovering from an error, report this error. */814 {815 ++yynerrs;817 #ifdef YYERROR_VERBOSE818 yyn = yypact[yystate];820 if (yyn > YYFLAG && yyn < YYLAST)821 {822 int size = 0;823 char *msg;824 int x, count;826 count = 0;827 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */828 for (x = (yyn < 0 ? -yyn : 0);829 x < (sizeof(yytname) / sizeof(char *)); x++)830 if (yycheck[x + yyn] == x)831 size += strlen(yytname[x]) + 15, count++;832 msg = (char *) malloc(size + 15);833 if (msg != 0)834 {835 strcpy(msg, "parse error");837 if (count < 5)838 {839 count = 0;840 for (x = (yyn < 0 ? -yyn : 0);841 x < (sizeof(yytname) / sizeof(char *)); x++)842 if (yycheck[x + yyn] == x)843 {844 strcat(msg, count == 0 ? ", expecting `" : " or `");845 strcat(msg, yytname[x]);846 strcat(msg, "'");847 count++;848 }849 }850 yyerror(msg);851 free(msg);852 }853 else854 yyerror ("parse error; also virtual memory exceeded");855 }856 else857 #endif /* YYERROR_VERBOSE */858 yyerror("parse error");859 }861 goto yyerrlab1;862 yyerrlab1: /* here on error raised explicitly by an action */864 if (yyerrstatus == 3)865 {866 /* if just tried and failed to reuse lookahead token after an error, discard it. */868 /* return failure if at end of input */869 if (yychar == YYEOF)870 YYABORT;872 #if YYDEBUG != 0873 if (yydebug)874 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);875 #endif877 yychar = YYEMPTY;878 }880 /* Else will try to reuse lookahead token881 after shifting the error token. */883 yyerrstatus = 3; /* Each real token shifted decrements this */885 goto yyerrhandle;887 yyerrdefault: /* current state does not do anything special for the error token. */889 #if 0890 /* This is wrong; only states that explicitly want error tokens891 should shift them. */892 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/893 if (yyn) goto yydefault;894 #endif896 yyerrpop: /* pop the current state because it cannot handle the error token */898 if (yyssp == yyss) YYABORT;899 yyvsp--;900 yystate = *--yyssp;901 #ifdef YYLSP_NEEDED902 yylsp--;903 #endif905 #if YYDEBUG != 0906 if (yydebug)907 {908 short *ssp1 = yyss - 1;909 fprintf (stderr, "Error: state stack now");910 while (ssp1 != yyssp)911 fprintf (stderr, " %d", *++ssp1);912 fprintf (stderr, "\n");913 }914 #endif916 yyerrhandle:918 yyn = yypact[yystate];919 if (yyn == YYFLAG)920 goto yyerrdefault;922 yyn += YYTERROR;923 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)924 goto yyerrdefault;926 yyn = yytable[yyn];927 if (yyn < 0)928 {929 if (yyn == YYFLAG)930 goto yyerrpop;931 yyn = -yyn;932 goto yyreduce;933 }934 else if (yyn == 0)935 goto yyerrpop;937 if (yyn == YYFINAL)938 YYACCEPT;940 #if YYDEBUG != 0941 if (yydebug)942 fprintf(stderr, "Shifting error token, ");943 #endif945 *++yyvsp = yylval;946 #ifdef YYLSP_NEEDED947 *++yylsp = yylloc;948 #endif950 yystate = yyn;951 goto yynewstate;953 yyacceptlab:954 /* YYACCEPT comes here. */955 if (yyfree_stacks)956 {957 free (yyss);958 free (yyvs);959 #ifdef YYLSP_NEEDED960 free (yyls);961 #endif962 }963 return 0;965 yyabortlab:966 /* YYABORT comes here. */967 if (yyfree_stacks)968 {969 free (yyss);970 free (yyvs);971 #ifdef YYLSP_NEEDED972 free (yyls);973 #endif974 }975 return 1;976 }977 #line 57 "expr.y"980 int yyerror(char *s)981 {982 return 0;983 }985 #ifndef SDL986 extern FILE *yyin;987 int main(int argc, char **argv)988 {989 // yydebug = 1;990 ++argv, --argc;991 if(argc > 0)992 yyin = fopen(argv[0], "r");993 else994 yyin = stdin;995 if(!yyparse())996 result->print();997 }998 #endif