Home | History | Annotate | Download | only in glcpp
      1 /* A Bison parser, made by GNU Bison 2.4.3.  */
      2 
      3 /* Skeleton implementation for Bison's Yacc-like parsers in C
      4 
      5       Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
      6    2009, 2010 Free Software Foundation, Inc.
      7 
      8    This program is free software: you can redistribute it and/or modify
      9    it under the terms of the GNU General Public License as published by
     10    the Free Software Foundation, either version 3 of the License, or
     11    (at your option) any later version.
     12 
     13    This program is distributed in the hope that it will be useful,
     14    but WITHOUT ANY WARRANTY; without even the implied warranty of
     15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     16    GNU General Public License for more details.
     17 
     18    You should have received a copy of the GNU General Public License
     19    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
     20 
     21 /* As a special exception, you may create a larger work that contains
     22    part or all of the Bison parser skeleton and distribute that work
     23    under terms of your choice, so long as that work isn't itself a
     24    parser generator using the skeleton or a modified version thereof
     25    as a parser skeleton.  Alternatively, if you modify or redistribute
     26    the parser skeleton itself, you may (at your option) remove this
     27    special exception, which will cause the skeleton and the resulting
     28    Bison output files to be licensed under the GNU General Public
     29    License without this special exception.
     30 
     31    This special exception was added by the Free Software Foundation in
     32    version 2.2 of Bison.  */
     33 
     34 /* C LALR(1) parser skeleton written by Richard Stallman, by
     35    simplifying the original so-called "semantic" parser.  */
     36 
     37 /* All symbols defined below should begin with yy or YY, to avoid
     38    infringing on user name space.  This should be done even for local
     39    variables, as they might otherwise be expanded by user macros.
     40    There are some unavoidable exceptions within include files to
     41    define necessary library symbols; they are noted "INFRINGES ON
     42    USER NAME SPACE" below.  */
     43 
     44 /* Identify Bison output.  */
     45 #define YYBISON 1
     46 
     47 /* Bison version.  */
     48 #define YYBISON_VERSION "2.4.3"
     49 
     50 /* Skeleton name.  */
     51 #define YYSKELETON_NAME "yacc.c"
     52 
     53 /* Pure parsers.  */
     54 #define YYPURE 1
     55 
     56 /* Push parsers.  */
     57 #define YYPUSH 0
     58 
     59 /* Pull parsers.  */
     60 #define YYPULL 1
     61 
     62 /* Using locations.  */
     63 #define YYLSP_NEEDED 1
     64 
     65 
     66 
     67 /* Copy the first part of user declarations.  */
     68 
     69 /* Line 189 of yacc.c  */
     70 #line 1 "glcpp/glcpp-parse.y"
     71 
     72 /*
     73  * Copyright  2010 Intel Corporation
     74  *
     75  * Permission is hereby granted, free of charge, to any person obtaining a
     76  * copy of this software and associated documentation files (the "Software"),
     77  * to deal in the Software without restriction, including without limitation
     78  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
     79  * and/or sell copies of the Software, and to permit persons to whom the
     80  * Software is furnished to do so, subject to the following conditions:
     81  *
     82  * The above copyright notice and this permission notice (including the next
     83  * paragraph) shall be included in all copies or substantial portions of the
     84  * Software.
     85  *
     86  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     87  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     88  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
     89  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     90  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
     91  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
     92  * DEALINGS IN THE SOFTWARE.
     93  */
     94 
     95 #include <stdio.h>
     96 #include <stdlib.h>
     97 #include <string.h>
     98 #include <assert.h>
     99 #include <inttypes.h>
    100 
    101 #include "glcpp.h"
    102 #include "main/core.h" /* for struct gl_extensions */
    103 #include "main/mtypes.h" /* for gl_api enum */
    104 
    105 #define glcpp_print(stream, str) stream = hieralloc_strdup_append(stream, str)
    106 #define glcpp_printf(stream, fmt, args, ...) \
    107 	stream = hieralloc_asprintf_append(stream, fmt, args)
    108 
    109 static void
    110 yyerror (YYLTYPE *locp, glcpp_parser_t *parser, const char *error);
    111 
    112 static void
    113 _define_object_macro (glcpp_parser_t *parser,
    114 		      YYLTYPE *loc,
    115 		      const char *macro,
    116 		      token_list_t *replacements);
    117 
    118 static void
    119 _define_function_macro (glcpp_parser_t *parser,
    120 			YYLTYPE *loc,
    121 			const char *macro,
    122 			string_list_t *parameters,
    123 			token_list_t *replacements);
    124 
    125 static string_list_t *
    126 _string_list_create (void *ctx);
    127 
    128 static void
    129 _string_list_append_item (string_list_t *list, const char *str);
    130 
    131 static int
    132 _string_list_contains (string_list_t *list, const char *member, int *index);
    133 
    134 static int
    135 _string_list_length (string_list_t *list);
    136 
    137 static int
    138 _string_list_equal (string_list_t *a, string_list_t *b);
    139 
    140 static argument_list_t *
    141 _argument_list_create (void *ctx);
    142 
    143 static void
    144 _argument_list_append (argument_list_t *list, token_list_t *argument);
    145 
    146 static int
    147 _argument_list_length (argument_list_t *list);
    148 
    149 static token_list_t *
    150 _argument_list_member_at (argument_list_t *list, int index);
    151 
    152 /* Note: This function hieralloc_steal()s the str pointer. */
    153 static token_t *
    154 _token_create_str (void *ctx, int type, char *str);
    155 
    156 static token_t *
    157 _token_create_ival (void *ctx, int type, int ival);
    158 
    159 static token_list_t *
    160 _token_list_create (void *ctx);
    161 
    162 /* Note: This function adds a hieralloc_reference() to token.
    163  *
    164  * You may want to hieralloc_unlink any current reference if you no
    165  * longer need it. */
    166 static void
    167 _token_list_append (token_list_t *list, token_t *token);
    168 
    169 static void
    170 _token_list_append_list (token_list_t *list, token_list_t *tail);
    171 
    172 static int
    173 _token_list_equal_ignoring_space (token_list_t *a, token_list_t *b);
    174 
    175 static active_list_t *
    176 _active_list_push (active_list_t *list,
    177 		   const char *identifier,
    178 		   token_node_t *marker);
    179 
    180 static active_list_t *
    181 _active_list_pop (active_list_t *list);
    182 
    183 int
    184 _active_list_contains (active_list_t *list, const char *identifier);
    185 
    186 static void
    187 _glcpp_parser_expand_if (glcpp_parser_t *parser, int type, token_list_t *list);
    188 
    189 static void
    190 _glcpp_parser_expand_token_list (glcpp_parser_t *parser,
    191 				 token_list_t *list);
    192 
    193 static void
    194 _glcpp_parser_print_expanded_token_list (glcpp_parser_t *parser,
    195 					 token_list_t *list);
    196 
    197 static void
    198 _glcpp_parser_skip_stack_push_if (glcpp_parser_t *parser, YYLTYPE *loc,
    199 				  int condition);
    200 
    201 static void
    202 _glcpp_parser_skip_stack_change_if (glcpp_parser_t *parser, YYLTYPE *loc,
    203 				    const char *type, int condition);
    204 
    205 static void
    206 _glcpp_parser_skip_stack_pop (glcpp_parser_t *parser, YYLTYPE *loc);
    207 
    208 #define yylex glcpp_parser_lex
    209 
    210 static int
    211 glcpp_parser_lex (YYSTYPE *yylval, YYLTYPE *yylloc, glcpp_parser_t *parser);
    212 
    213 static void
    214 glcpp_parser_lex_from (glcpp_parser_t *parser, token_list_t *list);
    215 
    216 static void
    217 add_builtin_define(glcpp_parser_t *parser, const char *name, int value);
    218 
    219 
    220 
    221 /* Line 189 of yacc.c  */
    222 #line 223 "glcpp/glcpp-parse.c"
    223 
    224 /* Enabling traces.  */
    225 #ifndef YYDEBUG
    226 # define YYDEBUG 0
    227 #endif
    228 
    229 /* Enabling verbose error messages.  */
    230 #ifdef YYERROR_VERBOSE
    231 # undef YYERROR_VERBOSE
    232 # define YYERROR_VERBOSE 1
    233 #else
    234 # define YYERROR_VERBOSE 1
    235 #endif
    236 
    237 /* Enabling the token table.  */
    238 #ifndef YYTOKEN_TABLE
    239 # define YYTOKEN_TABLE 0
    240 #endif
    241 
    242 
    243 /* Tokens.  */
    244 #ifndef YYTOKENTYPE
    245 # define YYTOKENTYPE
    246    /* Put the tokens into the symbol table, so that GDB and other debuggers
    247       know about them.  */
    248    enum yytokentype {
    249      COMMA_FINAL = 258,
    250      DEFINED = 259,
    251      ELIF_EXPANDED = 260,
    252      HASH = 261,
    253      HASH_DEFINE_FUNC = 262,
    254      HASH_DEFINE_OBJ = 263,
    255      HASH_ELIF = 264,
    256      HASH_ELSE = 265,
    257      HASH_ENDIF = 266,
    258      HASH_IF = 267,
    259      HASH_IFDEF = 268,
    260      HASH_IFNDEF = 269,
    261      HASH_UNDEF = 270,
    262      HASH_VERSION = 271,
    263      IDENTIFIER = 272,
    264      IF_EXPANDED = 273,
    265      INTEGER = 274,
    266      INTEGER_STRING = 275,
    267      NEWLINE = 276,
    268      OTHER = 277,
    269      PLACEHOLDER = 278,
    270      SPACE = 279,
    271      PASTE = 280,
    272      OR = 281,
    273      AND = 282,
    274      NOT_EQUAL = 283,
    275      EQUAL = 284,
    276      GREATER_OR_EQUAL = 285,
    277      LESS_OR_EQUAL = 286,
    278      RIGHT_SHIFT = 287,
    279      LEFT_SHIFT = 288,
    280      UNARY = 289
    281    };
    282 #endif
    283 
    284 
    285 
    286 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
    287 
    288 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
    289 # define YYSTYPE_IS_DECLARED 1
    290 #endif
    291 
    292 #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
    293 typedef struct YYLTYPE
    294 {
    295   int first_line;
    296   int first_column;
    297   int last_line;
    298   int last_column;
    299 } YYLTYPE;
    300 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
    301 # define YYLTYPE_IS_DECLARED 1
    302 # define YYLTYPE_IS_TRIVIAL 1
    303 #endif
    304 
    305 
    306 /* Copy the second part of user declarations.  */
    307 
    308 
    309 /* Line 264 of yacc.c  */
    310 #line 311 "glcpp/glcpp-parse.c"
    311 
    312 #ifdef short
    313 # undef short
    314 #endif
    315 
    316 #ifdef YYTYPE_UINT8
    317 typedef YYTYPE_UINT8 yytype_uint8;
    318 #else
    319 typedef unsigned char yytype_uint8;
    320 #endif
    321 
    322 #ifdef YYTYPE_INT8
    323 typedef YYTYPE_INT8 yytype_int8;
    324 #elif (defined __STDC__ || defined __C99__FUNC__ \
    325      || defined __cplusplus || defined _MSC_VER)
    326 typedef signed char yytype_int8;
    327 #else
    328 typedef short int yytype_int8;
    329 #endif
    330 
    331 #ifdef YYTYPE_UINT16
    332 typedef YYTYPE_UINT16 yytype_uint16;
    333 #else
    334 typedef unsigned short int yytype_uint16;
    335 #endif
    336 
    337 #ifdef YYTYPE_INT16
    338 typedef YYTYPE_INT16 yytype_int16;
    339 #else
    340 typedef short int yytype_int16;
    341 #endif
    342 
    343 #ifndef YYSIZE_T
    344 # ifdef __SIZE_TYPE__
    345 #  define YYSIZE_T __SIZE_TYPE__
    346 # elif defined size_t
    347 #  define YYSIZE_T size_t
    348 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
    349      || defined __cplusplus || defined _MSC_VER)
    350 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
    351 #  define YYSIZE_T size_t
    352 # else
    353 #  define YYSIZE_T unsigned int
    354 # endif
    355 #endif
    356 
    357 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
    358 
    359 #ifndef YY_
    360 # if defined YYENABLE_NLS && YYENABLE_NLS
    361 #  if ENABLE_NLS
    362 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
    363 #   define YY_(msgid) dgettext ("bison-runtime", msgid)
    364 #  endif
    365 # endif
    366 # ifndef YY_
    367 #  define YY_(msgid) msgid
    368 # endif
    369 #endif
    370 
    371 /* Suppress unused-variable warnings by "using" E.  */
    372 #if ! defined lint || defined __GNUC__
    373 # define YYUSE(e) ((void) (e))
    374 #else
    375 # define YYUSE(e) /* empty */
    376 #endif
    377 
    378 /* Identity function, used to suppress warnings about constant conditions.  */
    379 #ifndef lint
    380 # define YYID(n) (n)
    381 #else
    382 #if (defined __STDC__ || defined __C99__FUNC__ \
    383      || defined __cplusplus || defined _MSC_VER)
    384 static int
    385 YYID (int yyi)
    386 #else
    387 static int
    388 YYID (yyi)
    389     int yyi;
    390 #endif
    391 {
    392   return yyi;
    393 }
    394 #endif
    395 
    396 #if ! defined yyoverflow || YYERROR_VERBOSE
    397 
    398 /* The parser invokes alloca or malloc; define the necessary symbols.  */
    399 
    400 # ifdef YYSTACK_USE_ALLOCA
    401 #  if YYSTACK_USE_ALLOCA
    402 #   ifdef __GNUC__
    403 #    define YYSTACK_ALLOC __builtin_alloca
    404 #   elif defined __BUILTIN_VA_ARG_INCR
    405 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
    406 #   elif defined _AIX
    407 #    define YYSTACK_ALLOC __alloca
    408 #   elif defined _MSC_VER
    409 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
    410 #    define alloca _alloca
    411 #   else
    412 #    define YYSTACK_ALLOC alloca
    413 #    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
    414      || defined __cplusplus || defined _MSC_VER)
    415 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
    416 #     ifndef _STDLIB_H
    417 #      define _STDLIB_H 1
    418 #     endif
    419 #    endif
    420 #   endif
    421 #  endif
    422 # endif
    423 
    424 # ifdef YYSTACK_ALLOC
    425    /* Pacify GCC's `empty if-body' warning.  */
    426 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
    427 #  ifndef YYSTACK_ALLOC_MAXIMUM
    428     /* The OS might guarantee only one guard page at the bottom of the stack,
    429        and a page size can be as small as 4096 bytes.  So we cannot safely
    430        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
    431        to allow for a few compiler-allocated temporary stack slots.  */
    432 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
    433 #  endif
    434 # else
    435 #  define YYSTACK_ALLOC YYMALLOC
    436 #  define YYSTACK_FREE YYFREE
    437 #  ifndef YYSTACK_ALLOC_MAXIMUM
    438 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
    439 #  endif
    440 #  if (defined __cplusplus && ! defined _STDLIB_H \
    441        && ! ((defined YYMALLOC || defined malloc) \
    442 	     && (defined YYFREE || defined free)))
    443 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
    444 #   ifndef _STDLIB_H
    445 #    define _STDLIB_H 1
    446 #   endif
    447 #  endif
    448 #  ifndef YYMALLOC
    449 #   define YYMALLOC malloc
    450 #   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
    451      || defined __cplusplus || defined _MSC_VER)
    452 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
    453 #   endif
    454 #  endif
    455 #  ifndef YYFREE
    456 #   define YYFREE free
    457 #   if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
    458      || defined __cplusplus || defined _MSC_VER)
    459 void free (void *); /* INFRINGES ON USER NAME SPACE */
    460 #   endif
    461 #  endif
    462 # endif
    463 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
    464 
    465 
    466 #if (! defined yyoverflow \
    467      && (! defined __cplusplus \
    468 	 || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
    469 	     && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
    470 
    471 /* A type that is properly aligned for any stack member.  */
    472 union yyalloc
    473 {
    474   yytype_int16 yyss_alloc;
    475   YYSTYPE yyvs_alloc;
    476   YYLTYPE yyls_alloc;
    477 };
    478 
    479 /* The size of the maximum gap between one aligned stack and the next.  */
    480 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
    481 
    482 /* The size of an array large to enough to hold all stacks, each with
    483    N elements.  */
    484 # define YYSTACK_BYTES(N) \
    485      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
    486       + 2 * YYSTACK_GAP_MAXIMUM)
    487 
    488 /* Copy COUNT objects from FROM to TO.  The source and destination do
    489    not overlap.  */
    490 # ifndef YYCOPY
    491 #  if defined __GNUC__ && 1 < __GNUC__
    492 #   define YYCOPY(To, From, Count) \
    493       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
    494 #  else
    495 #   define YYCOPY(To, From, Count)		\
    496       do					\
    497 	{					\
    498 	  YYSIZE_T yyi;				\
    499 	  for (yyi = 0; yyi < (Count); yyi++)	\
    500 	    (To)[yyi] = (From)[yyi];		\
    501 	}					\
    502       while (YYID (0))
    503 #  endif
    504 # endif
    505 
    506 /* Relocate STACK from its old location to the new one.  The
    507    local variables YYSIZE and YYSTACKSIZE give the old and new number of
    508    elements in the stack, and YYPTR gives the new location of the
    509    stack.  Advance YYPTR to a properly aligned location for the next
    510    stack.  */
    511 # define YYSTACK_RELOCATE(Stack_alloc, Stack)				\
    512     do									\
    513       {									\
    514 	YYSIZE_T yynewbytes;						\
    515 	YYCOPY (&yyptr->Stack_alloc, Stack, yysize);			\
    516 	Stack = &yyptr->Stack_alloc;					\
    517 	yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
    518 	yyptr += yynewbytes / sizeof (*yyptr);				\
    519       }									\
    520     while (YYID (0))
    521 
    522 #endif
    523 
    524 /* YYFINAL -- State number of the termination state.  */
    525 #define YYFINAL  2
    526 /* YYLAST -- Last index in YYTABLE.  */
    527 #define YYLAST   606
    528 
    529 /* YYNTOKENS -- Number of terminals.  */
    530 #define YYNTOKENS  57
    531 /* YYNNTS -- Number of nonterminals.  */
    532 #define YYNNTS  17
    533 /* YYNRULES -- Number of rules.  */
    534 #define YYNRULES  101
    535 /* YYNRULES -- Number of states.  */
    536 #define YYNSTATES  162
    537 
    538 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
    539 #define YYUNDEFTOK  2
    540 #define YYMAXUTOK   289
    541 
    542 #define YYTRANSLATE(YYX)						\
    543   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
    544 
    545 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
    546 static const yytype_uint8 yytranslate[] =
    547 {
    548        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    549        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    550        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    551        2,     2,     2,    47,     2,     2,     2,    43,    30,     2,
    552       45,    46,    41,    39,    49,    40,    54,    42,     2,     2,
    553        2,     2,     2,     2,     2,     2,     2,     2,     2,    55,
    554       33,    56,    34,     2,     2,     2,     2,     2,     2,     2,
    555        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    556        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    557        2,    50,     2,    51,    29,     2,     2,     2,     2,     2,
    558        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    559        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    560        2,     2,     2,    52,    28,    53,    48,     2,     2,     2,
    561        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    562        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    563        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    564        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    565        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    566        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    567        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    568        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    569        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    570        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    571        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    572        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    573        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
    574        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
    575       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
    576       25,    26,    27,    31,    32,    35,    36,    37,    38,    44
    577 };
    578 
    579 #if YYDEBUG
    580 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
    581    YYRHS.  */
    582 static const yytype_uint16 yyprhs[] =
    583 {
    584        0,     0,     3,     4,     7,     9,    11,    13,    16,    20,
    585       24,    29,    36,    44,    48,    52,    55,    60,    65,    69,
    586       72,    75,    78,    82,    85,    87,    89,    91,    95,    99,
    587      103,   107,   111,   115,   119,   123,   127,   131,   135,   139,
    588      143,   147,   151,   155,   159,   163,   166,   169,   172,   175,
    589      179,   181,   185,   187,   190,   193,   194,   196,   197,   199,
    590      202,   207,   209,   211,   214,   216,   219,   221,   223,   225,
    591      227,   229,   231,   233,   235,   237,   239,   241,   243,   245,
    592      247,   249,   251,   253,   255,   257,   259,   261,   263,   265,
    593      267,   269,   271,   273,   275,   277,   279,   281,   283,   285,
    594      287,   289
    595 };
    596 
    597 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
    598 static const yytype_int8 yyrhs[] =
    599 {
    600       58,     0,    -1,    -1,    58,    59,    -1,    61,    -1,    65,
    601       -1,    60,    -1,     6,    66,    -1,    18,    63,    21,    -1,
    602        5,    63,    21,    -1,     8,    17,    67,    21,    -1,     7,
    603       17,    45,    46,    67,    21,    -1,     7,    17,    45,    64,
    604       46,    67,    21,    -1,    15,    17,    21,    -1,    12,    70,
    605       21,    -1,    12,    21,    -1,    13,    17,    68,    21,    -1,
    606       14,    17,    68,    21,    -1,     9,    70,    21,    -1,     9,
    607       21,    -1,    10,    21,    -1,    11,    21,    -1,    16,    62,
    608       21,    -1,     6,    21,    -1,    20,    -1,    19,    -1,    62,
    609       -1,    63,    26,    63,    -1,    63,    27,    63,    -1,    63,
    610       28,    63,    -1,    63,    29,    63,    -1,    63,    30,    63,
    611       -1,    63,    31,    63,    -1,    63,    32,    63,    -1,    63,
    612       35,    63,    -1,    63,    36,    63,    -1,    63,    34,    63,
    613       -1,    63,    33,    63,    -1,    63,    37,    63,    -1,    63,
    614       38,    63,    -1,    63,    40,    63,    -1,    63,    39,    63,
    615       -1,    63,    43,    63,    -1,    63,    42,    63,    -1,    63,
    616       41,    63,    -1,    47,    63,    -1,    48,    63,    -1,    40,
    617       63,    -1,    39,    63,    -1,    45,    63,    46,    -1,    17,
    618       -1,    64,    49,    17,    -1,    21,    -1,    71,    21,    -1,
    619       71,    21,    -1,    -1,    71,    -1,    -1,    71,    -1,     4,
    620       17,    -1,     4,    45,    17,    46,    -1,    72,    -1,    69,
    621       -1,    70,    69,    -1,    72,    -1,    71,    72,    -1,    17,
    622       -1,    20,    -1,    73,    -1,    22,    -1,    24,    -1,    50,
    623       -1,    51,    -1,    45,    -1,    46,    -1,    52,    -1,    53,
    624       -1,    54,    -1,    30,    -1,    41,    -1,    39,    -1,    40,
    625       -1,    48,    -1,    47,    -1,    42,    -1,    43,    -1,    38,
    626       -1,    37,    -1,    33,    -1,    34,    -1,    36,    -1,    35,
    627       -1,    32,    -1,    31,    -1,    29,    -1,    28,    -1,    27,
    628       -1,    26,    -1,    55,    -1,    49,    -1,    56,    -1,    25,
    629       -1
    630 };
    631 
    632 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
    633 static const yytype_uint16 yyrline[] =
    634 {
    635        0,   188,   188,   190,   194,   197,   202,   203,   207,   210,
    636      216,   219,   222,   225,   233,   252,   262,   267,   272,   291,
    637      306,   309,   312,   333,   337,   346,   351,   352,   355,   358,
    638      361,   364,   367,   370,   373,   376,   379,   382,   385,   388,
    639      391,   394,   397,   400,   403,   406,   409,   412,   415,   418,
    640      424,   429,   437,   438,   442,   448,   449,   452,   454,   461,
    641      465,   469,   474,   479,   487,   493,   501,   505,   509,   513,
    642      517,   524,   525,   526,   527,   528,   529,   530,   531,   532,
    643      533,   534,   535,   536,   537,   538,   539,   540,   541,   542,
    644      543,   544,   545,   546,   547,   548,   549,   550,   551,   552,
    645      553,   554
    646 };
    647 #endif
    648 
    649 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
    650 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
    651    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
    652 static const char *const yytname[] =
    653 {
    654   "$end", "error", "$undefined", "COMMA_FINAL", "DEFINED",
    655   "ELIF_EXPANDED", "HASH", "HASH_DEFINE_FUNC", "HASH_DEFINE_OBJ",
    656   "HASH_ELIF", "HASH_ELSE", "HASH_ENDIF", "HASH_IF", "HASH_IFDEF",
    657   "HASH_IFNDEF", "HASH_UNDEF", "HASH_VERSION", "IDENTIFIER", "IF_EXPANDED",
    658   "INTEGER", "INTEGER_STRING", "NEWLINE", "OTHER", "PLACEHOLDER", "SPACE",
    659   "PASTE", "OR", "AND", "'|'", "'^'", "'&'", "NOT_EQUAL", "EQUAL", "'<'",
    660   "'>'", "GREATER_OR_EQUAL", "LESS_OR_EQUAL", "RIGHT_SHIFT", "LEFT_SHIFT",
    661   "'+'", "'-'", "'*'", "'/'", "'%'", "UNARY", "'('", "')'", "'!'", "'~'",
    662   "','", "'['", "']'", "'{'", "'}'", "'.'", "';'", "'='", "$accept",
    663   "input", "line", "expanded_line", "control_line", "integer_constant",
    664   "expression", "identifier_list", "text_line", "non_directive",
    665   "replacement_list", "junk", "conditional_token", "conditional_tokens",
    666   "pp_tokens", "preprocessing_token", "operator", 0
    667 };
    668 #endif
    669 
    670 # ifdef YYPRINT
    671 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
    672    token YYLEX-NUM.  */
    673 static const yytype_uint16 yytoknum[] =
    674 {
    675        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
    676      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
    677      275,   276,   277,   278,   279,   280,   281,   282,   124,    94,
    678       38,   283,   284,    60,    62,   285,   286,   287,   288,    43,
    679       45,    42,    47,    37,   289,    40,    41,    33,   126,    44,
    680       91,    93,   123,   125,    46,    59,    61
    681 };
    682 # endif
    683 
    684 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
    685 static const yytype_uint8 yyr1[] =
    686 {
    687        0,    57,    58,    58,    59,    59,    59,    59,    60,    60,
    688       61,    61,    61,    61,    61,    61,    61,    61,    61,    61,
    689       61,    61,    61,    61,    62,    62,    63,    63,    63,    63,
    690       63,    63,    63,    63,    63,    63,    63,    63,    63,    63,
    691       63,    63,    63,    63,    63,    63,    63,    63,    63,    63,
    692       64,    64,    65,    65,    66,    67,    67,    68,    68,    69,
    693       69,    69,    70,    70,    71,    71,    72,    72,    72,    72,
    694       72,    73,    73,    73,    73,    73,    73,    73,    73,    73,
    695       73,    73,    73,    73,    73,    73,    73,    73,    73,    73,
    696       73,    73,    73,    73,    73,    73,    73,    73,    73,    73,
    697       73,    73
    698 };
    699 
    700 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
    701 static const yytype_uint8 yyr2[] =
    702 {
    703        0,     2,     0,     2,     1,     1,     1,     2,     3,     3,
    704        4,     6,     7,     3,     3,     2,     4,     4,     3,     2,
    705        2,     2,     3,     2,     1,     1,     1,     3,     3,     3,
    706        3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
    707        3,     3,     3,     3,     3,     2,     2,     2,     2,     3,
    708        1,     3,     1,     2,     2,     0,     1,     0,     1,     2,
    709        4,     1,     1,     2,     1,     2,     1,     1,     1,     1,
    710        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
    711        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
    712        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
    713        1,     1
    714 };
    715 
    716 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
    717    STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
    718    means the default is an error.  */
    719 static const yytype_uint8 yydefact[] =
    720 {
    721        2,     0,     1,     0,     0,     0,     0,     0,     0,     0,
    722        0,     0,     0,     0,     0,    66,     0,    67,    52,    69,
    723       70,   101,    97,    96,    95,    94,    78,    93,    92,    88,
    724       89,    91,    90,    87,    86,    80,    81,    79,    84,    85,
    725       73,    74,    83,    82,    99,    71,    72,    75,    76,    77,
    726       98,   100,     3,     6,     4,     5,     0,    64,    68,    25,
    727       24,     0,     0,     0,     0,     0,    26,     0,    23,     7,
    728        0,     0,    55,     0,    19,    62,     0,    61,    20,    21,
    729       15,     0,    57,    57,     0,     0,     0,    53,    65,    48,
    730       47,     0,    45,    46,     9,     0,     0,     0,     0,     0,
    731        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
    732        0,     0,     0,    54,     0,     0,    56,    59,     0,    18,
    733       63,    14,     0,    58,     0,    13,    22,     8,    49,    27,
    734       28,    29,    30,    31,    32,    33,    37,    36,    34,    35,
    735       38,    39,    41,    40,    44,    43,    42,    50,    55,     0,
    736       10,     0,    16,    17,     0,    55,     0,    60,    11,     0,
    737       51,    12
    738 };
    739 
    740 /* YYDEFGOTO[NTERM-NUM].  */
    741 static const yytype_int16 yydefgoto[] =
    742 {
    743       -1,     1,    52,    53,    54,    66,    67,   149,    55,    69,
    744      115,   122,    75,    76,   116,    57,    58
    745 };
    746 
    747 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
    748    STATE-NUM.  */
    749 #define YYPACT_NINF -147
    750 static const yytype_int16 yypact[] =
    751 {
    752     -147,   112,  -147,    28,   -10,    55,    62,   152,   -15,    59,
    753      192,    85,    86,    87,    51,  -147,    28,  -147,  -147,  -147,
    754     -147,  -147,  -147,  -147,  -147,  -147,  -147,  -147,  -147,  -147,
    755     -147,  -147,  -147,  -147,  -147,  -147,  -147,  -147,  -147,  -147,
    756     -147,  -147,  -147,  -147,  -147,  -147,  -147,  -147,  -147,  -147,
    757     -147,  -147,  -147,  -147,  -147,  -147,   312,  -147,  -147,  -147,
    758     -147,    28,    28,    28,    28,    28,  -147,   428,  -147,  -147,
    759      352,    63,   392,    17,  -147,  -147,   232,  -147,  -147,  -147,
    760     -147,   272,   392,   392,    84,    89,   451,  -147,  -147,  -147,
    761     -147,   469,  -147,  -147,  -147,    28,    28,    28,    28,    28,
    762       28,    28,    28,    28,    28,    28,    28,    28,    28,    28,
    763       28,    28,    28,  -147,    60,    90,   392,  -147,    96,  -147,
    764     -147,  -147,    93,   392,    94,  -147,  -147,  -147,  -147,   489,
    765      505,   520,   534,   547,   558,   558,    18,    18,    18,    18,
    766      563,   563,    23,    23,  -147,  -147,  -147,  -147,   392,    32,
    767     -147,    61,  -147,  -147,   110,   392,   118,  -147,  -147,   149,
    768     -147,  -147
    769 };
    770 
    771 /* YYPGOTO[NTERM-NUM].  */
    772 static const yytype_int16 yypgoto[] =
    773 {
    774     -147,  -147,  -147,  -147,  -147,   157,   -11,  -147,  -147,  -147,
    775     -146,    92,   -68,   200,     0,    -7,  -147
    776 };
    777 
    778 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
    779    positive, shift that token.  If negative, reduce the rule which
    780    number is the opposite.  If zero, do what YYDEFACT says.
    781    If YYTABLE_NINF, syntax error.  */
    782 #define YYTABLE_NINF -1
    783 static const yytype_uint8 yytable[] =
    784 {
    785       77,    56,   154,    77,    70,    86,    78,    15,   120,   159,
    786       17,    68,    19,   120,    20,    21,    22,    23,    24,    25,
    787       26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
    788       36,    37,    38,    39,   117,    40,    41,    42,    43,    44,
    789       45,    46,    47,    48,    49,    50,    51,    59,    60,    88,
    790       89,    90,    91,    92,    93,   106,   107,   108,   109,   110,
    791      111,   112,   118,    88,   110,   111,   112,    61,    62,    77,
    792       59,    60,    71,    63,    77,    64,    65,   147,   155,    72,
    793       79,   156,   123,   123,   129,   130,   131,   132,   133,   134,
    794      135,   136,   137,   138,   139,   140,   141,   142,   143,   144,
    795      145,   146,    82,    83,    84,   125,   148,   157,   114,    88,
    796      126,   150,     2,   151,   152,   153,    88,     3,     4,     5,
    797        6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
    798       16,   158,    17,    18,    19,   160,    20,    21,    22,    23,
    799       24,    25,    26,    27,    28,    29,    30,    31,    32,    33,
    800       34,    35,    36,    37,    38,    39,    73,    40,    41,    42,
    801       43,    44,    45,    46,    47,    48,    49,    50,    51,    15,
    802      161,    85,    17,    74,    19,   124,    20,    21,    22,    23,
    803       24,    25,    26,    27,    28,    29,    30,    31,    32,    33,
    804       34,    35,    36,    37,    38,    39,    73,    40,    41,    42,
    805       43,    44,    45,    46,    47,    48,    49,    50,    51,    15,
    806       81,     0,    17,    80,    19,     0,    20,    21,    22,    23,
    807       24,    25,    26,    27,    28,    29,    30,    31,    32,    33,
    808       34,    35,    36,    37,    38,    39,    73,    40,    41,    42,
    809       43,    44,    45,    46,    47,    48,    49,    50,    51,    15,
    810        0,     0,    17,   119,    19,     0,    20,    21,    22,    23,
    811       24,    25,    26,    27,    28,    29,    30,    31,    32,    33,
    812       34,    35,    36,    37,    38,    39,    73,    40,    41,    42,
    813       43,    44,    45,    46,    47,    48,    49,    50,    51,    15,
    814        0,     0,    17,   121,    19,     0,    20,    21,    22,    23,
    815       24,    25,    26,    27,    28,    29,    30,    31,    32,    33,
    816       34,    35,    36,    37,    38,    39,     0,    40,    41,    42,
    817       43,    44,    45,    46,    47,    48,    49,    50,    51,    15,
    818        0,     0,    17,    87,    19,     0,    20,    21,    22,    23,
    819       24,    25,    26,    27,    28,    29,    30,    31,    32,    33,
    820       34,    35,    36,    37,    38,    39,     0,    40,    41,    42,
    821       43,    44,    45,    46,    47,    48,    49,    50,    51,    15,
    822        0,     0,    17,   113,    19,     0,    20,    21,    22,    23,
    823       24,    25,    26,    27,    28,    29,    30,    31,    32,    33,
    824       34,    35,    36,    37,    38,    39,     0,    40,    41,    42,
    825       43,    44,    45,    46,    47,    48,    49,    50,    51,    15,
    826        0,     0,    17,     0,    19,     0,    20,    21,    22,    23,
    827       24,    25,    26,    27,    28,    29,    30,    31,    32,    33,
    828       34,    35,    36,    37,    38,    39,     0,    40,    41,    42,
    829       43,    44,    45,    46,    47,    48,    49,    50,    51,    94,
    830        0,     0,     0,     0,    95,    96,    97,    98,    99,   100,
    831      101,   102,   103,   104,   105,   106,   107,   108,   109,   110,
    832      111,   112,   127,     0,     0,     0,     0,    95,    96,    97,
    833       98,    99,   100,   101,   102,   103,   104,   105,   106,   107,
    834      108,   109,   110,   111,   112,    95,    96,    97,    98,    99,
    835      100,   101,   102,   103,   104,   105,   106,   107,   108,   109,
    836      110,   111,   112,     0,     0,   128,    96,    97,    98,    99,
    837      100,   101,   102,   103,   104,   105,   106,   107,   108,   109,
    838      110,   111,   112,    97,    98,    99,   100,   101,   102,   103,
    839      104,   105,   106,   107,   108,   109,   110,   111,   112,    98,
    840       99,   100,   101,   102,   103,   104,   105,   106,   107,   108,
    841      109,   110,   111,   112,    99,   100,   101,   102,   103,   104,
    842      105,   106,   107,   108,   109,   110,   111,   112,   100,   101,
    843      102,   103,   104,   105,   106,   107,   108,   109,   110,   111,
    844      112,   102,   103,   104,   105,   106,   107,   108,   109,   110,
    845      111,   112,   108,   109,   110,   111,   112
    846 };
    847 
    848 static const yytype_int16 yycheck[] =
    849 {
    850        7,     1,   148,    10,     4,    16,    21,    17,    76,   155,
    851       20,    21,    22,    81,    24,    25,    26,    27,    28,    29,
    852       30,    31,    32,    33,    34,    35,    36,    37,    38,    39,
    853       40,    41,    42,    43,    17,    45,    46,    47,    48,    49,
    854       50,    51,    52,    53,    54,    55,    56,    19,    20,    56,
    855       61,    62,    63,    64,    65,    37,    38,    39,    40,    41,
    856       42,    43,    45,    70,    41,    42,    43,    39,    40,    76,
    857       19,    20,    17,    45,    81,    47,    48,    17,    46,    17,
    858       21,    49,    82,    83,    95,    96,    97,    98,    99,   100,
    859      101,   102,   103,   104,   105,   106,   107,   108,   109,   110,
    860      111,   112,    17,    17,    17,    21,    46,    46,    45,   116,
    861       21,    21,     0,    17,    21,    21,   123,     5,     6,     7,
    862        8,     9,    10,    11,    12,    13,    14,    15,    16,    17,
    863       18,    21,    20,    21,    22,    17,    24,    25,    26,    27,
    864       28,    29,    30,    31,    32,    33,    34,    35,    36,    37,
    865       38,    39,    40,    41,    42,    43,     4,    45,    46,    47,
    866       48,    49,    50,    51,    52,    53,    54,    55,    56,    17,
    867       21,    14,    20,    21,    22,    83,    24,    25,    26,    27,
    868       28,    29,    30,    31,    32,    33,    34,    35,    36,    37,
    869       38,    39,    40,    41,    42,    43,     4,    45,    46,    47,
    870       48,    49,    50,    51,    52,    53,    54,    55,    56,    17,
    871       10,    -1,    20,    21,    22,    -1,    24,    25,    26,    27,
    872       28,    29,    30,    31,    32,    33,    34,    35,    36,    37,
    873       38,    39,    40,    41,    42,    43,     4,    45,    46,    47,
    874       48,    49,    50,    51,    52,    53,    54,    55,    56,    17,
    875       -1,    -1,    20,    21,    22,    -1,    24,    25,    26,    27,
    876       28,    29,    30,    31,    32,    33,    34,    35,    36,    37,
    877       38,    39,    40,    41,    42,    43,     4,    45,    46,    47,
    878       48,    49,    50,    51,    52,    53,    54,    55,    56,    17,
    879       -1,    -1,    20,    21,    22,    -1,    24,    25,    26,    27,
    880       28,    29,    30,    31,    32,    33,    34,    35,    36,    37,
    881       38,    39,    40,    41,    42,    43,    -1,    45,    46,    47,
    882       48,    49,    50,    51,    52,    53,    54,    55,    56,    17,
    883       -1,    -1,    20,    21,    22,    -1,    24,    25,    26,    27,
    884       28,    29,    30,    31,    32,    33,    34,    35,    36,    37,
    885       38,    39,    40,    41,    42,    43,    -1,    45,    46,    47,
    886       48,    49,    50,    51,    52,    53,    54,    55,    56,    17,
    887       -1,    -1,    20,    21,    22,    -1,    24,    25,    26,    27,
    888       28,    29,    30,    31,    32,    33,    34,    35,    36,    37,
    889       38,    39,    40,    41,    42,    43,    -1,    45,    46,    47,
    890       48,    49,    50,    51,    52,    53,    54,    55,    56,    17,
    891       -1,    -1,    20,    -1,    22,    -1,    24,    25,    26,    27,
    892       28,    29,    30,    31,    32,    33,    34,    35,    36,    37,
    893       38,    39,    40,    41,    42,    43,    -1,    45,    46,    47,
    894       48,    49,    50,    51,    52,    53,    54,    55,    56,    21,
    895       -1,    -1,    -1,    -1,    26,    27,    28,    29,    30,    31,
    896       32,    33,    34,    35,    36,    37,    38,    39,    40,    41,
    897       42,    43,    21,    -1,    -1,    -1,    -1,    26,    27,    28,
    898       29,    30,    31,    32,    33,    34,    35,    36,    37,    38,
    899       39,    40,    41,    42,    43,    26,    27,    28,    29,    30,
    900       31,    32,    33,    34,    35,    36,    37,    38,    39,    40,
    901       41,    42,    43,    -1,    -1,    46,    27,    28,    29,    30,
    902       31,    32,    33,    34,    35,    36,    37,    38,    39,    40,
    903       41,    42,    43,    28,    29,    30,    31,    32,    33,    34,
    904       35,    36,    37,    38,    39,    40,    41,    42,    43,    29,
    905       30,    31,    32,    33,    34,    35,    36,    37,    38,    39,
    906       40,    41,    42,    43,    30,    31,    32,    33,    34,    35,
    907       36,    37,    38,    39,    40,    41,    42,    43,    31,    32,
    908       33,    34,    35,    36,    37,    38,    39,    40,    41,    42,
    909       43,    33,    34,    35,    36,    37,    38,    39,    40,    41,
    910       42,    43,    39,    40,    41,    42,    43
    911 };
    912 
    913 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
    914    symbol of state STATE-NUM.  */
    915 static const yytype_uint8 yystos[] =
    916 {
    917        0,    58,     0,     5,     6,     7,     8,     9,    10,    11,
    918       12,    13,    14,    15,    16,    17,    18,    20,    21,    22,
    919       24,    25,    26,    27,    28,    29,    30,    31,    32,    33,
    920       34,    35,    36,    37,    38,    39,    40,    41,    42,    43,
    921       45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
    922       55,    56,    59,    60,    61,    65,    71,    72,    73,    19,
    923       20,    39,    40,    45,    47,    48,    62,    63,    21,    66,
    924       71,    17,    17,     4,    21,    69,    70,    72,    21,    21,
    925       21,    70,    17,    17,    17,    62,    63,    21,    72,    63,
    926       63,    63,    63,    63,    21,    26,    27,    28,    29,    30,
    927       31,    32,    33,    34,    35,    36,    37,    38,    39,    40,
    928       41,    42,    43,    21,    45,    67,    71,    17,    45,    21,
    929       69,    21,    68,    71,    68,    21,    21,    21,    46,    63,
    930       63,    63,    63,    63,    63,    63,    63,    63,    63,    63,
    931       63,    63,    63,    63,    63,    63,    63,    17,    46,    64,
    932       21,    17,    21,    21,    67,    46,    49,    46,    21,    67,
    933       17,    21
    934 };
    935 
    936 #define yyerrok		(yyerrstatus = 0)
    937 #define yyclearin	(yychar = YYEMPTY)
    938 #define YYEMPTY		(-2)
    939 #define YYEOF		0
    940 
    941 #define YYACCEPT	goto yyacceptlab
    942 #define YYABORT		goto yyabortlab
    943 #define YYERROR		goto yyerrorlab
    944 
    945 
    946 /* Like YYERROR except do call yyerror.  This remains here temporarily
    947    to ease the transition to the new meaning of YYERROR, for GCC.
    948    Once GCC version 2 has supplanted version 1, this can go.  However,
    949    YYFAIL appears to be in use.  Nevertheless, it is formally deprecated
    950    in Bison 2.4.2's NEWS entry, where a plan to phase it out is
    951    discussed.  */
    952 
    953 #define YYFAIL		goto yyerrlab
    954 #if defined YYFAIL
    955   /* This is here to suppress warnings from the GCC cpp's
    956      -Wunused-macros.  Normally we don't worry about that warning, but
    957      some users do, and we want to make it easy for users to remove
    958      YYFAIL uses, which will produce warnings from Bison 2.5.  */
    959 #endif
    960 
    961 #define YYRECOVERING()  (!!yyerrstatus)
    962 
    963 #define YYBACKUP(Token, Value)					\
    964 do								\
    965   if (yychar == YYEMPTY && yylen == 1)				\
    966     {								\
    967       yychar = (Token);						\
    968       yylval = (Value);						\
    969       yytoken = YYTRANSLATE (yychar);				\
    970       YYPOPSTACK (1);						\
    971       goto yybackup;						\
    972     }								\
    973   else								\
    974     {								\
    975       yyerror (&yylloc, parser, YY_("syntax error: cannot back up")); \
    976       YYERROR;							\
    977     }								\
    978 while (YYID (0))
    979 
    980 
    981 #define YYTERROR	1
    982 #define YYERRCODE	256
    983 
    984 
    985 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
    986    If N is 0, then set CURRENT to the empty location which ends
    987    the previous symbol: RHS[0] (always defined).  */
    988 
    989 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
    990 #ifndef YYLLOC_DEFAULT
    991 # define YYLLOC_DEFAULT(Current, Rhs, N)				\
    992     do									\
    993       if (YYID (N))                                                    \
    994 	{								\
    995 	  (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;	\
    996 	  (Current).first_column = YYRHSLOC (Rhs, 1).first_column;	\
    997 	  (Current).last_line    = YYRHSLOC (Rhs, N).last_line;		\
    998 	  (Current).last_column  = YYRHSLOC (Rhs, N).last_column;	\
    999 	}								\
   1000       else								\
   1001 	{								\
   1002 	  (Current).first_line   = (Current).last_line   =		\
   1003 	    YYRHSLOC (Rhs, 0).last_line;				\
   1004 	  (Current).first_column = (Current).last_column =		\
   1005 	    YYRHSLOC (Rhs, 0).last_column;				\
   1006 	}								\
   1007     while (YYID (0))
   1008 #endif
   1009 
   1010 
   1011 /* YY_LOCATION_PRINT -- Print the location on the stream.
   1012    This macro was not mandated originally: define only if we know
   1013    we won't break user code: when these are the locations we know.  */
   1014 
   1015 #ifndef YY_LOCATION_PRINT
   1016 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
   1017 #  define YY_LOCATION_PRINT(File, Loc)			\
   1018      fprintf (File, "%d.%d-%d.%d",			\
   1019 	      (Loc).first_line, (Loc).first_column,	\
   1020 	      (Loc).last_line,  (Loc).last_column)
   1021 # else
   1022 #  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
   1023 # endif
   1024 #endif
   1025 
   1026 
   1027 /* YYLEX -- calling `yylex' with the right arguments.  */
   1028 
   1029 #ifdef YYLEX_PARAM
   1030 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
   1031 #else
   1032 # define YYLEX yylex (&yylval, &yylloc, parser)
   1033 #endif
   1034 
   1035 /* Enable debugging if requested.  */
   1036 #if YYDEBUG
   1037 
   1038 # ifndef YYFPRINTF
   1039 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
   1040 #  define YYFPRINTF fprintf
   1041 # endif
   1042 
   1043 # define YYDPRINTF(Args)			\
   1044 do {						\
   1045   if (yydebug)					\
   1046     YYFPRINTF Args;				\
   1047 } while (YYID (0))
   1048 
   1049 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)			  \
   1050 do {									  \
   1051   if (yydebug)								  \
   1052     {									  \
   1053       YYFPRINTF (stderr, "%s ", Title);					  \
   1054       yy_symbol_print (stderr,						  \
   1055 		  Type, Value, Location, parser); \
   1056       YYFPRINTF (stderr, "\n");						  \
   1057     }									  \
   1058 } while (YYID (0))
   1059 
   1060 
   1061 /*--------------------------------.
   1062 | Print this symbol on YYOUTPUT.  |
   1063 `--------------------------------*/
   1064 
   1065 /*ARGSUSED*/
   1066 #if (defined __STDC__ || defined __C99__FUNC__ \
   1067      || defined __cplusplus || defined _MSC_VER)
   1068 static void
   1069 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, glcpp_parser_t *parser)
   1070 #else
   1071 static void
   1072 yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, parser)
   1073     FILE *yyoutput;
   1074     int yytype;
   1075     YYSTYPE const * const yyvaluep;
   1076     YYLTYPE const * const yylocationp;
   1077     glcpp_parser_t *parser;
   1078 #endif
   1079 {
   1080   if (!yyvaluep)
   1081     return;
   1082   YYUSE (yylocationp);
   1083   YYUSE (parser);
   1084 # ifdef YYPRINT
   1085   if (yytype < YYNTOKENS)
   1086     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
   1087 # else
   1088   YYUSE (yyoutput);
   1089 # endif
   1090   switch (yytype)
   1091     {
   1092       default:
   1093 	break;
   1094     }
   1095 }
   1096 
   1097 
   1098 /*--------------------------------.
   1099 | Print this symbol on YYOUTPUT.  |
   1100 `--------------------------------*/
   1101 
   1102 #if (defined __STDC__ || defined __C99__FUNC__ \
   1103      || defined __cplusplus || defined _MSC_VER)
   1104 static void
   1105 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, glcpp_parser_t *parser)
   1106 #else
   1107 static void
   1108 yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, parser)
   1109     FILE *yyoutput;
   1110     int yytype;
   1111     YYSTYPE const * const yyvaluep;
   1112     YYLTYPE const * const yylocationp;
   1113     glcpp_parser_t *parser;
   1114 #endif
   1115 {
   1116   if (yytype < YYNTOKENS)
   1117     YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
   1118   else
   1119     YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
   1120 
   1121   YY_LOCATION_PRINT (yyoutput, *yylocationp);
   1122   YYFPRINTF (yyoutput, ": ");
   1123   yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, parser);
   1124   YYFPRINTF (yyoutput, ")");
   1125 }
   1126 
   1127 /*------------------------------------------------------------------.
   1128 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
   1129 | TOP (included).                                                   |
   1130 `------------------------------------------------------------------*/
   1131 
   1132 #if (defined __STDC__ || defined __C99__FUNC__ \
   1133      || defined __cplusplus || defined _MSC_VER)
   1134 static void
   1135 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
   1136 #else
   1137 static void
   1138 yy_stack_print (yybottom, yytop)
   1139     yytype_int16 *yybottom;
   1140     yytype_int16 *yytop;
   1141 #endif
   1142 {
   1143   YYFPRINTF (stderr, "Stack now");
   1144   for (; yybottom <= yytop; yybottom++)
   1145     {
   1146       int yybot = *yybottom;
   1147       YYFPRINTF (stderr, " %d", yybot);
   1148     }
   1149   YYFPRINTF (stderr, "\n");
   1150 }
   1151 
   1152 # define YY_STACK_PRINT(Bottom, Top)				\
   1153 do {								\
   1154   if (yydebug)							\
   1155     yy_stack_print ((Bottom), (Top));				\
   1156 } while (YYID (0))
   1157 
   1158 
   1159 /*------------------------------------------------.
   1160 | Report that the YYRULE is going to be reduced.  |
   1161 `------------------------------------------------*/
   1162 
   1163 #if (defined __STDC__ || defined __C99__FUNC__ \
   1164      || defined __cplusplus || defined _MSC_VER)
   1165 static void
   1166 yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, glcpp_parser_t *parser)
   1167 #else
   1168 static void
   1169 yy_reduce_print (yyvsp, yylsp, yyrule, parser)
   1170     YYSTYPE *yyvsp;
   1171     YYLTYPE *yylsp;
   1172     int yyrule;
   1173     glcpp_parser_t *parser;
   1174 #endif
   1175 {
   1176   int yynrhs = yyr2[yyrule];
   1177   int yyi;
   1178   unsigned long int yylno = yyrline[yyrule];
   1179   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
   1180 	     yyrule - 1, yylno);
   1181   /* The symbols being reduced.  */
   1182   for (yyi = 0; yyi < yynrhs; yyi++)
   1183     {
   1184       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
   1185       yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
   1186 		       &(yyvsp[(yyi + 1) - (yynrhs)])
   1187 		       , &(yylsp[(yyi + 1) - (yynrhs)])		       , parser);
   1188       YYFPRINTF (stderr, "\n");
   1189     }
   1190 }
   1191 
   1192 # define YY_REDUCE_PRINT(Rule)		\
   1193 do {					\
   1194   if (yydebug)				\
   1195     yy_reduce_print (yyvsp, yylsp, Rule, parser); \
   1196 } while (YYID (0))
   1197 
   1198 /* Nonzero means print parse trace.  It is left uninitialized so that
   1199    multiple parsers can coexist.  */
   1200 int yydebug;
   1201 #else /* !YYDEBUG */
   1202 # define YYDPRINTF(Args)
   1203 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
   1204 # define YY_STACK_PRINT(Bottom, Top)
   1205 # define YY_REDUCE_PRINT(Rule)
   1206 #endif /* !YYDEBUG */
   1207 
   1208 
   1209 /* YYINITDEPTH -- initial size of the parser's stacks.  */
   1210 #ifndef	YYINITDEPTH
   1211 # define YYINITDEPTH 200
   1212 #endif
   1213 
   1214 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
   1215    if the built-in stack extension method is used).
   1216 
   1217    Do not make this value too large; the results are undefined if
   1218    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
   1219    evaluated with infinite-precision integer arithmetic.  */
   1220 
   1221 #ifndef YYMAXDEPTH
   1222 # define YYMAXDEPTH 10000
   1223 #endif
   1224 
   1225 
   1226 
   1228 #if YYERROR_VERBOSE
   1229 
   1230 # ifndef yystrlen
   1231 #  if defined __GLIBC__ && defined _STRING_H
   1232 #   define yystrlen strlen
   1233 #  else
   1234 /* Return the length of YYSTR.  */
   1235 #if (defined __STDC__ || defined __C99__FUNC__ \
   1236      || defined __cplusplus || defined _MSC_VER)
   1237 static YYSIZE_T
   1238 yystrlen (const char *yystr)
   1239 #else
   1240 static YYSIZE_T
   1241 yystrlen (yystr)
   1242     const char *yystr;
   1243 #endif
   1244 {
   1245   YYSIZE_T yylen;
   1246   for (yylen = 0; yystr[yylen]; yylen++)
   1247     continue;
   1248   return yylen;
   1249 }
   1250 #  endif
   1251 # endif
   1252 
   1253 # ifndef yystpcpy
   1254 #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
   1255 #   define yystpcpy stpcpy
   1256 #  else
   1257 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
   1258    YYDEST.  */
   1259 #if (defined __STDC__ || defined __C99__FUNC__ \
   1260      || defined __cplusplus || defined _MSC_VER)
   1261 static char *
   1262 yystpcpy (char *yydest, const char *yysrc)
   1263 #else
   1264 static char *
   1265 yystpcpy (yydest, yysrc)
   1266     char *yydest;
   1267     const char *yysrc;
   1268 #endif
   1269 {
   1270   char *yyd = yydest;
   1271   const char *yys = yysrc;
   1272 
   1273   while ((*yyd++ = *yys++) != '\0')
   1274     continue;
   1275 
   1276   return yyd - 1;
   1277 }
   1278 #  endif
   1279 # endif
   1280 
   1281 # ifndef yytnamerr
   1282 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
   1283    quotes and backslashes, so that it's suitable for yyerror.  The
   1284    heuristic is that double-quoting is unnecessary unless the string
   1285    contains an apostrophe, a comma, or backslash (other than
   1286    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
   1287    null, do not copy; instead, return the length of what the result
   1288    would have been.  */
   1289 static YYSIZE_T
   1290 yytnamerr (char *yyres, const char *yystr)
   1291 {
   1292   if (*yystr == '"')
   1293     {
   1294       YYSIZE_T yyn = 0;
   1295       char const *yyp = yystr;
   1296 
   1297       for (;;)
   1298 	switch (*++yyp)
   1299 	  {
   1300 	  case '\'':
   1301 	  case ',':
   1302 	    goto do_not_strip_quotes;
   1303 
   1304 	  case '\\':
   1305 	    if (*++yyp != '\\')
   1306 	      goto do_not_strip_quotes;
   1307 	    /* Fall through.  */
   1308 	  default:
   1309 	    if (yyres)
   1310 	      yyres[yyn] = *yyp;
   1311 	    yyn++;
   1312 	    break;
   1313 
   1314 	  case '"':
   1315 	    if (yyres)
   1316 	      yyres[yyn] = '\0';
   1317 	    return yyn;
   1318 	  }
   1319     do_not_strip_quotes: ;
   1320     }
   1321 
   1322   if (! yyres)
   1323     return yystrlen (yystr);
   1324 
   1325   return yystpcpy (yyres, yystr) - yyres;
   1326 }
   1327 # endif
   1328 
   1329 /* Copy into YYRESULT an error message about the unexpected token
   1330    YYCHAR while in state YYSTATE.  Return the number of bytes copied,
   1331    including the terminating null byte.  If YYRESULT is null, do not
   1332    copy anything; just return the number of bytes that would be
   1333    copied.  As a special case, return 0 if an ordinary "syntax error"
   1334    message will do.  Return YYSIZE_MAXIMUM if overflow occurs during
   1335    size calculation.  */
   1336 static YYSIZE_T
   1337 yysyntax_error (char *yyresult, int yystate, int yychar)
   1338 {
   1339   int yyn = yypact[yystate];
   1340 
   1341   if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
   1342     return 0;
   1343   else
   1344     {
   1345       int yytype = YYTRANSLATE (yychar);
   1346       YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
   1347       YYSIZE_T yysize = yysize0;
   1348       YYSIZE_T yysize1;
   1349       int yysize_overflow = 0;
   1350       enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
   1351       char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
   1352       int yyx;
   1353 
   1354 # if 0
   1355       /* This is so xgettext sees the translatable formats that are
   1356 	 constructed on the fly.  */
   1357       YY_("syntax error, unexpected %s");
   1358       YY_("syntax error, unexpected %s, expecting %s");
   1359       YY_("syntax error, unexpected %s, expecting %s or %s");
   1360       YY_("syntax error, unexpected %s, expecting %s or %s or %s");
   1361       YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
   1362 # endif
   1363       char *yyfmt;
   1364       char const *yyf;
   1365       static char const yyunexpected[] = "syntax error, unexpected %s";
   1366       static char const yyexpecting[] = ", expecting %s";
   1367       static char const yyor[] = " or %s";
   1368       char yyformat[sizeof yyunexpected
   1369 		    + sizeof yyexpecting - 1
   1370 		    + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
   1371 		       * (sizeof yyor - 1))];
   1372       char const *yyprefix = yyexpecting;
   1373 
   1374       /* Start YYX at -YYN if negative to avoid negative indexes in
   1375 	 YYCHECK.  */
   1376       int yyxbegin = yyn < 0 ? -yyn : 0;
   1377 
   1378       /* Stay within bounds of both yycheck and yytname.  */
   1379       int yychecklim = YYLAST - yyn + 1;
   1380       int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
   1381       int yycount = 1;
   1382 
   1383       yyarg[0] = yytname[yytype];
   1384       yyfmt = yystpcpy (yyformat, yyunexpected);
   1385 
   1386       for (yyx = yyxbegin; yyx < yyxend; ++yyx)
   1387 	if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
   1388 	  {
   1389 	    if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
   1390 	      {
   1391 		yycount = 1;
   1392 		yysize = yysize0;
   1393 		yyformat[sizeof yyunexpected - 1] = '\0';
   1394 		break;
   1395 	      }
   1396 	    yyarg[yycount++] = yytname[yyx];
   1397 	    yysize1 = yysize + yytnamerr (0, yytname[yyx]);
   1398 	    yysize_overflow |= (yysize1 < yysize);
   1399 	    yysize = yysize1;
   1400 	    yyfmt = yystpcpy (yyfmt, yyprefix);
   1401 	    yyprefix = yyor;
   1402 	  }
   1403 
   1404       yyf = YY_(yyformat);
   1405       yysize1 = yysize + yystrlen (yyf);
   1406       yysize_overflow |= (yysize1 < yysize);
   1407       yysize = yysize1;
   1408 
   1409       if (yysize_overflow)
   1410 	return YYSIZE_MAXIMUM;
   1411 
   1412       if (yyresult)
   1413 	{
   1414 	  /* Avoid sprintf, as that infringes on the user's name space.
   1415 	     Don't have undefined behavior even if the translation
   1416 	     produced a string with the wrong number of "%s"s.  */
   1417 	  char *yyp = yyresult;
   1418 	  int yyi = 0;
   1419 	  while ((*yyp = *yyf) != '\0')
   1420 	    {
   1421 	      if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
   1422 		{
   1423 		  yyp += yytnamerr (yyp, yyarg[yyi++]);
   1424 		  yyf += 2;
   1425 		}
   1426 	      else
   1427 		{
   1428 		  yyp++;
   1429 		  yyf++;
   1430 		}
   1431 	    }
   1432 	}
   1433       return yysize;
   1434     }
   1435 }
   1436 #endif /* YYERROR_VERBOSE */
   1437 
   1438 
   1440 /*-----------------------------------------------.
   1441 | Release the memory associated to this symbol.  |
   1442 `-----------------------------------------------*/
   1443 
   1444 /*ARGSUSED*/
   1445 #if (defined __STDC__ || defined __C99__FUNC__ \
   1446      || defined __cplusplus || defined _MSC_VER)
   1447 static void
   1448 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, glcpp_parser_t *parser)
   1449 #else
   1450 static void
   1451 yydestruct (yymsg, yytype, yyvaluep, yylocationp, parser)
   1452     const char *yymsg;
   1453     int yytype;
   1454     YYSTYPE *yyvaluep;
   1455     YYLTYPE *yylocationp;
   1456     glcpp_parser_t *parser;
   1457 #endif
   1458 {
   1459   YYUSE (yyvaluep);
   1460   YYUSE (yylocationp);
   1461   YYUSE (parser);
   1462 
   1463   if (!yymsg)
   1464     yymsg = "Deleting";
   1465   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
   1466 
   1467   switch (yytype)
   1468     {
   1469 
   1470       default:
   1471 	break;
   1472     }
   1473 }
   1474 
   1475 /* Prevent warnings from -Wmissing-prototypes.  */
   1476 #ifdef YYPARSE_PARAM
   1477 #if defined __STDC__ || defined __cplusplus
   1478 int yyparse (void *YYPARSE_PARAM);
   1479 #else
   1480 int yyparse ();
   1481 #endif
   1482 #else /* ! YYPARSE_PARAM */
   1483 #if defined __STDC__ || defined __cplusplus
   1484 int yyparse (glcpp_parser_t *parser);
   1485 #else
   1486 int yyparse ();
   1487 #endif
   1488 #endif /* ! YYPARSE_PARAM */
   1489 
   1490 
   1491 
   1492 
   1493 
   1494 /*-------------------------.
   1495 | yyparse or yypush_parse.  |
   1496 `-------------------------*/
   1497 
   1498 #ifdef YYPARSE_PARAM
   1499 #if (defined __STDC__ || defined __C99__FUNC__ \
   1500      || defined __cplusplus || defined _MSC_VER)
   1501 int
   1502 yyparse (void *YYPARSE_PARAM)
   1503 #else
   1504 int
   1505 yyparse (YYPARSE_PARAM)
   1506     void *YYPARSE_PARAM;
   1507 #endif
   1508 #else /* ! YYPARSE_PARAM */
   1509 #if (defined __STDC__ || defined __C99__FUNC__ \
   1510      || defined __cplusplus || defined _MSC_VER)
   1511 int
   1512 yyparse (glcpp_parser_t *parser)
   1513 #else
   1514 int
   1515 yyparse (parser)
   1516     glcpp_parser_t *parser;
   1517 #endif
   1518 #endif
   1519 {
   1520 /* The lookahead symbol.  */
   1521 int yychar;
   1522 
   1523 /* The semantic value of the lookahead symbol.  */
   1524 YYSTYPE yylval;
   1525 
   1526 /* Location data for the lookahead symbol.  */
   1527 YYLTYPE yylloc;
   1528 
   1529     /* Number of syntax errors so far.  */
   1530     int yynerrs;
   1531 
   1532     int yystate;
   1533     /* Number of tokens to shift before error messages enabled.  */
   1534     int yyerrstatus;
   1535 
   1536     /* The stacks and their tools:
   1537        `yyss': related to states.
   1538        `yyvs': related to semantic values.
   1539        `yyls': related to locations.
   1540 
   1541        Refer to the stacks thru separate pointers, to allow yyoverflow
   1542        to reallocate them elsewhere.  */
   1543 
   1544     /* The state stack.  */
   1545     yytype_int16 yyssa[YYINITDEPTH];
   1546     yytype_int16 *yyss;
   1547     yytype_int16 *yyssp;
   1548 
   1549     /* The semantic value stack.  */
   1550     YYSTYPE yyvsa[YYINITDEPTH];
   1551     YYSTYPE *yyvs;
   1552     YYSTYPE *yyvsp;
   1553 
   1554     /* The location stack.  */
   1555     YYLTYPE yylsa[YYINITDEPTH];
   1556     YYLTYPE *yyls;
   1557     YYLTYPE *yylsp;
   1558 
   1559     /* The locations where the error started and ended.  */
   1560     YYLTYPE yyerror_range[3];
   1561 
   1562     YYSIZE_T yystacksize;
   1563 
   1564   int yyn;
   1565   int yyresult;
   1566   /* Lookahead token as an internal (translated) token number.  */
   1567   int yytoken;
   1568   /* The variables used to return semantic value and location from the
   1569      action routines.  */
   1570   YYSTYPE yyval;
   1571   YYLTYPE yyloc;
   1572 
   1573 #if YYERROR_VERBOSE
   1574   /* Buffer for error messages, and its allocated size.  */
   1575   char yymsgbuf[128];
   1576   char *yymsg = yymsgbuf;
   1577   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
   1578 #endif
   1579 
   1580 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
   1581 
   1582   /* The number of symbols on the RHS of the reduced rule.
   1583      Keep to zero when no symbol should be popped.  */
   1584   int yylen = 0;
   1585 
   1586   yytoken = 0;
   1587   yyss = yyssa;
   1588   yyvs = yyvsa;
   1589   yyls = yylsa;
   1590   yystacksize = YYINITDEPTH;
   1591 
   1592   YYDPRINTF ((stderr, "Starting parse\n"));
   1593 
   1594   yystate = 0;
   1595   yyerrstatus = 0;
   1596   yynerrs = 0;
   1597   yychar = YYEMPTY; /* Cause a token to be read.  */
   1598 
   1599   /* Initialize stack pointers.
   1600      Waste one element of value and location stack
   1601      so that they stay on the same level as the state stack.
   1602      The wasted elements are never initialized.  */
   1603   yyssp = yyss;
   1604   yyvsp = yyvs;
   1605   yylsp = yyls;
   1606 
   1607 #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
   1608   /* Initialize the default location before parsing starts.  */
   1609   yylloc.first_line   = yylloc.last_line   = 1;
   1610   yylloc.first_column = yylloc.last_column = 1;
   1611 #endif
   1612 
   1613 /* User initialization code.  */
   1614 
   1615 /* Line 1251 of yacc.c  */
   1616 #line 155 "glcpp/glcpp-parse.y"
   1617 {
   1618 	yylloc.first_line = 1;
   1619 	yylloc.first_column = 1;
   1620 	yylloc.last_line = 1;
   1621 	yylloc.last_column = 1;
   1622 	yylloc.source = 0;
   1623 }
   1624 
   1625 /* Line 1251 of yacc.c  */
   1626 #line 1625 "glcpp/glcpp-parse.c"
   1627   yylsp[0] = yylloc;
   1628 
   1629   goto yysetstate;
   1630 
   1631 /*------------------------------------------------------------.
   1632 | yynewstate -- Push a new state, which is found in yystate.  |
   1633 `------------------------------------------------------------*/
   1634  yynewstate:
   1635   /* In all cases, when you get here, the value and location stacks
   1636      have just been pushed.  So pushing a state here evens the stacks.  */
   1637   yyssp++;
   1638 
   1639  yysetstate:
   1640   *yyssp = yystate;
   1641 
   1642   if (yyss + yystacksize - 1 <= yyssp)
   1643     {
   1644       /* Get the current used size of the three stacks, in elements.  */
   1645       YYSIZE_T yysize = yyssp - yyss + 1;
   1646 
   1647 #ifdef yyoverflow
   1648       {
   1649 	/* Give user a chance to reallocate the stack.  Use copies of
   1650 	   these so that the &'s don't force the real ones into
   1651 	   memory.  */
   1652 	YYSTYPE *yyvs1 = yyvs;
   1653 	yytype_int16 *yyss1 = yyss;
   1654 	YYLTYPE *yyls1 = yyls;
   1655 
   1656 	/* Each stack pointer address is followed by the size of the
   1657 	   data in use in that stack, in bytes.  This used to be a
   1658 	   conditional around just the two extra args, but that might
   1659 	   be undefined if yyoverflow is a macro.  */
   1660 	yyoverflow (YY_("memory exhausted"),
   1661 		    &yyss1, yysize * sizeof (*yyssp),
   1662 		    &yyvs1, yysize * sizeof (*yyvsp),
   1663 		    &yyls1, yysize * sizeof (*yylsp),
   1664 		    &yystacksize);
   1665 
   1666 	yyls = yyls1;
   1667 	yyss = yyss1;
   1668 	yyvs = yyvs1;
   1669       }
   1670 #else /* no yyoverflow */
   1671 # ifndef YYSTACK_RELOCATE
   1672       goto yyexhaustedlab;
   1673 # else
   1674       /* Extend the stack our own way.  */
   1675       if (YYMAXDEPTH <= yystacksize)
   1676 	goto yyexhaustedlab;
   1677       yystacksize *= 2;
   1678       if (YYMAXDEPTH < yystacksize)
   1679 	yystacksize = YYMAXDEPTH;
   1680 
   1681       {
   1682 	yytype_int16 *yyss1 = yyss;
   1683 	union yyalloc *yyptr =
   1684 	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
   1685 	if (! yyptr)
   1686 	  goto yyexhaustedlab;
   1687 	YYSTACK_RELOCATE (yyss_alloc, yyss);
   1688 	YYSTACK_RELOCATE (yyvs_alloc, yyvs);
   1689 	YYSTACK_RELOCATE (yyls_alloc, yyls);
   1690 #  undef YYSTACK_RELOCATE
   1691 	if (yyss1 != yyssa)
   1692 	  YYSTACK_FREE (yyss1);
   1693       }
   1694 # endif
   1695 #endif /* no yyoverflow */
   1696 
   1697       yyssp = yyss + yysize - 1;
   1698       yyvsp = yyvs + yysize - 1;
   1699       yylsp = yyls + yysize - 1;
   1700 
   1701       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
   1702 		  (unsigned long int) yystacksize));
   1703 
   1704       if (yyss + yystacksize - 1 <= yyssp)
   1705 	YYABORT;
   1706     }
   1707 
   1708   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
   1709 
   1710   if (yystate == YYFINAL)
   1711     YYACCEPT;
   1712 
   1713   goto yybackup;
   1714 
   1715 /*-----------.
   1716 | yybackup.  |
   1717 `-----------*/
   1718 yybackup:
   1719 
   1720   /* Do appropriate processing given the current state.  Read a
   1721      lookahead token if we need one and don't already have one.  */
   1722 
   1723   /* First try to decide what to do without reference to lookahead token.  */
   1724   yyn = yypact[yystate];
   1725   if (yyn == YYPACT_NINF)
   1726     goto yydefault;
   1727 
   1728   /* Not known => get a lookahead token if don't already have one.  */
   1729 
   1730   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
   1731   if (yychar == YYEMPTY)
   1732     {
   1733       YYDPRINTF ((stderr, "Reading a token: "));
   1734       yychar = YYLEX;
   1735     }
   1736 
   1737   if (yychar <= YYEOF)
   1738     {
   1739       yychar = yytoken = YYEOF;
   1740       YYDPRINTF ((stderr, "Now at end of input.\n"));
   1741     }
   1742   else
   1743     {
   1744       yytoken = YYTRANSLATE (yychar);
   1745       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
   1746     }
   1747 
   1748   /* If the proper action on seeing token YYTOKEN is to reduce or to
   1749      detect an error, take that action.  */
   1750   yyn += yytoken;
   1751   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
   1752     goto yydefault;
   1753   yyn = yytable[yyn];
   1754   if (yyn <= 0)
   1755     {
   1756       if (yyn == 0 || yyn == YYTABLE_NINF)
   1757 	goto yyerrlab;
   1758       yyn = -yyn;
   1759       goto yyreduce;
   1760     }
   1761 
   1762   /* Count tokens shifted since error; after three, turn off error
   1763      status.  */
   1764   if (yyerrstatus)
   1765     yyerrstatus--;
   1766 
   1767   /* Shift the lookahead token.  */
   1768   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
   1769 
   1770   /* Discard the shifted token.  */
   1771   yychar = YYEMPTY;
   1772 
   1773   yystate = yyn;
   1774   *++yyvsp = yylval;
   1775   *++yylsp = yylloc;
   1776   goto yynewstate;
   1777 
   1778 
   1779 /*-----------------------------------------------------------.
   1780 | yydefault -- do the default action for the current state.  |
   1781 `-----------------------------------------------------------*/
   1782 yydefault:
   1783   yyn = yydefact[yystate];
   1784   if (yyn == 0)
   1785     goto yyerrlab;
   1786   goto yyreduce;
   1787 
   1788 
   1789 /*-----------------------------.
   1790 | yyreduce -- Do a reduction.  |
   1791 `-----------------------------*/
   1792 yyreduce:
   1793   /* yyn is the number of a rule to reduce with.  */
   1794   yylen = yyr2[yyn];
   1795 
   1796   /* If YYLEN is nonzero, implement the default value of the action:
   1797      `$$ = $1'.
   1798 
   1799      Otherwise, the following line sets YYVAL to garbage.
   1800      This behavior is undocumented and Bison
   1801      users should not rely upon it.  Assigning to YYVAL
   1802      unconditionally makes the parser a bit smaller, and it avoids a
   1803      GCC warning that YYVAL may be used uninitialized.  */
   1804   yyval = yyvsp[1-yylen];
   1805 
   1806   /* Default location.  */
   1807   YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
   1808   YY_REDUCE_PRINT (yyn);
   1809   switch (yyn)
   1810     {
   1811         case 4:
   1812 
   1813 /* Line 1464 of yacc.c  */
   1814 #line 194 "glcpp/glcpp-parse.y"
   1815     {
   1816 		glcpp_print(parser->output, "\n");
   1817 	;}
   1818     break;
   1819 
   1820   case 5:
   1821 
   1822 /* Line 1464 of yacc.c  */
   1823 #line 197 "glcpp/glcpp-parse.y"
   1824     {
   1825 		_glcpp_parser_print_expanded_token_list (parser, (yyvsp[(1) - (1)].token_list));
   1826 		glcpp_print(parser->output, "\n");
   1827 		hieralloc_free ((yyvsp[(1) - (1)].token_list));
   1828 	;}
   1829     break;
   1830 
   1831   case 8:
   1832 
   1833 /* Line 1464 of yacc.c  */
   1834 #line 207 "glcpp/glcpp-parse.y"
   1835     {
   1836 		_glcpp_parser_skip_stack_push_if (parser, & (yylsp[(1) - (3)]), (yyvsp[(2) - (3)].ival));
   1837 	;}
   1838     break;
   1839 
   1840   case 9:
   1841 
   1842 /* Line 1464 of yacc.c  */
   1843 #line 210 "glcpp/glcpp-parse.y"
   1844     {
   1845 		_glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (3)]), "elif", (yyvsp[(2) - (3)].ival));
   1846 	;}
   1847     break;
   1848 
   1849   case 10:
   1850 
   1851 /* Line 1464 of yacc.c  */
   1852 #line 216 "glcpp/glcpp-parse.y"
   1853     {
   1854 		_define_object_macro (parser, & (yylsp[(2) - (4)]), (yyvsp[(2) - (4)].str), (yyvsp[(3) - (4)].token_list));
   1855 	;}
   1856     break;
   1857 
   1858   case 11:
   1859 
   1860 /* Line 1464 of yacc.c  */
   1861 #line 219 "glcpp/glcpp-parse.y"
   1862     {
   1863 		_define_function_macro (parser, & (yylsp[(2) - (6)]), (yyvsp[(2) - (6)].str), NULL, (yyvsp[(5) - (6)].token_list));
   1864 	;}
   1865     break;
   1866 
   1867   case 12:
   1868 
   1869 /* Line 1464 of yacc.c  */
   1870 #line 222 "glcpp/glcpp-parse.y"
   1871     {
   1872 		_define_function_macro (parser, & (yylsp[(2) - (7)]), (yyvsp[(2) - (7)].str), (yyvsp[(4) - (7)].string_list), (yyvsp[(6) - (7)].token_list));
   1873 	;}
   1874     break;
   1875 
   1876   case 13:
   1877 
   1878 /* Line 1464 of yacc.c  */
   1879 #line 225 "glcpp/glcpp-parse.y"
   1880     {
   1881 		macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (3)].str));
   1882 		if (macro) {
   1883 			hash_table_remove (parser->defines, (yyvsp[(2) - (3)].str));
   1884 			hieralloc_free (macro);
   1885 		}
   1886 		hieralloc_free ((yyvsp[(2) - (3)].str));
   1887 	;}
   1888     break;
   1889 
   1890   case 14:
   1891 
   1892 /* Line 1464 of yacc.c  */
   1893 #line 233 "glcpp/glcpp-parse.y"
   1894     {
   1895 		/* Be careful to only evaluate the 'if' expression if
   1896 		 * we are not skipping. When we are skipping, we
   1897 		 * simply push a new 0-valued 'if' onto the skip
   1898 		 * stack.
   1899 		 *
   1900 		 * This avoids generating diagnostics for invalid
   1901 		 * expressions that are being skipped. */
   1902 		if (parser->skip_stack == NULL ||
   1903 		    parser->skip_stack->type == SKIP_NO_SKIP)
   1904 		{
   1905 			_glcpp_parser_expand_if (parser, IF_EXPANDED, (yyvsp[(2) - (3)].token_list));
   1906 		}
   1907 		else
   1908 		{
   1909 			_glcpp_parser_skip_stack_push_if (parser, & (yylsp[(1) - (3)]), 0);
   1910 			parser->skip_stack->type = SKIP_TO_ENDIF;
   1911 		}
   1912 	;}
   1913     break;
   1914 
   1915   case 15:
   1916 
   1917 /* Line 1464 of yacc.c  */
   1918 #line 252 "glcpp/glcpp-parse.y"
   1919     {
   1920 		/* #if without an expression is only an error if we
   1921 		 *  are not skipping */
   1922 		if (parser->skip_stack == NULL ||
   1923 		    parser->skip_stack->type == SKIP_NO_SKIP)
   1924 		{
   1925 			glcpp_error(& (yylsp[(1) - (2)]), parser, "#if with no expression");
   1926 		}
   1927 		_glcpp_parser_skip_stack_push_if (parser, & (yylsp[(1) - (2)]), 0);
   1928 	;}
   1929     break;
   1930 
   1931   case 16:
   1932 
   1933 /* Line 1464 of yacc.c  */
   1934 #line 262 "glcpp/glcpp-parse.y"
   1935     {
   1936 		macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (4)].str));
   1937 		hieralloc_free ((yyvsp[(2) - (4)].str));
   1938 		_glcpp_parser_skip_stack_push_if (parser, & (yylsp[(1) - (4)]), macro != NULL);
   1939 	;}
   1940     break;
   1941 
   1942   case 17:
   1943 
   1944 /* Line 1464 of yacc.c  */
   1945 #line 267 "glcpp/glcpp-parse.y"
   1946     {
   1947 		macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (4)].str));
   1948 		hieralloc_free ((yyvsp[(2) - (4)].str));
   1949 		_glcpp_parser_skip_stack_push_if (parser, & (yylsp[(1) - (4)]), macro == NULL);
   1950 	;}
   1951     break;
   1952 
   1953   case 18:
   1954 
   1955 /* Line 1464 of yacc.c  */
   1956 #line 272 "glcpp/glcpp-parse.y"
   1957     {
   1958 		/* Be careful to only evaluate the 'elif' expression
   1959 		 * if we are not skipping. When we are skipping, we
   1960 		 * simply change to a 0-valued 'elif' on the skip
   1961 		 * stack.
   1962 		 *
   1963 		 * This avoids generating diagnostics for invalid
   1964 		 * expressions that are being skipped. */
   1965 		if (parser->skip_stack &&
   1966 		    parser->skip_stack->type == SKIP_TO_ELSE)
   1967 		{
   1968 			_glcpp_parser_expand_if (parser, ELIF_EXPANDED, (yyvsp[(2) - (3)].token_list));
   1969 		}
   1970 		else
   1971 		{
   1972 			_glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (3)]),
   1973 							    "elif", 0);
   1974 		}
   1975 	;}
   1976     break;
   1977 
   1978   case 19:
   1979 
   1980 /* Line 1464 of yacc.c  */
   1981 #line 291 "glcpp/glcpp-parse.y"
   1982     {
   1983 		/* #elif without an expression is an error unless we
   1984 		 * are skipping. */
   1985 		if (parser->skip_stack &&
   1986 		    parser->skip_stack->type == SKIP_TO_ELSE)
   1987 		{
   1988 			glcpp_error(& (yylsp[(1) - (2)]), parser, "#elif with no expression");
   1989 		}
   1990 		else
   1991 		{
   1992 			_glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (2)]),
   1993 							    "elif", 0);
   1994 			glcpp_warning(& (yylsp[(1) - (2)]), parser, "ignoring illegal #elif without expression");
   1995 		}
   1996 	;}
   1997     break;
   1998 
   1999   case 20:
   2000 
   2001 /* Line 1464 of yacc.c  */
   2002 #line 306 "glcpp/glcpp-parse.y"
   2003     {
   2004 		_glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (2)]), "else", 1);
   2005 	;}
   2006     break;
   2007 
   2008   case 21:
   2009 
   2010 /* Line 1464 of yacc.c  */
   2011 #line 309 "glcpp/glcpp-parse.y"
   2012     {
   2013 		_glcpp_parser_skip_stack_pop (parser, & (yylsp[(1) - (2)]));
   2014 	;}
   2015     break;
   2016 
   2017   case 22:
   2018 
   2019 /* Line 1464 of yacc.c  */
   2020 #line 312 "glcpp/glcpp-parse.y"
   2021     {
   2022 		macro_t *macro = hash_table_find (parser->defines, "__VERSION__");
   2023 		if (macro) {
   2024 			hash_table_remove (parser->defines, "__VERSION__");
   2025 			hieralloc_free (macro);
   2026 		}
   2027 		add_builtin_define (parser, "__VERSION__", (yyvsp[(2) - (3)].ival));
   2028 
   2029 		if ((yyvsp[(2) - (3)].ival) == 100)
   2030 			add_builtin_define (parser, "GL_ES", 1);
   2031 
   2032 		/* Currently, all ES2 implementations support highp in the
   2033 		 * fragment shader, so we always define this macro in ES2.
   2034 		 * If we ever get a driver that doesn't support highp, we'll
   2035 		 * need to add a flag to the gl_context and check that here.
   2036 		 */
   2037 		if ((yyvsp[(2) - (3)].ival) >= 130 || (yyvsp[(2) - (3)].ival) == 100)
   2038 			add_builtin_define (parser, "GL_FRAGMENT_PRECISION_HIGH", 1);
   2039 
   2040 		glcpp_printf(parser->output, "#version %" PRIiMAX, (yyvsp[(2) - (3)].ival));
   2041 	;}
   2042     break;
   2043 
   2044   case 24:
   2045 
   2046 /* Line 1464 of yacc.c  */
   2047 #line 337 "glcpp/glcpp-parse.y"
   2048     {
   2049 		if (strlen ((yyvsp[(1) - (1)].str)) >= 3 && strncmp ((yyvsp[(1) - (1)].str), "0x", 2) == 0) {
   2050 			(yyval.ival) = strtoll ((yyvsp[(1) - (1)].str) + 2, NULL, 16);
   2051 		} else if ((yyvsp[(1) - (1)].str)[0] == '0') {
   2052 			(yyval.ival) = strtoll ((yyvsp[(1) - (1)].str), NULL, 8);
   2053 		} else {
   2054 			(yyval.ival) = strtoll ((yyvsp[(1) - (1)].str), NULL, 10);
   2055 		}
   2056 	;}
   2057     break;
   2058 
   2059   case 25:
   2060 
   2061 /* Line 1464 of yacc.c  */
   2062 #line 346 "glcpp/glcpp-parse.y"
   2063     {
   2064 		(yyval.ival) = (yyvsp[(1) - (1)].ival);
   2065 	;}
   2066     break;
   2067 
   2068   case 27:
   2069 
   2070 /* Line 1464 of yacc.c  */
   2071 #line 352 "glcpp/glcpp-parse.y"
   2072     {
   2073 		(yyval.ival) = (yyvsp[(1) - (3)].ival) || (yyvsp[(3) - (3)].ival);
   2074 	;}
   2075     break;
   2076 
   2077   case 28:
   2078 
   2079 /* Line 1464 of yacc.c  */
   2080 #line 355 "glcpp/glcpp-parse.y"
   2081     {
   2082 		(yyval.ival) = (yyvsp[(1) - (3)].ival) && (yyvsp[(3) - (3)].ival);
   2083 	;}
   2084     break;
   2085 
   2086   case 29:
   2087 
   2088 /* Line 1464 of yacc.c  */
   2089 #line 358 "glcpp/glcpp-parse.y"
   2090     {
   2091 		(yyval.ival) = (yyvsp[(1) - (3)].ival) | (yyvsp[(3) - (3)].ival);
   2092 	;}
   2093     break;
   2094 
   2095   case 30:
   2096 
   2097 /* Line 1464 of yacc.c  */
   2098 #line 361 "glcpp/glcpp-parse.y"
   2099     {
   2100 		(yyval.ival) = (yyvsp[(1) - (3)].ival) ^ (yyvsp[(3) - (3)].ival);
   2101 	;}
   2102     break;
   2103 
   2104   case 31:
   2105 
   2106 /* Line 1464 of yacc.c  */
   2107 #line 364 "glcpp/glcpp-parse.y"
   2108     {
   2109 		(yyval.ival) = (yyvsp[(1) - (3)].ival) & (yyvsp[(3) - (3)].ival);
   2110 	;}
   2111     break;
   2112 
   2113   case 32:
   2114 
   2115 /* Line 1464 of yacc.c  */
   2116 #line 367 "glcpp/glcpp-parse.y"
   2117     {
   2118 		(yyval.ival) = (yyvsp[(1) - (3)].ival) != (yyvsp[(3) - (3)].ival);
   2119 	;}
   2120     break;
   2121 
   2122   case 33:
   2123 
   2124 /* Line 1464 of yacc.c  */
   2125 #line 370 "glcpp/glcpp-parse.y"
   2126     {
   2127 		(yyval.ival) = (yyvsp[(1) - (3)].ival) == (yyvsp[(3) - (3)].ival);
   2128 	;}
   2129     break;
   2130 
   2131   case 34:
   2132 
   2133 /* Line 1464 of yacc.c  */
   2134 #line 373 "glcpp/glcpp-parse.y"
   2135     {
   2136 		(yyval.ival) = (yyvsp[(1) - (3)].ival) >= (yyvsp[(3) - (3)].ival);
   2137 	;}
   2138     break;
   2139 
   2140   case 35:
   2141 
   2142 /* Line 1464 of yacc.c  */
   2143 #line 376 "glcpp/glcpp-parse.y"
   2144     {
   2145 		(yyval.ival) = (yyvsp[(1) - (3)].ival) <= (yyvsp[(3) - (3)].ival);
   2146 	;}
   2147     break;
   2148 
   2149   case 36:
   2150 
   2151 /* Line 1464 of yacc.c  */
   2152 #line 379 "glcpp/glcpp-parse.y"
   2153     {
   2154 		(yyval.ival) = (yyvsp[(1) - (3)].ival) > (yyvsp[(3) - (3)].ival);
   2155 	;}
   2156     break;
   2157 
   2158   case 37:
   2159 
   2160 /* Line 1464 of yacc.c  */
   2161 #line 382 "glcpp/glcpp-parse.y"
   2162     {
   2163 		(yyval.ival) = (yyvsp[(1) - (3)].ival) < (yyvsp[(3) - (3)].ival);
   2164 	;}
   2165     break;
   2166 
   2167   case 38:
   2168 
   2169 /* Line 1464 of yacc.c  */
   2170 #line 385 "glcpp/glcpp-parse.y"
   2171     {
   2172 		(yyval.ival) = (yyvsp[(1) - (3)].ival) >> (yyvsp[(3) - (3)].ival);
   2173 	;}
   2174     break;
   2175 
   2176   case 39:
   2177 
   2178 /* Line 1464 of yacc.c  */
   2179 #line 388 "glcpp/glcpp-parse.y"
   2180     {
   2181 		(yyval.ival) = (yyvsp[(1) - (3)].ival) << (yyvsp[(3) - (3)].ival);
   2182 	;}
   2183     break;
   2184 
   2185   case 40:
   2186 
   2187 /* Line 1464 of yacc.c  */
   2188 #line 391 "glcpp/glcpp-parse.y"
   2189     {
   2190 		(yyval.ival) = (yyvsp[(1) - (3)].ival) - (yyvsp[(3) - (3)].ival);
   2191 	;}
   2192     break;
   2193 
   2194   case 41:
   2195 
   2196 /* Line 1464 of yacc.c  */
   2197 #line 394 "glcpp/glcpp-parse.y"
   2198     {
   2199 		(yyval.ival) = (yyvsp[(1) - (3)].ival) + (yyvsp[(3) - (3)].ival);
   2200 	;}
   2201     break;
   2202 
   2203   case 42:
   2204 
   2205 /* Line 1464 of yacc.c  */
   2206 #line 397 "glcpp/glcpp-parse.y"
   2207     {
   2208 		(yyval.ival) = (yyvsp[(1) - (3)].ival) % (yyvsp[(3) - (3)].ival);
   2209 	;}
   2210     break;
   2211 
   2212   case 43:
   2213 
   2214 /* Line 1464 of yacc.c  */
   2215 #line 400 "glcpp/glcpp-parse.y"
   2216     {
   2217 		(yyval.ival) = (yyvsp[(1) - (3)].ival) / (yyvsp[(3) - (3)].ival);
   2218 	;}
   2219     break;
   2220 
   2221   case 44:
   2222 
   2223 /* Line 1464 of yacc.c  */
   2224 #line 403 "glcpp/glcpp-parse.y"
   2225     {
   2226 		(yyval.ival) = (yyvsp[(1) - (3)].ival) * (yyvsp[(3) - (3)].ival);
   2227 	;}
   2228     break;
   2229 
   2230   case 45:
   2231 
   2232 /* Line 1464 of yacc.c  */
   2233 #line 406 "glcpp/glcpp-parse.y"
   2234     {
   2235 		(yyval.ival) = ! (yyvsp[(2) - (2)].ival);
   2236 	;}
   2237     break;
   2238 
   2239   case 46:
   2240 
   2241 /* Line 1464 of yacc.c  */
   2242 #line 409 "glcpp/glcpp-parse.y"
   2243     {
   2244 		(yyval.ival) = ~ (yyvsp[(2) - (2)].ival);
   2245 	;}
   2246     break;
   2247 
   2248   case 47:
   2249 
   2250 /* Line 1464 of yacc.c  */
   2251 #line 412 "glcpp/glcpp-parse.y"
   2252     {
   2253 		(yyval.ival) = - (yyvsp[(2) - (2)].ival);
   2254 	;}
   2255     break;
   2256 
   2257   case 48:
   2258 
   2259 /* Line 1464 of yacc.c  */
   2260 #line 415 "glcpp/glcpp-parse.y"
   2261     {
   2262 		(yyval.ival) = + (yyvsp[(2) - (2)].ival);
   2263 	;}
   2264     break;
   2265 
   2266   case 49:
   2267 
   2268 /* Line 1464 of yacc.c  */
   2269 #line 418 "glcpp/glcpp-parse.y"
   2270     {
   2271 		(yyval.ival) = (yyvsp[(2) - (3)].ival);
   2272 	;}
   2273     break;
   2274 
   2275   case 50:
   2276 
   2277 /* Line 1464 of yacc.c  */
   2278 #line 424 "glcpp/glcpp-parse.y"
   2279     {
   2280 		(yyval.string_list) = _string_list_create (parser);
   2281 		_string_list_append_item ((yyval.string_list), (yyvsp[(1) - (1)].str));
   2282 		hieralloc_steal ((yyval.string_list), (yyvsp[(1) - (1)].str));
   2283 	;}
   2284     break;
   2285 
   2286   case 51:
   2287 
   2288 /* Line 1464 of yacc.c  */
   2289 #line 429 "glcpp/glcpp-parse.y"
   2290     {
   2291 		(yyval.string_list) = (yyvsp[(1) - (3)].string_list);
   2292 		_string_list_append_item ((yyval.string_list), (yyvsp[(3) - (3)].str));
   2293 		hieralloc_steal ((yyval.string_list), (yyvsp[(3) - (3)].str));
   2294 	;}
   2295     break;
   2296 
   2297   case 52:
   2298 
   2299 /* Line 1464 of yacc.c  */
   2300 #line 437 "glcpp/glcpp-parse.y"
   2301     { (yyval.token_list) = NULL; ;}
   2302     break;
   2303 
   2304   case 54:
   2305 
   2306 /* Line 1464 of yacc.c  */
   2307 #line 442 "glcpp/glcpp-parse.y"
   2308     {
   2309 		yyerror (& (yylsp[(1) - (2)]), parser, "Invalid tokens after #");
   2310 	;}
   2311     break;
   2312 
   2313   case 55:
   2314 
   2315 /* Line 1464 of yacc.c  */
   2316 #line 448 "glcpp/glcpp-parse.y"
   2317     { (yyval.token_list) = NULL; ;}
   2318     break;
   2319 
   2320   case 58:
   2321 
   2322 /* Line 1464 of yacc.c  */
   2323 #line 454 "glcpp/glcpp-parse.y"
   2324     {
   2325 		glcpp_warning(&(yylsp[(1) - (1)]), parser, "extra tokens at end of directive");
   2326 	;}
   2327     break;
   2328 
   2329   case 59:
   2330 
   2331 /* Line 1464 of yacc.c  */
   2332 #line 461 "glcpp/glcpp-parse.y"
   2333     {
   2334 		int v = hash_table_find (parser->defines, (yyvsp[(2) - (2)].str)) ? 1 : 0;
   2335 		(yyval.token) = _token_create_ival (parser, INTEGER, v);
   2336 	;}
   2337     break;
   2338 
   2339   case 60:
   2340 
   2341 /* Line 1464 of yacc.c  */
   2342 #line 465 "glcpp/glcpp-parse.y"
   2343     {
   2344 		int v = hash_table_find (parser->defines, (yyvsp[(3) - (4)].str)) ? 1 : 0;
   2345 		(yyval.token) = _token_create_ival (parser, INTEGER, v);
   2346 	;}
   2347     break;
   2348 
   2349   case 62:
   2350 
   2351 /* Line 1464 of yacc.c  */
   2352 #line 474 "glcpp/glcpp-parse.y"
   2353     {
   2354 		(yyval.token_list) = _token_list_create (parser);
   2355 		_token_list_append ((yyval.token_list), (yyvsp[(1) - (1)].token));
   2356 		hieralloc_unlink (parser, (yyvsp[(1) - (1)].token));
   2357 	;}
   2358     break;
   2359 
   2360   case 63:
   2361 
   2362 /* Line 1464 of yacc.c  */
   2363 #line 479 "glcpp/glcpp-parse.y"
   2364     {
   2365 		(yyval.token_list) = (yyvsp[(1) - (2)].token_list);
   2366 		_token_list_append ((yyval.token_list), (yyvsp[(2) - (2)].token));
   2367 		hieralloc_unlink (parser, (yyvsp[(2) - (2)].token));
   2368 	;}
   2369     break;
   2370 
   2371   case 64:
   2372 
   2373 /* Line 1464 of yacc.c  */
   2374 #line 487 "glcpp/glcpp-parse.y"
   2375     {
   2376 		parser->space_tokens = 1;
   2377 		(yyval.token_list) = _token_list_create (parser);
   2378 		_token_list_append ((yyval.token_list), (yyvsp[(1) - (1)].token));
   2379 		hieralloc_unlink (parser, (yyvsp[(1) - (1)].token));
   2380 	;}
   2381     break;
   2382 
   2383   case 65:
   2384 
   2385 /* Line 1464 of yacc.c  */
   2386 #line 493 "glcpp/glcpp-parse.y"
   2387     {
   2388 		(yyval.token_list) = (yyvsp[(1) - (2)].token_list);
   2389 		_token_list_append ((yyval.token_list), (yyvsp[(2) - (2)].token));
   2390 		hieralloc_unlink (parser, (yyvsp[(2) - (2)].token));
   2391 	;}
   2392     break;
   2393 
   2394   case 66:
   2395 
   2396 /* Line 1464 of yacc.c  */
   2397 #line 501 "glcpp/glcpp-parse.y"
   2398     {
   2399 		(yyval.token) = _token_create_str (parser, IDENTIFIER, (yyvsp[(1) - (1)].str));
   2400 		(yyval.token)->location = yylloc;
   2401 	;}
   2402     break;
   2403 
   2404   case 67:
   2405 
   2406 /* Line 1464 of yacc.c  */
   2407 #line 505 "glcpp/glcpp-parse.y"
   2408     {
   2409 		(yyval.token) = _token_create_str (parser, INTEGER_STRING, (yyvsp[(1) - (1)].str));
   2410 		(yyval.token)->location = yylloc;
   2411 	;}
   2412     break;
   2413 
   2414   case 68:
   2415 
   2416 /* Line 1464 of yacc.c  */
   2417 #line 509 "glcpp/glcpp-parse.y"
   2418     {
   2419 		(yyval.token) = _token_create_ival (parser, (yyvsp[(1) - (1)].ival), (yyvsp[(1) - (1)].ival));
   2420 		(yyval.token)->location = yylloc;
   2421 	;}
   2422     break;
   2423 
   2424   case 69:
   2425 
   2426 /* Line 1464 of yacc.c  */
   2427 #line 513 "glcpp/glcpp-parse.y"
   2428     {
   2429 		(yyval.token) = _token_create_str (parser, OTHER, (yyvsp[(1) - (1)].str));
   2430 		(yyval.token)->location = yylloc;
   2431 	;}
   2432     break;
   2433 
   2434   case 70:
   2435 
   2436 /* Line 1464 of yacc.c  */
   2437 #line 517 "glcpp/glcpp-parse.y"
   2438     {
   2439 		(yyval.token) = _token_create_ival (parser, SPACE, SPACE);
   2440 		(yyval.token)->location = yylloc;
   2441 	;}
   2442     break;
   2443 
   2444   case 71:
   2445 
   2446 /* Line 1464 of yacc.c  */
   2447 #line 524 "glcpp/glcpp-parse.y"
   2448     { (yyval.ival) = '['; ;}
   2449     break;
   2450 
   2451   case 72:
   2452 
   2453 /* Line 1464 of yacc.c  */
   2454 #line 525 "glcpp/glcpp-parse.y"
   2455     { (yyval.ival) = ']'; ;}
   2456     break;
   2457 
   2458   case 73:
   2459 
   2460 /* Line 1464 of yacc.c  */
   2461 #line 526 "glcpp/glcpp-parse.y"
   2462     { (yyval.ival) = '('; ;}
   2463     break;
   2464 
   2465   case 74:
   2466 
   2467 /* Line 1464 of yacc.c  */
   2468 #line 527 "glcpp/glcpp-parse.y"
   2469     { (yyval.ival) = ')'; ;}
   2470     break;
   2471 
   2472   case 75:
   2473 
   2474 /* Line 1464 of yacc.c  */
   2475 #line 528 "glcpp/glcpp-parse.y"
   2476     { (yyval.ival) = '{'; ;}
   2477     break;
   2478 
   2479   case 76:
   2480 
   2481 /* Line 1464 of yacc.c  */
   2482 #line 529 "glcpp/glcpp-parse.y"
   2483     { (yyval.ival) = '}'; ;}
   2484     break;
   2485 
   2486   case 77:
   2487 
   2488 /* Line 1464 of yacc.c  */
   2489 #line 530 "glcpp/glcpp-parse.y"
   2490     { (yyval.ival) = '.'; ;}
   2491     break;
   2492 
   2493   case 78:
   2494 
   2495 /* Line 1464 of yacc.c  */
   2496 #line 531 "glcpp/glcpp-parse.y"
   2497     { (yyval.ival) = '&'; ;}
   2498     break;
   2499 
   2500   case 79:
   2501 
   2502 /* Line 1464 of yacc.c  */
   2503 #line 532 "glcpp/glcpp-parse.y"
   2504     { (yyval.ival) = '*'; ;}
   2505     break;
   2506 
   2507   case 80:
   2508 
   2509 /* Line 1464 of yacc.c  */
   2510 #line 533 "glcpp/glcpp-parse.y"
   2511     { (yyval.ival) = '+'; ;}
   2512     break;
   2513 
   2514   case 81:
   2515 
   2516 /* Line 1464 of yacc.c  */
   2517 #line 534 "glcpp/glcpp-parse.y"
   2518     { (yyval.ival) = '-'; ;}
   2519     break;
   2520 
   2521   case 82:
   2522 
   2523 /* Line 1464 of yacc.c  */
   2524 #line 535 "glcpp/glcpp-parse.y"
   2525     { (yyval.ival) = '~'; ;}
   2526     break;
   2527 
   2528   case 83:
   2529 
   2530 /* Line 1464 of yacc.c  */
   2531 #line 536 "glcpp/glcpp-parse.y"
   2532     { (yyval.ival) = '!'; ;}
   2533     break;
   2534 
   2535   case 84:
   2536 
   2537 /* Line 1464 of yacc.c  */
   2538 #line 537 "glcpp/glcpp-parse.y"
   2539     { (yyval.ival) = '/'; ;}
   2540     break;
   2541 
   2542   case 85:
   2543 
   2544 /* Line 1464 of yacc.c  */
   2545 #line 538 "glcpp/glcpp-parse.y"
   2546     { (yyval.ival) = '%'; ;}
   2547     break;
   2548 
   2549   case 86:
   2550 
   2551 /* Line 1464 of yacc.c  */
   2552 #line 539 "glcpp/glcpp-parse.y"
   2553     { (yyval.ival) = LEFT_SHIFT; ;}
   2554     break;
   2555 
   2556   case 87:
   2557 
   2558 /* Line 1464 of yacc.c  */
   2559 #line 540 "glcpp/glcpp-parse.y"
   2560     { (yyval.ival) = RIGHT_SHIFT; ;}
   2561     break;
   2562 
   2563   case 88:
   2564 
   2565 /* Line 1464 of yacc.c  */
   2566 #line 541 "glcpp/glcpp-parse.y"
   2567     { (yyval.ival) = '<'; ;}
   2568     break;
   2569 
   2570   case 89:
   2571 
   2572 /* Line 1464 of yacc.c  */
   2573 #line 542 "glcpp/glcpp-parse.y"
   2574     { (yyval.ival) = '>'; ;}
   2575     break;
   2576 
   2577   case 90:
   2578 
   2579 /* Line 1464 of yacc.c  */
   2580 #line 543 "glcpp/glcpp-parse.y"
   2581     { (yyval.ival) = LESS_OR_EQUAL; ;}
   2582     break;
   2583 
   2584   case 91:
   2585 
   2586 /* Line 1464 of yacc.c  */
   2587 #line 544 "glcpp/glcpp-parse.y"
   2588     { (yyval.ival) = GREATER_OR_EQUAL; ;}
   2589     break;
   2590 
   2591   case 92:
   2592 
   2593 /* Line 1464 of yacc.c  */
   2594 #line 545 "glcpp/glcpp-parse.y"
   2595     { (yyval.ival) = EQUAL; ;}
   2596     break;
   2597 
   2598   case 93:
   2599 
   2600 /* Line 1464 of yacc.c  */
   2601 #line 546 "glcpp/glcpp-parse.y"
   2602     { (yyval.ival) = NOT_EQUAL; ;}
   2603     break;
   2604 
   2605   case 94:
   2606 
   2607 /* Line 1464 of yacc.c  */
   2608 #line 547 "glcpp/glcpp-parse.y"
   2609     { (yyval.ival) = '^'; ;}
   2610     break;
   2611 
   2612   case 95:
   2613 
   2614 /* Line 1464 of yacc.c  */
   2615 #line 548 "glcpp/glcpp-parse.y"
   2616     { (yyval.ival) = '|'; ;}
   2617     break;
   2618 
   2619   case 96:
   2620 
   2621 /* Line 1464 of yacc.c  */
   2622 #line 549 "glcpp/glcpp-parse.y"
   2623     { (yyval.ival) = AND; ;}
   2624     break;
   2625 
   2626   case 97:
   2627 
   2628 /* Line 1464 of yacc.c  */
   2629 #line 550 "glcpp/glcpp-parse.y"
   2630     { (yyval.ival) = OR; ;}
   2631     break;
   2632 
   2633   case 98:
   2634 
   2635 /* Line 1464 of yacc.c  */
   2636 #line 551 "glcpp/glcpp-parse.y"
   2637     { (yyval.ival) = ';'; ;}
   2638     break;
   2639 
   2640   case 99:
   2641 
   2642 /* Line 1464 of yacc.c  */
   2643 #line 552 "glcpp/glcpp-parse.y"
   2644     { (yyval.ival) = ','; ;}
   2645     break;
   2646 
   2647   case 100:
   2648 
   2649 /* Line 1464 of yacc.c  */
   2650 #line 553 "glcpp/glcpp-parse.y"
   2651     { (yyval.ival) = '='; ;}
   2652     break;
   2653 
   2654   case 101:
   2655 
   2656 /* Line 1464 of yacc.c  */
   2657 #line 554 "glcpp/glcpp-parse.y"
   2658     { (yyval.ival) = PASTE; ;}
   2659     break;
   2660 
   2661 
   2662 
   2663 /* Line 1464 of yacc.c  */
   2664 #line 2663 "glcpp/glcpp-parse.c"
   2665       default: break;
   2666     }
   2667   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
   2668 
   2669   YYPOPSTACK (yylen);
   2670   yylen = 0;
   2671   YY_STACK_PRINT (yyss, yyssp);
   2672 
   2673   *++yyvsp = yyval;
   2674   *++yylsp = yyloc;
   2675 
   2676   /* Now `shift' the result of the reduction.  Determine what state
   2677      that goes to, based on the state we popped back to and the rule
   2678      number reduced by.  */
   2679 
   2680   yyn = yyr1[yyn];
   2681 
   2682   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
   2683   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
   2684     yystate = yytable[yystate];
   2685   else
   2686     yystate = yydefgoto[yyn - YYNTOKENS];
   2687 
   2688   goto yynewstate;
   2689 
   2690 
   2691 /*------------------------------------.
   2692 | yyerrlab -- here on detecting error |
   2693 `------------------------------------*/
   2694 yyerrlab:
   2695   /* If not already recovering from an error, report this error.  */
   2696   if (!yyerrstatus)
   2697     {
   2698       ++yynerrs;
   2699 #if ! YYERROR_VERBOSE
   2700       yyerror (&yylloc, parser, YY_("syntax error"));
   2701 #else
   2702       {
   2703 	YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
   2704 	if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
   2705 	  {
   2706 	    YYSIZE_T yyalloc = 2 * yysize;
   2707 	    if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
   2708 	      yyalloc = YYSTACK_ALLOC_MAXIMUM;
   2709 	    if (yymsg != yymsgbuf)
   2710 	      YYSTACK_FREE (yymsg);
   2711 	    yymsg = (char *) YYSTACK_ALLOC (yyalloc);
   2712 	    if (yymsg)
   2713 	      yymsg_alloc = yyalloc;
   2714 	    else
   2715 	      {
   2716 		yymsg = yymsgbuf;
   2717 		yymsg_alloc = sizeof yymsgbuf;
   2718 	      }
   2719 	  }
   2720 
   2721 	if (0 < yysize && yysize <= yymsg_alloc)
   2722 	  {
   2723 	    (void) yysyntax_error (yymsg, yystate, yychar);
   2724 	    yyerror (&yylloc, parser, yymsg);
   2725 	  }
   2726 	else
   2727 	  {
   2728 	    yyerror (&yylloc, parser, YY_("syntax error"));
   2729 	    if (yysize != 0)
   2730 	      goto yyexhaustedlab;
   2731 	  }
   2732       }
   2733 #endif
   2734     }
   2735 
   2736   yyerror_range[1] = yylloc;
   2737 
   2738   if (yyerrstatus == 3)
   2739     {
   2740       /* If just tried and failed to reuse lookahead token after an
   2741 	 error, discard it.  */
   2742 
   2743       if (yychar <= YYEOF)
   2744 	{
   2745 	  /* Return failure if at end of input.  */
   2746 	  if (yychar == YYEOF)
   2747 	    YYABORT;
   2748 	}
   2749       else
   2750 	{
   2751 	  yydestruct ("Error: discarding",
   2752 		      yytoken, &yylval, &yylloc, parser);
   2753 	  yychar = YYEMPTY;
   2754 	}
   2755     }
   2756 
   2757   /* Else will try to reuse lookahead token after shifting the error
   2758      token.  */
   2759   goto yyerrlab1;
   2760 
   2761 
   2762 /*---------------------------------------------------.
   2763 | yyerrorlab -- error raised explicitly by YYERROR.  |
   2764 `---------------------------------------------------*/
   2765 yyerrorlab:
   2766 
   2767   /* Pacify compilers like GCC when the user code never invokes
   2768      YYERROR and the label yyerrorlab therefore never appears in user
   2769      code.  */
   2770   if (/*CONSTCOND*/ 0)
   2771      goto yyerrorlab;
   2772 
   2773   yyerror_range[1] = yylsp[1-yylen];
   2774   /* Do not reclaim the symbols of the rule which action triggered
   2775      this YYERROR.  */
   2776   YYPOPSTACK (yylen);
   2777   yylen = 0;
   2778   YY_STACK_PRINT (yyss, yyssp);
   2779   yystate = *yyssp;
   2780   goto yyerrlab1;
   2781 
   2782 
   2783 /*-------------------------------------------------------------.
   2784 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
   2785 `-------------------------------------------------------------*/
   2786 yyerrlab1:
   2787   yyerrstatus = 3;	/* Each real token shifted decrements this.  */
   2788 
   2789   for (;;)
   2790     {
   2791       yyn = yypact[yystate];
   2792       if (yyn != YYPACT_NINF)
   2793 	{
   2794 	  yyn += YYTERROR;
   2795 	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
   2796 	    {
   2797 	      yyn = yytable[yyn];
   2798 	      if (0 < yyn)
   2799 		break;
   2800 	    }
   2801 	}
   2802 
   2803       /* Pop the current state because it cannot handle the error token.  */
   2804       if (yyssp == yyss)
   2805 	YYABORT;
   2806 
   2807       yyerror_range[1] = *yylsp;
   2808       yydestruct ("Error: popping",
   2809 		  yystos[yystate], yyvsp, yylsp, parser);
   2810       YYPOPSTACK (1);
   2811       yystate = *yyssp;
   2812       YY_STACK_PRINT (yyss, yyssp);
   2813     }
   2814 
   2815   *++yyvsp = yylval;
   2816 
   2817   yyerror_range[2] = yylloc;
   2818   /* Using YYLLOC is tempting, but would change the location of
   2819      the lookahead.  YYLOC is available though.  */
   2820   YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
   2821   *++yylsp = yyloc;
   2822 
   2823   /* Shift the error token.  */
   2824   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
   2825 
   2826   yystate = yyn;
   2827   goto yynewstate;
   2828 
   2829 
   2830 /*-------------------------------------.
   2831 | yyacceptlab -- YYACCEPT comes here.  |
   2832 `-------------------------------------*/
   2833 yyacceptlab:
   2834   yyresult = 0;
   2835   goto yyreturn;
   2836 
   2837 /*-----------------------------------.
   2838 | yyabortlab -- YYABORT comes here.  |
   2839 `-----------------------------------*/
   2840 yyabortlab:
   2841   yyresult = 1;
   2842   goto yyreturn;
   2843 
   2844 #if !defined(yyoverflow) || YYERROR_VERBOSE
   2845 /*-------------------------------------------------.
   2846 | yyexhaustedlab -- memory exhaustion comes here.  |
   2847 `-------------------------------------------------*/
   2848 yyexhaustedlab:
   2849   yyerror (&yylloc, parser, YY_("memory exhausted"));
   2850   yyresult = 2;
   2851   /* Fall through.  */
   2852 #endif
   2853 
   2854 yyreturn:
   2855   if (yychar != YYEMPTY)
   2856      yydestruct ("Cleanup: discarding lookahead",
   2857 		 yytoken, &yylval, &yylloc, parser);
   2858   /* Do not reclaim the symbols of the rule which action triggered
   2859      this YYABORT or YYACCEPT.  */
   2860   YYPOPSTACK (yylen);
   2861   YY_STACK_PRINT (yyss, yyssp);
   2862   while (yyssp != yyss)
   2863     {
   2864       yydestruct ("Cleanup: popping",
   2865 		  yystos[*yyssp], yyvsp, yylsp, parser);
   2866       YYPOPSTACK (1);
   2867     }
   2868 #ifndef yyoverflow
   2869   if (yyss != yyssa)
   2870     YYSTACK_FREE (yyss);
   2871 #endif
   2872 #if YYERROR_VERBOSE
   2873   if (yymsg != yymsgbuf)
   2874     YYSTACK_FREE (yymsg);
   2875 #endif
   2876   /* Make sure YYID is used.  */
   2877   return YYID (yyresult);
   2878 }
   2879 
   2880 
   2881 
   2882 /* Line 1684 of yacc.c  */
   2883 #line 557 "glcpp/glcpp-parse.y"
   2884 
   2885 
   2886 string_list_t *
   2887 _string_list_create (void *ctx)
   2888 {
   2889 	string_list_t *list;
   2890 
   2891 	list = hieralloc (ctx, string_list_t);
   2892 	list->head = NULL;
   2893 	list->tail = NULL;
   2894 
   2895 	return list;
   2896 }
   2897 
   2898 void
   2899 _string_list_append_item (string_list_t *list, const char *str)
   2900 {
   2901 	string_node_t *node;
   2902 
   2903 	node = hieralloc (list, string_node_t);
   2904 	node->str = hieralloc_strdup (node, str);
   2905 
   2906 	node->next = NULL;
   2907 
   2908 	if (list->head == NULL) {
   2909 		list->head = node;
   2910 	} else {
   2911 		list->tail->next = node;
   2912 	}
   2913 
   2914 	list->tail = node;
   2915 }
   2916 
   2917 int
   2918 _string_list_contains (string_list_t *list, const char *member, int *index)
   2919 {
   2920 	string_node_t *node;
   2921 	int i;
   2922 
   2923 	if (list == NULL)
   2924 		return 0;
   2925 
   2926 	for (i = 0, node = list->head; node; i++, node = node->next) {
   2927 		if (strcmp (node->str, member) == 0) {
   2928 			if (index)
   2929 				*index = i;
   2930 			return 1;
   2931 		}
   2932 	}
   2933 
   2934 	return 0;
   2935 }
   2936 
   2937 int
   2938 _string_list_length (string_list_t *list)
   2939 {
   2940 	int length = 0;
   2941 	string_node_t *node;
   2942 
   2943 	if (list == NULL)
   2944 		return 0;
   2945 
   2946 	for (node = list->head; node; node = node->next)
   2947 		length++;
   2948 
   2949 	return length;
   2950 }
   2951 
   2952 int
   2953 _string_list_equal (string_list_t *a, string_list_t *b)
   2954 {
   2955 	string_node_t *node_a, *node_b;
   2956 
   2957 	if (a == NULL && b == NULL)
   2958 		return 1;
   2959 
   2960 	if (a == NULL || b == NULL)
   2961 		return 0;
   2962 
   2963 	for (node_a = a->head, node_b = b->head;
   2964 	     node_a && node_b;
   2965 	     node_a = node_a->next, node_b = node_b->next)
   2966 	{
   2967 		if (strcmp (node_a->str, node_b->str))
   2968 			return 0;
   2969 	}
   2970 
   2971 	/* Catch the case of lists being different lengths, (which
   2972 	 * would cause the loop above to terminate after the shorter
   2973 	 * list). */
   2974 	return node_a == node_b;
   2975 }
   2976 
   2977 argument_list_t *
   2978 _argument_list_create (void *ctx)
   2979 {
   2980 	argument_list_t *list;
   2981 
   2982 	list = hieralloc (ctx, argument_list_t);
   2983 	list->head = NULL;
   2984 	list->tail = NULL;
   2985 
   2986 	return list;
   2987 }
   2988 
   2989 void
   2990 _argument_list_append (argument_list_t *list, token_list_t *argument)
   2991 {
   2992 	argument_node_t *node;
   2993 
   2994 	node = hieralloc (list, argument_node_t);
   2995 	node->argument = argument;
   2996 
   2997 	node->next = NULL;
   2998 
   2999 	if (list->head == NULL) {
   3000 		list->head = node;
   3001 	} else {
   3002 		list->tail->next = node;
   3003 	}
   3004 
   3005 	list->tail = node;
   3006 }
   3007 
   3008 int
   3009 _argument_list_length (argument_list_t *list)
   3010 {
   3011 	int length = 0;
   3012 	argument_node_t *node;
   3013 
   3014 	if (list == NULL)
   3015 		return 0;
   3016 
   3017 	for (node = list->head; node; node = node->next)
   3018 		length++;
   3019 
   3020 	return length;
   3021 }
   3022 
   3023 token_list_t *
   3024 _argument_list_member_at (argument_list_t *list, int index)
   3025 {
   3026 	argument_node_t *node;
   3027 	int i;
   3028 
   3029 	if (list == NULL)
   3030 		return NULL;
   3031 
   3032 	node = list->head;
   3033 	for (i = 0; i < index; i++) {
   3034 		node = node->next;
   3035 		if (node == NULL)
   3036 			break;
   3037 	}
   3038 
   3039 	if (node)
   3040 		return node->argument;
   3041 
   3042 	return NULL;
   3043 }
   3044 
   3045 /* Note: This function hieralloc_steal()s the str pointer. */
   3046 token_t *
   3047 _token_create_str (void *ctx, int type, char *str)
   3048 {
   3049 	token_t *token;
   3050 
   3051 	token = hieralloc (ctx, token_t);
   3052 	token->type = type;
   3053 	token->value.str = hieralloc_steal (token, str);
   3054 
   3055 	return token;
   3056 }
   3057 
   3058 token_t *
   3059 _token_create_ival (void *ctx, int type, int ival)
   3060 {
   3061 	token_t *token;
   3062 
   3063 	token = hieralloc (ctx, token_t);
   3064 	token->type = type;
   3065 	token->value.ival = ival;
   3066 
   3067 	return token;
   3068 }
   3069 
   3070 token_list_t *
   3071 _token_list_create (void *ctx)
   3072 {
   3073 	token_list_t *list;
   3074 
   3075 	list = hieralloc (ctx, token_list_t);
   3076 	list->head = NULL;
   3077 	list->tail = NULL;
   3078 	list->non_space_tail = NULL;
   3079 
   3080 	return list;
   3081 }
   3082 
   3083 void
   3084 _token_list_append (token_list_t *list, token_t *token)
   3085 {
   3086 	token_node_t *node;
   3087 
   3088 	node = hieralloc (list, token_node_t);
   3089 	node->token = hieralloc_reference (list, token);
   3090 
   3091 	node->next = NULL;
   3092 
   3093 	if (list->head == NULL) {
   3094 		list->head = node;
   3095 	} else {
   3096 		list->tail->next = node;
   3097 	}
   3098 
   3099 	list->tail = node;
   3100 	if (token->type != SPACE)
   3101 		list->non_space_tail = node;
   3102 }
   3103 
   3104 void
   3105 _token_list_append_list (token_list_t *list, token_list_t *tail)
   3106 {
   3107 	if (tail == NULL || tail->head == NULL)
   3108 		return;
   3109 
   3110 	if (list->head == NULL) {
   3111 		list->head = tail->head;
   3112 	} else {
   3113 		list->tail->next = tail->head;
   3114 	}
   3115 
   3116 	list->tail = tail->tail;
   3117 	list->non_space_tail = tail->non_space_tail;
   3118 }
   3119 
   3120 static token_list_t *
   3121 _token_list_copy (void *ctx, token_list_t *other)
   3122 {
   3123 	token_list_t *copy;
   3124 	token_node_t *node;
   3125 
   3126 	if (other == NULL)
   3127 		return NULL;
   3128 
   3129 	copy = _token_list_create (ctx);
   3130 	for (node = other->head; node; node = node->next)
   3131 		_token_list_append (copy, node->token);
   3132 
   3133 	return copy;
   3134 }
   3135 
   3136 static void
   3137 _token_list_trim_trailing_space (token_list_t *list)
   3138 {
   3139 	token_node_t *tail, *next;
   3140 
   3141 	if (list->non_space_tail) {
   3142 		tail = list->non_space_tail->next;
   3143 		list->non_space_tail->next = NULL;
   3144 		list->tail = list->non_space_tail;
   3145 
   3146 		while (tail) {
   3147 			next = tail->next;
   3148 			hieralloc_free (tail);
   3149 			tail = next;
   3150 		}
   3151 	}
   3152 }
   3153 
   3154 int
   3155 _token_list_equal_ignoring_space (token_list_t *a, token_list_t *b)
   3156 {
   3157 	token_node_t *node_a, *node_b;
   3158 
   3159 	node_a = a->head;
   3160 	node_b = b->head;
   3161 
   3162 	while (1)
   3163 	{
   3164 		if (node_a == NULL && node_b == NULL)
   3165 			break;
   3166 
   3167 		if (node_a == NULL || node_b == NULL)
   3168 			return 0;
   3169 
   3170 		if (node_a->token->type == SPACE) {
   3171 			node_a = node_a->next;
   3172 			continue;
   3173 		}
   3174 
   3175 		if (node_b->token->type == SPACE) {
   3176 			node_b = node_b->next;
   3177 			continue;
   3178 		}
   3179 
   3180 		if (node_a->token->type != node_b->token->type)
   3181 			return 0;
   3182 
   3183 		switch (node_a->token->type) {
   3184 		case INTEGER:
   3185 			if (node_a->token->value.ival !=
   3186 			    node_b->token->value.ival)
   3187 			{
   3188 				return 0;
   3189 			}
   3190 			break;
   3191 		case IDENTIFIER:
   3192 		case INTEGER_STRING:
   3193 		case OTHER:
   3194 			if (strcmp (node_a->token->value.str,
   3195 				    node_b->token->value.str))
   3196 			{
   3197 				return 0;
   3198 			}
   3199 			break;
   3200 		}
   3201 
   3202 		node_a = node_a->next;
   3203 		node_b = node_b->next;
   3204 	}
   3205 
   3206 	return 1;
   3207 }
   3208 
   3209 static void
   3210 _token_print (char **out, token_t *token)
   3211 {
   3212 	if (token->type < 256) {
   3213 		glcpp_printf (*out, "%c", token->type);
   3214 		return;
   3215 	}
   3216 
   3217 	switch (token->type) {
   3218 	case INTEGER:
   3219 		glcpp_printf (*out, "%" PRIiMAX, token->value.ival);
   3220 		break;
   3221 	case IDENTIFIER:
   3222 	case INTEGER_STRING:
   3223 	case OTHER:
   3224 		glcpp_print (*out, token->value.str);
   3225 		break;
   3226 	case SPACE:
   3227 		glcpp_print (*out, " ");
   3228 		break;
   3229 	case LEFT_SHIFT:
   3230 		glcpp_print (*out, "<<");
   3231 		break;
   3232 	case RIGHT_SHIFT:
   3233 		glcpp_print (*out, ">>");
   3234 		break;
   3235 	case LESS_OR_EQUAL:
   3236 		glcpp_print (*out, "<=");
   3237 		break;
   3238 	case GREATER_OR_EQUAL:
   3239 		glcpp_print (*out, ">=");
   3240 		break;
   3241 	case EQUAL:
   3242 		glcpp_print (*out, "==");
   3243 		break;
   3244 	case NOT_EQUAL:
   3245 		glcpp_print (*out, "!=");
   3246 		break;
   3247 	case AND:
   3248 		glcpp_print (*out, "&&");
   3249 		break;
   3250 	case OR:
   3251 		glcpp_print (*out, "||");
   3252 		break;
   3253 	case PASTE:
   3254 		glcpp_print (*out, "##");
   3255 		break;
   3256 	case COMMA_FINAL:
   3257 		glcpp_print (*out, ",");
   3258 		break;
   3259 	case PLACEHOLDER:
   3260 		/* Nothing to print. */
   3261 		break;
   3262 	default:
   3263 		assert(!"Error: Don't know how to print token.");
   3264 		break;
   3265 	}
   3266 }
   3267 
   3268 /* Return a new token (hieralloc()ed off of 'token') formed by pasting
   3269  * 'token' and 'other'. Note that this function may return 'token' or
   3270  * 'other' directly rather than allocating anything new.
   3271  *
   3272  * Caution: Only very cursory error-checking is performed to see if
   3273  * the final result is a valid single token. */
   3274 static token_t *
   3275 _token_paste (glcpp_parser_t *parser, token_t *token, token_t *other)
   3276 {
   3277 	token_t *combined = NULL;
   3278 
   3279 	/* Pasting a placeholder onto anything makes no change. */
   3280 	if (other->type == PLACEHOLDER)
   3281 		return token;
   3282 
   3283 	/* When 'token' is a placeholder, just return 'other'. */
   3284 	if (token->type == PLACEHOLDER)
   3285 		return other;
   3286 
   3287 	/* A very few single-character punctuators can be combined
   3288 	 * with another to form a multi-character punctuator. */
   3289 	switch (token->type) {
   3290 	case '<':
   3291 		if (other->type == '<')
   3292 			combined = _token_create_ival (token, LEFT_SHIFT, LEFT_SHIFT);
   3293 		else if (other->type == '=')
   3294 			combined = _token_create_ival (token, LESS_OR_EQUAL, LESS_OR_EQUAL);
   3295 		break;
   3296 	case '>':
   3297 		if (other->type == '>')
   3298 			combined = _token_create_ival (token, RIGHT_SHIFT, RIGHT_SHIFT);
   3299 		else if (other->type == '=')
   3300 			combined = _token_create_ival (token, GREATER_OR_EQUAL, GREATER_OR_EQUAL);
   3301 		break;
   3302 	case '=':
   3303 		if (other->type == '=')
   3304 			combined = _token_create_ival (token, EQUAL, EQUAL);
   3305 		break;
   3306 	case '!':
   3307 		if (other->type == '=')
   3308 			combined = _token_create_ival (token, NOT_EQUAL, NOT_EQUAL);
   3309 		break;
   3310 	case '&':
   3311 		if (other->type == '&')
   3312 			combined = _token_create_ival (token, AND, AND);
   3313 		break;
   3314 	case '|':
   3315 		if (other->type == '|')
   3316 			combined = _token_create_ival (token, OR, OR);
   3317 		break;
   3318 	}
   3319 
   3320 	if (combined != NULL) {
   3321 		/* Inherit the location from the first token */
   3322 		combined->location = token->location;
   3323 		return combined;
   3324 	}
   3325 
   3326 	/* Two string-valued tokens can usually just be mashed
   3327 	 * together.
   3328 	 *
   3329 	 * XXX: This isn't actually legitimate. Several things here
   3330 	 * should result in a diagnostic since the result cannot be a
   3331 	 * valid, single pre-processing token. For example, pasting
   3332 	 * "123" and "abc" is not legal, but we don't catch that
   3333 	 * here. */
   3334 	if ((token->type == IDENTIFIER || token->type == OTHER || token->type == INTEGER_STRING) &&
   3335 	    (other->type == IDENTIFIER || other->type == OTHER || other->type == INTEGER_STRING))
   3336 	{
   3337 		char *str;
   3338 
   3339 		str = hieralloc_asprintf (token, "%s%s", token->value.str,
   3340 				       other->value.str);
   3341 		combined = _token_create_str (token, token->type, str);
   3342 		combined->location = token->location;
   3343 		return combined;
   3344 	}
   3345 
   3346 	glcpp_error (&token->location, parser, "");
   3347 	glcpp_print (parser->info_log, "Pasting \"");
   3348 	_token_print (&parser->info_log, token);
   3349 	glcpp_print (parser->info_log, "\" and \"");
   3350 	_token_print (&parser->info_log, other);
   3351 	glcpp_print (parser->info_log, "\" does not give a valid preprocessing token.\n");
   3352 
   3353 	return token;
   3354 }
   3355 
   3356 static void
   3357 _token_list_print (glcpp_parser_t *parser, token_list_t *list)
   3358 {
   3359 	token_node_t *node;
   3360 
   3361 	if (list == NULL)
   3362 		return;
   3363 
   3364 	for (node = list->head; node; node = node->next)
   3365 		_token_print (&parser->output, node->token);
   3366 }
   3367 
   3368 void
   3369 yyerror (YYLTYPE *locp, glcpp_parser_t *parser, const char *error)
   3370 {
   3371 	glcpp_error(locp, parser, "%s", error);
   3372 }
   3373 
   3374 static void add_builtin_define(glcpp_parser_t *parser,
   3375 			       const char *name, int value)
   3376 {
   3377    token_t *tok;
   3378    token_list_t *list;
   3379 
   3380    tok = _token_create_ival (parser, INTEGER, value);
   3381 
   3382    list = _token_list_create(parser);
   3383    _token_list_append(list, tok);
   3384    _define_object_macro(parser, NULL, name, list);
   3385 
   3386    hieralloc_unlink(parser, tok);
   3387 }
   3388 
   3389 glcpp_parser_t *
   3390 glcpp_parser_create (const struct gl_extensions *extensions, int api)
   3391 {
   3392 	glcpp_parser_t *parser;
   3393 	int language_version;
   3394 
   3395 	parser = hieralloc (NULL, glcpp_parser_t);
   3396 
   3397 	glcpp_lex_init_extra (parser, &parser->scanner);
   3398 	parser->defines = hash_table_ctor (32, hash_table_string_hash,
   3399 					   hash_table_string_compare);
   3400 	parser->active = NULL;
   3401 	parser->lexing_if = 0;
   3402 	parser->space_tokens = 1;
   3403 	parser->newline_as_space = 0;
   3404 	parser->in_control_line = 0;
   3405 	parser->paren_count = 0;
   3406 
   3407 	parser->skip_stack = NULL;
   3408 
   3409 	parser->lex_from_list = NULL;
   3410 	parser->lex_from_node = NULL;
   3411 
   3412 	parser->output = hieralloc_strdup(parser, "");
   3413 	parser->info_log = hieralloc_strdup(parser, "");
   3414 	parser->error = 0;
   3415 
   3416 	/* Add pre-defined macros. */
   3417 	add_builtin_define(parser, "GL_ARB_draw_buffers", 1);
   3418 	add_builtin_define(parser, "GL_ARB_texture_rectangle", 1);
   3419 
   3420 	if (api == API_OPENGLES2)
   3421 		add_builtin_define(parser, "GL_ES", 1);
   3422 
   3423 	if (extensions != NULL) {
   3424 	   if (extensions->EXT_texture_array) {
   3425 	      add_builtin_define(parser, "GL_EXT_texture_array", 1);
   3426 	   }
   3427 
   3428 	   if (extensions->ARB_fragment_coord_conventions)
   3429 	      add_builtin_define(parser, "GL_ARB_fragment_coord_conventions",
   3430 				 1);
   3431 
   3432 	   if (extensions->ARB_explicit_attrib_location)
   3433 	      add_builtin_define(parser, "GL_ARB_explicit_attrib_location", 1);
   3434 	}
   3435 
   3436 	language_version = 110;
   3437 	add_builtin_define(parser, "__VERSION__", language_version);
   3438 
   3439 	return parser;
   3440 }
   3441 
   3442 int
   3443 glcpp_parser_parse (glcpp_parser_t *parser)
   3444 {
   3445 	return yyparse (parser);
   3446 }
   3447 
   3448 void
   3449 glcpp_parser_destroy (glcpp_parser_t *parser)
   3450 {
   3451 	glcpp_lex_destroy (parser->scanner);
   3452 	hash_table_dtor (parser->defines);
   3453 	hieralloc_free (parser);
   3454 }
   3455 
   3456 typedef enum function_status
   3457 {
   3458 	FUNCTION_STATUS_SUCCESS,
   3459 	FUNCTION_NOT_A_FUNCTION,
   3460 	FUNCTION_UNBALANCED_PARENTHESES
   3461 } function_status_t;
   3462 
   3463 /* Find a set of function-like macro arguments by looking for a
   3464  * balanced set of parentheses.
   3465  *
   3466  * When called, 'node' should be the opening-parenthesis token, (or
   3467  * perhaps preceeding SPACE tokens). Upon successful return *last will
   3468  * be the last consumed node, (corresponding to the closing right
   3469  * parenthesis).
   3470  *
   3471  * Return values:
   3472  *
   3473  *   FUNCTION_STATUS_SUCCESS:
   3474  *
   3475  *	Successfully parsed a set of function arguments.
   3476  *
   3477  *   FUNCTION_NOT_A_FUNCTION:
   3478  *
   3479  *	Macro name not followed by a '('. This is not an error, but
   3480  *	simply that the macro name should be treated as a non-macro.
   3481  *
   3482  *   FUNCTION_UNBALANCED_PARENTHESES
   3483  *
   3484  *	Macro name is not followed by a balanced set of parentheses.
   3485  */
   3486 static function_status_t
   3487 _arguments_parse (argument_list_t *arguments,
   3488 		  token_node_t *node,
   3489 		  token_node_t **last)
   3490 {
   3491 	token_list_t *argument;
   3492 	int paren_count;
   3493 
   3494 	node = node->next;
   3495 
   3496 	/* Ignore whitespace before first parenthesis. */
   3497 	while (node && node->token->type == SPACE)
   3498 		node = node->next;
   3499 
   3500 	if (node == NULL || node->token->type != '(')
   3501 		return FUNCTION_NOT_A_FUNCTION;
   3502 
   3503 	node = node->next;
   3504 
   3505 	argument = _token_list_create (arguments);
   3506 	_argument_list_append (arguments, argument);
   3507 
   3508 	for (paren_count = 1; node; node = node->next) {
   3509 		if (node->token->type == '(')
   3510 		{
   3511 			paren_count++;
   3512 		}
   3513 		else if (node->token->type == ')')
   3514 		{
   3515 			paren_count--;
   3516 			if (paren_count == 0)
   3517 				break;
   3518 		}
   3519 
   3520 		if (node->token->type == ',' &&
   3521 			 paren_count == 1)
   3522 		{
   3523 			_token_list_trim_trailing_space (argument);
   3524 			argument = _token_list_create (arguments);
   3525 			_argument_list_append (arguments, argument);
   3526 		}
   3527 		else {
   3528 			if (argument->head == NULL) {
   3529 				/* Don't treat initial whitespace as
   3530 				 * part of the arguement. */
   3531 				if (node->token->type == SPACE)
   3532 					continue;
   3533 			}
   3534 			_token_list_append (argument, node->token);
   3535 		}
   3536 	}
   3537 
   3538 	if (paren_count)
   3539 		return FUNCTION_UNBALANCED_PARENTHESES;
   3540 
   3541 	*last = node;
   3542 
   3543 	return FUNCTION_STATUS_SUCCESS;
   3544 }
   3545 
   3546 static token_list_t *
   3547 _token_list_create_with_one_space (void *ctx)
   3548 {
   3549 	token_list_t *list;
   3550 	token_t *space;
   3551 
   3552 	list = _token_list_create (ctx);
   3553 	space = _token_create_ival (list, SPACE, SPACE);
   3554 	_token_list_append (list, space);
   3555 
   3556 	return list;
   3557 }
   3558 
   3559 static void
   3560 _glcpp_parser_expand_if (glcpp_parser_t *parser, int type, token_list_t *list)
   3561 {
   3562 	token_list_t *expanded;
   3563 	token_t *token;
   3564 
   3565 	expanded = _token_list_create (parser);
   3566 	token = _token_create_ival (parser, type, type);
   3567 	_token_list_append (expanded, token);
   3568 	_glcpp_parser_expand_token_list (parser, list);
   3569 	_token_list_append_list (expanded, list);
   3570 	glcpp_parser_lex_from (parser, expanded);
   3571 }
   3572 
   3573 /* This is a helper function that's essentially part of the
   3574  * implementation of _glcpp_parser_expand_node. It shouldn't be called
   3575  * except for by that function.
   3576  *
   3577  * Returns NULL if node is a simple token with no expansion, (that is,
   3578  * although 'node' corresponds to an identifier defined as a
   3579  * function-like macro, it is not followed with a parenthesized
   3580  * argument list).
   3581  *
   3582  * Compute the complete expansion of node (which is a function-like
   3583  * macro) and subsequent nodes which are arguments.
   3584  *
   3585  * Returns the token list that results from the expansion and sets
   3586  * *last to the last node in the list that was consumed by the
   3587  * expansion. Specifically, *last will be set as follows: as the
   3588  * token of the closing right parenthesis.
   3589  */
   3590 static token_list_t *
   3591 _glcpp_parser_expand_function (glcpp_parser_t *parser,
   3592 			       token_node_t *node,
   3593 			       token_node_t **last)
   3594 
   3595 {
   3596 	macro_t *macro;
   3597 	const char *identifier;
   3598 	argument_list_t *arguments;
   3599 	function_status_t status;
   3600 	token_list_t *substituted;
   3601 	int parameter_index;
   3602 
   3603 	identifier = node->token->value.str;
   3604 
   3605 	macro = hash_table_find (parser->defines, identifier);
   3606 
   3607 	assert (macro->is_function);
   3608 
   3609 	arguments = _argument_list_create (parser);
   3610 	status = _arguments_parse (arguments, node, last);
   3611 
   3612 	switch (status) {
   3613 	case FUNCTION_STATUS_SUCCESS:
   3614 		break;
   3615 	case FUNCTION_NOT_A_FUNCTION:
   3616 		return NULL;
   3617 	case FUNCTION_UNBALANCED_PARENTHESES:
   3618 		glcpp_error (&node->token->location, parser, "Macro %s call has unbalanced parentheses\n", identifier);
   3619 		return NULL;
   3620 	}
   3621 
   3622 	/* Replace a macro defined as empty with a SPACE token. */
   3623 	if (macro->replacements == NULL) {
   3624 		hieralloc_free (arguments);
   3625 		return _token_list_create_with_one_space (parser);
   3626 	}
   3627 
   3628 	if (! ((_argument_list_length (arguments) ==
   3629 		_string_list_length (macro->parameters)) ||
   3630 	       (_string_list_length (macro->parameters) == 0 &&
   3631 		_argument_list_length (arguments) == 1 &&
   3632 		arguments->head->argument->head == NULL)))
   3633 	{
   3634 		glcpp_error (&node->token->location, parser,
   3635 			      "Error: macro %s invoked with %d arguments (expected %d)\n",
   3636 			      identifier,
   3637 			      _argument_list_length (arguments),
   3638 			      _string_list_length (macro->parameters));
   3639 		return NULL;
   3640 	}
   3641 
   3642 	/* Perform argument substitution on the replacement list. */
   3643 	substituted = _token_list_create (arguments);
   3644 
   3645 	for (node = macro->replacements->head; node; node = node->next)
   3646 	{
   3647 		if (node->token->type == IDENTIFIER &&
   3648 		    _string_list_contains (macro->parameters,
   3649 					   node->token->value.str,
   3650 					   &parameter_index))
   3651 		{
   3652 			token_list_t *argument;
   3653 			argument = _argument_list_member_at (arguments,
   3654 							     parameter_index);
   3655 			/* Before substituting, we expand the argument
   3656 			 * tokens, or append a placeholder token for
   3657 			 * an empty argument. */
   3658 			if (argument->head) {
   3659 				token_list_t *expanded_argument;
   3660 				expanded_argument = _token_list_copy (parser,
   3661 								      argument);
   3662 				_glcpp_parser_expand_token_list (parser,
   3663 								 expanded_argument);
   3664 				_token_list_append_list (substituted,
   3665 							 expanded_argument);
   3666 			} else {
   3667 				token_t *new_token;
   3668 
   3669 				new_token = _token_create_ival (substituted,
   3670 								PLACEHOLDER,
   3671 								PLACEHOLDER);
   3672 				_token_list_append (substituted, new_token);
   3673 			}
   3674 		} else {
   3675 			_token_list_append (substituted, node->token);
   3676 		}
   3677 	}
   3678 
   3679 	/* After argument substitution, and before further expansion
   3680 	 * below, implement token pasting. */
   3681 
   3682 	_token_list_trim_trailing_space (substituted);
   3683 
   3684 	node = substituted->head;
   3685 	while (node)
   3686 	{
   3687 		token_node_t *next_non_space;
   3688 
   3689 		/* Look ahead for a PASTE token, skipping space. */
   3690 		next_non_space = node->next;
   3691 		while (next_non_space && next_non_space->token->type == SPACE)
   3692 			next_non_space = next_non_space->next;
   3693 
   3694 		if (next_non_space == NULL)
   3695 			break;
   3696 
   3697 		if (next_non_space->token->type != PASTE) {
   3698 			node = next_non_space;
   3699 			continue;
   3700 		}
   3701 
   3702 		/* Now find the next non-space token after the PASTE. */
   3703 		next_non_space = next_non_space->next;
   3704 		while (next_non_space && next_non_space->token->type == SPACE)
   3705 			next_non_space = next_non_space->next;
   3706 
   3707 		if (next_non_space == NULL) {
   3708 			yyerror (&node->token->location, parser, "'##' cannot appear at either end of a macro expansion\n");
   3709 			return NULL;
   3710 		}
   3711 
   3712 		node->token = _token_paste (parser, node->token, next_non_space->token);
   3713 		node->next = next_non_space->next;
   3714 		if (next_non_space == substituted->tail)
   3715 			substituted->tail = node;
   3716 
   3717 		node = node->next;
   3718 	}
   3719 
   3720 	substituted->non_space_tail = substituted->tail;
   3721 
   3722 	return substituted;
   3723 }
   3724 
   3725 /* Compute the complete expansion of node, (and subsequent nodes after
   3726  * 'node' in the case that 'node' is a function-like macro and
   3727  * subsequent nodes are arguments).
   3728  *
   3729  * Returns NULL if node is a simple token with no expansion.
   3730  *
   3731  * Otherwise, returns the token list that results from the expansion
   3732  * and sets *last to the last node in the list that was consumed by
   3733  * the expansion. Specifically, *last will be set as follows:
   3734  *
   3735  *	As 'node' in the case of object-like macro expansion.
   3736  *
   3737  *	As the token of the closing right parenthesis in the case of
   3738  *	function-like macro expansion.
   3739  */
   3740 static token_list_t *
   3741 _glcpp_parser_expand_node (glcpp_parser_t *parser,
   3742 			   token_node_t *node,
   3743 			   token_node_t **last)
   3744 {
   3745 	token_t *token = node->token;
   3746 	const char *identifier;
   3747 	macro_t *macro;
   3748 
   3749 	/* We only expand identifiers */
   3750 	if (token->type != IDENTIFIER) {
   3751 		/* We change any COMMA into a COMMA_FINAL to prevent
   3752 		 * it being mistaken for an argument separator
   3753 		 * later. */
   3754 		if (token->type == ',') {
   3755 			token->type = COMMA_FINAL;
   3756 			token->value.ival = COMMA_FINAL;
   3757 		}
   3758 
   3759 		return NULL;
   3760 	}
   3761 
   3762 	/* Look up this identifier in the hash table. */
   3763 	identifier = token->value.str;
   3764 	macro = hash_table_find (parser->defines, identifier);
   3765 
   3766 	/* Not a macro, so no expansion needed. */
   3767 	if (macro == NULL)
   3768 		return NULL;
   3769 
   3770 	/* Finally, don't expand this macro if we're already actively
   3771 	 * expanding it, (to avoid infinite recursion). */
   3772 	if (_active_list_contains (parser->active, identifier)) {
   3773 		/* We change the token type here from IDENTIFIER to
   3774 		 * OTHER to prevent any future expansion of this
   3775 		 * unexpanded token. */
   3776 		char *str;
   3777 		token_list_t *expansion;
   3778 		token_t *final;
   3779 
   3780 		str = hieralloc_strdup (parser, token->value.str);
   3781 		final = _token_create_str (parser, OTHER, str);
   3782 		expansion = _token_list_create (parser);
   3783 		_token_list_append (expansion, final);
   3784 		*last = node;
   3785 		return expansion;
   3786 	}
   3787 
   3788 	if (! macro->is_function)
   3789 	{
   3790 		*last = node;
   3791 
   3792 		/* Replace a macro defined as empty with a SPACE token. */
   3793 		if (macro->replacements == NULL)
   3794 			return _token_list_create_with_one_space (parser);
   3795 
   3796 		return _token_list_copy (parser, macro->replacements);
   3797 	}
   3798 
   3799 	return _glcpp_parser_expand_function (parser, node, last);
   3800 }
   3801 
   3802 /* Push a new identifier onto the active list, returning the new list.
   3803  *
   3804  * Here, 'marker' is the token node that appears in the list after the
   3805  * expansion of 'identifier'. That is, when the list iterator begins
   3806  * examinging 'marker', then it is time to pop this node from the
   3807  * active stack.
   3808  */
   3809 active_list_t *
   3810 _active_list_push (active_list_t *list,
   3811 		   const char *identifier,
   3812 		   token_node_t *marker)
   3813 {
   3814 	active_list_t *node;
   3815 
   3816 	node = hieralloc (list, active_list_t);
   3817 	node->identifier = hieralloc_strdup (node, identifier);
   3818 	node->marker = marker;
   3819 	node->next = list;
   3820 
   3821 	return node;
   3822 }
   3823 
   3824 active_list_t *
   3825 _active_list_pop (active_list_t *list)
   3826 {
   3827 	active_list_t *node = list;
   3828 
   3829 	if (node == NULL)
   3830 		return NULL;
   3831 
   3832 	node = list->next;
   3833 	hieralloc_free (list);
   3834 
   3835 	return node;
   3836 }
   3837 
   3838 int
   3839 _active_list_contains (active_list_t *list, const char *identifier)
   3840 {
   3841 	active_list_t *node;
   3842 
   3843 	if (list == NULL)
   3844 		return 0;
   3845 
   3846 	for (node = list; node; node = node->next)
   3847 		if (strcmp (node->identifier, identifier) == 0)
   3848 			return 1;
   3849 
   3850 	return 0;
   3851 }
   3852 
   3853 /* Walk over the token list replacing nodes with their expansion.
   3854  * Whenever nodes are expanded the walking will walk over the new
   3855  * nodes, continuing to expand as necessary. The results are placed in
   3856  * 'list' itself;
   3857  */
   3858 static void
   3859 _glcpp_parser_expand_token_list (glcpp_parser_t *parser,
   3860 				 token_list_t *list)
   3861 {
   3862 	token_node_t *node_prev;
   3863 	token_node_t *node, *last = NULL;
   3864 	token_list_t *expansion;
   3865 
   3866 	if (list == NULL)
   3867 		return;
   3868 
   3869 	_token_list_trim_trailing_space (list);
   3870 
   3871 	node_prev = NULL;
   3872 	node = list->head;
   3873 
   3874 	while (node) {
   3875 
   3876 		while (parser->active && parser->active->marker == node)
   3877 			parser->active = _active_list_pop (parser->active);
   3878 
   3879 		/* Find the expansion for node, which will replace all
   3880 		 * nodes from node to last, inclusive. */
   3881 		expansion = _glcpp_parser_expand_node (parser, node, &last);
   3882 		if (expansion) {
   3883 			token_node_t *n;
   3884 
   3885 			for (n = node; n != last->next; n = n->next)
   3886 				while (parser->active &&
   3887 				       parser->active->marker == n)
   3888 				{
   3889 					parser->active = _active_list_pop (parser->active);
   3890 				}
   3891 
   3892 			parser->active = _active_list_push (parser->active,
   3893 							    node->token->value.str,
   3894 							    last->next);
   3895 
   3896 			/* Splice expansion into list, supporting a
   3897 			 * simple deletion if the expansion is
   3898 			 * empty. */
   3899 			if (expansion->head) {
   3900 				if (node_prev)
   3901 					node_prev->next = expansion->head;
   3902 				else
   3903 					list->head = expansion->head;
   3904 				expansion->tail->next = last->next;
   3905 				if (last == list->tail)
   3906 					list->tail = expansion->tail;
   3907 			} else {
   3908 				if (node_prev)
   3909 					node_prev->next = last->next;
   3910 				else
   3911 					list->head = last->next;
   3912 				if (last == list->tail)
   3913 					list->tail = NULL;
   3914 			}
   3915 		} else {
   3916 			node_prev = node;
   3917 		}
   3918 		node = node_prev ? node_prev->next : list->head;
   3919 	}
   3920 
   3921 	while (parser->active)
   3922 		parser->active = _active_list_pop (parser->active);
   3923 
   3924 	list->non_space_tail = list->tail;
   3925 }
   3926 
   3927 void
   3928 _glcpp_parser_print_expanded_token_list (glcpp_parser_t *parser,
   3929 					 token_list_t *list)
   3930 {
   3931 	if (list == NULL)
   3932 		return;
   3933 
   3934 	_glcpp_parser_expand_token_list (parser, list);
   3935 
   3936 	_token_list_trim_trailing_space (list);
   3937 
   3938 	_token_list_print (parser, list);
   3939 }
   3940 
   3941 static void
   3942 _check_for_reserved_macro_name (glcpp_parser_t *parser, YYLTYPE *loc,
   3943 				const char *identifier)
   3944 {
   3945 	/* According to the GLSL specification, macro names starting with "__"
   3946 	 * or "GL_" are reserved for future use.  So, don't allow them.
   3947 	 */
   3948 	if (strncmp(identifier, "__", 2) == 0) {
   3949 		glcpp_error (loc, parser, "Macro names starting with \"__\" are reserved.\n");
   3950 	}
   3951 	if (strncmp(identifier, "GL_", 3) == 0) {
   3952 		glcpp_error (loc, parser, "Macro names starting with \"GL_\" are reserved.\n");
   3953 	}
   3954 }
   3955 
   3956 static int
   3957 _macro_equal (macro_t *a, macro_t *b)
   3958 {
   3959 	if (a->is_function != b->is_function)
   3960 		return 0;
   3961 
   3962 	if (a->is_function) {
   3963 		if (! _string_list_equal (a->parameters, b->parameters))
   3964 			return 0;
   3965 	}
   3966 
   3967 	return _token_list_equal_ignoring_space (a->replacements,
   3968 						 b->replacements);
   3969 }
   3970 
   3971 void
   3972 _define_object_macro (glcpp_parser_t *parser,
   3973 		      YYLTYPE *loc,
   3974 		      const char *identifier,
   3975 		      token_list_t *replacements)
   3976 {
   3977 	macro_t *macro, *previous;
   3978 
   3979 	if (loc != NULL)
   3980 		_check_for_reserved_macro_name(parser, loc, identifier);
   3981 
   3982 	macro = hieralloc (parser, macro_t);
   3983 
   3984 	macro->is_function = 0;
   3985 	macro->parameters = NULL;
   3986 	macro->identifier = hieralloc_strdup (macro, identifier);
   3987 	macro->replacements = hieralloc_steal (macro, replacements);
   3988 
   3989 	previous = hash_table_find (parser->defines, identifier);
   3990 	if (previous) {
   3991 		if (_macro_equal (macro, previous)) {
   3992 			hieralloc_free (macro);
   3993 			return;
   3994 		}
   3995 		glcpp_error (loc, parser, "Redefinition of macro %s\n",
   3996 			     identifier);
   3997 	}
   3998 
   3999 	hash_table_insert (parser->defines, macro, identifier);
   4000 }
   4001 
   4002 void
   4003 _define_function_macro (glcpp_parser_t *parser,
   4004 			YYLTYPE *loc,
   4005 			const char *identifier,
   4006 			string_list_t *parameters,
   4007 			token_list_t *replacements)
   4008 {
   4009 	macro_t *macro, *previous;
   4010 
   4011 	_check_for_reserved_macro_name(parser, loc, identifier);
   4012 
   4013 	macro = hieralloc (parser, macro_t);
   4014 
   4015 	macro->is_function = 1;
   4016 	macro->parameters = hieralloc_steal (macro, parameters);
   4017 	macro->identifier = hieralloc_strdup (macro, identifier);
   4018 	macro->replacements = hieralloc_steal (macro, replacements);
   4019 
   4020 	previous = hash_table_find (parser->defines, identifier);
   4021 	if (previous) {
   4022 		if (_macro_equal (macro, previous)) {
   4023 			hieralloc_free (macro);
   4024 			return;
   4025 		}
   4026 		glcpp_error (loc, parser, "Redefinition of macro %s\n",
   4027 			     identifier);
   4028 	}
   4029 
   4030 	hash_table_insert (parser->defines, macro, identifier);
   4031 }
   4032 
   4033 static int
   4034 glcpp_parser_lex (YYSTYPE *yylval, YYLTYPE *yylloc, glcpp_parser_t *parser)
   4035 {
   4036 	token_node_t *node;
   4037 	int ret;
   4038 
   4039 	if (parser->lex_from_list == NULL) {
   4040 		ret = glcpp_lex (yylval, yylloc, parser->scanner);
   4041 
   4042 		/* XXX: This ugly block of code exists for the sole
   4043 		 * purpose of converting a NEWLINE token into a SPACE
   4044 		 * token, but only in the case where we have seen a
   4045 		 * function-like macro name, but have not yet seen its
   4046 		 * closing parenthesis.
   4047 		 *
   4048 		 * There's perhaps a more compact way to do this with
   4049 		 * mid-rule actions in the grammar.
   4050 		 *
   4051 		 * I'm definitely not pleased with the complexity of
   4052 		 * this code here.
   4053 		 */
   4054 		if (parser->newline_as_space)
   4055 		{
   4056 			if (ret == '(') {
   4057 				parser->paren_count++;
   4058 			} else if (ret == ')') {
   4059 				parser->paren_count--;
   4060 				if (parser->paren_count == 0)
   4061 					parser->newline_as_space = 0;
   4062 			} else if (ret == NEWLINE) {
   4063 				ret = SPACE;
   4064 			} else if (ret != SPACE) {
   4065 				if (parser->paren_count == 0)
   4066 					parser->newline_as_space = 0;
   4067 			}
   4068 		}
   4069 		else if (parser->in_control_line)
   4070 		{
   4071 			if (ret == NEWLINE)
   4072 				parser->in_control_line = 0;
   4073 		}
   4074 		else if (ret == HASH_DEFINE_OBJ || ret == HASH_DEFINE_FUNC ||
   4075 			   ret == HASH_UNDEF || ret == HASH_IF ||
   4076 			   ret == HASH_IFDEF || ret == HASH_IFNDEF ||
   4077 			   ret == HASH_ELIF || ret == HASH_ELSE ||
   4078 			   ret == HASH_ENDIF || ret == HASH)
   4079 		{
   4080 			parser->in_control_line = 1;
   4081 		}
   4082 		else if (ret == IDENTIFIER)
   4083 		{
   4084 			macro_t *macro;
   4085 			macro = hash_table_find (parser->defines,
   4086 						 yylval->str);
   4087 			if (macro && macro->is_function) {
   4088 				parser->newline_as_space = 1;
   4089 				parser->paren_count = 0;
   4090 			}
   4091 		}
   4092 
   4093 		return ret;
   4094 	}
   4095 
   4096 	node = parser->lex_from_node;
   4097 
   4098 	if (node == NULL) {
   4099 		hieralloc_free (parser->lex_from_list);
   4100 		parser->lex_from_list = NULL;
   4101 		return NEWLINE;
   4102 	}
   4103 
   4104 	*yylval = node->token->value;
   4105 	ret = node->token->type;
   4106 
   4107 	parser->lex_from_node = node->next;
   4108 
   4109 	return ret;
   4110 }
   4111 
   4112 static void
   4113 glcpp_parser_lex_from (glcpp_parser_t *parser, token_list_t *list)
   4114 {
   4115 	token_node_t *node;
   4116 
   4117 	assert (parser->lex_from_list == NULL);
   4118 
   4119 	/* Copy list, eliminating any space tokens. */
   4120 	parser->lex_from_list = _token_list_create (parser);
   4121 
   4122 	for (node = list->head; node; node = node->next) {
   4123 		if (node->token->type == SPACE)
   4124 			continue;
   4125 		_token_list_append (parser->lex_from_list, node->token);
   4126 	}
   4127 
   4128 	hieralloc_free (list);
   4129 
   4130 	parser->lex_from_node = parser->lex_from_list->head;
   4131 
   4132 	/* It's possible the list consisted of nothing but whitespace. */
   4133 	if (parser->lex_from_node == NULL) {
   4134 		hieralloc_free (parser->lex_from_list);
   4135 		parser->lex_from_list = NULL;
   4136 	}
   4137 }
   4138 
   4139 static void
   4140 _glcpp_parser_skip_stack_push_if (glcpp_parser_t *parser, YYLTYPE *loc,
   4141 				  int condition)
   4142 {
   4143 	skip_type_t current = SKIP_NO_SKIP;
   4144 	skip_node_t *node;
   4145 
   4146 	if (parser->skip_stack)
   4147 		current = parser->skip_stack->type;
   4148 
   4149 	node = hieralloc (parser, skip_node_t);
   4150 	node->loc = *loc;
   4151 
   4152 	if (current == SKIP_NO_SKIP) {
   4153 		if (condition)
   4154 			node->type = SKIP_NO_SKIP;
   4155 		else
   4156 			node->type = SKIP_TO_ELSE;
   4157 	} else {
   4158 		node->type = SKIP_TO_ENDIF;
   4159 	}
   4160 
   4161 	node->next = parser->skip_stack;
   4162 	parser->skip_stack = node;
   4163 }
   4164 
   4165 static void
   4166 _glcpp_parser_skip_stack_change_if (glcpp_parser_t *parser, YYLTYPE *loc,
   4167 				    const char *type, int condition)
   4168 {
   4169 	if (parser->skip_stack == NULL) {
   4170 		glcpp_error (loc, parser, "%s without #if\n", type);
   4171 		return;
   4172 	}
   4173 
   4174 	if (parser->skip_stack->type == SKIP_TO_ELSE) {
   4175 		if (condition)
   4176 			parser->skip_stack->type = SKIP_NO_SKIP;
   4177 	} else {
   4178 		parser->skip_stack->type = SKIP_TO_ENDIF;
   4179 	}
   4180 }
   4181 
   4182 static void
   4183 _glcpp_parser_skip_stack_pop (glcpp_parser_t *parser, YYLTYPE *loc)
   4184 {
   4185 	skip_node_t *node;
   4186 
   4187 	if (parser->skip_stack == NULL) {
   4188 		glcpp_error (loc, parser, "#endif without #if\n");
   4189 		return;
   4190 	}
   4191 
   4192 	node = parser->skip_stack;
   4193 	parser->skip_stack = node->next;
   4194 	hieralloc_free (node);
   4195 }
   4196 
   4197