diff options
Diffstat (limited to 'parse.c')
-rw-r--r-- | parse.c | 1618 |
1 files changed, 980 insertions, 638 deletions
@@ -1,30 +1,39 @@ -/* A Bison parser, made by GNU Bison 2.1. */ -/* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. +/* A Bison parser, made by GNU Bison 2.4.1. */ - This program is free software; you can redistribute it and/or modify +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ - -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ - -/* Written by Richard Stallman by simplifying the original so called - ``semantic'' parser. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local @@ -37,7 +46,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.1" +#define YYBISON_VERSION "2.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -45,11 +54,126 @@ /* Pure parsers. */ #define YYPURE 0 +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + /* Using locations. */ #define YYLSP_NEEDED 0 +/* Copy the first part of user declarations. */ + +/* Line 189 of yacc.c */ +#line 34 "parse.y" + +/* Copyright (c) 1990 The Regents of the University of California. */ +/* All rights reserved. */ + +/* This code is derived from software contributed to Berkeley by */ +/* Vern Paxson. */ + +/* The United States Government has rights in this work pursuant */ +/* to contract no. DE-AC03-76SF00098 between the United States */ +/* Department of Energy and the University of California. */ + +/* This file is part of flex. */ + +/* Redistribution and use in source and binary forms, with or without */ +/* modification, are permitted provided that the following conditions */ +/* are met: */ + +/* 1. Redistributions of source code must retain the above copyright */ +/* notice, this list of conditions and the following disclaimer. */ +/* 2. Redistributions in binary form must reproduce the above copyright */ +/* notice, this list of conditions and the following disclaimer in the */ +/* documentation and/or other materials provided with the distribution. */ + +/* Neither the name of the University nor the names of its contributors */ +/* may be used to endorse or promote products derived from this software */ +/* without specific prior written permission. */ + +/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */ +/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */ +/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ +/* PURPOSE. */ + +#include "flexdef.h" +#include "tables.h" + +int pat, scnum, eps, headcnt, trailcnt, lastchar, i, rulelen; +int trlcontxt, xcluflg, currccl, cclsorted, varlength, variable_trail_rule; + +int *scon_stk; +int scon_stk_ptr; + +static int madeany = false; /* whether we've made the '.' character class */ +static int ccldot, cclany; +int previous_continued_action; /* whether the previous rule's action was '|' */ + +#define format_warn3(fmt, a1, a2) \ + do{ \ + char fw3_msg[MAXLINE];\ + snprintf( fw3_msg, MAXLINE,(fmt), (a1), (a2) );\ + warn( fw3_msg );\ + }while(0) + +/* Expand a POSIX character class expression. */ +#define CCL_EXPR(func) \ + do{ \ + int c; \ + for ( c = 0; c < csize; ++c ) \ + if ( isascii(c) && func(c) ) \ + ccladd( currccl, c ); \ + }while(0) + +/* negated class */ +#define CCL_NEG_EXPR(func) \ + do{ \ + int c; \ + for ( c = 0; c < csize; ++c ) \ + if ( !func(c) ) \ + ccladd( currccl, c ); \ + }while(0) + +/* While POSIX defines isblank(), it's not ANSI C. */ +#define IS_BLANK(c) ((c) == ' ' || (c) == '\t') + +/* On some over-ambitious machines, such as DEC Alpha's, the default + * token type is "long" instead of "int"; this leads to problems with + * declaring yylval in flexdef.h. But so far, all the yacc's I've seen + * wrap their definitions of YYSTYPE with "#ifndef YYSTYPE"'s, so the + * following should ensure that the default token type is "int". + */ +#define YYSTYPE int + + + +/* Line 189 of yacc.c */ +#line 157 "parse.c" + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif + + /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE @@ -153,138 +277,67 @@ -/* Copy the first part of user declarations. */ -#line 34 "parse.y" - -/* Copyright (c) 1990 The Regents of the University of California. */ -/* All rights reserved. */ - -/* This code is derived from software contributed to Berkeley by */ -/* Vern Paxson. */ - -/* The United States Government has rights in this work pursuant */ -/* to contract no. DE-AC03-76SF00098 between the United States */ -/* Department of Energy and the University of California. */ - -/* This file is part of flex. */ - -/* Redistribution and use in source and binary forms, with or without */ -/* modification, are permitted provided that the following conditions */ -/* are met: */ - -/* 1. Redistributions of source code must retain the above copyright */ -/* notice, this list of conditions and the following disclaimer. */ -/* 2. Redistributions in binary form must reproduce the above copyright */ -/* notice, this list of conditions and the following disclaimer in the */ -/* documentation and/or other materials provided with the distribution. */ - -/* Neither the name of the University nor the names of its contributors */ -/* may be used to endorse or promote products derived from this software */ -/* without specific prior written permission. */ - -/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */ -/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */ -/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ -/* PURPOSE. */ - -#include "flexdef.h" -#include "tables.h" - -int pat, scnum, eps, headcnt, trailcnt, lastchar, i, rulelen; -int trlcontxt, xcluflg, currccl, cclsorted, varlength, variable_trail_rule; - -int *scon_stk; -int scon_stk_ptr; - -static int madeany = false; /* whether we've made the '.' character class */ -static int ccldot, cclany; -int previous_continued_action; /* whether the previous rule's action was '|' */ - -#define format_warn3(fmt, a1, a2) \ - do{ \ - char fw3_msg[MAXLINE];\ - snprintf( fw3_msg, MAXLINE,(fmt), (a1), (a2) );\ - warn( fw3_msg );\ - }while(0) - -/* Expand a POSIX character class expression. */ -#define CCL_EXPR(func) \ - do{ \ - int c; \ - for ( c = 0; c < csize; ++c ) \ - if ( isascii(c) && func(c) ) \ - ccladd( currccl, c ); \ - }while(0) - -/* negated class */ -#define CCL_NEG_EXPR(func) \ - do{ \ - int c; \ - for ( c = 0; c < csize; ++c ) \ - if ( !func(c) ) \ - ccladd( currccl, c ); \ - }while(0) +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef int YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +#endif -/* While POSIX defines isblank(), it's not ANSI C. */ -#define IS_BLANK(c) ((c) == ' ' || (c) == '\t') -/* On some over-ambitious machines, such as DEC Alpha's, the default - * token type is "long" instead of "int"; this leads to problems with - * declaring yylval in flexdef.h. But so far, all the yacc's I've seen - * wrap their definitions of YYSTYPE with "#ifndef YYSTYPE"'s, so the - * following should ensure that the default token type is "int". - */ -#define YYSTYPE int +/* Copy the second part of user declarations. */ +/* Line 264 of yacc.c */ +#line 293 "parse.c" -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 +#ifdef short +# undef short #endif -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; #else -# define YYERROR_VERBOSE 0 +typedef unsigned char yytype_uint8; #endif -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -# define YYTOKEN_TABLE 0 +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#elif (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +typedef signed char yytype_int8; +#else +typedef short int yytype_int8; #endif -#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -typedef int YYSTYPE; -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; #endif - - -/* Copy the second part of user declarations. */ - - -/* Line 219 of yacc.c. */ -#line 273 "parse.c" - -#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) -# define YYSIZE_T __SIZE_TYPE__ -#endif -#if ! defined (YYSIZE_T) && defined (size_t) -# define YYSIZE_T size_t -#endif -#if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus)) -# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; #endif -#if ! defined (YYSIZE_T) -# define YYSIZE_T unsigned int + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif #endif +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + #ifndef YY_ # if YYENABLE_NLS # if ENABLE_NLS @@ -297,7 +350,32 @@ typedef int YYSTYPE; # endif #endif -#if ! defined (yyoverflow) || YYERROR_VERBOSE +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(e) ((void) (e)) +#else +# define YYUSE(e) /* empty */ +#endif + +/* Identity function, used to suppress warnings about constant conditions. */ +#ifndef lint +# define YYID(n) (n) +#else +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static int +YYID (int yyi) +#else +static int +YYID (yyi) + int yyi; +#endif +{ + return yyi; +} +#endif + +#if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ @@ -305,66 +383,78 @@ typedef int YYSTYPE; # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if defined (__STDC__) || defined (__cplusplus) +# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ -# define YYINCLUDED_STDLIB_H +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ -# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM -# define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1) +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif -# ifdef __cplusplus -extern "C" { +# if (defined __cplusplus && ! defined _STDLIB_H \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \ - && (defined (__STDC__) || defined (__cplusplus))) +# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \ - && (defined (__STDC__) || defined (__cplusplus))) +# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif -# ifdef __cplusplus -} -# endif # endif -#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ -#if (! defined (yyoverflow) \ - && (! defined (__cplusplus) \ - || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { - short int yyss; - YYSTYPE yyvs; - }; + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) @@ -372,13 +462,13 @@ union yyalloc /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ - ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY -# if defined (__GNUC__) && 1 < __GNUC__ +# if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else @@ -389,7 +479,7 @@ union yyalloc for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ - while (0) + while (YYID (0)) # endif # endif @@ -398,37 +488,31 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack) \ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ - while (0) + while (YYID (0)) #endif -#if defined (__STDC__) || defined (__cplusplus) - typedef signed char yysigned_char; -#else - typedef short int yysigned_char; -#endif - -/* YYFINAL -- State number of the termination state. */ +/* YYFINAL -- State number of the termination state. */ #define YYFINAL 3 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 161 -/* YYNTOKENS -- Number of terminals. */ +/* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 69 -/* YYNNTS -- Number of nonterminals. */ +/* YYNNTS -- Number of nonterminals. */ #define YYNNTS 27 -/* YYNRULES -- Number of rules. */ +/* YYNRULES -- Number of rules. */ #define YYNRULES 97 -/* YYNRULES -- Number of states. */ +/* YYNRULES -- Number of states. */ #define YYNSTATES 140 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ @@ -439,7 +523,7 @@ union yyalloc ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ -static const unsigned char yytranslate[] = +static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 49, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -477,7 +561,7 @@ static const unsigned char yytranslate[] = #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ -static const unsigned short int yyprhs[] = +static const yytype_uint16 yyprhs[] = { 0, 0, 3, 9, 10, 14, 17, 18, 20, 22, 24, 26, 29, 31, 33, 36, 39, 40, 44, 48, @@ -491,8 +575,8 @@ static const unsigned short int yyprhs[] = 262, 264, 266, 268, 270, 272, 274, 277 }; -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yysigned_char yyrhs[] = +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int8 yyrhs[] = { 70, 0, -1, 71, 72, 73, 79, 80, -1, -1, 72, 74, 75, -1, 72, 76, -1, -1, 1, -1, @@ -525,24 +609,24 @@ static const yysigned_char yyrhs[] = }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const unsigned short int yyrline[] = +static const yytype_uint16 yyrline[] = { 0, 118, 118, 148, 155, 156, 157, 158, 162, 170, 173, 177, 180, 183, 187, 190, 191, 194, 199, 201, 203, 205, 207, 211, 213, 215, 219, 231, 267, 291, 314, 319, 322, 325, 343, 346, 348, 350, 354, 377, 433, 436, 479, 497, 503, 508, 535, 543, 546, 574, - 588, 610, 617, 623, 629, 657, 671, 690, 724, 744, - 754, 757, 760, 775, 776, 777, 782, 784, 791, 851, - 869, 877, 885, 886, 887, 888, 889, 890, 891, 896, - 897, 898, 899, 900, 906, 907, 908, 909, 910, 911, - 912, 913, 914, 915, 916, 922, 930, 946 + 588, 610, 617, 623, 629, 657, 671, 690, 724, 742, + 752, 755, 758, 773, 774, 775, 780, 782, 789, 849, + 867, 875, 883, 884, 885, 886, 887, 888, 889, 894, + 895, 896, 897, 898, 904, 905, 906, 907, 908, 909, + 910, 911, 912, 913, 914, 920, 928, 944 }; #endif #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "CHAR", "NUMBER", "SECTEND", "SCDECL", @@ -568,7 +652,7 @@ static const char *const yytname[] = # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ -static const unsigned short int yytoknum[] = +static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, @@ -581,7 +665,7 @@ static const unsigned short int yytoknum[] = # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const unsigned char yyr1[] = +static const yytype_uint8 yyr1[] = { 0, 69, 70, 71, 72, 72, 72, 72, 73, 74, 74, 75, 75, 75, 76, 77, 77, 78, 78, 78, @@ -596,7 +680,7 @@ static const unsigned char yyr1[] = }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const unsigned char yyr2[] = +static const yytype_uint8 yyr2[] = { 0, 2, 5, 0, 3, 2, 0, 1, 1, 1, 1, 2, 1, 1, 2, 2, 0, 3, 3, 3, @@ -613,7 +697,7 @@ static const unsigned char yyr2[] = /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ -static const unsigned char yydefact[] = +static const yytype_uint8 yydefact[] = { 3, 0, 0, 1, 7, 0, 8, 9, 10, 16, 25, 0, 5, 14, 34, 13, 12, 4, 0, 0, @@ -631,8 +715,8 @@ static const unsigned char yydefact[] = 0, 56, 0, 68, 0, 49, 0, 55, 48, 54 }; -/* YYDEFGOTO[NTERM-NUM]. */ -static const yysigned_char yydefgoto[] = +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int8 yydefgoto[] = { -1, 1, 2, 5, 10, 11, 17, 12, 13, 24, 14, 26, 60, 36, 27, 48, 49, 61, 62, 63, @@ -642,7 +726,7 @@ static const yysigned_char yydefgoto[] = /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -52 -static const short int yypact[] = +static const yytype_int16 yypact[] = { -52, 17, 103, -52, -52, 113, -52, -52, -52, -52, -52, 48, -52, 114, 6, -52, -52, 42, 7, 12, @@ -661,7 +745,7 @@ static const short int yypact[] = }; /* YYPGOTO[NTERM-NUM]. */ -static const short int yypgoto[] = +static const yytype_int16 yypgoto[] = { -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, 118, 129, -52, -52, -52, -52, 92, 102, -48, -52, @@ -673,7 +757,7 @@ static const short int yypgoto[] = number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -27 -static const short int yytable[] = +static const yytype_int16 yytable[] = { 51, 136, 52, 94, 90, 129, -26, 78, 53, 54, 73, 87, 88, 134, 92, 80, 130, 3, 95, 96, @@ -694,7 +778,7 @@ static const short int yytable[] = 0, 89 }; -static const yysigned_char yycheck[] = +static const yytype_int8 yycheck[] = { 1, 4, 3, 3, 3, 45, 0, 58, 9, 10, 58, 42, 43, 4, 65, 63, 56, 0, 18, 19, @@ -717,7 +801,7 @@ static const yysigned_char yycheck[] = /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ -static const unsigned char yystos[] = +static const yytype_uint8 yystos[] = { 0, 70, 71, 0, 1, 72, 5, 6, 7, 11, 73, 74, 76, 77, 79, 1, 8, 75, 12, 13, @@ -760,7 +844,7 @@ do \ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ - YYPOPSTACK; \ + YYPOPSTACK (1); \ goto yybackup; \ } \ else \ @@ -768,7 +852,7 @@ do \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ -while (0) +while (YYID (0)) #define YYTERROR 1 @@ -783,7 +867,7 @@ while (0) #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ - if (N) \ + if (YYID (N)) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ @@ -797,7 +881,7 @@ while (0) (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ - while (0) + while (YYID (0)) #endif @@ -809,8 +893,8 @@ while (0) # if YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) # else # define YY_LOCATION_PRINT(File, Loc) ((void) 0) # endif @@ -837,37 +921,100 @@ while (0) do { \ if (yydebug) \ YYFPRINTF Args; \ -} while (0) +} while (YYID (0)) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yysymprint (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (0) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (YYID (0)) + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_value_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# else + YYUSE (yyoutput); +# endif + switch (yytype) + { + default: + break; + } +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + yy_symbol_value_print (yyoutput, yytype, yyvaluep); + YYFPRINTF (yyoutput, ")"); +} /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ -#if defined (__STDC__) || defined (__cplusplus) +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (short int *bottom, short int *top) +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) #else static void -yy_stack_print (bottom, top) - short int *bottom; - short int *top; +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; #endif { YYFPRINTF (stderr, "Stack now"); - for (/* Nothing. */; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } YYFPRINTF (stderr, "\n"); } @@ -875,37 +1022,45 @@ yy_stack_print (bottom, top) do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ -} while (0) +} while (YYID (0)) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ -#if defined (__STDC__) || defined (__cplusplus) +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static void -yy_reduce_print (int yyrule) +yy_reduce_print (YYSTYPE *yyvsp, int yyrule) #else static void -yy_reduce_print (yyrule) +yy_reduce_print (yyvsp, yyrule) + YYSTYPE *yyvsp; int yyrule; #endif { + int yynrhs = yyr2[yyrule]; int yyi; unsigned long int yylno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ", - yyrule - 1, yylno); - /* Print the symbols being reduced, and their result. */ - for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) - YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); - YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]); + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); + YYFPRINTF (stderr, "\n"); + } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ - yy_reduce_print (Rule); \ -} while (0) + yy_reduce_print (yyvsp, Rule); \ +} while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ @@ -939,42 +1094,44 @@ int yydebug; #if YYERROR_VERBOSE # ifndef yystrlen -# if defined (__GLIBC__) && defined (_STRING_H) +# if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static YYSIZE_T -# if defined (__STDC__) || defined (__cplusplus) yystrlen (const char *yystr) -# else +#else +static YYSIZE_T yystrlen (yystr) - const char *yystr; -# endif + const char *yystr; +#endif { - const char *yys = yystr; - - while (*yys++ != '\0') + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) continue; - - return yys - yystr - 1; + return yylen; } # endif # endif # ifndef yystpcpy -# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static char * -# if defined (__STDC__) || defined (__cplusplus) yystpcpy (char *yydest, const char *yysrc) -# else +#else +static char * yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -# endif + char *yydest; + const char *yysrc; +#endif { char *yyd = yydest; const char *yys = yysrc; @@ -1000,7 +1157,7 @@ yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { - size_t yyn = 0; + YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) @@ -1035,53 +1192,123 @@ yytnamerr (char *yyres, const char *yystr) } # endif -#endif /* YYERROR_VERBOSE */ - - - -#if YYDEBUG -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -#if defined (__STDC__) || defined (__cplusplus) -static void -yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) -#else -static void -yysymprint (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE *yyvaluep; -#endif +/* Copy into YYRESULT an error message about the unexpected token + YYCHAR while in state YYSTATE. Return the number of bytes copied, + including the terminating null byte. If YYRESULT is null, do not + copy anything; just return the number of bytes that would be + copied. As a special case, return 0 if an ordinary "syntax error" + message will do. Return YYSIZE_MAXIMUM if overflow occurs during + size calculation. */ +static YYSIZE_T +yysyntax_error (char *yyresult, int yystate, int yychar) { - /* Pacify ``unused variable'' warnings. */ - (void) yyvaluep; + int yyn = yypact[yystate]; - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) + return 0; else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + { + int yytype = YYTRANSLATE (yychar); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; + +# if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +# endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# endif - switch (yytype) - { - default: - break; + if (yysize_overflow) + return YYSIZE_MAXIMUM; + + if (yyresult) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yyresult; + int yyi = 0; + while ((*yyp = *yyf) != '\0') + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + } + return yysize; } - YYFPRINTF (yyoutput, ")"); } +#endif /* YYERROR_VERBOSE */ + -#endif /* ! YYDEBUG */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ -#if defined (__STDC__) || defined (__cplusplus) +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) #else @@ -1092,8 +1319,7 @@ yydestruct (yymsg, yytype, yyvaluep) YYSTYPE *yyvaluep; #endif { - /* Pacify ``unused variable'' warnings. */ - (void) yyvaluep; + YYUSE (yyvaluep); if (!yymsg) yymsg = "Deleting"; @@ -1103,21 +1329,19 @@ yydestruct (yymsg, yytype, yyvaluep) { default: - break; + break; } } - /* Prevent warnings from -Wmissing-prototypes. */ - #ifdef YYPARSE_PARAM -# if defined (__STDC__) || defined (__cplusplus) +#if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); -# else +#else int yyparse (); -# endif +#endif #else /* ! YYPARSE_PARAM */ -#if defined (__STDC__) || defined (__cplusplus) +#if defined __STDC__ || defined __cplusplus int yyparse (void); #else int yyparse (); @@ -1125,11 +1349,10 @@ int yyparse (); #endif /* ! YYPARSE_PARAM */ - -/* The look-ahead symbol. */ +/* The lookahead symbol. */ int yychar; -/* The semantic value of the look-ahead symbol. */ +/* The semantic value of the lookahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ @@ -1137,82 +1360,94 @@ int yynerrs; -/*----------. -| yyparse. | -`----------*/ +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ #ifdef YYPARSE_PARAM -# if defined (__STDC__) || defined (__cplusplus) -int yyparse (void *YYPARSE_PARAM) -# else -int yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -# endif +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void *YYPARSE_PARAM) +#else +int +yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +#endif #else /* ! YYPARSE_PARAM */ -#if defined (__STDC__) || defined (__cplusplus) +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) int yyparse (void) #else int yyparse () - ; + #endif #endif { - - int yystate; - int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; - /* The state stack. */ - short int yyssa[YYINITDEPTH]; - short int *yyss = yyssa; - short int *yyssp; + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; -#define YYPOPSTACK (yyvsp--, yyssp--) - - YYSIZE_T yystacksize = YYINITDEPTH; + YYSIZE_T yystacksize; + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif - /* When reducing, the number of symbols on the RHS of the reduced - rule. */ - int yylen; +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss; yyvsp = yyvs; @@ -1223,8 +1458,7 @@ yyparse () `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks - have just been pushed. so pushing a state here evens the stacks. - */ + have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: @@ -1237,12 +1471,11 @@ yyparse () #ifdef yyoverflow { - /* Give user a chance to reallocate the stack. Use copies of + /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; - short int *yyss1 = yyss; - + yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a @@ -1251,7 +1484,6 @@ yyparse () yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); yyss = yyss1; @@ -1269,14 +1501,13 @@ yyparse () yystacksize = YYMAXDEPTH; { - short int *yyss1 = yyss; + yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -1287,7 +1518,6 @@ yyparse () yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; - YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); @@ -1297,6 +1527,9 @@ yyparse () YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + if (yystate == YYFINAL) + YYACCEPT; + goto yybackup; /*-----------. @@ -1304,19 +1537,17 @@ yyparse () `-----------*/ yybackup: -/* Do appropriate processing given the current state. */ -/* Read a look-ahead token if we need one and don't already have one. */ -/* yyresume: */ - - /* First try to decide what to do without reference to look-ahead token. */ + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a look-ahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -1348,25 +1579,20 @@ yybackup: goto yyreduce; } - if (yyn == YYFINAL) - YYACCEPT; - - /* Shift the look-ahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the token being shifted unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; - - *++yyvsp = yylval; - - /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + yystate = yyn; + *++yyvsp = yylval; + goto yynewstate; @@ -1402,6 +1628,8 @@ yyreduce: switch (yyn) { case 2: + +/* Line 1455 of yacc.c */ #line 119 "parse.y" { /* add default rule */ int def_rule; @@ -1432,6 +1660,8 @@ yyreduce: break; case 3: + +/* Line 1455 of yacc.c */ #line 148 "parse.y" { /* initialize for processing rules */ @@ -1441,11 +1671,15 @@ yyreduce: break; case 7: + +/* Line 1455 of yacc.c */ #line 159 "parse.y" { synerr( _("unknown error processing section 1") ); } break; case 8: + +/* Line 1455 of yacc.c */ #line 163 "parse.y" { check_options(); @@ -1455,31 +1689,43 @@ yyreduce: break; case 9: + +/* Line 1455 of yacc.c */ #line 171 "parse.y" { xcluflg = false; } break; case 10: + +/* Line 1455 of yacc.c */ #line 174 "parse.y" { xcluflg = true; } break; case 11: + +/* Line 1455 of yacc.c */ #line 178 "parse.y" { scinstal( nmstr, xcluflg ); } break; case 12: + +/* Line 1455 of yacc.c */ #line 181 "parse.y" { scinstal( nmstr, xcluflg ); } break; case 13: + +/* Line 1455 of yacc.c */ #line 184 "parse.y" { synerr( _("bad start condition list") ); } break; case 17: + +/* Line 1455 of yacc.c */ #line 195 "parse.y" { outfilename = copy_string( nmstr ); @@ -1488,41 +1734,57 @@ yyreduce: break; case 18: + +/* Line 1455 of yacc.c */ #line 200 "parse.y" { extra_type = copy_string( nmstr ); } break; case 19: + +/* Line 1455 of yacc.c */ #line 202 "parse.y" { prefix = copy_string( nmstr ); } break; case 20: + +/* Line 1455 of yacc.c */ #line 204 "parse.y" { yyclass = copy_string( nmstr ); } break; case 21: + +/* Line 1455 of yacc.c */ #line 206 "parse.y" { headerfilename = copy_string( nmstr ); } break; case 22: + +/* Line 1455 of yacc.c */ #line 208 "parse.y" { tablesext = true; tablesfilename = copy_string( nmstr ); } break; case 23: + +/* Line 1455 of yacc.c */ #line 212 "parse.y" - { scon_stk_ptr = (yyvsp[-3]); } + { scon_stk_ptr = (yyvsp[(2) - (5)]); } break; case 24: + +/* Line 1455 of yacc.c */ #line 214 "parse.y" - { scon_stk_ptr = (yyvsp[-3]); } + { scon_stk_ptr = (yyvsp[(2) - (5)]); } break; case 26: + +/* Line 1455 of yacc.c */ #line 219 "parse.y" { /* Initialize for a parse of one rule. */ @@ -1537,9 +1799,11 @@ yyreduce: break; case 27: + +/* Line 1455 of yacc.c */ #line 232 "parse.y" { - pat = (yyvsp[0]); + pat = (yyvsp[(2) - (2)]); finish_rule( pat, variable_trail_rule, headcnt, trailcnt , previous_continued_action); @@ -1575,9 +1839,11 @@ yyreduce: break; case 28: + +/* Line 1455 of yacc.c */ #line 268 "parse.y" { - pat = (yyvsp[0]); + pat = (yyvsp[(1) - (1)]); finish_rule( pat, variable_trail_rule, headcnt, trailcnt , previous_continued_action); @@ -1601,6 +1867,8 @@ yyreduce: break; case 29: + +/* Line 1455 of yacc.c */ #line 292 "parse.y" { if ( scon_stk_ptr > 0 ) @@ -1626,21 +1894,29 @@ yyreduce: break; case 30: + +/* Line 1455 of yacc.c */ #line 315 "parse.y" { synerr( _("unrecognized rule") ); } break; case 31: + +/* Line 1455 of yacc.c */ #line 319 "parse.y" { (yyval) = scon_stk_ptr; } break; case 32: + +/* Line 1455 of yacc.c */ #line 323 "parse.y" - { (yyval) = (yyvsp[-2]); } + { (yyval) = (yyvsp[(2) - (4)]); } break; case 33: + +/* Line 1455 of yacc.c */ #line 326 "parse.y" { (yyval) = scon_stk_ptr; @@ -1660,16 +1936,22 @@ yyreduce: break; case 34: + +/* Line 1455 of yacc.c */ #line 343 "parse.y" { (yyval) = scon_stk_ptr; } break; case 37: + +/* Line 1455 of yacc.c */ #line 351 "parse.y" { synerr( _("bad start condition list") ); } break; case 38: + +/* Line 1455 of yacc.c */ #line 355 "parse.y" { if ( (scnum = sclookup( nmstr )) == 0 ) @@ -1694,17 +1976,19 @@ yyreduce: break; case 39: + +/* Line 1455 of yacc.c */ #line 378 "parse.y" { - if ( transchar[lastst[(yyvsp[0])]] != SYM_EPSILON ) + if ( transchar[lastst[(yyvsp[(2) - (2)])]] != SYM_EPSILON ) /* Provide final transition \now/ so it * will be marked as a trailing context * state. */ - (yyvsp[0]) = link_machines( (yyvsp[0]), + (yyvsp[(2) - (2)]) = link_machines( (yyvsp[(2) - (2)]), mkstate( SYM_EPSILON ) ); - mark_beginning_as_normal( (yyvsp[0]) ); + mark_beginning_as_normal( (yyvsp[(2) - (2)]) ); current_state_type = STATE_NORMAL; if ( previous_continued_action ) @@ -1739,7 +2023,7 @@ yyreduce: * trail rule, and add_accept() can create * a new state ... */ - add_accept( (yyvsp[-1]), + add_accept( (yyvsp[(1) - (2)]), num_rules | YY_TRAILING_HEAD_MASK ); variable_trail_rule = true; } @@ -1747,16 +2031,20 @@ yyreduce: else trailcnt = rulelen; - (yyval) = link_machines( (yyvsp[-1]), (yyvsp[0]) ); + (yyval) = link_machines( (yyvsp[(1) - (2)]), (yyvsp[(2) - (2)]) ); } break; case 40: + +/* Line 1455 of yacc.c */ #line 434 "parse.y" { synerr( _("trailing context used twice") ); } break; case 41: + +/* Line 1455 of yacc.c */ #line 437 "parse.y" { headcnt = 0; @@ -1788,7 +2076,7 @@ yyreduce: /* Again, see the comment in the rule for * "re2 re" above. */ - add_accept( (yyvsp[-1]), + add_accept( (yyvsp[(1) - (2)]), num_rules | YY_TRAILING_HEAD_MASK ); variable_trail_rule = true; } @@ -1796,15 +2084,17 @@ yyreduce: trlcontxt = true; eps = mkstate( SYM_EPSILON ); - (yyval) = link_machines( (yyvsp[-1]), + (yyval) = link_machines( (yyvsp[(1) - (2)]), link_machines( eps, mkstate( '\n' ) ) ); } break; case 42: + +/* Line 1455 of yacc.c */ #line 480 "parse.y" { - (yyval) = (yyvsp[0]); + (yyval) = (yyvsp[(1) - (1)]); if ( trlcontxt ) { @@ -1820,19 +2110,25 @@ yyreduce: break; case 43: + +/* Line 1455 of yacc.c */ #line 498 "parse.y" { varlength = true; - (yyval) = mkor( (yyvsp[-2]), (yyvsp[0]) ); + (yyval) = mkor( (yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]) ); } break; case 44: + +/* Line 1455 of yacc.c */ #line 504 "parse.y" - { (yyval) = (yyvsp[0]); } + { (yyval) = (yyvsp[(1) - (1)]); } break; case 45: + +/* Line 1455 of yacc.c */ #line 509 "parse.y" { /* This rule is written separately so the @@ -1856,72 +2152,82 @@ yyreduce: rulelen = 0; current_state_type = STATE_TRAILING_CONTEXT; - (yyval) = (yyvsp[-1]); + (yyval) = (yyvsp[(1) - (2)]); } break; case 46: + +/* Line 1455 of yacc.c */ #line 536 "parse.y" { /* This is where concatenation of adjacent patterns * gets done. */ - (yyval) = link_machines( (yyvsp[-1]), (yyvsp[0]) ); + (yyval) = link_machines( (yyvsp[(1) - (2)]), (yyvsp[(2) - (2)]) ); } break; case 47: + +/* Line 1455 of yacc.c */ #line 544 "parse.y" - { (yyval) = (yyvsp[0]); } + { (yyval) = (yyvsp[(1) - (1)]); } break; case 48: + +/* Line 1455 of yacc.c */ #line 547 "parse.y" { varlength = true; - if ( (yyvsp[-3]) > (yyvsp[-1]) || (yyvsp[-3]) < 0 ) + if ( (yyvsp[(3) - (6)]) > (yyvsp[(5) - (6)]) || (yyvsp[(3) - (6)]) < 0 ) { synerr( _("bad iteration values") ); - (yyval) = (yyvsp[-5]); + (yyval) = (yyvsp[(1) - (6)]); } else { - if ( (yyvsp[-3]) == 0 ) + if ( (yyvsp[(3) - (6)]) == 0 ) { - if ( (yyvsp[-1]) <= 0 ) + if ( (yyvsp[(5) - (6)]) <= 0 ) { synerr( _("bad iteration values") ); - (yyval) = (yyvsp[-5]); + (yyval) = (yyvsp[(1) - (6)]); } else (yyval) = mkopt( - mkrep( (yyvsp[-5]), 1, (yyvsp[-1]) ) ); + mkrep( (yyvsp[(1) - (6)]), 1, (yyvsp[(5) - (6)]) ) ); } else - (yyval) = mkrep( (yyvsp[-5]), (yyvsp[-3]), (yyvsp[-1]) ); + (yyval) = mkrep( (yyvsp[(1) - (6)]), (yyvsp[(3) - (6)]), (yyvsp[(5) - (6)]) ); } } break; case 49: + +/* Line 1455 of yacc.c */ #line 575 "parse.y" { varlength = true; - if ( (yyvsp[-2]) <= 0 ) + if ( (yyvsp[(3) - (5)]) <= 0 ) { synerr( _("iteration value must be positive") ); - (yyval) = (yyvsp[-4]); + (yyval) = (yyvsp[(1) - (5)]); } else - (yyval) = mkrep( (yyvsp[-4]), (yyvsp[-2]), INFINITE_REPEAT ); + (yyval) = mkrep( (yyvsp[(1) - (5)]), (yyvsp[(3) - (5)]), INFINITE_REPEAT ); } break; case 50: + +/* Line 1455 of yacc.c */ #line 589 "parse.y" { /* The series could be something like "(foo)", @@ -1930,91 +2236,103 @@ yyreduce: */ varlength = true; - if ( (yyvsp[-1]) <= 0 ) + if ( (yyvsp[(3) - (4)]) <= 0 ) { synerr( _("iteration value must be positive") ); - (yyval) = (yyvsp[-3]); + (yyval) = (yyvsp[(1) - (4)]); } else - (yyval) = link_machines( (yyvsp[-3]), - copysingl( (yyvsp[-3]), (yyvsp[-1]) - 1 ) ); + (yyval) = link_machines( (yyvsp[(1) - (4)]), + copysingl( (yyvsp[(1) - (4)]), (yyvsp[(3) - (4)]) - 1 ) ); } break; case 51: + +/* Line 1455 of yacc.c */ #line 611 "parse.y" { varlength = true; - (yyval) = mkclos( (yyvsp[-1]) ); + (yyval) = mkclos( (yyvsp[(1) - (2)]) ); } break; case 52: + +/* Line 1455 of yacc.c */ #line 618 "parse.y" { varlength = true; - (yyval) = mkposcl( (yyvsp[-1]) ); + (yyval) = mkposcl( (yyvsp[(1) - (2)]) ); } break; case 53: + +/* Line 1455 of yacc.c */ #line 624 "parse.y" { varlength = true; - (yyval) = mkopt( (yyvsp[-1]) ); + (yyval) = mkopt( (yyvsp[(1) - (2)]) ); } break; case 54: + +/* Line 1455 of yacc.c */ #line 630 "parse.y" { varlength = true; - if ( (yyvsp[-3]) > (yyvsp[-1]) || (yyvsp[-3]) < 0 ) + if ( (yyvsp[(3) - (6)]) > (yyvsp[(5) - (6)]) || (yyvsp[(3) - (6)]) < 0 ) { synerr( _("bad iteration values") ); - (yyval) = (yyvsp[-5]); + (yyval) = (yyvsp[(1) - (6)]); } else { - if ( (yyvsp[-3]) == 0 ) + if ( (yyvsp[(3) - (6)]) == 0 ) { - if ( (yyvsp[-1]) <= 0 ) + if ( (yyvsp[(5) - (6)]) <= 0 ) { synerr( _("bad iteration values") ); - (yyval) = (yyvsp[-5]); + (yyval) = (yyvsp[(1) - (6)]); } else (yyval) = mkopt( - mkrep( (yyvsp[-5]), 1, (yyvsp[-1]) ) ); + mkrep( (yyvsp[(1) - (6)]), 1, (yyvsp[(5) - (6)]) ) ); } else - (yyval) = mkrep( (yyvsp[-5]), (yyvsp[-3]), (yyvsp[-1]) ); + (yyval) = mkrep( (yyvsp[(1) - (6)]), (yyvsp[(3) - (6)]), (yyvsp[(5) - (6)]) ); } } break; case 55: + +/* Line 1455 of yacc.c */ #line 658 "parse.y" { varlength = true; - if ( (yyvsp[-2]) <= 0 ) + if ( (yyvsp[(3) - (5)]) <= 0 ) { synerr( _("iteration value must be positive") ); - (yyval) = (yyvsp[-4]); + (yyval) = (yyvsp[(1) - (5)]); } else - (yyval) = mkrep( (yyvsp[-4]), (yyvsp[-2]), INFINITE_REPEAT ); + (yyval) = mkrep( (yyvsp[(1) - (5)]), (yyvsp[(3) - (5)]), INFINITE_REPEAT ); } break; case 56: + +/* Line 1455 of yacc.c */ #line 672 "parse.y" { /* The singleton could be something like "(foo)", @@ -2023,19 +2341,21 @@ yyreduce: */ varlength = true; - if ( (yyvsp[-1]) <= 0 ) + if ( (yyvsp[(3) - (4)]) <= 0 ) { synerr( _("iteration value must be positive") ); - (yyval) = (yyvsp[-3]); + (yyval) = (yyvsp[(1) - (4)]); } else - (yyval) = link_machines( (yyvsp[-3]), - copysingl( (yyvsp[-3]), (yyvsp[-1]) - 1 ) ); + (yyval) = link_machines( (yyvsp[(1) - (4)]), + copysingl( (yyvsp[(1) - (4)]), (yyvsp[(3) - (4)]) - 1 ) ); } break; case 57: + +/* Line 1455 of yacc.c */ #line 691 "parse.y" { if ( ! madeany ) @@ -2072,90 +2392,108 @@ yyreduce: break; case 58: + +/* Line 1455 of yacc.c */ #line 725 "parse.y" { - /* Sort characters for fast searching. We - * use a shell sort since this list could - * be large. + /* Sort characters for fast searching. */ - cshell( ccltbl + cclmap[(yyvsp[0])], ccllen[(yyvsp[0])], true ); + qsort( ccltbl + cclmap[(yyvsp[(1) - (1)])], ccllen[(yyvsp[(1) - (1)])], sizeof (*ccltbl), cclcmp ); if ( useecs ) - mkeccl( ccltbl + cclmap[(yyvsp[0])], ccllen[(yyvsp[0])], + mkeccl( ccltbl + cclmap[(yyvsp[(1) - (1)])], ccllen[(yyvsp[(1) - (1)])], nextecm, ecgroup, csize, csize ); ++rulelen; - if (ccl_has_nl[(yyvsp[0])]) + if (ccl_has_nl[(yyvsp[(1) - (1)])]) rule_has_nl[num_rules] = true; - (yyval) = mkstate( -(yyvsp[0]) ); + (yyval) = mkstate( -(yyvsp[(1) - (1)]) ); } break; case 59: -#line 745 "parse.y" + +/* Line 1455 of yacc.c */ +#line 743 "parse.y" { ++rulelen; - if (ccl_has_nl[(yyvsp[0])]) + if (ccl_has_nl[(yyvsp[(1) - (1)])]) rule_has_nl[num_rules] = true; - (yyval) = mkstate( -(yyvsp[0]) ); + (yyval) = mkstate( -(yyvsp[(1) - (1)]) ); } break; case 60: -#line 755 "parse.y" - { (yyval) = (yyvsp[-1]); } + +/* Line 1455 of yacc.c */ +#line 753 "parse.y" + { (yyval) = (yyvsp[(2) - (3)]); } break; case 61: -#line 758 "parse.y" - { (yyval) = (yyvsp[-1]); } + +/* Line 1455 of yacc.c */ +#line 756 "parse.y" + { (yyval) = (yyvsp[(2) - (3)]); } break; case 62: -#line 761 "parse.y" + +/* Line 1455 of yacc.c */ +#line 759 "parse.y" { ++rulelen; - if ((yyvsp[0]) == nlch) + if ((yyvsp[(1) - (1)]) == nlch) rule_has_nl[num_rules] = true; - if (sf_case_ins() && has_case((yyvsp[0]))) + if (sf_case_ins() && has_case((yyvsp[(1) - (1)]))) /* create an alternation, as in (a|A) */ - (yyval) = mkor (mkstate((yyvsp[0])), mkstate(reverse_case((yyvsp[0])))); + (yyval) = mkor (mkstate((yyvsp[(1) - (1)])), mkstate(reverse_case((yyvsp[(1) - (1)])))); else - (yyval) = mkstate( (yyvsp[0]) ); + (yyval) = mkstate( (yyvsp[(1) - (1)]) ); } break; case 63: -#line 775 "parse.y" - { (yyval) = ccl_set_diff ((yyvsp[-2]), (yyvsp[0])); } + +/* Line 1455 of yacc.c */ +#line 773 "parse.y" + { (yyval) = ccl_set_diff ((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); } break; case 64: -#line 776 "parse.y" - { (yyval) = ccl_set_union ((yyvsp[-2]), (yyvsp[0])); } + +/* Line 1455 of yacc.c */ +#line 774 "parse.y" + { (yyval) = ccl_set_union ((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); } break; case 66: -#line 782 "parse.y" - { (yyval) = (yyvsp[-1]); } + +/* Line 1455 of yacc.c */ +#line 780 "parse.y" + { (yyval) = (yyvsp[(2) - (3)]); } break; case 67: -#line 785 "parse.y" + +/* Line 1455 of yacc.c */ +#line 783 "parse.y" { - cclnegate( (yyvsp[-1]) ); - (yyval) = (yyvsp[-1]); + cclnegate( (yyvsp[(3) - (4)]) ); + (yyval) = (yyvsp[(3) - (4)]); } break; case 68: -#line 792 "parse.y" + +/* Line 1455 of yacc.c */ +#line 790 "parse.y" { if (sf_case_ins()) @@ -2166,87 +2504,93 @@ yyreduce: * sure what range the user is trying to express. * Examples: [@-z] or [S-t] */ - if (has_case ((yyvsp[-2])) != has_case ((yyvsp[0])) - || (has_case ((yyvsp[-2])) && (b_islower ((yyvsp[-2])) != b_islower ((yyvsp[0])))) - || (has_case ((yyvsp[-2])) && (b_isupper ((yyvsp[-2])) != b_isupper ((yyvsp[0]))))) + if (has_case ((yyvsp[(2) - (4)])) != has_case ((yyvsp[(4) - (4)])) + || (has_case ((yyvsp[(2) - (4)])) && (b_islower ((yyvsp[(2) - (4)])) != b_islower ((yyvsp[(4) - (4)])))) + || (has_case ((yyvsp[(2) - (4)])) && (b_isupper ((yyvsp[(2) - (4)])) != b_isupper ((yyvsp[(4) - (4)]))))) format_warn3 ( _("the character range [%c-%c] is ambiguous in a case-insensitive scanner"), - (yyvsp[-2]), (yyvsp[0])); + (yyvsp[(2) - (4)]), (yyvsp[(4) - (4)])); /* If the range spans uppercase characters but not * lowercase (or vice-versa), then should we automatically * include lowercase characters in the range? * Example: [@-_] spans [a-z] but not [A-Z] */ - else if (!has_case ((yyvsp[-2])) && !has_case ((yyvsp[0])) && !range_covers_case ((yyvsp[-2]), (yyvsp[0]))) + else if (!has_case ((yyvsp[(2) - (4)])) && !has_case ((yyvsp[(4) - (4)])) && !range_covers_case ((yyvsp[(2) - (4)]), (yyvsp[(4) - (4)]))) format_warn3 ( _("the character range [%c-%c] is ambiguous in a case-insensitive scanner"), - (yyvsp[-2]), (yyvsp[0])); + (yyvsp[(2) - (4)]), (yyvsp[(4) - (4)])); } - if ( (yyvsp[-2]) > (yyvsp[0]) ) + if ( (yyvsp[(2) - (4)]) > (yyvsp[(4) - (4)]) ) synerr( _("negative range in character class") ); else { - for ( i = (yyvsp[-2]); i <= (yyvsp[0]); ++i ) - ccladd( (yyvsp[-3]), i ); + for ( i = (yyvsp[(2) - (4)]); i <= (yyvsp[(4) - (4)]); ++i ) + ccladd( (yyvsp[(1) - (4)]), i ); /* Keep track if this ccl is staying in * alphabetical order. */ - cclsorted = cclsorted && ((yyvsp[-2]) > lastchar); - lastchar = (yyvsp[0]); + cclsorted = cclsorted && ((yyvsp[(2) - (4)]) > lastchar); + lastchar = (yyvsp[(4) - (4)]); /* Do it again for upper/lowercase */ - if (sf_case_ins() && has_case((yyvsp[-2])) && has_case((yyvsp[0]))){ - (yyvsp[-2]) = reverse_case ((yyvsp[-2])); - (yyvsp[0]) = reverse_case ((yyvsp[0])); + if (sf_case_ins() && has_case((yyvsp[(2) - (4)])) && has_case((yyvsp[(4) - (4)]))){ + (yyvsp[(2) - (4)]) = reverse_case ((yyvsp[(2) - (4)])); + (yyvsp[(4) - (4)]) = reverse_case ((yyvsp[(4) - (4)])); - for ( i = (yyvsp[-2]); i <= (yyvsp[0]); ++i ) - ccladd( (yyvsp[-3]), i ); + for ( i = (yyvsp[(2) - (4)]); i <= (yyvsp[(4) - (4)]); ++i ) + ccladd( (yyvsp[(1) - (4)]), i ); - cclsorted = cclsorted && ((yyvsp[-2]) > lastchar); - lastchar = (yyvsp[0]); + cclsorted = cclsorted && ((yyvsp[(2) - (4)]) > lastchar); + lastchar = (yyvsp[(4) - (4)]); } } - (yyval) = (yyvsp[-3]); + (yyval) = (yyvsp[(1) - (4)]); } break; case 69: -#line 852 "parse.y" + +/* Line 1455 of yacc.c */ +#line 850 "parse.y" { - ccladd( (yyvsp[-1]), (yyvsp[0]) ); - cclsorted = cclsorted && ((yyvsp[0]) > lastchar); - lastchar = (yyvsp[0]); + ccladd( (yyvsp[(1) - (2)]), (yyvsp[(2) - (2)]) ); + cclsorted = cclsorted && ((yyvsp[(2) - (2)]) > lastchar); + lastchar = (yyvsp[(2) - (2)]); /* Do it again for upper/lowercase */ - if (sf_case_ins() && has_case((yyvsp[0]))){ - (yyvsp[0]) = reverse_case ((yyvsp[0])); - ccladd ((yyvsp[-1]), (yyvsp[0])); + if (sf_case_ins() && has_case((yyvsp[(2) - (2)]))){ + (yyvsp[(2) - (2)]) = reverse_case ((yyvsp[(2) - (2)])); + ccladd ((yyvsp[(1) - (2)]), (yyvsp[(2) - (2)])); - cclsorted = cclsorted && ((yyvsp[0]) > lastchar); - lastchar = (yyvsp[0]); + cclsorted = cclsorted && ((yyvsp[(2) - (2)]) > lastchar); + lastchar = (yyvsp[(2) - (2)]); } - (yyval) = (yyvsp[-1]); + (yyval) = (yyvsp[(1) - (2)]); } break; case 70: -#line 870 "parse.y" + +/* Line 1455 of yacc.c */ +#line 868 "parse.y" { /* Too hard to properly maintain cclsorted. */ cclsorted = false; - (yyval) = (yyvsp[-1]); + (yyval) = (yyvsp[(1) - (2)]); } break; case 71: -#line 877 "parse.y" + +/* Line 1455 of yacc.c */ +#line 875 "parse.y" { cclsorted = true; lastchar = 0; @@ -2255,37 +2599,51 @@ yyreduce: break; case 72: -#line 885 "parse.y" + +/* Line 1455 of yacc.c */ +#line 883 "parse.y" { CCL_EXPR(isalnum); } break; case 73: -#line 886 "parse.y" + +/* Line 1455 of yacc.c */ +#line 884 "parse.y" { CCL_EXPR(isalpha); } break; case 74: -#line 887 "parse.y" + +/* Line 1455 of yacc.c */ +#line 885 "parse.y" { CCL_EXPR(IS_BLANK); } break; case 75: -#line 888 "parse.y" + +/* Line 1455 of yacc.c */ +#line 886 "parse.y" { CCL_EXPR(iscntrl); } break; case 76: -#line 889 "parse.y" + +/* Line 1455 of yacc.c */ +#line 887 "parse.y" { CCL_EXPR(isdigit); } break; case 77: -#line 890 "parse.y" + +/* Line 1455 of yacc.c */ +#line 888 "parse.y" { CCL_EXPR(isgraph); } break; case 78: -#line 891 "parse.y" + +/* Line 1455 of yacc.c */ +#line 889 "parse.y" { CCL_EXPR(islower); if (sf_case_ins()) @@ -2294,27 +2652,37 @@ yyreduce: break; case 79: -#line 896 "parse.y" + +/* Line 1455 of yacc.c */ +#line 894 "parse.y" { CCL_EXPR(isprint); } break; case 80: -#line 897 "parse.y" + +/* Line 1455 of yacc.c */ +#line 895 "parse.y" { CCL_EXPR(ispunct); } break; case 81: -#line 898 "parse.y" + +/* Line 1455 of yacc.c */ +#line 896 "parse.y" { CCL_EXPR(isspace); } break; case 82: -#line 899 "parse.y" + +/* Line 1455 of yacc.c */ +#line 897 "parse.y" { CCL_EXPR(isxdigit); } break; case 83: -#line 900 "parse.y" + +/* Line 1455 of yacc.c */ +#line 898 "parse.y" { CCL_EXPR(isupper); if (sf_case_ins()) @@ -2323,57 +2691,79 @@ yyreduce: break; case 84: -#line 906 "parse.y" + +/* Line 1455 of yacc.c */ +#line 904 "parse.y" { CCL_NEG_EXPR(isalnum); } break; case 85: -#line 907 "parse.y" + +/* Line 1455 of yacc.c */ +#line 905 "parse.y" { CCL_NEG_EXPR(isalpha); } break; case 86: -#line 908 "parse.y" + +/* Line 1455 of yacc.c */ +#line 906 "parse.y" { CCL_NEG_EXPR(IS_BLANK); } break; case 87: -#line 909 "parse.y" + +/* Line 1455 of yacc.c */ +#line 907 "parse.y" { CCL_NEG_EXPR(iscntrl); } break; case 88: -#line 910 "parse.y" + +/* Line 1455 of yacc.c */ +#line 908 "parse.y" { CCL_NEG_EXPR(isdigit); } break; case 89: -#line 911 "parse.y" + +/* Line 1455 of yacc.c */ +#line 909 "parse.y" { CCL_NEG_EXPR(isgraph); } break; case 90: -#line 912 "parse.y" + +/* Line 1455 of yacc.c */ +#line 910 "parse.y" { CCL_NEG_EXPR(isprint); } break; case 91: -#line 913 "parse.y" + +/* Line 1455 of yacc.c */ +#line 911 "parse.y" { CCL_NEG_EXPR(ispunct); } break; case 92: -#line 914 "parse.y" + +/* Line 1455 of yacc.c */ +#line 912 "parse.y" { CCL_NEG_EXPR(isspace); } break; case 93: -#line 915 "parse.y" + +/* Line 1455 of yacc.c */ +#line 913 "parse.y" { CCL_NEG_EXPR(isxdigit); } break; case 94: -#line 916 "parse.y" + +/* Line 1455 of yacc.c */ +#line 914 "parse.y" { if ( sf_case_ins() ) warn(_("[:^lower:] is ambiguous in case insensitive scanner")); @@ -2383,7 +2773,9 @@ yyreduce: break; case 95: -#line 922 "parse.y" + +/* Line 1455 of yacc.c */ +#line 920 "parse.y" { if ( sf_case_ins() ) warn(_("[:^upper:] ambiguous in case insensitive scanner")); @@ -2393,43 +2785,45 @@ yyreduce: break; case 96: -#line 931 "parse.y" + +/* Line 1455 of yacc.c */ +#line 929 "parse.y" { - if ( (yyvsp[0]) == nlch ) + if ( (yyvsp[(2) - (2)]) == nlch ) rule_has_nl[num_rules] = true; ++rulelen; - if (sf_case_ins() && has_case((yyvsp[0]))) - (yyval) = mkor (mkstate((yyvsp[0])), mkstate(reverse_case((yyvsp[0])))); + if (sf_case_ins() && has_case((yyvsp[(2) - (2)]))) + (yyval) = mkor (mkstate((yyvsp[(2) - (2)])), mkstate(reverse_case((yyvsp[(2) - (2)])))); else - (yyval) = mkstate ((yyvsp[0])); + (yyval) = mkstate ((yyvsp[(2) - (2)])); - (yyval) = link_machines( (yyvsp[-1]), (yyval)); + (yyval) = link_machines( (yyvsp[(1) - (2)]), (yyval)); } break; case 97: -#line 946 "parse.y" + +/* Line 1455 of yacc.c */ +#line 944 "parse.y" { (yyval) = mkstate( SYM_EPSILON ); } break; + +/* Line 1455 of yacc.c */ +#line 2817 "parse.c" default: break; } + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); -/* Line 1126 of yacc.c. */ -#line 2423 "parse.c" - - yyvsp -= yylen; - yyssp -= yylen; - - + YYPOPSTACK (yylen); + yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; - /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ @@ -2453,133 +2847,65 @@ yyerrlab: if (!yyerrstatus) { ++yynerrs; -#if YYERROR_VERBOSE - yyn = yypact[yystate]; - - if (YYPACT_NINF < yyn && yyn < YYLAST) - { - int yytype = YYTRANSLATE (yychar); - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - int yysize_overflow = 0; - char *yymsg = 0; -# define YYERROR_VERBOSE_ARGS_MAXIMUM 5 - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - int yyx; - -#if 0 - /* This is so xgettext sees the translatable formats that are - constructed on the fly. */ - YY_("syntax error, unexpected %s"); - YY_("syntax error, unexpected %s, expecting %s"); - YY_("syntax error, unexpected %s, expecting %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); -#endif - char *yyfmt; - char const *yyf; - static char const yyunexpected[] = "syntax error, unexpected %s"; - static char const yyexpecting[] = ", expecting %s"; - static char const yyor[] = " or %s"; - char yyformat[sizeof yyunexpected - + sizeof yyexpecting - 1 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) - * (sizeof yyor - 1))]; - char const *yyprefix = yyexpecting; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 1; - - yyarg[0] = yytname[yytype]; - yyfmt = yystpcpy (yyformat, yyunexpected); - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) +#if ! YYERROR_VERBOSE + yyerror (YY_("syntax error")); +#else + { + YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); + if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + { + YYSIZE_T yyalloc = 2 * yysize; + if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) + yyalloc = YYSTACK_ALLOC_MAXIMUM; + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (yymsg) + yymsg_alloc = yyalloc; + else { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - yysize_overflow |= yysize1 < yysize; - yysize = yysize1; - yyfmt = yystpcpy (yyfmt, yyprefix); - yyprefix = yyor; + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; } + } - yyf = YY_(yyformat); - yysize1 = yysize + yystrlen (yyf); - yysize_overflow |= yysize1 < yysize; - yysize = yysize1; - - if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM) - yymsg = (char *) YYSTACK_ALLOC (yysize); - if (yymsg) - { - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - char *yyp = yymsg; - int yyi = 0; - while ((*yyp = *yyf)) - { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyf += 2; - } - else - { - yyp++; - yyf++; - } - } - yyerror (yymsg); - YYSTACK_FREE (yymsg); - } - else - { - yyerror (YY_("syntax error")); + if (0 < yysize && yysize <= yymsg_alloc) + { + (void) yysyntax_error (yymsg, yystate, yychar); + yyerror (yymsg); + } + else + { + yyerror (YY_("syntax error")); + if (yysize != 0) goto yyexhaustedlab; - } - } - else -#endif /* YYERROR_VERBOSE */ - yyerror (YY_("syntax error")); + } + } +#endif } if (yyerrstatus == 3) { - /* If just tried and failed to reuse look-ahead token after an + /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) - { + { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; - } + } else { - yydestruct ("Error: discarding", yytoken, &yylval); + yydestruct ("Error: discarding", + yytoken, &yylval); yychar = YYEMPTY; } } - /* Else will try to reuse look-ahead token after shifting the error + /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; @@ -2592,11 +2918,14 @@ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ - if (0) + if (/*CONSTCOND*/ 0) goto yyerrorlab; -yyvsp -= yylen; - yyssp -= yylen; + /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; @@ -2626,19 +2955,17 @@ yyerrlab1: YYABORT; - yydestruct ("Error: popping", yystos[yystate], yyvsp); - YYPOPSTACK; + yydestruct ("Error: popping", + yystos[yystate], yyvsp); + YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } - if (yyn == YYFINAL) - YYACCEPT; - *++yyvsp = yylval; - /* Shift the error token. */ + /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; @@ -2659,7 +2986,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#ifndef yyoverflow +#if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -2670,24 +2997,35 @@ yyexhaustedlab: #endif yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) + if (yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); + /* Do not reclaim the symbols of the rule which action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp); - YYPOPSTACK; + YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif - return yyresult; +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + /* Make sure YYID is used. */ + return YYID (yyresult); } -#line 949 "parse.y" + +/* Line 1675 of yacc.c */ +#line 947 "parse.y" @@ -2710,6 +3048,10 @@ void build_eof_action() else { sceof[scon_stk[i]] = true; + + if (previous_continued_action /* && previous action was regular */) + add_action("YY_RULE_SETUP\n"); + snprintf( action_text, sizeof(action_text), "case YY_STATE_EOF(%s):\n", scname[scon_stk[i]] ); add_action( action_text ); |