Imported Upstream version 2.8.12.2
[platform/upstream/cmake.git] / Source / cmExprParser.cxx
1 /* A Bison parser, made by GNU Bison 1.875d.  */
2
3 /* Skeleton parser for Yacc-like parsing with Bison, Copyright (C) 1984,
4    1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
5
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)
9    any later version.
10
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.
15
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.  */
20
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.  */
25
26 /* Written by Richard Stallman by simplifying the original so called
27    ``semantic'' parser.  */
28
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.  */
35
36 /* turn off some warning as this is generated code */
37 #if defined(_MSC_VER)
38 #  pragma warning ( disable : 4702 ) /* unreachable code */
39 #endif
40
41 /* Identify Bison output.  */
42 #define YYBISON 1
43
44 /* Skeleton name.  */
45 #define YYSKELETON_NAME "yacc.c"
46
47 /* Pure parsers.  */
48 #define YYPURE 1
49
50 /* Using locations.  */
51 #define YYLSP_NEEDED 0
52
53 /* If NAME_PREFIX is specified substitute the variables and functions
54    names.  */
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
62
63
64 /* Tokens.  */
65 #ifndef YYTOKENTYPE
66 # define YYTOKENTYPE
67    /* Put the tokens into the symbol table, so that GDB and other debuggers
68       know about them.  */
69    enum yytokentype {
70      exp_PLUS = 258,
71      exp_MINUS = 259,
72      exp_TIMES = 260,
73      exp_DIVIDE = 261,
74      exp_MOD = 262,
75      exp_SHIFTLEFT = 263,
76      exp_SHIFTRIGHT = 264,
77      exp_OPENPARENT = 265,
78      exp_CLOSEPARENT = 266,
79      exp_OR = 267,
80      exp_AND = 268,
81      exp_XOR = 269,
82      exp_NOT = 270,
83      exp_NUMBER = 271
84    };
85 #endif
86 #define exp_PLUS 258
87 #define exp_MINUS 259
88 #define exp_TIMES 260
89 #define exp_DIVIDE 261
90 #define exp_MOD 262
91 #define exp_SHIFTLEFT 263
92 #define exp_SHIFTRIGHT 264
93 #define exp_OPENPARENT 265
94 #define exp_CLOSEPARENT 266
95 #define exp_OR 267
96 #define exp_AND 268
97 #define exp_XOR 269
98 #define exp_NOT 270
99 #define exp_NUMBER 271
100
101
102
103
104 /* Copy the first part of user declarations.  */
105
106
107 /*============================================================================
108   CMake - Cross Platform Makefile Generator
109   Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
110
111   Distributed under the OSI-approved BSD License (the "License");
112   see accompanying file Copyright.txt for details.
113
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 ============================================================================*/
118 /*
119
120 This file must be translated to C and modified to build everywhere.
121
122 Run bison like this:
123
124   bison --yacc --name-prefix=cmExpr_yy --defines=cmExprParserTokens.h
125   -ocmExprParser.cxx cmExprParser.y
126
127 Modify cmExprParser.cxx:
128   - remove TABs
129   - add __HP_aCC to the #if test for yyerrorlab warning suppression
130
131 */
132
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))
140
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.  */
145
146 #include <math.h>
147
148 /* Forward declare the lexer entry point.  */
149 YY_DECL;
150
151 /* Internal utility functions.  */
152 static void cmExprError(yyscan_t yyscanner, const char* message);
153
154 #define YYDEBUG 1
155 //#define YYMAXDEPTH 100000
156 //#define YYINITDEPTH 10000
157
158
159 /* Disable some warnings in the generated code.  */
160 #ifdef __BORLANDC__
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 */
165 #endif
166 #ifdef _MSC_VER
167 # pragma warning (disable: 4102) /* Unused goto label.  */
168 # pragma warning (disable: 4065) /* Switch statement contains default but
169                                     no case. */
170 #endif
171
172
173 /* Enabling traces.  */
174 #ifndef YYDEBUG
175 # define YYDEBUG 0
176 #endif
177
178 /* Enabling verbose error messages.  */
179 #ifdef YYERROR_VERBOSE
180 # undef YYERROR_VERBOSE
181 # define YYERROR_VERBOSE 1
182 #else
183 # define YYERROR_VERBOSE 0
184 #endif
185
186 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
187 typedef int YYSTYPE;
188 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
189 # define YYSTYPE_IS_DECLARED 1
190 # define YYSTYPE_IS_TRIVIAL 1
191 #endif
192
193
194
195 /* Copy the second part of user declarations.  */
196
197
198 /* Line 214 of yacc.c.  */
199
200
201 #if ! defined (yyoverflow) || YYERROR_VERBOSE
202
203 # ifndef YYFREE
204 #  define YYFREE free
205 # endif
206 # ifndef YYMALLOC
207 #  define YYMALLOC malloc
208 # endif
209
210 /* The parser invokes alloca or malloc; define the necessary symbols.  */
211
212 # ifdef YYSTACK_USE_ALLOCA
213 #  if YYSTACK_USE_ALLOCA
214 #   define YYSTACK_ALLOC alloca
215 #  endif
216 # else
217 #  if defined (alloca) || defined (_ALLOCA_H)
218 #   define YYSTACK_ALLOC alloca
219 #  else
220 #   ifdef __GNUC__
221 #    define YYSTACK_ALLOC __builtin_alloca
222 #   endif
223 #  endif
224 # endif
225
226 # ifdef YYSTACK_ALLOC
227    /* Pacify GCC's `empty if-body' warning. */
228 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
229 # else
230 #  if defined (__STDC__) || defined (__cplusplus)
231 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
232 #   define YYSIZE_T size_t
233 #  endif
234 #  define YYSTACK_ALLOC YYMALLOC
235 #  define YYSTACK_FREE YYFREE
236 # endif
237 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
238
239
240 #if (! defined (yyoverflow) \
241      && (! defined (__cplusplus) \
242    || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
243
244 /* A type that is properly aligned for any stack member.  */
245 union yyalloc
246 {
247   short int yyss;
248   YYSTYPE yyvs;
249   };
250
251 /* The size of the maximum gap between one aligned stack and the next.  */
252 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
253
254 /* The size of an array large to enough to hold all stacks, each with
255    N elements.  */
256 # define YYSTACK_BYTES(N) \
257      ((N) * (sizeof (short int) + sizeof (YYSTYPE))      \
258       + YYSTACK_GAP_MAXIMUM)
259
260 /* Copy COUNT objects from FROM to TO.  The source and destination do
261    not overlap.  */
262 # ifndef YYCOPY
263 #  if defined (__GNUC__) && 1 < __GNUC__
264 #   define YYCOPY(To, From, Count) \
265       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
266 #  else
267 #   define YYCOPY(To, From, Count)    \
268       do          \
269   {          \
270     YYSIZE_T yyi;    \
271     for (yyi = 0; yyi < (Count); yyi++)  \
272       (To)[yyi] = (From)[yyi];    \
273   }          \
274       while (0)
275 #  endif
276 # endif
277
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
282    stack.  */
283 # define YYSTACK_RELOCATE(Stack)          \
284     do                  \
285       {                  \
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);        \
291       }                  \
292     while (0)
293
294 #endif
295
296 #if defined (__STDC__) || defined (__cplusplus)
297    typedef signed char yysigned_char;
298 #else
299    typedef short int yysigned_char;
300 #endif
301
302 /* YYFINAL -- State number of the termination state. */
303 #define YYFINAL  12
304 /* YYLAST -- Last index in YYTABLE.  */
305 #define YYLAST   25
306
307 /* YYNTOKENS -- Number of terminals. */
308 #define YYNTOKENS  17
309 /* YYNNTS -- Number of nonterminals. */
310 #define YYNNTS  9
311 /* YYNRULES -- Number of rules. */
312 #define YYNRULES  20
313 /* YYNRULES -- Number of states. */
314 #define YYNSTATES  34
315
316 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
317 #define YYUNDEFTOK  2
318 #define YYMAXUTOK   271
319
320 #define YYTRANSLATE(YYX)             \
321   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
322
323 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
324 static const unsigned char yytranslate[] =
325 {
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,
353       15,    16
354 };
355
356 #if YYDEBUG
357 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
358    YYRHS.  */
359 static const unsigned char yyprhs[] =
360 {
361        0,     0,     3,     5,     7,    11,    13,    17,    19,    23,
362       25,    29,    33,    35,    39,    43,    45,    49,    53,    57,
363       59
364 };
365
366 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
367 static const yysigned_char yyrhs[] =
368 {
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,
375       19,    11,    -1
376 };
377
378 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
379 static const unsigned char yyrline[] =
380 {
381        0,    94,    94,   100,   103,   107,   110,   114,   117,   121,
382      124,   127,   132,   135,   138,   142,   145,   148,   151,   155,
383      158
384 };
385 #endif
386
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[] =
391 {
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
397 };
398 #endif
399
400 # ifdef YYPRINT
401 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
402    token YYLEX-NUM.  */
403 static const unsigned short int yytoknum[] =
404 {
405        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
406      265,   266,   267,   268,   269,   270,   271
407 };
408 # endif
409
410 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
411 static const unsigned char yyr1[] =
412 {
413        0,    17,    18,    19,    19,    20,    20,    21,    21,    22,
414       22,    22,    23,    23,    23,    24,    24,    24,    24,    25,
415       25
416 };
417
418 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
419 static const unsigned char yyr2[] =
420 {
421        0,     2,     1,     1,     3,     1,     3,     1,     3,     1,
422        3,     3,     1,     3,     3,     1,     3,     3,     3,     1,
423        3
424 };
425
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[] =
430 {
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,
434       14,    16,    17,    18
435 };
436
437 /* YYDEFGOTO[NTERM-NUM]. */
438 static const yysigned_char yydefgoto[] =
439 {
440       -1,     3,     4,     5,     6,     7,     8,     9,    10
441 };
442
443 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
444    STATE-NUM.  */
445 #define YYPACT_NINF -14
446 static const yysigned_char yypact[] =
447 {
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,
451       -4,   -14,   -14,   -14
452 };
453
454 /* YYPGOTO[NTERM-NUM].  */
455 static const yysigned_char yypgoto[] =
456 {
457      -14,   -14,    21,    10,    11,     9,     0,    -6,   -13
458 };
459
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[] =
466 {
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
470 };
471
472 static const unsigned char yycheck[] =
473 {
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
477 };
478
479 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
480    symbol of state STATE-NUM.  */
481 static const unsigned char yystos[] =
482 {
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,
486       24,    25,    25,    25
487 };
488
489 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
490 # define YYSIZE_T __SIZE_TYPE__
491 #endif
492 #if ! defined (YYSIZE_T) && defined (size_t)
493 # define YYSIZE_T size_t
494 #endif
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
499 # endif
500 #endif
501 #if ! defined (YYSIZE_T)
502 # define YYSIZE_T unsigned int
503 #endif
504
505 #define yyerrok    (yyerrstatus = 0)
506 #define yyclearin  (yychar = YYEMPTY)
507 #define YYEMPTY    (-2)
508 #define YYEOF    0
509
510 #define YYACCEPT  goto yyacceptlab
511 #define YYABORT    goto yyabortlab
512 #define YYERROR    goto yyerrorlab
513
514
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.  */
518
519 #define YYFAIL    goto yyerrlab
520
521 #define YYRECOVERING()  (!!yyerrstatus)
522
523 #define YYBACKUP(Token, Value)          \
524 do                \
525   if (yychar == YYEMPTY && yylen == 1)        \
526     {                \
527       yychar = (Token);            \
528       yylval = (Value);            \
529       yytoken = YYTRANSLATE (yychar);        \
530       YYPOPSTACK;            \
531       goto yybackup;            \
532     }                \
533   else                \
534     {                 \
535       yyerror ("syntax error: cannot back up");\
536       YYERROR;              \
537     }                \
538 while (0)
539
540 #define YYTERROR  1
541 #define YYERRCODE  256
542
543 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
544    are run).  */
545
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)
552 #endif
553
554 /* YYLEX -- calling `yylex' with the right arguments.  */
555
556 #ifdef YYLEX_PARAM
557 # define YYLEX yylex (&yylval, YYLEX_PARAM)
558 #else
559 # define YYLEX yylex (&yylval)
560 #endif
561
562 /* Enable debugging if requested.  */
563 #if YYDEBUG
564
565 # ifndef YYFPRINTF
566 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
567 #  define YYFPRINTF fprintf
568 # endif
569
570 # define YYDPRINTF(Args)      \
571 do {            \
572   if (yydebug)          \
573     YYFPRINTF Args;        \
574 } while (0)
575
576 # define YYDSYMPRINT(Args)      \
577 do {            \
578   if (yydebug)          \
579     yysymprint Args;        \
580 } while (0)
581
582 # define YYDSYMPRINTF(Title, Token, Value, Location)    \
583 do {                \
584   if (yydebug)              \
585     {                \
586       YYFPRINTF (stderr, "%s ", Title);        \
587       yysymprint (stderr,           \
588                   Token, Value);  \
589       YYFPRINTF (stderr, "\n");          \
590     }                \
591 } while (0)
592
593 /*------------------------------------------------------------------.
594 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
595 | TOP (included).                                                   |
596 `------------------------------------------------------------------*/
597
598 #if defined (__STDC__) || defined (__cplusplus)
599 static void
600 yy_stack_print (short int *bottom, short int *top)
601 #else
602 static void
603 yy_stack_print (bottom, top)
604     short int *bottom;
605     short int *top;
606 #endif
607 {
608   YYFPRINTF (stderr, "Stack now");
609   for (/* Nothing. */; bottom <= top; ++bottom)
610     YYFPRINTF (stderr, " %d", *bottom);
611   YYFPRINTF (stderr, "\n");
612 }
613
614 # define YY_STACK_PRINT(Bottom, Top)        \
615 do {                \
616   if (yydebug)              \
617     yy_stack_print ((Bottom), (Top));        \
618 } while (0)
619
620
621 /*------------------------------------------------.
622 | Report that the YYRULE is going to be reduced.  |
623 `------------------------------------------------*/
624
625 #if defined (__STDC__) || defined (__cplusplus)
626 static void
627 yy_reduce_print (int yyrule)
628 #else
629 static void
630 yy_reduce_print (yyrule)
631     int yyrule;
632 #endif
633 {
634   int yyi;
635   unsigned int yylno = yyrline[yyrule];
636   YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
637              yyrule - 1, yylno);
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]]);
642 }
643
644 # define YY_REDUCE_PRINT(Rule)    \
645 do {          \
646   if (yydebug)        \
647     yy_reduce_print (Rule);    \
648 } while (0)
649
650 /* Nonzero means print parse trace.  It is left uninitialized so that
651    multiple parsers can coexist.  */
652 int yydebug;
653 #else /* !YYDEBUG */
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 */
660
661
662 /* YYINITDEPTH -- initial size of the parser's stacks.  */
663 #ifndef  YYINITDEPTH
664 # define YYINITDEPTH 200
665 #endif
666
667 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
668    if the built-in stack extension method is used).
669
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.  */
673
674 #if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
675 # undef YYMAXDEPTH
676 #endif
677
678 #ifndef YYMAXDEPTH
679 # define YYMAXDEPTH 10000
680 #endif
681
682 \f
683
684 #if YYERROR_VERBOSE
685
686 # ifndef yystrlen
687 #  if defined (__GLIBC__) && defined (_STRING_H)
688 #   define yystrlen strlen
689 #  else
690 /* Return the length of YYSTR.  */
691 static YYSIZE_T
692 #   if defined (__STDC__) || defined (__cplusplus)
693 yystrlen (const char *yystr)
694 #   else
695 yystrlen (yystr)
696      const char *yystr;
697 #   endif
698 {
699   const char *yys = yystr;
700
701   while (*yys++ != '\0')
702     continue;
703
704   return yys - yystr - 1;
705 }
706 #  endif
707 # endif
708
709 # ifndef yystpcpy
710 #  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
711 #   define yystpcpy stpcpy
712 #  else
713 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
714    YYDEST.  */
715 static char *
716 #   if defined (__STDC__) || defined (__cplusplus)
717 yystpcpy (char *yydest, const char *yysrc)
718 #   else
719 yystpcpy (yydest, yysrc)
720      char *yydest;
721      const char *yysrc;
722 #   endif
723 {
724   char *yyd = yydest;
725   const char *yys = yysrc;
726
727   while ((*yyd++ = *yys++) != '\0')
728     continue;
729
730   return yyd - 1;
731 }
732 #  endif
733 # endif
734
735 #endif /* !YYERROR_VERBOSE */
736
737 \f
738
739 #if YYDEBUG
740 /*--------------------------------.
741 | Print this symbol on YYOUTPUT.  |
742 `--------------------------------*/
743
744 #if defined (__STDC__) || defined (__cplusplus)
745 static void
746 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
747 #else
748 static void
749 yysymprint (yyoutput, yytype, yyvaluep)
750     FILE *yyoutput;
751     int yytype;
752     YYSTYPE *yyvaluep;
753 #endif
754 {
755   /* Pacify ``unused variable'' warnings.  */
756   (void) yyvaluep;
757
758   if (yytype < YYNTOKENS)
759     {
760       YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
761 # ifdef YYPRINT
762       YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
763 # endif
764     }
765   else
766     YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
767
768   switch (yytype)
769     {
770       default:
771         break;
772     }
773   YYFPRINTF (yyoutput, ")");
774 }
775
776 #endif /* ! YYDEBUG */
777 /*-----------------------------------------------.
778 | Release the memory associated to this symbol.  |
779 `-----------------------------------------------*/
780
781 #if defined (__STDC__) || defined (__cplusplus)
782 static void
783 yydestruct (int yytype, YYSTYPE *yyvaluep)
784 #else
785 static void
786 yydestruct (yytype, yyvaluep)
787     int yytype;
788     YYSTYPE *yyvaluep;
789 #endif
790 {
791   /* Pacify ``unused variable'' warnings.  */
792   (void) yyvaluep;
793
794   switch (yytype)
795     {
796
797       default:
798         break;
799     }
800 }
801 \f
802
803 /* Prevent warnings from -Wmissing-prototypes.  */
804
805 #ifdef YYPARSE_PARAM
806 # if defined (__STDC__) || defined (__cplusplus)
807 int yyparse (void *YYPARSE_PARAM);
808 # else
809 int yyparse ();
810 # endif
811 #else /* ! YYPARSE_PARAM */
812 #if defined (__STDC__) || defined (__cplusplus)
813 int yyparse (void);
814 #else
815 int yyparse ();
816 #endif
817 #endif /* ! YYPARSE_PARAM */
818
819
820
821
822
823
824 /*----------.
825 | yyparse.  |
826 `----------*/
827
828 #ifdef YYPARSE_PARAM
829 # if defined (__STDC__) || defined (__cplusplus)
830 int yyparse (void *YYPARSE_PARAM)
831 # else
832 int yyparse (YYPARSE_PARAM)
833   void *YYPARSE_PARAM;
834 # endif
835 #else /* ! YYPARSE_PARAM */
836 #if defined (__STDC__) || defined (__cplusplus)
837 int
838 yyparse (void)
839 #else
840 int
841 yyparse ()
842
843 #endif
844 #endif
845 {
846   /* The lookahead symbol.  */
847 int yychar;
848
849 /* The semantic value of the lookahead symbol.  */
850 YYSTYPE yylval;
851
852 /* Number of syntax errors so far.  */
853 int yynerrs;
854
855   int yystate;
856   int yyn;
857   int yyresult;
858   /* Number of tokens to shift before error messages enabled.  */
859   int yyerrstatus;
860   /* Lookahead token as an internal (translated) token number.  */
861   int yytoken = 0;
862
863   /* Three stacks and their tools:
864      `yyss': related to states,
865      `yyvs': related to semantic values,
866      `yyls': related to locations.
867
868      Refer to the stacks thru separate pointers, to allow yyoverflow
869      to reallocate them elsewhere.  */
870
871   /* The state stack.  */
872   short int yyssa[YYINITDEPTH];
873   short int *yyss = yyssa;
874   short int *yyssp;
875
876   /* The semantic value stack.  */
877   YYSTYPE yyvsa[YYINITDEPTH];
878   YYSTYPE *yyvs = yyvsa;
879   YYSTYPE *yyvsp;
880
881
882
883 #define YYPOPSTACK   (yyvsp--, yyssp--)
884
885   YYSIZE_T yystacksize = YYINITDEPTH;
886
887   /* The variables used to return semantic value and location from the
888      action routines.  */
889   YYSTYPE yyval;
890
891
892   /* When reducing, the number of symbols on the RHS of the reduced
893      rule.  */
894   int yylen;
895
896   YYDPRINTF ((stderr, "Starting parse\n"));
897
898   yystate = 0;
899   yyerrstatus = 0;
900   yynerrs = 0;
901   yychar = YYEMPTY;    /* Cause a token to be read.  */
902
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.  */
907
908   yyssp = yyss;
909   yyvsp = yyvs;
910
911
912   goto yysetstate;
913
914 /*------------------------------------------------------------.
915 | yynewstate -- Push a new state, which is found in yystate.  |
916 `------------------------------------------------------------*/
917  yynewstate:
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.
920      */
921   yyssp++;
922
923  yysetstate:
924   *yyssp = yystate;
925
926   if (yyss + yystacksize - 1 <= yyssp)
927     {
928       /* Get the current used size of the three stacks, in elements.  */
929       YYSIZE_T yysize = yyssp - yyss + 1;
930
931 #ifdef yyoverflow
932       {
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
935      memory.  */
936   YYSTYPE *yyvs1 = yyvs;
937   short int *yyss1 = yyss;
938
939
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),
947
948         &yystacksize);
949
950   yyss = yyss1;
951   yyvs = yyvs1;
952       }
953 #else /* no yyoverflow */
954 # ifndef YYSTACK_RELOCATE
955       goto yyoverflowlab;
956 # else
957       /* Extend the stack our own way.  */
958       if (YYMAXDEPTH <= yystacksize)
959   goto yyoverflowlab;
960       yystacksize *= 2;
961       if (YYMAXDEPTH < yystacksize)
962   yystacksize = YYMAXDEPTH;
963
964       {
965   short int *yyss1 = yyss;
966   union yyalloc *yyptr =
967     (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
968   if (! yyptr)
969     goto yyoverflowlab;
970   YYSTACK_RELOCATE (yyss);
971   YYSTACK_RELOCATE (yyvs);
972
973 #  undef YYSTACK_RELOCATE
974   if (yyss1 != yyssa)
975     YYSTACK_FREE (yyss1);
976       }
977 # endif
978 #endif /* no yyoverflow */
979
980       yyssp = yyss + yysize - 1;
981       yyvsp = yyvs + yysize - 1;
982
983
984       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
985       (unsigned long int) yystacksize));
986
987       if (yyss + yystacksize - 1 <= yyssp)
988   YYABORT;
989     }
990
991   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
992
993   goto yybackup;
994
995 /*-----------.
996 | yybackup.  |
997 `-----------*/
998 yybackup:
999
1000 /* Do appropriate processing given the current state.  */
1001 /* Read a lookahead token if we need one and don't already have one.  */
1002 /* yyresume: */
1003
1004   /* First try to decide what to do without reference to lookahead token.  */
1005
1006   yyn = yypact[yystate];
1007   if (yyn == YYPACT_NINF)
1008     goto yydefault;
1009
1010   /* Not known => get a lookahead token if don't already have one.  */
1011
1012   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
1013   if (yychar == YYEMPTY)
1014     {
1015       YYDPRINTF ((stderr, "Reading a token: "));
1016       yychar = YYLEX;
1017     }
1018
1019   if (yychar <= YYEOF)
1020     {
1021       yychar = yytoken = YYEOF;
1022       YYDPRINTF ((stderr, "Now at end of input.\n"));
1023     }
1024   else
1025     {
1026       yytoken = YYTRANSLATE (yychar);
1027       YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
1028     }
1029
1030   /* If the proper action on seeing token YYTOKEN is to reduce or to
1031      detect an error, take that action.  */
1032   yyn += yytoken;
1033   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1034     goto yydefault;
1035   yyn = yytable[yyn];
1036   if (yyn <= 0)
1037     {
1038       if (yyn == 0 || yyn == YYTABLE_NINF)
1039   goto yyerrlab;
1040       yyn = -yyn;
1041       goto yyreduce;
1042     }
1043
1044   if (yyn == YYFINAL)
1045     YYACCEPT;
1046
1047   /* Shift the lookahead token.  */
1048   YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
1049
1050   /* Discard the token being shifted unless it is eof.  */
1051   if (yychar != YYEOF)
1052     yychar = YYEMPTY;
1053
1054   *++yyvsp = yylval;
1055
1056
1057   /* Count tokens shifted since error; after three, turn off error
1058      status.  */
1059   if (yyerrstatus)
1060     yyerrstatus--;
1061
1062   yystate = yyn;
1063   goto yynewstate;
1064
1065
1066 /*-----------------------------------------------------------.
1067 | yydefault -- do the default action for the current state.  |
1068 `-----------------------------------------------------------*/
1069 yydefault:
1070   yyn = yydefact[yystate];
1071   if (yyn == 0)
1072     goto yyerrlab;
1073   goto yyreduce;
1074
1075
1076 /*-----------------------------.
1077 | yyreduce -- Do a reduction.  |
1078 `-----------------------------*/
1079 yyreduce:
1080   /* yyn is the number of a rule to reduce with.  */
1081   yylen = yyr2[yyn];
1082
1083   /* If YYLEN is nonzero, implement the default value of the action:
1084      `$$ = $1'.
1085
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];
1092
1093
1094   YY_REDUCE_PRINT (yyn);
1095   switch (yyn)
1096     {
1097         case 2:
1098
1099     {
1100   yyGetParser->SetResult(yyvsp[0].Number);
1101 }
1102     break;
1103
1104   case 3:
1105
1106     {yyval.Number = yyvsp[0].Number;}
1107     break;
1108
1109   case 4:
1110
1111     {yyval.Number = yyvsp[-2].Number | yyvsp[0].Number;}
1112     break;
1113
1114   case 5:
1115
1116     {yyval.Number = yyvsp[0].Number;}
1117     break;
1118
1119   case 6:
1120
1121     {yyval.Number = yyvsp[-2].Number ^ yyvsp[0].Number;}
1122     break;
1123
1124   case 7:
1125
1126     {yyval.Number = yyvsp[0].Number;}
1127     break;
1128
1129   case 8:
1130
1131     {yyval.Number = yyvsp[-2].Number & yyvsp[0].Number;}
1132     break;
1133
1134   case 9:
1135
1136     {yyval.Number = yyvsp[0].Number;}
1137     break;
1138
1139   case 10:
1140
1141     {yyval.Number = yyvsp[-2].Number << yyvsp[0].Number;}
1142     break;
1143
1144   case 11:
1145
1146     {yyval.Number = yyvsp[-2].Number >> yyvsp[0].Number;}
1147     break;
1148
1149   case 12:
1150
1151     {yyval.Number = yyvsp[0].Number;}
1152     break;
1153
1154   case 13:
1155
1156     {yyval.Number = yyvsp[-2].Number + yyvsp[0].Number;}
1157     break;
1158
1159   case 14:
1160
1161     {yyval.Number = yyvsp[-2].Number - yyvsp[0].Number;}
1162     break;
1163
1164   case 15:
1165
1166     {yyval.Number = yyvsp[0].Number;}
1167     break;
1168
1169   case 16:
1170
1171     {yyval.Number = yyvsp[-2].Number * yyvsp[0].Number;}
1172     break;
1173
1174   case 17:
1175
1176     {yyval.Number = yyvsp[-2].Number / yyvsp[0].Number;}
1177     break;
1178
1179   case 18:
1180
1181     {yyval.Number = yyvsp[-2].Number % yyvsp[0].Number;}
1182     break;
1183
1184   case 19:
1185
1186     {yyval.Number = yyvsp[0].Number;}
1187     break;
1188
1189   case 20:
1190
1191     {yyval.Number = yyvsp[-1].Number;}
1192     break;
1193
1194
1195     }
1196
1197 /* Line 1010 of yacc.c.  */
1198
1199 \f
1200   yyvsp -= yylen;
1201   yyssp -= yylen;
1202
1203
1204   YY_STACK_PRINT (yyss, yyssp);
1205
1206   *++yyvsp = yyval;
1207
1208
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.  */
1212
1213   yyn = yyr1[yyn];
1214
1215   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1216   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1217     yystate = yytable[yystate];
1218   else
1219     yystate = yydefgoto[yyn - YYNTOKENS];
1220
1221   goto yynewstate;
1222
1223
1224 /*------------------------------------.
1225 | yyerrlab -- here on detecting error |
1226 `------------------------------------*/
1227 yyerrlab:
1228   /* If not already recovering from an error, report this error.  */
1229   if (!yyerrstatus)
1230     {
1231       ++yynerrs;
1232 #if YYERROR_VERBOSE
1233       yyn = yypact[yystate];
1234
1235       if (YYPACT_NINF < yyn && yyn < YYLAST)
1236   {
1237     YYSIZE_T yysize = 0;
1238     int yytype = YYTRANSLATE (yychar);
1239     const char* yyprefix;
1240     char *yymsg;
1241     int yyx;
1242
1243     /* Start YYX at -YYN if negative to avoid negative indexes in
1244        YYCHECK.  */
1245     int yyxbegin = yyn < 0 ? -yyn : 0;
1246
1247     /* Stay within bounds of both yycheck and yytname.  */
1248     int yychecklim = YYLAST - yyn;
1249     int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1250     int yycount = 0;
1251
1252     yyprefix = ", expecting ";
1253     for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1254       if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1255         {
1256     yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
1257     yycount += 1;
1258     if (yycount == 5)
1259       {
1260         yysize = 0;
1261         break;
1262       }
1263         }
1264     yysize += (sizeof ("syntax error, unexpected ")
1265          + yystrlen (yytname[yytype]));
1266     yymsg = (char *) YYSTACK_ALLOC (yysize);
1267     if (yymsg != 0)
1268       {
1269         char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
1270         yyp = yystpcpy (yyp, yytname[yytype]);
1271
1272         if (yycount < 5)
1273     {
1274       yyprefix = ", expecting ";
1275       for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1276         if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1277           {
1278       yyp = yystpcpy (yyp, yyprefix);
1279       yyp = yystpcpy (yyp, yytname[yyx]);
1280       yyprefix = " or ";
1281           }
1282     }
1283         yyerror (yymsg);
1284         YYSTACK_FREE (yymsg);
1285       }
1286     else
1287       yyerror ("syntax error; also virtual memory exhausted");
1288   }
1289       else
1290 #endif /* YYERROR_VERBOSE */
1291   yyerror ("syntax error");
1292     }
1293
1294
1295
1296   if (yyerrstatus == 3)
1297     {
1298       /* If just tried and failed to reuse lookahead token after an
1299    error, discard it.  */
1300
1301       if (yychar <= YYEOF)
1302         {
1303           /* If at end of input, pop the error token,
1304        then the rest of the stack, then return failure.  */
1305     if (yychar == YYEOF)
1306        for (;;)
1307          {
1308      YYPOPSTACK;
1309      if (yyssp == yyss)
1310        YYABORT;
1311      YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1312      yydestruct (yystos[*yyssp], yyvsp);
1313          }
1314         }
1315       else
1316   {
1317     YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
1318     yydestruct (yytoken, &yylval);
1319     yychar = YYEMPTY;
1320
1321   }
1322     }
1323
1324   /* Else will try to reuse lookahead token after shifting the error
1325      token.  */
1326   goto yyerrlab1;
1327
1328
1329 /*---------------------------------------------------.
1330 | yyerrorlab -- error raised explicitly by YYERROR.  |
1331 `---------------------------------------------------*/
1332 yyerrorlab:
1333
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.  */
1337   if (0)
1338      goto yyerrorlab;
1339 #endif
1340
1341   yyvsp -= yylen;
1342   yyssp -= yylen;
1343   yystate = *yyssp;
1344   goto yyerrlab1;
1345
1346
1347 /*-------------------------------------------------------------.
1348 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
1349 `-------------------------------------------------------------*/
1350 yyerrlab1:
1351   yyerrstatus = 3;  /* Each real token shifted decrements this.  */
1352
1353   for (;;)
1354     {
1355       yyn = yypact[yystate];
1356       if (yyn != YYPACT_NINF)
1357   {
1358     yyn += YYTERROR;
1359     if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1360       {
1361         yyn = yytable[yyn];
1362         if (0 < yyn)
1363     break;
1364       }
1365   }
1366
1367       /* Pop the current state because it cannot handle the error token.  */
1368       if (yyssp == yyss)
1369   YYABORT;
1370
1371       YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1372       yydestruct (yystos[yystate], yyvsp);
1373       YYPOPSTACK;
1374       yystate = *yyssp;
1375       YY_STACK_PRINT (yyss, yyssp);
1376     }
1377
1378   if (yyn == YYFINAL)
1379     YYACCEPT;
1380
1381   YYDPRINTF ((stderr, "Shifting error token, "));
1382
1383   *++yyvsp = yylval;
1384
1385
1386   yystate = yyn;
1387   goto yynewstate;
1388
1389
1390 /*-------------------------------------.
1391 | yyacceptlab -- YYACCEPT comes here.  |
1392 `-------------------------------------*/
1393 yyacceptlab:
1394   yyresult = 0;
1395   goto yyreturn;
1396
1397 /*-----------------------------------.
1398 | yyabortlab -- YYABORT comes here.  |
1399 `-----------------------------------*/
1400 yyabortlab:
1401   yyresult = 1;
1402   goto yyreturn;
1403
1404 #ifndef yyoverflow
1405 /*----------------------------------------------.
1406 | yyoverflowlab -- parser overflow comes here.  |
1407 `----------------------------------------------*/
1408 yyoverflowlab:
1409   yyerror ("parser stack overflow");
1410   yyresult = 2;
1411   /* Fall through.  */
1412 #endif
1413
1414 yyreturn:
1415 #ifndef yyoverflow
1416   if (yyss != yyssa)
1417     YYSTACK_FREE (yyss);
1418 #endif
1419   return yyresult;
1420 }
1421
1422
1423
1424
1425 /* End of grammar */
1426
1427 /*--------------------------------------------------------------------------*/
1428 void cmExprError(yyscan_t yyscanner, const char* message)
1429 {
1430   yyGetParser->Error(message);
1431 }
1432
1433