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 /*============================================================================
108 CMake - Cross Platform Makefile Generator
109 Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
111 Distributed under the OSI-approved BSD License (the "License");
112 see accompanying file Copyright.txt for details.
114 This software is distributed WITHOUT ANY WARRANTY; without even the
115 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
116 See the License for more information.
117 ============================================================================*/
120 This file must be translated to C and modified to build everywhere.
124 bison --yacc --name-prefix=cmExpr_yy --defines=cmExprParserTokens.h
125 -ocmExprParser.cxx cmExprParser.y
127 Modify cmExprParser.cxx:
129 - add __HP_aCC to the #if test for yyerrorlab warning suppression
133 /* Configure the parser to use a lexer object. */
134 #define YYPARSE_PARAM yyscanner
135 #define YYLEX_PARAM yyscanner
136 #define YYERROR_VERBOSE 1
137 #define cmExpr_yyerror(x) \
138 cmExprError(yyscanner, x)
139 #define yyGetParser (cmExpr_yyget_extra(yyscanner))
141 /*-------------------------------------------------------------------------*/
142 #include "cmExprParserHelper.h" /* Interface to parser object. */
143 #include "cmExprLexer.h" /* Interface to lexer object. */
144 #include "cmExprParserTokens.h" /* Need YYSTYPE for YY_DECL. */
148 /* Forward declare the lexer entry point. */
151 /* Internal utility functions. */
152 static void cmExprError(yyscan_t yyscanner, const char* message);
155 //#define YYMAXDEPTH 100000
156 //#define YYINITDEPTH 10000
159 /* Disable some warnings in the generated code. */
161 # pragma warn -8004 /* Variable assigned a value that is not used. */
162 # pragma warn -8008 /* condition always returns true */
163 # pragma warn -8060 /* possibly incorrect assignment */
164 # pragma warn -8066 /* unreachable code */
167 # pragma warning (disable: 4102) /* Unused goto label. */
168 # pragma warning (disable: 4065) /* Switch statement contains default but
173 /* Enabling traces. */
178 /* Enabling verbose error messages. */
179 #ifdef YYERROR_VERBOSE
180 # undef YYERROR_VERBOSE
181 # define YYERROR_VERBOSE 1
183 # define YYERROR_VERBOSE 0
186 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
188 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
189 # define YYSTYPE_IS_DECLARED 1
190 # define YYSTYPE_IS_TRIVIAL 1
195 /* Copy the second part of user declarations. */
198 /* Line 214 of yacc.c. */
201 #if ! defined (yyoverflow) || YYERROR_VERBOSE
207 # define YYMALLOC malloc
210 /* The parser invokes alloca or malloc; define the necessary symbols. */
212 # ifdef YYSTACK_USE_ALLOCA
213 # if YYSTACK_USE_ALLOCA
214 # define YYSTACK_ALLOC alloca
217 # if defined (alloca) || defined (_ALLOCA_H)
218 # define YYSTACK_ALLOC alloca
221 # define YYSTACK_ALLOC __builtin_alloca
226 # ifdef YYSTACK_ALLOC
227 /* Pacify GCC's `empty if-body' warning. */
228 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
230 # if defined (__STDC__) || defined (__cplusplus)
231 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
232 # define YYSIZE_T size_t
234 # define YYSTACK_ALLOC YYMALLOC
235 # define YYSTACK_FREE YYFREE
237 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
240 #if (! defined (yyoverflow) \
241 && (! defined (__cplusplus) \
242 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
244 /* A type that is properly aligned for any stack member. */
251 /* The size of the maximum gap between one aligned stack and the next. */
252 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
254 /* The size of an array large to enough to hold all stacks, each with
256 # define YYSTACK_BYTES(N) \
257 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
258 + YYSTACK_GAP_MAXIMUM)
260 /* Copy COUNT objects from FROM to TO. The source and destination do
263 # if defined (__GNUC__) && 1 < __GNUC__
264 # define YYCOPY(To, From, Count) \
265 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
267 # define YYCOPY(To, From, Count) \
271 for (yyi = 0; yyi < (Count); yyi++) \
272 (To)[yyi] = (From)[yyi]; \
278 /* Relocate STACK from its old location to the new one. The
279 local variables YYSIZE and YYSTACKSIZE give the old and new number of
280 elements in the stack, and YYPTR gives the new location of the
281 stack. Advance YYPTR to a properly aligned location for the next
283 # define YYSTACK_RELOCATE(Stack) \
286 YYSIZE_T yynewbytes; \
287 YYCOPY (&yyptr->Stack, Stack, yysize); \
288 Stack = &yyptr->Stack; \
289 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
290 yyptr += yynewbytes / sizeof (*yyptr); \
296 #if defined (__STDC__) || defined (__cplusplus)
297 typedef signed char yysigned_char;
299 typedef short int yysigned_char;
302 /* YYFINAL -- State number of the termination state. */
304 /* YYLAST -- Last index in YYTABLE. */
307 /* YYNTOKENS -- Number of terminals. */
309 /* YYNNTS -- Number of nonterminals. */
311 /* YYNRULES -- Number of rules. */
313 /* YYNRULES -- Number of states. */
316 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
318 #define YYMAXUTOK 271
320 #define YYTRANSLATE(YYX) \
321 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
323 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
324 static const unsigned char yytranslate[] =
326 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
327 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
328 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
329 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
330 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
331 2, 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, 1, 2, 3, 4,
352 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
357 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
359 static const unsigned char yyprhs[] =
361 0, 0, 3, 5, 7, 11, 13, 17, 19, 23,
362 25, 29, 33, 35, 39, 43, 45, 49, 53, 57,
366 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
367 static const yysigned_char yyrhs[] =
369 18, 0, -1, 19, -1, 20, -1, 19, 12, 20,
370 -1, 21, -1, 20, 14, 21, -1, 22, -1, 21,
371 13, 22, -1, 23, -1, 22, 8, 23, -1, 22,
372 9, 23, -1, 24, -1, 23, 3, 24, -1, 23,
373 4, 24, -1, 25, -1, 24, 5, 25, -1, 24,
374 6, 25, -1, 24, 7, 25, -1, 16, -1, 10,
378 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
379 static const unsigned char yyrline[] =
381 0, 94, 94, 100, 103, 107, 110, 114, 117, 121,
382 124, 127, 132, 135, 138, 142, 145, 148, 151, 155,
387 #if YYDEBUG || YYERROR_VERBOSE
388 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
389 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
390 static const char *const yytname[] =
392 "$end", "error", "$undefined", "exp_PLUS", "exp_MINUS", "exp_TIMES",
393 "exp_DIVIDE", "exp_MOD", "exp_SHIFTLEFT", "exp_SHIFTRIGHT",
394 "exp_OPENPARENT", "exp_CLOSEPARENT", "exp_OR", "exp_AND", "exp_XOR",
395 "exp_NOT", "exp_NUMBER", "$accept", "Start", "exp", "bitwiseor",
396 "bitwisexor", "bitwiseand", "shift", "term", "factor", 0
401 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
403 static const unsigned short int yytoknum[] =
405 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
406 265, 266, 267, 268, 269, 270, 271
410 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
411 static const unsigned char yyr1[] =
413 0, 17, 18, 19, 19, 20, 20, 21, 21, 22,
414 22, 22, 23, 23, 23, 24, 24, 24, 24, 25,
418 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
419 static const unsigned char yyr2[] =
421 0, 2, 1, 1, 3, 1, 3, 1, 3, 1,
422 3, 3, 1, 3, 3, 1, 3, 3, 3, 1,
426 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
427 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
428 means the default is an error. */
429 static const unsigned char yydefact[] =
431 0, 0, 19, 0, 2, 3, 5, 7, 9, 12,
432 15, 0, 1, 0, 0, 0, 0, 0, 0, 0,
433 0, 0, 0, 20, 4, 6, 8, 10, 11, 13,
437 /* YYDEFGOTO[NTERM-NUM]. */
438 static const yysigned_char yydefgoto[] =
440 -1, 3, 4, 5, 6, 7, 8, 9, 10
443 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
445 #define YYPACT_NINF -14
446 static const yysigned_char yypact[] =
448 -10, -10, -14, 18, 7, 6, 8, 2, 1, -4,
449 -14, 3, -14, -10, -10, -10, -10, -10, -10, -10,
450 -10, -10, -10, -14, 6, 8, 2, 1, 1, -4,
454 /* YYPGOTO[NTERM-NUM]. */
455 static const yysigned_char yypgoto[] =
457 -14, -14, 21, 10, 11, 9, 0, -6, -13
460 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
461 positive, shift that token. If negative, reduce the rule which
462 number is the opposite. If zero, do what YYDEFACT says.
463 If YYTABLE_NINF, syntax error. */
464 #define YYTABLE_NINF -1
465 static const unsigned char yytable[] =
467 1, 20, 21, 22, 18, 19, 2, 31, 32, 33,
468 16, 17, 29, 30, 23, 13, 27, 28, 12, 13,
469 14, 15, 11, 24, 26, 25
472 static const unsigned char yycheck[] =
474 10, 5, 6, 7, 3, 4, 16, 20, 21, 22,
475 8, 9, 18, 19, 11, 12, 16, 17, 0, 12,
476 14, 13, 1, 13, 15, 14
479 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
480 symbol of state STATE-NUM. */
481 static const unsigned char yystos[] =
483 0, 10, 16, 18, 19, 20, 21, 22, 23, 24,
484 25, 19, 0, 12, 14, 13, 8, 9, 3, 4,
485 5, 6, 7, 11, 20, 21, 22, 23, 23, 24,
489 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
490 # define YYSIZE_T __SIZE_TYPE__
492 #if ! defined (YYSIZE_T) && defined (size_t)
493 # define YYSIZE_T size_t
495 #if ! defined (YYSIZE_T)
496 # if defined (__STDC__) || defined (__cplusplus)
497 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
498 # define YYSIZE_T size_t
501 #if ! defined (YYSIZE_T)
502 # define YYSIZE_T unsigned int
505 #define yyerrok (yyerrstatus = 0)
506 #define yyclearin (yychar = YYEMPTY)
510 #define YYACCEPT goto yyacceptlab
511 #define YYABORT goto yyabortlab
512 #define YYERROR goto yyerrorlab
515 /* Like YYERROR except do call yyerror. This remains here temporarily
516 to ease the transition to the new meaning of YYERROR, for GCC.
517 Once GCC version 2 has supplanted version 1, this can go. */
519 #define YYFAIL goto yyerrlab
521 #define YYRECOVERING() (!!yyerrstatus)
523 #define YYBACKUP(Token, Value) \
525 if (yychar == YYEMPTY && yylen == 1) \
529 yytoken = YYTRANSLATE (yychar); \
535 yyerror ("syntax error: cannot back up");\
541 #define YYERRCODE 256
543 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
546 #ifndef YYLLOC_DEFAULT
547 # define YYLLOC_DEFAULT(Current, Rhs, N) \
548 ((Current).first_line = (Rhs)[1].first_line, \
549 (Current).first_column = (Rhs)[1].first_column, \
550 (Current).last_line = (Rhs)[N].last_line, \
551 (Current).last_column = (Rhs)[N].last_column)
554 /* YYLEX -- calling `yylex' with the right arguments. */
557 # define YYLEX yylex (&yylval, YYLEX_PARAM)
559 # define YYLEX yylex (&yylval)
562 /* Enable debugging if requested. */
566 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
567 # define YYFPRINTF fprintf
570 # define YYDPRINTF(Args) \
576 # define YYDSYMPRINT(Args) \
582 # define YYDSYMPRINTF(Title, Token, Value, Location) \
586 YYFPRINTF (stderr, "%s ", Title); \
587 yysymprint (stderr, \
589 YYFPRINTF (stderr, "\n"); \
593 /*------------------------------------------------------------------.
594 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
596 `------------------------------------------------------------------*/
598 #if defined (__STDC__) || defined (__cplusplus)
600 yy_stack_print (short int *bottom, short int *top)
603 yy_stack_print (bottom, top)
608 YYFPRINTF (stderr, "Stack now");
609 for (/* Nothing. */; bottom <= top; ++bottom)
610 YYFPRINTF (stderr, " %d", *bottom);
611 YYFPRINTF (stderr, "\n");
614 # define YY_STACK_PRINT(Bottom, Top) \
617 yy_stack_print ((Bottom), (Top)); \
621 /*------------------------------------------------.
622 | Report that the YYRULE is going to be reduced. |
623 `------------------------------------------------*/
625 #if defined (__STDC__) || defined (__cplusplus)
627 yy_reduce_print (int yyrule)
630 yy_reduce_print (yyrule)
635 unsigned int yylno = yyrline[yyrule];
636 YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
638 /* Print the symbols being reduced, and their result. */
639 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
640 YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
641 YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
644 # define YY_REDUCE_PRINT(Rule) \
647 yy_reduce_print (Rule); \
650 /* Nonzero means print parse trace. It is left uninitialized so that
651 multiple parsers can coexist. */
654 # define YYDPRINTF(Args)
655 # define YYDSYMPRINT(Args)
656 # define YYDSYMPRINTF(Title, Token, Value, Location)
657 # define YY_STACK_PRINT(Bottom, Top)
658 # define YY_REDUCE_PRINT(Rule)
659 #endif /* !YYDEBUG */
662 /* YYINITDEPTH -- initial size of the parser's stacks. */
664 # define YYINITDEPTH 200
667 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
668 if the built-in stack extension method is used).
670 Do not make this value too large; the results are undefined if
671 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
672 evaluated with infinite-precision integer arithmetic. */
674 #if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
679 # define YYMAXDEPTH 10000
687 # if defined (__GLIBC__) && defined (_STRING_H)
688 # define yystrlen strlen
690 /* Return the length of YYSTR. */
692 # if defined (__STDC__) || defined (__cplusplus)
693 yystrlen (const char *yystr)
699 const char *yys = yystr;
701 while (*yys++ != '\0')
704 return yys - yystr - 1;
710 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
711 # define yystpcpy stpcpy
713 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
716 # if defined (__STDC__) || defined (__cplusplus)
717 yystpcpy (char *yydest, const char *yysrc)
719 yystpcpy (yydest, yysrc)
725 const char *yys = yysrc;
727 while ((*yyd++ = *yys++) != '\0')
735 #endif /* !YYERROR_VERBOSE */
740 /*--------------------------------.
741 | Print this symbol on YYOUTPUT. |
742 `--------------------------------*/
744 #if defined (__STDC__) || defined (__cplusplus)
746 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
749 yysymprint (yyoutput, yytype, yyvaluep)
755 /* Pacify ``unused variable'' warnings. */
758 if (yytype < YYNTOKENS)
760 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
762 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
766 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
773 YYFPRINTF (yyoutput, ")");
776 #endif /* ! YYDEBUG */
777 /*-----------------------------------------------.
778 | Release the memory associated to this symbol. |
779 `-----------------------------------------------*/
781 #if defined (__STDC__) || defined (__cplusplus)
783 yydestruct (int yytype, YYSTYPE *yyvaluep)
786 yydestruct (yytype, yyvaluep)
791 /* Pacify ``unused variable'' warnings. */
803 /* Prevent warnings from -Wmissing-prototypes. */
806 # if defined (__STDC__) || defined (__cplusplus)
807 int yyparse (void *YYPARSE_PARAM);
811 #else /* ! YYPARSE_PARAM */
812 #if defined (__STDC__) || defined (__cplusplus)
817 #endif /* ! YYPARSE_PARAM */
829 # if defined (__STDC__) || defined (__cplusplus)
830 int yyparse (void *YYPARSE_PARAM)
832 int yyparse (YYPARSE_PARAM)
835 #else /* ! YYPARSE_PARAM */
836 #if defined (__STDC__) || defined (__cplusplus)
846 /* The lookahead symbol. */
849 /* The semantic value of the lookahead symbol. */
852 /* Number of syntax errors so far. */
858 /* Number of tokens to shift before error messages enabled. */
860 /* Lookahead token as an internal (translated) token number. */
863 /* Three stacks and their tools:
864 `yyss': related to states,
865 `yyvs': related to semantic values,
866 `yyls': related to locations.
868 Refer to the stacks thru separate pointers, to allow yyoverflow
869 to reallocate them elsewhere. */
871 /* The state stack. */
872 short int yyssa[YYINITDEPTH];
873 short int *yyss = yyssa;
876 /* The semantic value stack. */
877 YYSTYPE yyvsa[YYINITDEPTH];
878 YYSTYPE *yyvs = yyvsa;
883 #define YYPOPSTACK (yyvsp--, yyssp--)
885 YYSIZE_T yystacksize = YYINITDEPTH;
887 /* The variables used to return semantic value and location from the
892 /* When reducing, the number of symbols on the RHS of the reduced
896 YYDPRINTF ((stderr, "Starting parse\n"));
901 yychar = YYEMPTY; /* Cause a token to be read. */
903 /* Initialize stack pointers.
904 Waste one element of value and location stack
905 so that they stay on the same level as the state stack.
906 The wasted elements are never initialized. */
914 /*------------------------------------------------------------.
915 | yynewstate -- Push a new state, which is found in yystate. |
916 `------------------------------------------------------------*/
918 /* In all cases, when you get here, the value and location stacks
919 have just been pushed. so pushing a state here evens the stacks.
926 if (yyss + yystacksize - 1 <= yyssp)
928 /* Get the current used size of the three stacks, in elements. */
929 YYSIZE_T yysize = yyssp - yyss + 1;
933 /* Give user a chance to reallocate the stack. Use copies of
934 these so that the &'s don't force the real ones into
936 YYSTYPE *yyvs1 = yyvs;
937 short int *yyss1 = yyss;
940 /* Each stack pointer address is followed by the size of the
941 data in use in that stack, in bytes. This used to be a
942 conditional around just the two extra args, but that might
943 be undefined if yyoverflow is a macro. */
944 yyoverflow ("parser stack overflow",
945 &yyss1, yysize * sizeof (*yyssp),
946 &yyvs1, yysize * sizeof (*yyvsp),
953 #else /* no yyoverflow */
954 # ifndef YYSTACK_RELOCATE
957 /* Extend the stack our own way. */
958 if (YYMAXDEPTH <= yystacksize)
961 if (YYMAXDEPTH < yystacksize)
962 yystacksize = YYMAXDEPTH;
965 short int *yyss1 = yyss;
966 union yyalloc *yyptr =
967 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
970 YYSTACK_RELOCATE (yyss);
971 YYSTACK_RELOCATE (yyvs);
973 # undef YYSTACK_RELOCATE
975 YYSTACK_FREE (yyss1);
978 #endif /* no yyoverflow */
980 yyssp = yyss + yysize - 1;
981 yyvsp = yyvs + yysize - 1;
984 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
985 (unsigned long int) yystacksize));
987 if (yyss + yystacksize - 1 <= yyssp)
991 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1000 /* Do appropriate processing given the current state. */
1001 /* Read a lookahead token if we need one and don't already have one. */
1004 /* First try to decide what to do without reference to lookahead token. */
1006 yyn = yypact[yystate];
1007 if (yyn == YYPACT_NINF)
1010 /* Not known => get a lookahead token if don't already have one. */
1012 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1013 if (yychar == YYEMPTY)
1015 YYDPRINTF ((stderr, "Reading a token: "));
1019 if (yychar <= YYEOF)
1021 yychar = yytoken = YYEOF;
1022 YYDPRINTF ((stderr, "Now at end of input.\n"));
1026 yytoken = YYTRANSLATE (yychar);
1027 YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
1030 /* If the proper action on seeing token YYTOKEN is to reduce or to
1031 detect an error, take that action. */
1033 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1038 if (yyn == 0 || yyn == YYTABLE_NINF)
1047 /* Shift the lookahead token. */
1048 YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
1050 /* Discard the token being shifted unless it is eof. */
1051 if (yychar != YYEOF)
1057 /* Count tokens shifted since error; after three, turn off error
1066 /*-----------------------------------------------------------.
1067 | yydefault -- do the default action for the current state. |
1068 `-----------------------------------------------------------*/
1070 yyn = yydefact[yystate];
1076 /*-----------------------------.
1077 | yyreduce -- Do a reduction. |
1078 `-----------------------------*/
1080 /* yyn is the number of a rule to reduce with. */
1083 /* If YYLEN is nonzero, implement the default value of the action:
1086 Otherwise, the following line sets YYVAL to garbage.
1087 This behavior is undocumented and Bison
1088 users should not rely upon it. Assigning to YYVAL
1089 unconditionally makes the parser a bit smaller, and it avoids a
1090 GCC warning that YYVAL may be used uninitialized. */
1091 yyval = yyvsp[1-yylen];
1094 YY_REDUCE_PRINT (yyn);
1100 yyGetParser->SetResult(yyvsp[0].Number);
1106 {yyval.Number = yyvsp[0].Number;}
1111 {yyval.Number = yyvsp[-2].Number | yyvsp[0].Number;}
1116 {yyval.Number = yyvsp[0].Number;}
1121 {yyval.Number = yyvsp[-2].Number ^ yyvsp[0].Number;}
1126 {yyval.Number = yyvsp[0].Number;}
1131 {yyval.Number = yyvsp[-2].Number & yyvsp[0].Number;}
1136 {yyval.Number = yyvsp[0].Number;}
1141 {yyval.Number = yyvsp[-2].Number << yyvsp[0].Number;}
1146 {yyval.Number = yyvsp[-2].Number >> yyvsp[0].Number;}
1151 {yyval.Number = yyvsp[0].Number;}
1156 {yyval.Number = yyvsp[-2].Number + yyvsp[0].Number;}
1161 {yyval.Number = yyvsp[-2].Number - yyvsp[0].Number;}
1166 {yyval.Number = yyvsp[0].Number;}
1171 {yyval.Number = yyvsp[-2].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[0].Number;}
1191 {yyval.Number = yyvsp[-1].Number;}
1197 /* Line 1010 of yacc.c. */
1204 YY_STACK_PRINT (yyss, yyssp);
1209 /* Now `shift' the result of the reduction. Determine what state
1210 that goes to, based on the state we popped back to and the rule
1211 number reduced by. */
1215 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1216 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1217 yystate = yytable[yystate];
1219 yystate = yydefgoto[yyn - YYNTOKENS];
1224 /*------------------------------------.
1225 | yyerrlab -- here on detecting error |
1226 `------------------------------------*/
1228 /* If not already recovering from an error, report this error. */
1233 yyn = yypact[yystate];
1235 if (YYPACT_NINF < yyn && yyn < YYLAST)
1237 YYSIZE_T yysize = 0;
1238 int yytype = YYTRANSLATE (yychar);
1239 const char* yyprefix;
1243 /* Start YYX at -YYN if negative to avoid negative indexes in
1245 int yyxbegin = yyn < 0 ? -yyn : 0;
1247 /* Stay within bounds of both yycheck and yytname. */
1248 int yychecklim = YYLAST - yyn;
1249 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1252 yyprefix = ", expecting ";
1253 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1254 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1256 yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
1264 yysize += (sizeof ("syntax error, unexpected ")
1265 + yystrlen (yytname[yytype]));
1266 yymsg = (char *) YYSTACK_ALLOC (yysize);
1269 char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
1270 yyp = yystpcpy (yyp, yytname[yytype]);
1274 yyprefix = ", expecting ";
1275 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1276 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1278 yyp = yystpcpy (yyp, yyprefix);
1279 yyp = yystpcpy (yyp, yytname[yyx]);
1284 YYSTACK_FREE (yymsg);
1287 yyerror ("syntax error; also virtual memory exhausted");
1290 #endif /* YYERROR_VERBOSE */
1291 yyerror ("syntax error");
1296 if (yyerrstatus == 3)
1298 /* If just tried and failed to reuse lookahead token after an
1299 error, discard it. */
1301 if (yychar <= YYEOF)
1303 /* If at end of input, pop the error token,
1304 then the rest of the stack, then return failure. */
1305 if (yychar == YYEOF)
1311 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1312 yydestruct (yystos[*yyssp], yyvsp);
1317 YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
1318 yydestruct (yytoken, &yylval);
1324 /* Else will try to reuse lookahead token after shifting the error
1329 /*---------------------------------------------------.
1330 | yyerrorlab -- error raised explicitly by YYERROR. |
1331 `---------------------------------------------------*/
1334 #if defined( __GNUC__ ) || defined(__HP_aCC)
1335 /* Pacify GCC when the user code never invokes YYERROR and the label
1336 yyerrorlab therefore never appears in user code. */
1347 /*-------------------------------------------------------------.
1348 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1349 `-------------------------------------------------------------*/
1351 yyerrstatus = 3; /* Each real token shifted decrements this. */
1355 yyn = yypact[yystate];
1356 if (yyn != YYPACT_NINF)
1359 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1367 /* Pop the current state because it cannot handle the error token. */
1371 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1372 yydestruct (yystos[yystate], yyvsp);
1375 YY_STACK_PRINT (yyss, yyssp);
1381 YYDPRINTF ((stderr, "Shifting error token, "));
1390 /*-------------------------------------.
1391 | yyacceptlab -- YYACCEPT comes here. |
1392 `-------------------------------------*/
1397 /*-----------------------------------.
1398 | yyabortlab -- YYABORT comes here. |
1399 `-----------------------------------*/
1405 /*----------------------------------------------.
1406 | yyoverflowlab -- parser overflow comes here. |
1407 `----------------------------------------------*/
1409 yyerror ("parser stack overflow");
1417 YYSTACK_FREE (yyss);
1425 /* End of grammar */
1427 /*--------------------------------------------------------------------------*/
1428 void cmExprError(yyscan_t yyscanner, const char* message)
1430 yyGetParser->Error(message);