diff options
Diffstat (limited to 'phpdbg_parser.c')
-rw-r--r-- | phpdbg_parser.c | 671 |
1 files changed, 354 insertions, 317 deletions
diff --git a/phpdbg_parser.c b/phpdbg_parser.c index 79af58f8c9..83c84c51d9 100644 --- a/phpdbg_parser.c +++ b/phpdbg_parser.c @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 2.7. */ +/* A Bison parser, made by GNU Bison 2.5. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2011 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 @@ -44,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.7" +#define YYBISON_VERSION "2.5" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -58,12 +58,23 @@ /* Pull parsers. */ #define YYPULL 1 +/* Using locations. */ +#define YYLSP_NEEDED 0 +/* Substitute the variable and function names. */ +#define yyparse phpdbg_parse +#define yylex phpdbg_lex +#define yyerror phpdbg_error +#define yylval phpdbg_lval +#define yychar phpdbg_char +#define yydebug phpdbg_debug +#define yynerrs phpdbg_nerrs /* Copy the first part of user declarations. */ -/* Line 371 of yacc.c */ -#line 2 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y" + +/* Line 268 of yacc.c */ +#line 1 "/home/pi/php-src/sapi/phpdbg/phpdbg_parser.y" /* @@ -84,33 +95,20 @@ #include "phpdbg_parser.h" #include "phpdbg_lexer.h" +#undef yyerror +static int yyerror(const char *msg); + ZEND_EXTERN_MODULE_GLOBALS(phpdbg); -int yyerror(phpdbg_param_t *stack, yyscan_t scanner, const char *msg) { - TSRMLS_FETCH(); - phpdbg_error("Parse Error: %s", msg); - { - const phpdbg_param_t *top = stack; - - while (top) { - phpdbg_param_debug( - top, "--> "); - top = top->next; - } - } - return 0; -} -/* Line 371 of yacc.c */ -#line 106 "sapi/phpdbg/phpdbg_parser.c" -# ifndef YY_NULL -# if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULL nullptr -# else -# define YY_NULL 0 -# endif -# endif +/* Line 268 of yacc.c */ +#line 107 "sapi/phpdbg/phpdbg_parser.c" + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE @@ -120,20 +118,15 @@ int yyerror(phpdbg_param_t *stack, yyscan_t scanner, const char *msg) { # define YYERROR_VERBOSE 1 #endif -/* In a future release of Bison, this section will be replaced - by #include "phpdbg_parser.h". */ -#ifndef YY_YY_SAPI_PHPDBG_PHPDBG_PARSER_H_INCLUDED -# define YY_YY_SAPI_PHPDBG_PHPDBG_PARSER_H_INCLUDED -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif -#if YYDEBUG -extern int yydebug; +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 #endif + /* "%code requires" blocks. */ -/* Line 387 of yacc.c */ -#line 40 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y" + +/* Line 288 of yacc.c */ +#line 31 "/home/pi/php-src/sapi/phpdbg/phpdbg_parser.y" #include "phpdbg.h" #ifndef YY_TYPEDEF_YY_SCANNER_T @@ -142,8 +135,9 @@ typedef void* yyscan_t; #endif -/* Line 387 of yacc.c */ -#line 147 "sapi/phpdbg/phpdbg_parser.c" + +/* Line 288 of yacc.c */ +#line 141 "sapi/phpdbg/phpdbg_parser.c" /* Tokens. */ #ifndef YYTOKENTYPE @@ -193,6 +187,7 @@ typedef void* yyscan_t; + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 @@ -201,26 +196,11 @@ typedef int YYSTYPE; #endif -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int yyparse (void *YYPARSE_PARAM); -#else -int yyparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -int yyparse (phpdbg_param_t *stack, yyscan_t scanner); -#else -int yyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ - -#endif /* !YY_YY_SAPI_PHPDBG_PHPDBG_PARSER_H_INCLUDED */ - /* Copy the second part of user declarations. */ -/* Line 390 of yacc.c */ -#line 224 "sapi/phpdbg/phpdbg_parser.c" + +/* Line 343 of yacc.c */ +#line 204 "sapi/phpdbg/phpdbg_parser.c" #ifdef short # undef short @@ -273,24 +253,24 @@ typedef short int yytype_int16; # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ -# define YY_(Msgid) dgettext ("bison-runtime", Msgid) +# define YY_(msgid) dgettext ("bison-runtime", msgid) # endif # endif # ifndef YY_ -# define YY_(Msgid) Msgid +# define YY_(msgid) msgid # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ -# define YYUSE(E) ((void) (E)) +# define YYUSE(e) ((void) (e)) #else -# define YYUSE(E) /* empty */ +# define YYUSE(e) /* empty */ #endif /* Identity function, used to suppress warnings about constant conditions. */ #ifndef lint -# define YYID(N) (N) +# define YYID(n) (n) #else #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) @@ -326,7 +306,6 @@ YYID (yyi) # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ - /* Use EXIT_SUCCESS as a witness for stdlib.h. */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif @@ -418,38 +397,38 @@ union yyalloc #endif #if defined YYCOPY_NEEDED && YYCOPY_NEEDED -/* Copy COUNT objects from SRC to DST. The source and destination do +/* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(Dst, Src, Count) \ - __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else -# define YYCOPY(Dst, Src, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (Dst)[yyi] = (Src)[yyi]; \ - } \ +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ while (YYID (0)) # endif # endif #endif /* !YYCOPY_NEEDED */ /* YYFINAL -- State number of the termination state. */ -#define YYFINAL 24 +#define YYFINAL 25 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 33 +#define YYLAST 41 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 21 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 4 +#define YYNNTS 5 /* YYNRULES -- Number of rules. */ -#define YYNRULES 24 +#define YYNRULES 25 /* YYNRULES -- Number of states. */ -#define YYNSTATES 37 +#define YYNSTATES 38 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 @@ -496,34 +475,34 @@ static const yytype_uint8 yytranslate[] = YYRHS. */ static const yytype_uint8 yyprhs[] = { - 0, 0, 3, 5, 6, 8, 11, 15, 20, 25, - 31, 35, 41, 45, 48, 51, 54, 56, 59, 61, - 63, 65, 67, 69, 71 + 0, 0, 3, 5, 7, 8, 10, 13, 17, 22, + 27, 33, 37, 43, 47, 49, 51, 53, 55, 57, + 59, 61, 64, 67, 70, 72 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int8 yyrhs[] = { - 22, 0, -1, 23, -1, -1, 24, -1, 23, 24, - -1, 18, 10, 14, -1, 18, 10, 12, 14, -1, - 13, 18, 10, 14, -1, 13, 18, 10, 12, 14, - -1, 18, 11, 18, -1, 18, 11, 18, 12, 14, - -1, 18, 12, 14, -1, 6, 19, -1, 3, 19, - -1, 5, 19, -1, 4, -1, 4, 19, -1, 17, - -1, 16, -1, 15, -1, 7, -1, 8, -1, 14, - -1, 18, -1 + 22, 0, -1, 23, -1, 25, -1, -1, 24, -1, + 23, 24, -1, 18, 10, 14, -1, 18, 10, 12, + 14, -1, 13, 18, 10, 14, -1, 13, 18, 10, + 12, 14, -1, 18, 11, 18, -1, 18, 11, 18, + 12, 14, -1, 18, 12, 14, -1, 17, -1, 16, + -1, 15, -1, 7, -1, 8, -1, 14, -1, 18, + -1, 6, 19, -1, 3, 19, -1, 5, 19, -1, + 4, -1, 4, 19, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 76, 76, 77, 81, 82, 86, 91, 96, 107, - 118, 123, 129, 135, 140, 145, 150, 154, 159, 160, - 161, 162, 163, 164, 165 + 0, 64, 64, 65, 66, 70, 71, 75, 80, 85, + 95, 105, 110, 116, 122, 123, 124, 125, 126, 127, + 128, 132, 137, 142, 147, 151 }; #endif -#if YYDEBUG || YYERROR_VERBOSE || 1 +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = @@ -536,7 +515,7 @@ static const char *const yytname[] = "\"digits (numbers)\"", "\"literal (string)\"", "\"address\"", "\"opcode\"", "\"identifier (command or function name)\"", "\"input (input string or data)\"", "\"input\"", "$accept", "input", - "parameters", "parameter", YY_NULL + "parameters", "parameter", "full_expression", 0 }; #endif @@ -554,17 +533,17 @@ static const yytype_uint16 yytoknum[] = /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 21, 22, 22, 23, 23, 24, 24, 24, 24, + 0, 21, 22, 22, 22, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24 + 24, 25, 25, 25, 25, 25 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { - 0, 2, 1, 0, 1, 2, 3, 4, 4, 5, - 3, 5, 3, 2, 2, 2, 1, 2, 1, 1, - 1, 1, 1, 1, 1 + 0, 2, 1, 1, 0, 1, 2, 3, 4, 4, + 5, 3, 5, 3, 1, 1, 1, 1, 1, 1, + 1, 2, 2, 2, 1, 2 }; /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. @@ -572,16 +551,16 @@ static const yytype_uint8 yyr2[] = means the default is an error. */ static const yytype_uint8 yydefact[] = { - 3, 0, 16, 0, 0, 21, 22, 0, 23, 20, - 19, 18, 24, 0, 2, 4, 14, 17, 15, 13, - 0, 0, 0, 0, 1, 5, 0, 0, 6, 10, - 12, 0, 8, 7, 0, 9, 11 + 4, 0, 24, 0, 0, 17, 18, 0, 19, 16, + 15, 14, 20, 0, 2, 5, 3, 22, 25, 23, + 21, 0, 0, 0, 0, 1, 6, 0, 0, 7, + 11, 13, 0, 9, 8, 0, 10, 12 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { - -1, 13, 14, 15 + -1, 13, 14, 15, 16 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing @@ -589,16 +568,16 @@ static const yytype_int8 yydefgoto[] = #define YYPACT_NINF -11 static const yytype_int8 yypact[] = { - -3, -10, 1, 2, 3, -11, -11, 6, -11, -11, - -11, -11, -4, 23, -3, -11, -11, -11, -11, -11, - 15, 4, 8, 13, -11, -11, 5, 14, -11, 17, - -11, 16, -11, -11, 18, -11, -11 + -3, -10, 10, 11, 12, -11, -11, 14, -11, -11, + -11, -11, -4, 28, 9, -11, -11, -11, -11, -11, + -11, 23, 6, 16, 21, -11, -11, 7, 22, -11, + 25, -11, 24, -11, -11, 26, -11, -11 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { - -11, -11, -11, 19 + -11, -11, -11, 27, -11 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -607,24 +586,26 @@ static const yytype_int8 yypgoto[] = #define YYTABLE_NINF -1 static const yytype_uint8 yytable[] = { - 1, 2, 3, 4, 5, 6, 21, 22, 23, 16, - 7, 8, 9, 10, 11, 12, 27, 31, 28, 32, - 17, 18, 19, 24, 20, 26, 29, 30, 33, 34, - 35, 0, 36, 25 + 1, 2, 3, 4, 5, 6, 22, 23, 24, 17, + 7, 8, 9, 10, 11, 12, 5, 6, 28, 32, + 29, 33, 7, 8, 9, 10, 11, 12, 25, 18, + 19, 20, 21, 27, 30, 31, 34, 35, 36, 0, + 37, 26 }; -#define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-11))) +#define yypact_value_is_default(yystate) \ + ((yystate) == (-11)) -#define yytable_value_is_error(Yytable_value) \ +#define yytable_value_is_error(yytable_value) \ YYID (0) static const yytype_int8 yycheck[] = { 3, 4, 5, 6, 7, 8, 10, 11, 12, 19, - 13, 14, 15, 16, 17, 18, 12, 12, 14, 14, - 19, 19, 19, 0, 18, 10, 18, 14, 14, 12, - 14, -1, 14, 14 + 13, 14, 15, 16, 17, 18, 7, 8, 12, 12, + 14, 14, 13, 14, 15, 16, 17, 18, 0, 19, + 19, 19, 18, 10, 18, 14, 14, 12, 14, -1, + 14, 14 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -632,9 +613,9 @@ static const yytype_int8 yycheck[] = static const yytype_uint8 yystos[] = { 0, 3, 4, 5, 6, 7, 8, 13, 14, 15, - 16, 17, 18, 22, 23, 24, 19, 19, 19, 19, - 18, 10, 11, 12, 0, 24, 10, 12, 14, 18, - 14, 12, 14, 14, 12, 14, 14 + 16, 17, 18, 22, 23, 24, 25, 19, 19, 19, + 19, 18, 10, 11, 12, 0, 24, 10, 12, 14, + 18, 14, 12, 14, 14, 12, 14, 14 }; #define yyerrok (yyerrstatus = 0) @@ -664,39 +645,66 @@ static const yytype_uint8 yystos[] = #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (stack, scanner, YY_("syntax error: cannot back up")); \ +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (1); \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (YYID (0)) -/* Error token number */ + #define YYTERROR 1 #define YYERRCODE 256 +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (YYID (N)) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (YYID (0)) +#endif + + /* This macro is provided for backward compatibility. */ + #ifndef YY_LOCATION_PRINT # define YY_LOCATION_PRINT(File, Loc) ((void) 0) #endif /* YYLEX -- calling `yylex' with the right arguments. */ + #ifdef YYLEX_PARAM # define YYLEX yylex (&yylval, YYLEX_PARAM) #else -# define YYLEX yylex (&yylval, scanner) +# define YYLEX yylex (&yylval) #endif /* Enable debugging if requested. */ @@ -719,7 +727,7 @@ do { \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ - Type, Value, stack, scanner); \ + Type, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (YYID (0)) @@ -733,23 +741,17 @@ do { \ #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, phpdbg_param_t *stack, yyscan_t scanner) +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) #else static void -yy_symbol_value_print (yyoutput, yytype, yyvaluep, stack, scanner) +yy_symbol_value_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; - phpdbg_param_t *stack; - yyscan_t scanner; #endif { - FILE *yyo = yyoutput; - YYUSE (yyo); if (!yyvaluep) return; - YYUSE (stack); - YYUSE (scanner); # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); @@ -759,7 +761,7 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, stack, scanner) switch (yytype) { default: - break; + break; } } @@ -771,15 +773,13 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, stack, scanner) #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, phpdbg_param_t *stack, yyscan_t scanner) +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) #else static void -yy_symbol_print (yyoutput, yytype, yyvaluep, stack, scanner) +yy_symbol_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; - phpdbg_param_t *stack; - yyscan_t scanner; #endif { if (yytype < YYNTOKENS) @@ -787,7 +787,7 @@ yy_symbol_print (yyoutput, yytype, yyvaluep, stack, scanner) else YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); - yy_symbol_value_print (yyoutput, yytype, yyvaluep, stack, scanner); + yy_symbol_value_print (yyoutput, yytype, yyvaluep); YYFPRINTF (yyoutput, ")"); } @@ -830,14 +830,12 @@ do { \ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_reduce_print (YYSTYPE *yyvsp, int yyrule, phpdbg_param_t *stack, yyscan_t scanner) +yy_reduce_print (YYSTYPE *yyvsp, int yyrule) #else static void -yy_reduce_print (yyvsp, yyrule, stack, scanner) +yy_reduce_print (yyvsp, yyrule) YYSTYPE *yyvsp; int yyrule; - phpdbg_param_t *stack; - yyscan_t scanner; #endif { int yynrhs = yyr2[yyrule]; @@ -851,7 +849,7 @@ yy_reduce_print (yyvsp, yyrule, stack, scanner) YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) - , stack, scanner); + ); YYFPRINTF (stderr, "\n"); } } @@ -859,7 +857,7 @@ yy_reduce_print (yyvsp, yyrule, stack, scanner) # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ - yy_reduce_print (yyvsp, Rule, stack, scanner); \ + yy_reduce_print (yyvsp, Rule); \ } while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that @@ -1003,11 +1001,12 @@ static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { - YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ - const char *yyformat = YY_NULL; + const char *yyformat = 0; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per @@ -1067,13 +1066,11 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, break; } yyarg[yycount++] = yytname[yyx]; - { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; } } } @@ -1093,12 +1090,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, # undef YYCASE_ } - { - YYSIZE_T yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } + yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; if (*yymsg_alloc < yysize) { @@ -1139,20 +1134,16 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, phpdbg_param_t *stack, yyscan_t scanner) +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) #else static void -yydestruct (yymsg, yytype, yyvaluep, stack, scanner) +yydestruct (yymsg, yytype, yyvaluep) const char *yymsg; int yytype; YYSTYPE *yyvaluep; - phpdbg_param_t *stack; - yyscan_t scanner; #endif { YYUSE (yyvaluep); - YYUSE (stack); - YYUSE (scanner); if (!yymsg) yymsg = "Deleting"; @@ -1162,11 +1153,25 @@ yydestruct (yymsg, yytype, yyvaluep, stack, scanner) { default: - break; + break; } } +/* Prevent warnings from -Wmissing-prototypes. */ +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +int yyparse (void *YYPARSE_PARAM); +#else +int yyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int yyparse (void); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ /*----------. @@ -1187,43 +1192,19 @@ yyparse (YYPARSE_PARAM) #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int -yyparse (phpdbg_param_t *stack, yyscan_t scanner) +yyparse (void) #else int -yyparse (stack, scanner) - phpdbg_param_t *stack; - yyscan_t scanner; +yyparse () + #endif #endif { /* The lookahead symbol. */ int yychar; - -#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ -/* Suppress an incorrect diagnostic about yylval being uninitialized. */ -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ - _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") -# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ - _Pragma ("GCC diagnostic pop") -#else -/* Default value used for initialization, for pacifying older GCCs - or non-GCC compilers. */ -static YYSTYPE yyval_default; -# define YY_INITIAL_VALUE(Value) = Value -#endif -#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_END -#endif -#ifndef YY_INITIAL_VALUE -# define YY_INITIAL_VALUE(Value) /* Nothing. */ -#endif - /* The semantic value of the lookahead symbol. */ -YYSTYPE yylval YY_INITIAL_VALUE(yyval_default); +YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; @@ -1236,7 +1217,7 @@ YYSTYPE yylval YY_INITIAL_VALUE(yyval_default); `yyss': related to states. `yyvs': related to semantic values. - Refer to the stacks through separate pointers, to allow yyoverflow + Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ @@ -1254,7 +1235,7 @@ YYSTYPE yylval YY_INITIAL_VALUE(yyval_default); int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ - int yytoken = 0; + int yytoken; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; @@ -1272,8 +1253,9 @@ YYSTYPE yylval YY_INITIAL_VALUE(yyval_default); Keep to zero when no symbol should be popped. */ int yylen = 0; - yyssp = yyss = yyssa; - yyvsp = yyvs = yyvsa; + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); @@ -1282,6 +1264,14 @@ YYSTYPE yylval YY_INITIAL_VALUE(yyval_default); yyerrstatus = 0; yynerrs = 0; 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; + goto yysetstate; /*------------------------------------------------------------. @@ -1422,9 +1412,7 @@ yybackup: yychar = YYEMPTY; yystate = yyn; - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END goto yynewstate; @@ -1460,21 +1448,31 @@ yyreduce: YY_REDUCE_PRINT (yyn); switch (yyn) { - case 4: -/* Line 1792 of yacc.c */ -#line 81 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y" - { phpdbg_stack_push(stack, &(yyvsp[(1) - (1)])); } + case 3: + +/* Line 1806 of yacc.c */ +#line 65 "/home/pi/php-src/sapi/phpdbg/phpdbg_parser.y" + { phpdbg_stack_push(PHPDBG_G(parser_stack), &(yyvsp[(1) - (1)])); } break; case 5: -/* Line 1792 of yacc.c */ -#line 82 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y" - { phpdbg_stack_push(stack, &(yyvsp[(2) - (2)])); } + +/* Line 1806 of yacc.c */ +#line 70 "/home/pi/php-src/sapi/phpdbg/phpdbg_parser.y" + { phpdbg_stack_push(PHPDBG_G(parser_stack), &(yyvsp[(1) - (1)])); } break; case 6: -/* Line 1792 of yacc.c */ -#line 86 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y" + +/* Line 1806 of yacc.c */ +#line 71 "/home/pi/php-src/sapi/phpdbg/phpdbg_parser.y" + { phpdbg_stack_push(PHPDBG_G(parser_stack), &(yyvsp[(2) - (2)])); } + break; + + case 7: + +/* Line 1806 of yacc.c */ +#line 75 "/home/pi/php-src/sapi/phpdbg/phpdbg_parser.y" { (yyval).type = FILE_PARAM; (yyval).file.name = (yyvsp[(2) - (3)]).str; @@ -1482,9 +1480,10 @@ yyreduce: } break; - case 7: -/* Line 1792 of yacc.c */ -#line 91 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y" + case 8: + +/* Line 1806 of yacc.c */ +#line 80 "/home/pi/php-src/sapi/phpdbg/phpdbg_parser.y" { (yyval).type = NUMERIC_FILE_PARAM; (yyval).file.name = (yyvsp[(1) - (4)]).str; @@ -1492,13 +1491,13 @@ yyreduce: } break; - case 8: -/* Line 1792 of yacc.c */ -#line 96 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y" + case 9: + +/* Line 1806 of yacc.c */ +#line 85 "/home/pi/php-src/sapi/phpdbg/phpdbg_parser.y" { (yyval).type = FILE_PARAM; - (yyval).file.name = malloc((yyvsp[(1) - (4)]).len + - (yyvsp[(2) - (4)]).len + 1); + (yyval).file.name = malloc((yyvsp[(1) - (4)]).len + (yyvsp[(2) - (4)]).len + 1); if ((yyval).file.name) { memcpy(&(yyval).file.name[0], (yyvsp[(1) - (4)]).str, (yyvsp[(1) - (4)]).len); memcpy(&(yyval).file.name[(yyvsp[(1) - (4)]).len], (yyvsp[(2) - (4)]).str, (yyvsp[(2) - (4)]).len); @@ -1508,13 +1507,13 @@ yyreduce: } break; - case 9: -/* Line 1792 of yacc.c */ -#line 107 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y" + case 10: + +/* Line 1806 of yacc.c */ +#line 95 "/home/pi/php-src/sapi/phpdbg/phpdbg_parser.y" { (yyval).type = NUMERIC_FILE_PARAM; - (yyval).file.name = malloc((yyvsp[(1) - (5)]).len + - (yyvsp[(2) - (5)]).len + 1); + (yyval).file.name = malloc((yyvsp[(1) - (5)]).len + (yyvsp[(2) - (5)]).len + 1); if ((yyval).file.name) { memcpy(&(yyval).file.name[0], (yyvsp[(1) - (5)]).str, (yyvsp[(1) - (5)]).len); memcpy(&(yyval).file.name[(yyvsp[(1) - (5)]).len], (yyvsp[(2) - (5)]).str, (yyvsp[(2) - (5)]).len); @@ -1524,9 +1523,10 @@ yyreduce: } break; - case 10: -/* Line 1792 of yacc.c */ -#line 118 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y" + case 11: + +/* Line 1806 of yacc.c */ +#line 105 "/home/pi/php-src/sapi/phpdbg/phpdbg_parser.y" { (yyval).type = METHOD_PARAM; (yyval).method.class = (yyvsp[(1) - (3)]).str; @@ -1534,9 +1534,10 @@ yyreduce: } break; - case 11: -/* Line 1792 of yacc.c */ -#line 123 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y" + case 12: + +/* Line 1806 of yacc.c */ +#line 110 "/home/pi/php-src/sapi/phpdbg/phpdbg_parser.y" { (yyval).type = NUMERIC_METHOD_PARAM; (yyval).method.class = (yyvsp[(1) - (5)]).str; @@ -1545,9 +1546,10 @@ yyreduce: } break; - case 12: -/* Line 1792 of yacc.c */ -#line 129 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y" + case 13: + +/* Line 1806 of yacc.c */ +#line 116 "/home/pi/php-src/sapi/phpdbg/phpdbg_parser.y" { (yyval).type = NUMERIC_FUNCTION_PARAM; (yyval).str = (yyvsp[(1) - (3)]).str; @@ -1556,100 +1558,113 @@ yyreduce: } break; - case 13: -/* Line 1792 of yacc.c */ -#line 135 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y" - { - (yyval).type = COND_PARAM; - (yyval).str = (yyvsp[(2) - (2)]).str; - (yyval).len = (yyvsp[(2) - (2)]).len; - } - break; - case 14: -/* Line 1792 of yacc.c */ -#line 140 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y" - { - (yyval).type = EVAL_PARAM; - (yyval).str = (yyvsp[(2) - (2)]).str; - (yyval).len = (yyvsp[(2) - (2)]).len; - } + +/* Line 1806 of yacc.c */ +#line 122 "/home/pi/php-src/sapi/phpdbg/phpdbg_parser.y" + { (yyval) = (yyvsp[(1) - (1)]); } break; case 15: -/* Line 1792 of yacc.c */ -#line 145 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y" - { - (yyval).type = SHELL_PARAM; - (yyval).str = (yyvsp[(2) - (2)]).str; - (yyval).len = (yyvsp[(2) - (2)]).len; - } + +/* Line 1806 of yacc.c */ +#line 123 "/home/pi/php-src/sapi/phpdbg/phpdbg_parser.y" + { (yyval) = (yyvsp[(1) - (1)]); } break; case 16: -/* Line 1792 of yacc.c */ -#line 150 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y" - { - (yyval).type = RUN_PARAM; - (yyval).len = 0; - } + +/* Line 1806 of yacc.c */ +#line 124 "/home/pi/php-src/sapi/phpdbg/phpdbg_parser.y" + { (yyval) = (yyvsp[(1) - (1)]); } break; case 17: -/* Line 1792 of yacc.c */ -#line 154 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y" - { - (yyval).type = RUN_PARAM; - (yyval).str = (yyvsp[(2) - (2)]).str; - (yyval).len = (yyvsp[(2) - (2)]).len; - } + +/* Line 1806 of yacc.c */ +#line 125 "/home/pi/php-src/sapi/phpdbg/phpdbg_parser.y" + { (yyval) = (yyvsp[(1) - (1)]); } break; case 18: -/* Line 1792 of yacc.c */ -#line 159 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y" + +/* Line 1806 of yacc.c */ +#line 126 "/home/pi/php-src/sapi/phpdbg/phpdbg_parser.y" { (yyval) = (yyvsp[(1) - (1)]); } break; case 19: -/* Line 1792 of yacc.c */ -#line 160 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y" + +/* Line 1806 of yacc.c */ +#line 127 "/home/pi/php-src/sapi/phpdbg/phpdbg_parser.y" { (yyval) = (yyvsp[(1) - (1)]); } break; case 20: -/* Line 1792 of yacc.c */ -#line 161 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y" + +/* Line 1806 of yacc.c */ +#line 128 "/home/pi/php-src/sapi/phpdbg/phpdbg_parser.y" { (yyval) = (yyvsp[(1) - (1)]); } break; case 21: -/* Line 1792 of yacc.c */ -#line 162 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y" - { (yyval) = (yyvsp[(1) - (1)]); } + +/* Line 1806 of yacc.c */ +#line 132 "/home/pi/php-src/sapi/phpdbg/phpdbg_parser.y" + { + (yyval).type = COND_PARAM; + (yyval).str = (yyvsp[(2) - (2)]).str; + (yyval).len = (yyvsp[(2) - (2)]).len; + } break; case 22: -/* Line 1792 of yacc.c */ -#line 163 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y" - { (yyval) = (yyvsp[(1) - (1)]); } + +/* Line 1806 of yacc.c */ +#line 137 "/home/pi/php-src/sapi/phpdbg/phpdbg_parser.y" + { + (yyval).type = EVAL_PARAM; + (yyval).str = (yyvsp[(2) - (2)]).str; + (yyval).len = (yyvsp[(2) - (2)]).len; + } break; case 23: -/* Line 1792 of yacc.c */ -#line 164 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y" - { (yyval) = (yyvsp[(1) - (1)]); } + +/* Line 1806 of yacc.c */ +#line 142 "/home/pi/php-src/sapi/phpdbg/phpdbg_parser.y" + { + (yyval).type = SHELL_PARAM; + (yyval).str = (yyvsp[(2) - (2)]).str; + (yyval).len = (yyvsp[(2) - (2)]).len; + } break; case 24: -/* Line 1792 of yacc.c */ -#line 165 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y" - { (yyval) = (yyvsp[(1) - (1)]); } + +/* Line 1806 of yacc.c */ +#line 147 "/home/pi/php-src/sapi/phpdbg/phpdbg_parser.y" + { + (yyval).type = RUN_PARAM; + (yyval).len = 0; + } break; + case 25: -/* Line 1792 of yacc.c */ -#line 1653 "sapi/phpdbg/phpdbg_parser.c" +/* Line 1806 of yacc.c */ +#line 151 "/home/pi/php-src/sapi/phpdbg/phpdbg_parser.y" + { + (yyval).type = RUN_PARAM; + (yyval).str = (yyvsp[(2) - (2)]).str; + (yyval).len = (yyvsp[(2) - (2)]).len; + } + break; + + + +/* Line 1806 of yacc.c */ +#line 1668 "sapi/phpdbg/phpdbg_parser.c" default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1699,7 +1714,7 @@ yyerrlab: { ++yynerrs; #if ! YYERROR_VERBOSE - yyerror (stack, scanner, YY_("syntax error")); + yyerror (YY_("syntax error")); #else # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ yyssp, yytoken) @@ -1726,7 +1741,7 @@ yyerrlab: yymsgp = yymsg; } } - yyerror (stack, scanner, yymsgp); + yyerror (yymsgp); if (yysyntax_error_status == 2) goto yyexhaustedlab; } @@ -1750,7 +1765,7 @@ yyerrlab: else { yydestruct ("Error: discarding", - yytoken, &yylval, stack, scanner); + yytoken, &yylval); yychar = YYEMPTY; } } @@ -1806,15 +1821,13 @@ yyerrlab1: yydestruct ("Error: popping", - yystos[yystate], yyvsp, stack, scanner); + yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END /* Shift the error token. */ @@ -1838,12 +1851,12 @@ yyabortlab: yyresult = 1; goto yyreturn; -#if !defined yyoverflow || YYERROR_VERBOSE +#if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: - yyerror (stack, scanner, YY_("memory exhausted")); + yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif @@ -1855,7 +1868,7 @@ yyreturn: user semantic actions for why this is necessary. */ yytoken = YYTRANSLATE (yychar); yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval, stack, scanner); + yytoken, &yylval); } /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ @@ -1864,7 +1877,7 @@ yyreturn: while (yyssp != yyss) { yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp, stack, scanner); + yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow @@ -1880,6 +1893,30 @@ yyreturn: } -/* Line 2055 of yacc.c */ -#line 168 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y" + +/* Line 2067 of yacc.c */ +#line 158 "/home/pi/php-src/sapi/phpdbg/phpdbg_parser.y" + + +static int yyerror(const char *msg) { + TSRMLS_FETCH(); + + phpdbg_error("Parse Error: %s", msg); + + { + const phpdbg_param_t *top = PHPDBG_G(parser_stack); + + while (top) { + phpdbg_param_debug(top, "--> "); + top = top->next; + } + } + return 0; +} + +int phpdbg_do_parse(phpdbg_param_t *stack, char *input TSRMLS_DC) { + phpdbg_init_lexer(stack, input TSRMLS_CC); + + return yyparse(); +} |