From b654ce0ee86c2737cb882206d923ffdd5bd215c2 Mon Sep 17 00:00:00 2001 From: tilghman Date: Thu, 28 Oct 2010 19:44:37 +0000 Subject: "!00" evaluated as false, which is incorrect. Fixing. Reported (though the reporter did not understand he was reporting a bug) on the asterisk-users list: http://lists.digium.com/pipermail/asterisk-users/2010-October/255505.html git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@293194 f38db490-d61c-443f-a65b-d21fe96a405b --- main/ast_expr2.c | 540 ++++++++++++++++++++++++++++++++++--------------------- main/ast_expr2.h | 67 +++---- main/ast_expr2.y | 4 + 3 files changed, 369 insertions(+), 242 deletions(-) (limited to 'main') diff --git a/main/ast_expr2.c b/main/ast_expr2.c index 7c7897340..280b2c32f 100644 --- a/main/ast_expr2.c +++ b/main/ast_expr2.c @@ -1,24 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton implementation for Bison's Yacc-like parsers in C +/* A Bison parser, made by GNU Bison 2.4.1. */ - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +/* 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 + + 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. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,7 +28,7 @@ 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. */ @@ -47,7 +46,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.3" +#define YYBISON_VERSION "2.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -55,75 +54,28 @@ /* Pure parsers. */ #define YYPURE 1 +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + /* Using locations. */ #define YYLSP_NEEDED 1 /* Substitute the variable and function names. */ -#define yyparse ast_yyparse -#define yylex ast_yylex -#define yyerror ast_yyerror -#define yylval ast_yylval -#define yychar ast_yychar -#define yydebug ast_yydebug -#define yynerrs ast_yynerrs -#define yylloc ast_yylloc - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - TOK_COLONCOLON = 258, - TOK_COND = 259, - TOK_OR = 260, - TOK_AND = 261, - TOK_NE = 262, - TOK_LE = 263, - TOK_GE = 264, - TOK_LT = 265, - TOK_GT = 266, - TOK_EQ = 267, - TOK_MINUS = 268, - TOK_PLUS = 269, - TOK_MOD = 270, - TOK_DIV = 271, - TOK_MULT = 272, - TOK_COMPL = 273, - TOK_EQTILDE = 274, - TOK_COLON = 275, - TOK_LP = 276, - TOK_RP = 277, - TOKEN = 278 - }; -#endif -/* Tokens. */ -#define TOK_COLONCOLON 258 -#define TOK_COND 259 -#define TOK_OR 260 -#define TOK_AND 261 -#define TOK_NE 262 -#define TOK_LE 263 -#define TOK_GE 264 -#define TOK_LT 265 -#define TOK_GT 266 -#define TOK_EQ 267 -#define TOK_MINUS 268 -#define TOK_PLUS 269 -#define TOK_MOD 270 -#define TOK_DIV 271 -#define TOK_MULT 272 -#define TOK_COMPL 273 -#define TOK_EQTILDE 274 -#define TOK_COLON 275 -#define TOK_LP 276 -#define TOK_RP 277 -#define TOKEN 278 - - - +#define yyparse ast_yyparse +#define yylex ast_yylex +#define yyerror ast_yyerror +#define yylval ast_yylval +#define yychar ast_yychar +#define yydebug ast_yydebug +#define yynerrs ast_yynerrs +#define yylloc ast_yylloc /* Copy the first part of user declarations. */ + +/* Line 189 of yacc.c */ #line 1 "ast_expr2.y" /* Written by Pace Willisson (pace@blitz.com) @@ -264,6 +216,9 @@ int ast_yyerror(const char *,YYLTYPE *, struct parse_io *); #define DESTROY(x) {if((x)->type == AST_EXPR_numeric_string || (x)->type == AST_EXPR_string) free((x)->u.s); (x)->u.s = 0; free(x);} +/* Line 189 of yacc.c */ +#line 221 "ast_expr2.c" + /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 @@ -282,18 +237,56 @@ int ast_yyerror(const char *,YYLTYPE *, struct parse_io *); # define YYTOKEN_TABLE 0 #endif + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + TOK_COLONCOLON = 258, + TOK_COND = 259, + TOK_OR = 260, + TOK_AND = 261, + TOK_NE = 262, + TOK_LE = 263, + TOK_GE = 264, + TOK_LT = 265, + TOK_GT = 266, + TOK_EQ = 267, + TOK_MINUS = 268, + TOK_PLUS = 269, + TOK_MOD = 270, + TOK_DIV = 271, + TOK_MULT = 272, + TOK_COMPL = 273, + TOK_EQTILDE = 274, + TOK_COLON = 275, + TOK_LP = 276, + TOK_RP = 277, + TOKEN = 278 + }; +#endif + + + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 147 "ast_expr2.y" { + +/* Line 214 of yacc.c */ +#line 147 "ast_expr2.y" + struct val *val; -} -/* Line 187 of yacc.c. */ -#line 293 "ast_expr2.c" - YYSTYPE; + + + +/* Line 214 of yacc.c */ +#line 286 "ast_expr2.c" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED @@ -311,13 +304,15 @@ typedef struct YYLTYPE /* Copy the second part of user declarations. */ + +/* Line 264 of yacc.c */ #line 151 "ast_expr2.y" extern int ast_yylex __P((YYSTYPE *, YYLTYPE *, yyscan_t)); -/* Line 216 of yacc.c. */ -#line 321 "ast_expr2.c" +/* Line 264 of yacc.c */ +#line 316 "ast_expr2.c" #ifdef short # undef short @@ -392,14 +387,14 @@ typedef short int yytype_int16; #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int -YYID (int i) +YYID (int yyi) #else static int -YYID (i) - int i; +YYID (yyi) + int yyi; #endif { - return i; + return yyi; } #endif @@ -481,9 +476,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss; - YYSTYPE yyvs; - YYLTYPE yyls; + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; + YYLTYPE yyls_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ @@ -518,12 +513,12 @@ 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); \ } \ @@ -935,17 +930,20 @@ yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp) #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) #else static void -yy_stack_print (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; #endif { YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } YYFPRINTF (stderr, "\n"); } @@ -980,11 +978,11 @@ yy_reduce_print (yyvsp, yylsp, yyrule) /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { - fprintf (stderr, " $%d = ", yyi + 1); + YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) , &(yylsp[(yyi + 1) - (yynrhs)]) ); - fprintf (stderr, "\n"); + YYFPRINTF (stderr, "\n"); } } @@ -1262,124 +1260,210 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp) switch (yytype) { case 3: /* "TOK_COLONCOLON" */ + +/* Line 1000 of yacc.c */ #line 169 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1268 "ast_expr2.c" + +/* Line 1000 of yacc.c */ +#line 1270 "ast_expr2.c" break; case 4: /* "TOK_COND" */ + +/* Line 1000 of yacc.c */ #line 169 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1273 "ast_expr2.c" + +/* Line 1000 of yacc.c */ +#line 1279 "ast_expr2.c" break; case 5: /* "TOK_OR" */ + +/* Line 1000 of yacc.c */ #line 169 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1278 "ast_expr2.c" + +/* Line 1000 of yacc.c */ +#line 1288 "ast_expr2.c" break; case 6: /* "TOK_AND" */ + +/* Line 1000 of yacc.c */ #line 169 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1283 "ast_expr2.c" + +/* Line 1000 of yacc.c */ +#line 1297 "ast_expr2.c" break; case 7: /* "TOK_NE" */ + +/* Line 1000 of yacc.c */ #line 169 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1288 "ast_expr2.c" + +/* Line 1000 of yacc.c */ +#line 1306 "ast_expr2.c" break; case 8: /* "TOK_LE" */ + +/* Line 1000 of yacc.c */ #line 169 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1293 "ast_expr2.c" + +/* Line 1000 of yacc.c */ +#line 1315 "ast_expr2.c" break; case 9: /* "TOK_GE" */ + +/* Line 1000 of yacc.c */ #line 169 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1298 "ast_expr2.c" + +/* Line 1000 of yacc.c */ +#line 1324 "ast_expr2.c" break; case 10: /* "TOK_LT" */ + +/* Line 1000 of yacc.c */ #line 169 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1303 "ast_expr2.c" + +/* Line 1000 of yacc.c */ +#line 1333 "ast_expr2.c" break; case 11: /* "TOK_GT" */ + +/* Line 1000 of yacc.c */ #line 169 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1308 "ast_expr2.c" + +/* Line 1000 of yacc.c */ +#line 1342 "ast_expr2.c" break; case 12: /* "TOK_EQ" */ + +/* Line 1000 of yacc.c */ #line 169 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1313 "ast_expr2.c" + +/* Line 1000 of yacc.c */ +#line 1351 "ast_expr2.c" break; case 13: /* "TOK_MINUS" */ + +/* Line 1000 of yacc.c */ #line 169 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1318 "ast_expr2.c" + +/* Line 1000 of yacc.c */ +#line 1360 "ast_expr2.c" break; case 14: /* "TOK_PLUS" */ + +/* Line 1000 of yacc.c */ #line 169 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1323 "ast_expr2.c" + +/* Line 1000 of yacc.c */ +#line 1369 "ast_expr2.c" break; case 15: /* "TOK_MOD" */ + +/* Line 1000 of yacc.c */ #line 169 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1328 "ast_expr2.c" + +/* Line 1000 of yacc.c */ +#line 1378 "ast_expr2.c" break; case 16: /* "TOK_DIV" */ + +/* Line 1000 of yacc.c */ #line 169 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1333 "ast_expr2.c" + +/* Line 1000 of yacc.c */ +#line 1387 "ast_expr2.c" break; case 17: /* "TOK_MULT" */ + +/* Line 1000 of yacc.c */ #line 169 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1338 "ast_expr2.c" + +/* Line 1000 of yacc.c */ +#line 1396 "ast_expr2.c" break; case 18: /* "TOK_COMPL" */ + +/* Line 1000 of yacc.c */ #line 169 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1343 "ast_expr2.c" + +/* Line 1000 of yacc.c */ +#line 1405 "ast_expr2.c" break; case 19: /* "TOK_EQTILDE" */ + +/* Line 1000 of yacc.c */ #line 169 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1348 "ast_expr2.c" + +/* Line 1000 of yacc.c */ +#line 1414 "ast_expr2.c" break; case 20: /* "TOK_COLON" */ + +/* Line 1000 of yacc.c */ #line 169 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1353 "ast_expr2.c" + +/* Line 1000 of yacc.c */ +#line 1423 "ast_expr2.c" break; case 21: /* "TOK_LP" */ + +/* Line 1000 of yacc.c */ #line 169 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1358 "ast_expr2.c" + +/* Line 1000 of yacc.c */ +#line 1432 "ast_expr2.c" break; case 22: /* "TOK_RP" */ + +/* Line 1000 of yacc.c */ #line 169 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1363 "ast_expr2.c" + +/* Line 1000 of yacc.c */ +#line 1441 "ast_expr2.c" break; case 23: /* "TOKEN" */ + +/* Line 1000 of yacc.c */ #line 169 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1368 "ast_expr2.c" + +/* Line 1000 of yacc.c */ +#line 1450 "ast_expr2.c" break; case 26: /* "expr" */ + +/* Line 1000 of yacc.c */ #line 169 "ast_expr2.y" { free_value((yyvaluep->val)); }; -#line 1373 "ast_expr2.c" + +/* Line 1000 of yacc.c */ +#line 1459 "ast_expr2.c" break; default: break; } } - /* Prevent warnings from -Wmissing-prototypes. */ - #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); @@ -1398,10 +1482,9 @@ int yyparse (); - -/*----------. -| yyparse. | -`----------*/ +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -1425,88 +1508,97 @@ yyparse () #endif #endif { - /* 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. */ -int yynerrs; -/* Location data for the look-ahead symbol. */ +/* Location data for the lookahead symbol. */ YYLTYPE yylloc; - 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; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif + /* Number of syntax errors so far. */ + int yynerrs; - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + `yyls': related to locations. - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; - /* The location stack. */ - YYLTYPE yylsa[YYINITDEPTH]; - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp; - /* The locations where the error started and ended. */ - YYLTYPE yyerror_range[2]; + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) + /* The location stack. */ + YYLTYPE yylsa[YYINITDEPTH]; + YYLTYPE *yyls; + YYLTYPE *yylsp; - YYSIZE_T yystacksize = YYINITDEPTH; + /* The locations where the error started and ended. */ + YYLTYPE yyerror_range[2]; + 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; YYLTYPE yyloc; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (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; + yyls = yylsa; + 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; yylsp = yyls; + #if YYLTYPE_IS_TRIVIAL /* Initialize the default location before parsing starts. */ yylloc.first_line = yylloc.last_line = 1; - yylloc.first_column = yylloc.last_column = 0; + yylloc.first_column = yylloc.last_column = 1; #endif goto yysetstate; @@ -1545,6 +1637,7 @@ YYLTYPE yylloc; &yyvs1, yysize * sizeof (*yyvsp), &yyls1, yysize * sizeof (*yylsp), &yystacksize); + yyls = yyls1; yyss = yyss1; yyvs = yyvs1; @@ -1566,9 +1659,9 @@ YYLTYPE yylloc; (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - YYSTACK_RELOCATE (yyls); + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); + YYSTACK_RELOCATE (yyls_alloc, yyls); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -1589,6 +1682,9 @@ YYLTYPE yylloc; YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + if (yystate == YYFINAL) + YYACCEPT; + goto yybackup; /*-----------. @@ -1597,16 +1693,16 @@ YYLTYPE yylloc; yybackup: /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ + lookahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to look-ahead token. */ + /* 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: ")); @@ -1638,20 +1734,16 @@ yybackup: goto yyreduce; } - if (yyn == YYFINAL) - YYACCEPT; - /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; - /* Shift the look-ahead token. */ + /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; + /* Discard the shifted token. */ + yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; @@ -1692,6 +1784,8 @@ yyreduce: switch (yyn) { case 2: + +/* Line 1455 of yacc.c */ #line 175 "ast_expr2.y" { ((struct parse_io *)parseio)->val = (struct val *)calloc(sizeof(struct val),1); ((struct parse_io *)parseio)->val->type = (yyvsp[(1) - (1)].val)->type; @@ -1704,6 +1798,8 @@ yyreduce: break; case 3: + +/* Line 1455 of yacc.c */ #line 183 "ast_expr2.y" {/* nothing */ ((struct parse_io *)parseio)->val = (struct val *)calloc(sizeof(struct val),1); ((struct parse_io *)parseio)->val->type = AST_EXPR_string; @@ -1712,11 +1808,15 @@ yyreduce: break; case 4: + +/* Line 1455 of yacc.c */ #line 190 "ast_expr2.y" { (yyval.val)= (yyvsp[(1) - (1)].val);;} break; case 5: + +/* Line 1455 of yacc.c */ #line 191 "ast_expr2.y" { (yyval.val) = (yyvsp[(2) - (3)].val); (yyloc).first_column = (yylsp[(1) - (3)]).first_column; (yyloc).last_column = (yylsp[(3) - (3)]).last_column; @@ -1725,6 +1825,8 @@ yyreduce: break; case 6: + +/* Line 1455 of yacc.c */ #line 195 "ast_expr2.y" { (yyval.val) = op_or ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); @@ -1733,6 +1835,8 @@ yyreduce: break; case 7: + +/* Line 1455 of yacc.c */ #line 199 "ast_expr2.y" { (yyval.val) = op_and ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); @@ -1741,6 +1845,8 @@ yyreduce: break; case 8: + +/* Line 1455 of yacc.c */ #line 203 "ast_expr2.y" { (yyval.val) = op_eq ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); @@ -1749,6 +1855,8 @@ yyreduce: break; case 9: + +/* Line 1455 of yacc.c */ #line 207 "ast_expr2.y" { (yyval.val) = op_gt ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); @@ -1757,6 +1865,8 @@ yyreduce: break; case 10: + +/* Line 1455 of yacc.c */ #line 211 "ast_expr2.y" { (yyval.val) = op_lt ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); @@ -1765,6 +1875,8 @@ yyreduce: break; case 11: + +/* Line 1455 of yacc.c */ #line 215 "ast_expr2.y" { (yyval.val) = op_ge ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); @@ -1773,6 +1885,8 @@ yyreduce: break; case 12: + +/* Line 1455 of yacc.c */ #line 219 "ast_expr2.y" { (yyval.val) = op_le ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); @@ -1781,6 +1895,8 @@ yyreduce: break; case 13: + +/* Line 1455 of yacc.c */ #line 223 "ast_expr2.y" { (yyval.val) = op_ne ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); @@ -1789,6 +1905,8 @@ yyreduce: break; case 14: + +/* Line 1455 of yacc.c */ #line 227 "ast_expr2.y" { (yyval.val) = op_plus ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); @@ -1797,6 +1915,8 @@ yyreduce: break; case 15: + +/* Line 1455 of yacc.c */ #line 231 "ast_expr2.y" { (yyval.val) = op_minus ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); @@ -1805,6 +1925,8 @@ yyreduce: break; case 16: + +/* Line 1455 of yacc.c */ #line 235 "ast_expr2.y" { (yyval.val) = op_negate ((yyvsp[(2) - (2)].val)); DESTROY((yyvsp[(1) - (2)].val)); @@ -1813,6 +1935,8 @@ yyreduce: break; case 17: + +/* Line 1455 of yacc.c */ #line 239 "ast_expr2.y" { (yyval.val) = op_compl ((yyvsp[(2) - (2)].val)); DESTROY((yyvsp[(1) - (2)].val)); @@ -1821,6 +1945,8 @@ yyreduce: break; case 18: + +/* Line 1455 of yacc.c */ #line 243 "ast_expr2.y" { (yyval.val) = op_times ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); @@ -1829,6 +1955,8 @@ yyreduce: break; case 19: + +/* Line 1455 of yacc.c */ #line 247 "ast_expr2.y" { (yyval.val) = op_div ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); @@ -1837,6 +1965,8 @@ yyreduce: break; case 20: + +/* Line 1455 of yacc.c */ #line 251 "ast_expr2.y" { (yyval.val) = op_rem ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); @@ -1845,6 +1975,8 @@ yyreduce: break; case 21: + +/* Line 1455 of yacc.c */ #line 255 "ast_expr2.y" { (yyval.val) = op_colon ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); @@ -1853,6 +1985,8 @@ yyreduce: break; case 22: + +/* Line 1455 of yacc.c */ #line 259 "ast_expr2.y" { (yyval.val) = op_eqtilde ((yyvsp[(1) - (3)].val), (yyvsp[(3) - (3)].val)); DESTROY((yyvsp[(2) - (3)].val)); @@ -1861,6 +1995,8 @@ yyreduce: break; case 23: + +/* Line 1455 of yacc.c */ #line 263 "ast_expr2.y" { (yyval.val) = op_cond ((yyvsp[(1) - (5)].val), (yyvsp[(3) - (5)].val), (yyvsp[(5) - (5)].val)); DESTROY((yyvsp[(2) - (5)].val)); @@ -1870,8 +2006,9 @@ yyreduce: break; -/* Line 1267 of yacc.c. */ -#line 1875 "ast_expr2.c" + +/* Line 1455 of yacc.c */ +#line 2012 "ast_expr2.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -1947,7 +2084,7 @@ yyerrlab: 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) @@ -1964,7 +2101,7 @@ yyerrlab: } } - /* 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; @@ -2022,14 +2159,11 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } - if (yyn == YYFINAL) - YYACCEPT; - *++yyvsp = yylval; yyerror_range[1] = yylloc; /* Using YYLLOC is tempting, but would change the location of - the look-ahead. YYLOC is available though. */ + the lookahead. YYLOC is available though. */ YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); *++yylsp = yyloc; @@ -2054,7 +2188,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#ifndef yyoverflow +#if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -2065,7 +2199,7 @@ yyexhaustedlab: #endif yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) + if (yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc); /* Do not reclaim the symbols of the rule which action triggered @@ -2091,6 +2225,8 @@ yyreturn: } + +/* Line 1675 of yacc.c */ #line 270 "ast_expr2.y" @@ -2647,6 +2783,8 @@ op_compl (struct val *a) v1 = 0; else if (strlen(a->u.s) == 1 && a->u.s[0] == '0' ) v1 = 0; + else + v1 = atoi(a->u.s); } break; @@ -2659,6 +2797,8 @@ op_compl (struct val *a) v1 = 0; else if (strlen(a->u.s) == 1 && a->u.s[0] == '0' ) v1 = 0; + else + v1 = atoi(a->u.s); } break; } @@ -2794,7 +2934,7 @@ op_colon (struct val *a, struct val *b) /* compile regular expression */ if ((eval = regcomp (&rp, b->u.s, REG_EXTENDED)) != 0) { regerror (eval, &rp, errbuf, sizeof(errbuf)); - ast_log(LOG_WARNING,"regcomp() error : %s",errbuf); + ast_log(LOG_WARNING, "regcomp() error : %s\n", errbuf); free_value(a); free_value(b); return make_str(""); @@ -2845,7 +2985,7 @@ op_eqtilde (struct val *a, struct val *b) /* compile regular expression */ if ((eval = regcomp (&rp, b->u.s, REG_EXTENDED)) != 0) { regerror (eval, &rp, errbuf, sizeof(errbuf)); - ast_log(LOG_WARNING,"regcomp() error : %s",errbuf); + ast_log(LOG_WARNING, "regcomp() error : %s\n", errbuf); free_value(a); free_value(b); return make_str(""); diff --git a/main/ast_expr2.h b/main/ast_expr2.h index d05161266..864e01873 100644 --- a/main/ast_expr2.h +++ b/main/ast_expr2.h @@ -1,24 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton interface for Bison's Yacc-like parsers in C +/* A Bison parser, made by GNU Bison 2.4.1. */ - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +/* Skeleton interface 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 + + 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. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,10 +28,11 @@ 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. */ + /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE @@ -62,44 +62,26 @@ TOKEN = 278 }; #endif -/* Tokens. */ -#define TOK_COLONCOLON 258 -#define TOK_COND 259 -#define TOK_OR 260 -#define TOK_AND 261 -#define TOK_NE 262 -#define TOK_LE 263 -#define TOK_GE 264 -#define TOK_LT 265 -#define TOK_GT 266 -#define TOK_EQ 267 -#define TOK_MINUS 268 -#define TOK_PLUS 269 -#define TOK_MOD 270 -#define TOK_DIV 271 -#define TOK_MULT 272 -#define TOK_COMPL 273 -#define TOK_EQTILDE 274 -#define TOK_COLON 275 -#define TOK_LP 276 -#define TOK_RP 277 -#define TOKEN 278 - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 147 "ast_expr2.y" { + +/* Line 1676 of yacc.c */ +#line 147 "ast_expr2.y" + struct val *val; -} -/* Line 1489 of yacc.c. */ -#line 99 "ast_expr2.h" - YYSTYPE; + + + +/* Line 1676 of yacc.c */ +#line 81 "ast_expr2.h" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif @@ -118,3 +100,4 @@ typedef struct YYLTYPE #endif + diff --git a/main/ast_expr2.y b/main/ast_expr2.y index c09cd0a69..fa2007c12 100644 --- a/main/ast_expr2.y +++ b/main/ast_expr2.y @@ -822,6 +822,8 @@ op_compl (struct val *a) v1 = 0; else if (strlen(a->u.s) == 1 && a->u.s[0] == '0' ) v1 = 0; + else + v1 = atoi(a->u.s); } break; @@ -834,6 +836,8 @@ op_compl (struct val *a) v1 = 0; else if (strlen(a->u.s) == 1 && a->u.s[0] == '0' ) v1 = 0; + else + v1 = atoi(a->u.s); } break; } -- cgit v1.2.3