1 /* A Bison parser, made by GNU Bison 1.875d. */
3 /* Skeleton parser for Yacc-like parsing with Bison, Copyright (C) 1984,
4 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
29 /* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
36 /* turn off some warning as this is generated code */
38 # pragma warning ( disable : 4702 ) /* unreachable code */
41 /* Identify Bison output. */
45 #define YYSKELETON_NAME "yacc.c"
50 /* Using locations. */
51 #define YYLSP_NEEDED 0
53 /* If NAME_PREFIX is specified substitute the variables and functions
55 #define yyparse cmExpr_yyparse
56 #define yylex cmExpr_yylex
57 #define yyerror cmExpr_yyerror
58 #define yylval cmExpr_yylval
59 #define yychar cmExpr_yychar
60 #define yydebug cmExpr_yydebug
61 #define yynerrs cmExpr_yynerrs
67 /* Put the tokens into the symbol table, so that GDB and other debuggers
78 exp_CLOSEPARENT
= 266,
89 #define exp_DIVIDE 261
91 #define exp_SHIFTLEFT 263
92 #define exp_SHIFTRIGHT 264
93 #define exp_OPENPARENT 265
94 #define exp_CLOSEPARENT 266
99 #define exp_NUMBER 271
104 /* Copy the first part of user declarations. */
107 /*=========================================================================
109 Program: CMake - Cross-Platform Makefile Generator
110 Module: $RCSfile: cmExprParser.cxx,v $
112 Date: $Date: 2007-03-05 15:36:06 $
113 Version: $Revision: 1.6 $
115 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
116 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
118 This software is distributed WITHOUT ANY WARRANTY; without even
119 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
120 PURPOSE. See the above copyright notices for more information.
122 =========================================================================*/
125 This file must be translated to C and modified to build everywhere.
129 bison --yacc --name-prefix=cmExpr_yy --defines=cmExprParserTokens.h
130 -ocmExprParser.cxx cmExprParser.y
132 Modify cmExprParser.cxx:
134 - add __HP_aCC to the #if test for yyerrorlab warning suppression
138 /* Configure the parser to use a lexer object. */
139 #define YYPARSE_PARAM yyscanner
140 #define YYLEX_PARAM yyscanner
141 #define YYERROR_VERBOSE 1
142 #define cmExpr_yyerror(x) \
143 cmExprError(yyscanner, x)
144 #define yyGetParser (cmExpr_yyget_extra(yyscanner))
146 /*-------------------------------------------------------------------------*/
147 #include "cmExprParserHelper.h" /* Interface to parser object. */
148 #include "cmExprLexer.h" /* Interface to lexer object. */
149 #include "cmExprParserTokens.h" /* Need YYSTYPE for YY_DECL. */
153 /* Forward declare the lexer entry point. */
156 /* Internal utility functions. */
157 static void cmExprError(yyscan_t yyscanner
, const char* message
);
160 //#define YYMAXDEPTH 100000
161 //#define YYINITDEPTH 10000
164 /* Disable some warnings in the generated code. */
166 # pragma warn -8004 /* Variable assigned a value that is not used. */
167 # pragma warn -8008 /* condition always returns true */
168 # pragma warn -8060 /* possibly incorrect assignment */
169 # pragma warn -8066 /* unreachable code */
172 # pragma warning (disable: 4102) /* Unused goto label. */
173 # pragma warning (disable: 4065) /* Switch statement contains default but
178 /* Enabling traces. */
183 /* Enabling verbose error messages. */
184 #ifdef YYERROR_VERBOSE
185 # undef YYERROR_VERBOSE
186 # define YYERROR_VERBOSE 1
188 # define YYERROR_VERBOSE 0
191 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
193 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
194 # define YYSTYPE_IS_DECLARED 1
195 # define YYSTYPE_IS_TRIVIAL 1
200 /* Copy the second part of user declarations. */
203 /* Line 214 of yacc.c. */
206 #if ! defined (yyoverflow) || YYERROR_VERBOSE
212 # define YYMALLOC malloc
215 /* The parser invokes alloca or malloc; define the necessary symbols. */
217 # ifdef YYSTACK_USE_ALLOCA
218 # if YYSTACK_USE_ALLOCA
219 # define YYSTACK_ALLOC alloca
222 # if defined (alloca) || defined (_ALLOCA_H)
223 # define YYSTACK_ALLOC alloca
226 # define YYSTACK_ALLOC __builtin_alloca
231 # ifdef YYSTACK_ALLOC
232 /* Pacify GCC's `empty if-body' warning. */
233 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
235 # if defined (__STDC__) || defined (__cplusplus)
236 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
237 # define YYSIZE_T size_t
239 # define YYSTACK_ALLOC YYMALLOC
240 # define YYSTACK_FREE YYFREE
242 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
245 #if (! defined (yyoverflow) \
246 && (! defined (__cplusplus) \
247 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
249 /* A type that is properly aligned for any stack member. */
256 /* The size of the maximum gap between one aligned stack and the next. */
257 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
259 /* The size of an array large to enough to hold all stacks, each with
261 # define YYSTACK_BYTES(N) \
262 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
263 + YYSTACK_GAP_MAXIMUM)
265 /* Copy COUNT objects from FROM to TO. The source and destination do
268 # if defined (__GNUC__) && 1 < __GNUC__
269 # define YYCOPY(To, From, Count) \
270 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
272 # define YYCOPY(To, From, Count) \
275 register YYSIZE_T yyi; \
276 for (yyi = 0; yyi < (Count); yyi++) \
277 (To)[yyi] = (From)[yyi]; \
283 /* Relocate STACK from its old location to the new one. The
284 local variables YYSIZE and YYSTACKSIZE give the old and new number of
285 elements in the stack, and YYPTR gives the new location of the
286 stack. Advance YYPTR to a properly aligned location for the next
288 # define YYSTACK_RELOCATE(Stack) \
291 YYSIZE_T yynewbytes; \
292 YYCOPY (&yyptr->Stack, Stack, yysize); \
293 Stack = &yyptr->Stack; \
294 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
295 yyptr += yynewbytes / sizeof (*yyptr); \
301 #if defined (__STDC__) || defined (__cplusplus)
302 typedef signed char yysigned_char
;
304 typedef short int yysigned_char
;
307 /* YYFINAL -- State number of the termination state. */
309 /* YYLAST -- Last index in YYTABLE. */
312 /* YYNTOKENS -- Number of terminals. */
314 /* YYNNTS -- Number of nonterminals. */
316 /* YYNRULES -- Number of rules. */
318 /* YYNRULES -- Number of states. */
321 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
323 #define YYMAXUTOK 271
325 #define YYTRANSLATE(YYX) \
326 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
328 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
329 static const unsigned char yytranslate
[] =
331 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
332 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
333 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
334 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
335 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
336 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
337 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
338 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
339 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
340 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
341 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
342 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
343 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
344 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
345 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
346 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
347 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
348 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
349 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
350 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
351 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
352 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
353 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
354 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
355 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
356 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
357 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
362 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
364 static const unsigned char yyprhs
[] =
366 0, 0, 3, 5, 7, 11, 13, 17, 19, 23,
367 25, 29, 33, 35, 39, 43, 45, 49, 53, 57,
371 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
372 static const yysigned_char yyrhs
[] =
374 18, 0, -1, 19, -1, 20, -1, 19, 12, 20,
375 -1, 21, -1, 20, 14, 21, -1, 22, -1, 21,
376 13, 22, -1, 23, -1, 22, 8, 23, -1, 22,
377 9, 23, -1, 24, -1, 23, 3, 24, -1, 23,
378 4, 24, -1, 25, -1, 24, 5, 25, -1, 24,
379 6, 25, -1, 24, 7, 25, -1, 16, -1, 10,
383 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
384 static const unsigned char yyrline
[] =
386 0, 94, 94, 100, 103, 107, 110, 114, 117, 121,
387 124, 127, 132, 135, 138, 142, 145, 148, 151, 155,
392 #if YYDEBUG || YYERROR_VERBOSE
393 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
394 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
395 static const char *const yytname
[] =
397 "$end", "error", "$undefined", "exp_PLUS", "exp_MINUS", "exp_TIMES",
398 "exp_DIVIDE", "exp_MOD", "exp_SHIFTLEFT", "exp_SHIFTRIGHT",
399 "exp_OPENPARENT", "exp_CLOSEPARENT", "exp_OR", "exp_AND", "exp_XOR",
400 "exp_NOT", "exp_NUMBER", "$accept", "Start", "exp", "bitwiseor",
401 "bitwisexor", "bitwiseand", "shift", "term", "factor", 0
406 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
408 static const unsigned short int yytoknum
[] =
410 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
411 265, 266, 267, 268, 269, 270, 271
415 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
416 static const unsigned char yyr1
[] =
418 0, 17, 18, 19, 19, 20, 20, 21, 21, 22,
419 22, 22, 23, 23, 23, 24, 24, 24, 24, 25,
423 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
424 static const unsigned char yyr2
[] =
426 0, 2, 1, 1, 3, 1, 3, 1, 3, 1,
427 3, 3, 1, 3, 3, 1, 3, 3, 3, 1,
431 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
432 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
433 means the default is an error. */
434 static const unsigned char yydefact
[] =
436 0, 0, 19, 0, 2, 3, 5, 7, 9, 12,
437 15, 0, 1, 0, 0, 0, 0, 0, 0, 0,
438 0, 0, 0, 20, 4, 6, 8, 10, 11, 13,
442 /* YYDEFGOTO[NTERM-NUM]. */
443 static const yysigned_char yydefgoto
[] =
445 -1, 3, 4, 5, 6, 7, 8, 9, 10
448 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
450 #define YYPACT_NINF -14
451 static const yysigned_char yypact
[] =
453 -10, -10, -14, 18, 7, 6, 8, 2, 1, -4,
454 -14, 3, -14, -10, -10, -10, -10, -10, -10, -10,
455 -10, -10, -10, -14, 6, 8, 2, 1, 1, -4,
459 /* YYPGOTO[NTERM-NUM]. */
460 static const yysigned_char yypgoto
[] =
462 -14, -14, 21, 10, 11, 9, 0, -6, -13
465 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
466 positive, shift that token. If negative, reduce the rule which
467 number is the opposite. If zero, do what YYDEFACT says.
468 If YYTABLE_NINF, syntax error. */
469 #define YYTABLE_NINF -1
470 static const unsigned char yytable
[] =
472 1, 20, 21, 22, 18, 19, 2, 31, 32, 33,
473 16, 17, 29, 30, 23, 13, 27, 28, 12, 13,
474 14, 15, 11, 24, 26, 25
477 static const unsigned char yycheck
[] =
479 10, 5, 6, 7, 3, 4, 16, 20, 21, 22,
480 8, 9, 18, 19, 11, 12, 16, 17, 0, 12,
481 14, 13, 1, 13, 15, 14
484 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
485 symbol of state STATE-NUM. */
486 static const unsigned char yystos
[] =
488 0, 10, 16, 18, 19, 20, 21, 22, 23, 24,
489 25, 19, 0, 12, 14, 13, 8, 9, 3, 4,
490 5, 6, 7, 11, 20, 21, 22, 23, 23, 24,
494 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
495 # define YYSIZE_T __SIZE_TYPE__
497 #if ! defined (YYSIZE_T) && defined (size_t)
498 # define YYSIZE_T size_t
500 #if ! defined (YYSIZE_T)
501 # if defined (__STDC__) || defined (__cplusplus)
502 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
503 # define YYSIZE_T size_t
506 #if ! defined (YYSIZE_T)
507 # define YYSIZE_T unsigned int
510 #define yyerrok (yyerrstatus = 0)
511 #define yyclearin (yychar = YYEMPTY)
515 #define YYACCEPT goto yyacceptlab
516 #define YYABORT goto yyabortlab
517 #define YYERROR goto yyerrorlab
520 /* Like YYERROR except do call yyerror. This remains here temporarily
521 to ease the transition to the new meaning of YYERROR, for GCC.
522 Once GCC version 2 has supplanted version 1, this can go. */
524 #define YYFAIL goto yyerrlab
526 #define YYRECOVERING() (!!yyerrstatus)
528 #define YYBACKUP(Token, Value) \
530 if (yychar == YYEMPTY && yylen == 1) \
534 yytoken = YYTRANSLATE (yychar); \
540 yyerror ("syntax error: cannot back up");\
546 #define YYERRCODE 256
548 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
551 #ifndef YYLLOC_DEFAULT
552 # define YYLLOC_DEFAULT(Current, Rhs, N) \
553 ((Current).first_line = (Rhs)[1].first_line, \
554 (Current).first_column = (Rhs)[1].first_column, \
555 (Current).last_line = (Rhs)[N].last_line, \
556 (Current).last_column = (Rhs)[N].last_column)
559 /* YYLEX -- calling `yylex' with the right arguments. */
562 # define YYLEX yylex (&yylval, YYLEX_PARAM)
564 # define YYLEX yylex (&yylval)
567 /* Enable debugging if requested. */
571 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
572 # define YYFPRINTF fprintf
575 # define YYDPRINTF(Args) \
581 # define YYDSYMPRINT(Args) \
587 # define YYDSYMPRINTF(Title, Token, Value, Location) \
591 YYFPRINTF (stderr, "%s ", Title); \
592 yysymprint (stderr, \
594 YYFPRINTF (stderr, "\n"); \
598 /*------------------------------------------------------------------.
599 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
601 `------------------------------------------------------------------*/
603 #if defined (__STDC__) || defined (__cplusplus)
605 yy_stack_print (short int *bottom
, short int *top
)
608 yy_stack_print (bottom
, top
)
613 YYFPRINTF (stderr
, "Stack now");
614 for (/* Nothing. */; bottom
<= top
; ++bottom
)
615 YYFPRINTF (stderr
, " %d", *bottom
);
616 YYFPRINTF (stderr
, "\n");
619 # define YY_STACK_PRINT(Bottom, Top) \
622 yy_stack_print ((Bottom), (Top)); \
626 /*------------------------------------------------.
627 | Report that the YYRULE is going to be reduced. |
628 `------------------------------------------------*/
630 #if defined (__STDC__) || defined (__cplusplus)
632 yy_reduce_print (int yyrule
)
635 yy_reduce_print (yyrule
)
640 unsigned int yylno
= yyrline
[yyrule
];
641 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %u), ",
643 /* Print the symbols being reduced, and their result. */
644 for (yyi
= yyprhs
[yyrule
]; 0 <= yyrhs
[yyi
]; yyi
++)
645 YYFPRINTF (stderr
, "%s ", yytname
[yyrhs
[yyi
]]);
646 YYFPRINTF (stderr
, "-> %s\n", yytname
[yyr1
[yyrule
]]);
649 # define YY_REDUCE_PRINT(Rule) \
652 yy_reduce_print (Rule); \
655 /* Nonzero means print parse trace. It is left uninitialized so that
656 multiple parsers can coexist. */
659 # define YYDPRINTF(Args)
660 # define YYDSYMPRINT(Args)
661 # define YYDSYMPRINTF(Title, Token, Value, Location)
662 # define YY_STACK_PRINT(Bottom, Top)
663 # define YY_REDUCE_PRINT(Rule)
664 #endif /* !YYDEBUG */
667 /* YYINITDEPTH -- initial size of the parser's stacks. */
669 # define YYINITDEPTH 200
672 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
673 if the built-in stack extension method is used).
675 Do not make this value too large; the results are undefined if
676 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
677 evaluated with infinite-precision integer arithmetic. */
679 #if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
684 # define YYMAXDEPTH 10000
692 # if defined (__GLIBC__) && defined (_STRING_H)
693 # define yystrlen strlen
695 /* Return the length of YYSTR. */
697 # if defined (__STDC__) || defined (__cplusplus)
698 yystrlen (const char *yystr
)
704 register const char *yys
= yystr
;
706 while (*yys
++ != '\0')
709 return yys
- yystr
- 1;
715 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
716 # define yystpcpy stpcpy
718 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
721 # if defined (__STDC__) || defined (__cplusplus)
722 yystpcpy (char *yydest
, const char *yysrc
)
724 yystpcpy (yydest
, yysrc
)
729 register char *yyd
= yydest
;
730 register const char *yys
= yysrc
;
732 while ((*yyd
++ = *yys
++) != '\0')
740 #endif /* !YYERROR_VERBOSE */
745 /*--------------------------------.
746 | Print this symbol on YYOUTPUT. |
747 `--------------------------------*/
749 #if defined (__STDC__) || defined (__cplusplus)
751 yysymprint (FILE *yyoutput
, int yytype
, YYSTYPE
*yyvaluep
)
754 yysymprint (yyoutput
, yytype
, yyvaluep
)
760 /* Pacify ``unused variable'' warnings. */
763 if (yytype
< YYNTOKENS
)
765 YYFPRINTF (yyoutput
, "token %s (", yytname
[yytype
]);
767 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
771 YYFPRINTF (yyoutput
, "nterm %s (", yytname
[yytype
]);
778 YYFPRINTF (yyoutput
, ")");
781 #endif /* ! YYDEBUG */
782 /*-----------------------------------------------.
783 | Release the memory associated to this symbol. |
784 `-----------------------------------------------*/
786 #if defined (__STDC__) || defined (__cplusplus)
788 yydestruct (int yytype
, YYSTYPE
*yyvaluep
)
791 yydestruct (yytype
, yyvaluep
)
796 /* Pacify ``unused variable'' warnings. */
808 /* Prevent warnings from -Wmissing-prototypes. */
811 # if defined (__STDC__) || defined (__cplusplus)
812 int yyparse (void *YYPARSE_PARAM
);
816 #else /* ! YYPARSE_PARAM */
817 #if defined (__STDC__) || defined (__cplusplus)
822 #endif /* ! YYPARSE_PARAM */
834 # if defined (__STDC__) || defined (__cplusplus)
835 int yyparse (void *YYPARSE_PARAM
)
837 int yyparse (YYPARSE_PARAM
)
840 #else /* ! YYPARSE_PARAM */
841 #if defined (__STDC__) || defined (__cplusplus)
851 /* The lookahead symbol. */
854 /* The semantic value of the lookahead symbol. */
857 /* Number of syntax errors so far. */
860 register int yystate
;
863 /* Number of tokens to shift before error messages enabled. */
865 /* Lookahead token as an internal (translated) token number. */
868 /* Three stacks and their tools:
869 `yyss': related to states,
870 `yyvs': related to semantic values,
871 `yyls': related to locations.
873 Refer to the stacks thru separate pointers, to allow yyoverflow
874 to reallocate them elsewhere. */
876 /* The state stack. */
877 short int yyssa
[YYINITDEPTH
];
878 short int *yyss
= yyssa
;
879 register short int *yyssp
;
881 /* The semantic value stack. */
882 YYSTYPE yyvsa
[YYINITDEPTH
];
883 YYSTYPE
*yyvs
= yyvsa
;
884 register YYSTYPE
*yyvsp
;
888 #define YYPOPSTACK (yyvsp--, yyssp--)
890 YYSIZE_T yystacksize
= YYINITDEPTH
;
892 /* The variables used to return semantic value and location from the
897 /* When reducing, the number of symbols on the RHS of the reduced
901 YYDPRINTF ((stderr
, "Starting parse\n"));
906 yychar
= YYEMPTY
; /* Cause a token to be read. */
908 /* Initialize stack pointers.
909 Waste one element of value and location stack
910 so that they stay on the same level as the state stack.
911 The wasted elements are never initialized. */
919 /*------------------------------------------------------------.
920 | yynewstate -- Push a new state, which is found in yystate. |
921 `------------------------------------------------------------*/
923 /* In all cases, when you get here, the value and location stacks
924 have just been pushed. so pushing a state here evens the stacks.
931 if (yyss
+ yystacksize
- 1 <= yyssp
)
933 /* Get the current used size of the three stacks, in elements. */
934 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
938 /* Give user a chance to reallocate the stack. Use copies of
939 these so that the &'s don't force the real ones into
941 YYSTYPE
*yyvs1
= yyvs
;
942 short int *yyss1
= yyss
;
945 /* Each stack pointer address is followed by the size of the
946 data in use in that stack, in bytes. This used to be a
947 conditional around just the two extra args, but that might
948 be undefined if yyoverflow is a macro. */
949 yyoverflow ("parser stack overflow",
950 &yyss1
, yysize
* sizeof (*yyssp
),
951 &yyvs1
, yysize
* sizeof (*yyvsp
),
958 #else /* no yyoverflow */
959 # ifndef YYSTACK_RELOCATE
962 /* Extend the stack our own way. */
963 if (YYMAXDEPTH
<= yystacksize
)
966 if (YYMAXDEPTH
< yystacksize
)
967 yystacksize
= YYMAXDEPTH
;
970 short int *yyss1
= yyss
;
971 union yyalloc
*yyptr
=
972 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
975 YYSTACK_RELOCATE (yyss
);
976 YYSTACK_RELOCATE (yyvs
);
978 # undef YYSTACK_RELOCATE
980 YYSTACK_FREE (yyss1
);
983 #endif /* no yyoverflow */
985 yyssp
= yyss
+ yysize
- 1;
986 yyvsp
= yyvs
+ yysize
- 1;
989 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
990 (unsigned long int) yystacksize
));
992 if (yyss
+ yystacksize
- 1 <= yyssp
)
996 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1005 /* Do appropriate processing given the current state. */
1006 /* Read a lookahead token if we need one and don't already have one. */
1009 /* First try to decide what to do without reference to lookahead token. */
1011 yyn
= yypact
[yystate
];
1012 if (yyn
== YYPACT_NINF
)
1015 /* Not known => get a lookahead token if don't already have one. */
1017 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1018 if (yychar
== YYEMPTY
)
1020 YYDPRINTF ((stderr
, "Reading a token: "));
1024 if (yychar
<= YYEOF
)
1026 yychar
= yytoken
= YYEOF
;
1027 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1031 yytoken
= YYTRANSLATE (yychar
);
1032 YYDSYMPRINTF ("Next token is", yytoken
, &yylval
, &yylloc
);
1035 /* If the proper action on seeing token YYTOKEN is to reduce or to
1036 detect an error, take that action. */
1038 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1043 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
1052 /* Shift the lookahead token. */
1053 YYDPRINTF ((stderr
, "Shifting token %s, ", yytname
[yytoken
]));
1055 /* Discard the token being shifted unless it is eof. */
1056 if (yychar
!= YYEOF
)
1062 /* Count tokens shifted since error; after three, turn off error
1071 /*-----------------------------------------------------------.
1072 | yydefault -- do the default action for the current state. |
1073 `-----------------------------------------------------------*/
1075 yyn
= yydefact
[yystate
];
1081 /*-----------------------------.
1082 | yyreduce -- Do a reduction. |
1083 `-----------------------------*/
1085 /* yyn is the number of a rule to reduce with. */
1088 /* If YYLEN is nonzero, implement the default value of the action:
1091 Otherwise, the following line sets YYVAL to garbage.
1092 This behavior is undocumented and Bison
1093 users should not rely upon it. Assigning to YYVAL
1094 unconditionally makes the parser a bit smaller, and it avoids a
1095 GCC warning that YYVAL may be used uninitialized. */
1096 yyval
= yyvsp
[1-yylen
];
1099 YY_REDUCE_PRINT (yyn
);
1105 yyGetParser
->SetResult(yyvsp
[0].Number
);
1111 {yyval
.Number
= yyvsp
[0].Number
;}
1116 {yyval
.Number
= yyvsp
[-2].Number
| yyvsp
[0].Number
;}
1121 {yyval
.Number
= yyvsp
[0].Number
;}
1126 {yyval
.Number
= yyvsp
[-2].Number
^ yyvsp
[0].Number
;}
1131 {yyval
.Number
= yyvsp
[0].Number
;}
1136 {yyval
.Number
= yyvsp
[-2].Number
& yyvsp
[0].Number
;}
1141 {yyval
.Number
= yyvsp
[0].Number
;}
1146 {yyval
.Number
= yyvsp
[-2].Number
<< yyvsp
[0].Number
;}
1151 {yyval
.Number
= yyvsp
[-2].Number
>> yyvsp
[0].Number
;}
1156 {yyval
.Number
= yyvsp
[0].Number
;}
1161 {yyval
.Number
= yyvsp
[-2].Number
+ yyvsp
[0].Number
;}
1166 {yyval
.Number
= yyvsp
[-2].Number
- yyvsp
[0].Number
;}
1171 {yyval
.Number
= yyvsp
[0].Number
;}
1176 {yyval
.Number
= yyvsp
[-2].Number
* yyvsp
[0].Number
;}
1181 {yyval
.Number
= yyvsp
[-2].Number
/ yyvsp
[0].Number
;}
1186 {yyval
.Number
= yyvsp
[-2].Number
% yyvsp
[0].Number
;}
1191 {yyval
.Number
= yyvsp
[0].Number
;}
1196 {yyval
.Number
= yyvsp
[-1].Number
;}
1202 /* Line 1010 of yacc.c. */
1209 YY_STACK_PRINT (yyss
, yyssp
);
1214 /* Now `shift' the result of the reduction. Determine what state
1215 that goes to, based on the state we popped back to and the rule
1216 number reduced by. */
1220 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
1221 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1222 yystate
= yytable
[yystate
];
1224 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
1229 /*------------------------------------.
1230 | yyerrlab -- here on detecting error |
1231 `------------------------------------*/
1233 /* If not already recovering from an error, report this error. */
1238 yyn
= yypact
[yystate
];
1240 if (YYPACT_NINF
< yyn
&& yyn
< YYLAST
)
1242 YYSIZE_T yysize
= 0;
1243 int yytype
= YYTRANSLATE (yychar
);
1244 const char* yyprefix
;
1248 /* Start YYX at -YYN if negative to avoid negative indexes in
1250 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
1252 /* Stay within bounds of both yycheck and yytname. */
1253 int yychecklim
= YYLAST
- yyn
;
1254 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
1257 yyprefix
= ", expecting ";
1258 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1259 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1261 yysize
+= yystrlen (yyprefix
) + yystrlen (yytname
[yyx
]);
1269 yysize
+= (sizeof ("syntax error, unexpected ")
1270 + yystrlen (yytname
[yytype
]));
1271 yymsg
= (char *) YYSTACK_ALLOC (yysize
);
1274 char *yyp
= yystpcpy (yymsg
, "syntax error, unexpected ");
1275 yyp
= yystpcpy (yyp
, yytname
[yytype
]);
1279 yyprefix
= ", expecting ";
1280 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1281 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
1283 yyp
= yystpcpy (yyp
, yyprefix
);
1284 yyp
= yystpcpy (yyp
, yytname
[yyx
]);
1289 YYSTACK_FREE (yymsg
);
1292 yyerror ("syntax error; also virtual memory exhausted");
1295 #endif /* YYERROR_VERBOSE */
1296 yyerror ("syntax error");
1301 if (yyerrstatus
== 3)
1303 /* If just tried and failed to reuse lookahead token after an
1304 error, discard it. */
1306 if (yychar
<= YYEOF
)
1308 /* If at end of input, pop the error token,
1309 then the rest of the stack, then return failure. */
1310 if (yychar
== YYEOF
)
1316 YYDSYMPRINTF ("Error: popping", yystos
[*yyssp
], yyvsp
, yylsp
);
1317 yydestruct (yystos
[*yyssp
], yyvsp
);
1322 YYDSYMPRINTF ("Error: discarding", yytoken
, &yylval
, &yylloc
);
1323 yydestruct (yytoken
, &yylval
);
1329 /* Else will try to reuse lookahead token after shifting the error
1334 /*---------------------------------------------------.
1335 | yyerrorlab -- error raised explicitly by YYERROR. |
1336 `---------------------------------------------------*/
1339 #if defined( __GNUC__ ) || defined(__HP_aCC)
1340 /* Pacify GCC when the user code never invokes YYERROR and the label
1341 yyerrorlab therefore never appears in user code. */
1352 /*-------------------------------------------------------------.
1353 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1354 `-------------------------------------------------------------*/
1356 yyerrstatus
= 3; /* Each real token shifted decrements this. */
1360 yyn
= yypact
[yystate
];
1361 if (yyn
!= YYPACT_NINF
)
1364 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
1372 /* Pop the current state because it cannot handle the error token. */
1376 YYDSYMPRINTF ("Error: popping", yystos
[*yyssp
], yyvsp
, yylsp
);
1377 yydestruct (yystos
[yystate
], yyvsp
);
1380 YY_STACK_PRINT (yyss
, yyssp
);
1386 YYDPRINTF ((stderr
, "Shifting error token, "));
1395 /*-------------------------------------.
1396 | yyacceptlab -- YYACCEPT comes here. |
1397 `-------------------------------------*/
1402 /*-----------------------------------.
1403 | yyabortlab -- YYABORT comes here. |
1404 `-----------------------------------*/
1410 /*----------------------------------------------.
1411 | yyoverflowlab -- parser overflow comes here. |
1412 `----------------------------------------------*/
1414 yyerror ("parser stack overflow");
1422 YYSTACK_FREE (yyss
);
1430 /* End of grammar */
1432 /*--------------------------------------------------------------------------*/
1433 void cmExprError(yyscan_t yyscanner
, const char* message
)
1435 yyGetParser
->Error(message
);