Codename Pineapple

Home page | Mailing list | Docs

Last updated: Sat Feb 3 05:00:31 2007

Asterisk developer's documentation :: Codename Pineapple


ast_expr2.c

Go to the documentation of this file.
00001 /* A Bison parser, made by GNU Bison 2.3.  */
00002 
00003 /* Skeleton implementation for Bison's Yacc-like parsers in C
00004 
00005    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
00006    Free Software Foundation, Inc.
00007 
00008    This program is free software; you can redistribute it and/or modify
00009    it under the terms of the GNU General Public License as published by
00010    the Free Software Foundation; either version 2, or (at your option)
00011    any later version.
00012 
00013    This program is distributed in the hope that it will be useful,
00014    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016    GNU General Public License for more details.
00017 
00018    You should have received a copy of the GNU General Public License
00019    along with this program; if not, write to the Free Software
00020    Foundation, Inc., 51 Franklin Street, Fifth Floor,
00021    Boston, MA 02110-1301, USA.  */
00022 
00023 /* As a special exception, you may create a larger work that contains
00024    part or all of the Bison parser skeleton and distribute that work
00025    under terms of your choice, so long as that work isn't itself a
00026    parser generator using the skeleton or a modified version thereof
00027    as a parser skeleton.  Alternatively, if you modify or redistribute
00028    the parser skeleton itself, you may (at your option) remove this
00029    special exception, which will cause the skeleton and the resulting
00030    Bison output files to be licensed under the GNU General Public
00031    License without this special exception.
00032 
00033    This special exception was added by the Free Software Foundation in
00034    version 2.2 of Bison.  */
00035 
00036 /* C LALR(1) parser skeleton written by Richard Stallman, by
00037    simplifying the original so-called "semantic" parser.  */
00038 
00039 /* All symbols defined below should begin with yy or YY, to avoid
00040    infringing on user name space.  This should be done even for local
00041    variables, as they might otherwise be expanded by user macros.
00042    There are some unavoidable exceptions within include files to
00043    define necessary library symbols; they are noted "INFRINGES ON
00044    USER NAME SPACE" below.  */
00045 
00046 /* Identify Bison output.  */
00047 #define YYBISON 1
00048 
00049 /* Bison version.  */
00050 #define YYBISON_VERSION "2.3"
00051 
00052 /* Skeleton name.  */
00053 #define YYSKELETON_NAME "yacc.c"
00054 
00055 /* Pure parsers.  */
00056 #define YYPURE 1
00057 
00058 /* Using locations.  */
00059 #define YYLSP_NEEDED 1
00060 
00061 /* Substitute the variable and function names.  */
00062 #define yyparse ast_yyparse
00063 #define yylex   ast_yylex
00064 #define yyerror ast_yyerror
00065 #define yylval  ast_yylval
00066 #define yychar  ast_yychar
00067 #define yydebug ast_yydebug
00068 #define yynerrs ast_yynerrs
00069 #define yylloc ast_yylloc
00070 
00071 /* Tokens.  */
00072 #ifndef YYTOKENTYPE
00073 # define YYTOKENTYPE
00074    /* Put the tokens into the symbol table, so that GDB and other debuggers
00075       know about them.  */
00076    enum yytokentype {
00077      TOK_COLONCOLON = 258,
00078      TOK_COND = 259,
00079      TOK_OR = 260,
00080      TOK_AND = 261,
00081      TOK_NE = 262,
00082      TOK_LE = 263,
00083      TOK_GE = 264,
00084      TOK_LT = 265,
00085      TOK_GT = 266,
00086      TOK_EQ = 267,
00087      TOK_MINUS = 268,
00088      TOK_PLUS = 269,
00089      TOK_MOD = 270,
00090      TOK_DIV = 271,
00091      TOK_MULT = 272,
00092      TOK_COMPL = 273,
00093      TOK_EQTILDE = 274,
00094      TOK_COLON = 275,
00095      TOK_LP = 276,
00096      TOK_RP = 277,
00097      TOKEN = 278
00098    };
00099 #endif
00100 /* Tokens.  */
00101 #define TOK_COLONCOLON 258
00102 #define TOK_COND 259
00103 #define TOK_OR 260
00104 #define TOK_AND 261
00105 #define TOK_NE 262
00106 #define TOK_LE 263
00107 #define TOK_GE 264
00108 #define TOK_LT 265
00109 #define TOK_GT 266
00110 #define TOK_EQ 267
00111 #define TOK_MINUS 268
00112 #define TOK_PLUS 269
00113 #define TOK_MOD 270
00114 #define TOK_DIV 271
00115 #define TOK_MULT 272
00116 #define TOK_COMPL 273
00117 #define TOK_EQTILDE 274
00118 #define TOK_COLON 275
00119 #define TOK_LP 276
00120 #define TOK_RP 277
00121 #define TOKEN 278
00122 
00123 
00124 
00125 
00126 /* Copy the first part of user declarations.  */
00127 #line 1 "ast_expr2.y"
00128 
00129 /* Written by Pace Willisson (pace@blitz.com) 
00130  * and placed in the public domain.
00131  *
00132  * Largely rewritten by J.T. Conklin (jtc@wimsey.com)
00133  *
00134  * And then overhauled twice by Steve Murphy (murf@e-tools.com)
00135  * to add double-quoted strings, allow mult. spaces, improve
00136  * error messages, and then to fold in a flex scanner for the 
00137  * yylex operation.
00138  *
00139  * $FreeBSD: src/bin/expr/expr.y,v 1.16 2000/07/22 10:59:36 se Exp $
00140  */
00141 
00142 #include "asterisk.h"
00143 
00144 #ifndef STANDALONE
00145 ASTERISK_FILE_VERSION(__FILE__, "$Revision: 49116 $")
00146 #endif
00147 
00148 #include <sys/types.h>
00149 #include <stdio.h>
00150 #include <stdlib.h>
00151 #include <string.h>
00152 #include <locale.h>
00153 #include <unistd.h>
00154 #include <ctype.h>
00155 #if !defined(SOLARIS) && !defined(__CYGWIN__)
00156    /* #include <err.h> */
00157 #else
00158 #define quad_t int64_t
00159 #endif
00160 #include <errno.h>
00161 #include <regex.h>
00162 #include <limits.h>
00163 
00164 #include "asterisk/ast_expr.h"
00165 #include "asterisk/logger.h"
00166 
00167 #if defined(LONG_LONG_MIN) && !defined(QUAD_MIN)
00168 #define QUAD_MIN LONG_LONG_MIN
00169 #endif
00170 #if defined(LONG_LONG_MAX) && !defined(QUAD_MAX)
00171 #define QUAD_MAX LONG_LONG_MAX
00172 #endif
00173 
00174 #  if ! defined(QUAD_MIN)
00175 #   define QUAD_MIN     (-0x7fffffffffffffffLL-1)
00176 #  endif
00177 #  if ! defined(QUAD_MAX)
00178 #   define QUAD_MAX     (0x7fffffffffffffffLL)
00179 #  endif
00180 
00181 #define YYPARSE_PARAM parseio
00182 #define YYLEX_PARAM ((struct parse_io *)parseio)->scanner
00183 #define YYERROR_VERBOSE 1
00184 extern char extra_error_message[4095];
00185 extern int extra_error_message_supplied;
00186 
00187 enum valtype {
00188    AST_EXPR_integer, AST_EXPR_numeric_string, AST_EXPR_string
00189 } ;
00190 
00191 #ifdef STANDALONE
00192 void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...) __attribute__ ((format (printf,5,6)));
00193 #endif
00194 
00195 struct val {
00196    enum valtype type;
00197    union {
00198       char *s;
00199       quad_t i;
00200    } u;
00201 } ;
00202 
00203 typedef void *yyscan_t;
00204 
00205 struct parse_io
00206 {
00207    char *string;
00208    struct val *val;
00209    yyscan_t scanner;
00210 };
00211  
00212 static int     chk_div __P((quad_t, quad_t));
00213 static int     chk_minus __P((quad_t, quad_t, quad_t));
00214 static int     chk_plus __P((quad_t, quad_t, quad_t));
00215 static int     chk_times __P((quad_t, quad_t, quad_t));
00216 static void    free_value __P((struct val *));
00217 static int     is_zero_or_null __P((struct val *));
00218 static int     isstring __P((struct val *));
00219 static struct val *make_integer __P((quad_t));
00220 static struct val *make_str __P((const char *));
00221 static struct val *op_and __P((struct val *, struct val *));
00222 static struct val *op_colon __P((struct val *, struct val *));
00223 static struct val *op_eqtilde __P((struct val *, struct val *));
00224 static struct val *op_div __P((struct val *, struct val *));
00225 static struct val *op_eq __P((struct val *, struct val *));
00226 static struct val *op_ge __P((struct val *, struct val *));
00227 static struct val *op_gt __P((struct val *, struct val *));
00228 static struct val *op_le __P((struct val *, struct val *));
00229 static struct val *op_lt __P((struct val *, struct val *));
00230 static struct val *op_cond __P((struct val *, struct val *, struct val *));
00231 static struct val *op_minus __P((struct val *, struct val *));
00232 static struct val *op_negate __P((struct val *));
00233 static struct val *op_compl __P((struct val *));
00234 static struct val *op_ne __P((struct val *, struct val *));
00235 static struct val *op_or __P((struct val *, struct val *));
00236 static struct val *op_plus __P((struct val *, struct val *));
00237 static struct val *op_rem __P((struct val *, struct val *));
00238 static struct val *op_times __P((struct val *, struct val *));
00239 static quad_t     to_integer __P((struct val *));
00240 static void    to_string __P((struct val *));
00241 
00242 /* uh, if I want to predeclare yylex with a YYLTYPE, I have to predeclare the yyltype... sigh */
00243 typedef struct yyltype
00244 {
00245   int first_line;
00246   int first_column;
00247 
00248   int last_line;
00249   int last_column;
00250 } yyltype;
00251 
00252 # define YYLTYPE yyltype
00253 # define YYLTYPE_IS_TRIVIAL 1
00254 
00255 /* we will get warning about no prototype for yylex! But we can't
00256    define it here, we have no definition yet for YYSTYPE. */
00257 
00258 int      ast_yyerror(const char *,YYLTYPE *, struct parse_io *);
00259  
00260 /* I wanted to add args to the yyerror routine, so I could print out
00261    some useful info about the error. Not as easy as it looks, but it
00262    is possible. */
00263 #define ast_yyerror(x) ast_yyerror(x,&yyloc,parseio)
00264 #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);}
00265 
00266 
00267 /* Enabling traces.  */
00268 #ifndef YYDEBUG
00269 # define YYDEBUG 0
00270 #endif
00271 
00272 /* Enabling verbose error messages.  */
00273 #ifdef YYERROR_VERBOSE
00274 # undef YYERROR_VERBOSE
00275 # define YYERROR_VERBOSE 1
00276 #else
00277 # define YYERROR_VERBOSE 0
00278 #endif
00279 
00280 /* Enabling the token table.  */
00281 #ifndef YYTOKEN_TABLE
00282 # define YYTOKEN_TABLE 0
00283 #endif
00284 
00285 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
00286 typedef union YYSTYPE
00287 #line 147 "ast_expr2.y"
00288 {
00289    struct val *val;
00290 }
00291 /* Line 193 of yacc.c.  */
00292 #line 293 "ast_expr2.c"
00293    YYSTYPE;
00294 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
00295 # define YYSTYPE_IS_DECLARED 1
00296 # define YYSTYPE_IS_TRIVIAL 1
00297 #endif
00298 
00299 #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
00300 typedef struct YYLTYPE
00301 {
00302   int first_line;
00303   int first_column;
00304   int last_line;
00305   int last_column;
00306 } YYLTYPE;
00307 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
00308 # define YYLTYPE_IS_DECLARED 1
00309 # define YYLTYPE_IS_TRIVIAL 1
00310 #endif
00311 
00312 
00313 /* Copy the second part of user declarations.  */
00314 #line 151 "ast_expr2.y"
00315 
00316 extern int     ast_yylex __P((YYSTYPE *, YYLTYPE *, yyscan_t));
00317 
00318 
00319 /* Line 216 of yacc.c.  */
00320 #line 321 "ast_expr2.c"
00321 
00322 #ifdef short
00323 # undef short
00324 #endif
00325 
00326 #ifdef YYTYPE_UINT8
00327 typedef YYTYPE_UINT8 yytype_uint8;
00328 #else
00329 typedef unsigned char yytype_uint8;
00330 #endif
00331 
00332 #ifdef YYTYPE_INT8
00333 typedef YYTYPE_INT8 yytype_int8;
00334 #elif (defined __STDC__ || defined __C99__FUNC__ \
00335      || defined __cplusplus || defined _MSC_VER)
00336 typedef signed char yytype_int8;
00337 #else
00338 typedef short int yytype_int8;
00339 #endif
00340 
00341 #ifdef YYTYPE_UINT16
00342 typedef YYTYPE_UINT16 yytype_uint16;
00343 #else
00344 typedef unsigned short int yytype_uint16;
00345 #endif
00346 
00347 #ifdef YYTYPE_INT16
00348 typedef YYTYPE_INT16 yytype_int16;
00349 #else
00350 typedef short int yytype_int16;
00351 #endif
00352 
00353 #ifndef YYSIZE_T
00354 # ifdef __SIZE_TYPE__
00355 #  define YYSIZE_T __SIZE_TYPE__
00356 # elif defined size_t
00357 #  define YYSIZE_T size_t
00358 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
00359      || defined __cplusplus || defined _MSC_VER)
00360 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
00361 #  define YYSIZE_T size_t
00362 # else
00363 #  define YYSIZE_T unsigned int
00364 # endif
00365 #endif
00366 
00367 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
00368 
00369 #ifndef YY_
00370 # if YYENABLE_NLS
00371 #  if ENABLE_NLS
00372 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
00373 #   define YY_(msgid) dgettext ("bison-runtime", msgid)
00374 #  endif
00375 # endif
00376 # ifndef YY_
00377 #  define YY_(msgid) msgid
00378 # endif
00379 #endif
00380 
00381 /* Suppress unused-variable warnings by "using" E.  */
00382 #if ! defined lint || defined __GNUC__
00383 # define YYUSE(e) ((void) (e))
00384 #else
00385 # define YYUSE(e) /* empty */
00386 #endif
00387 
00388 /* Identity function, used to suppress warnings about constant conditions.  */
00389 #ifndef lint
00390 # define YYID(n) (n)
00391 #else
00392 #if (defined __STDC__ || defined __C99__FUNC__ \
00393      || defined __cplusplus || defined _MSC_VER)
00394 static int
00395 YYID (int i)
00396 #else
00397 static int
00398 YYID (i)
00399     int i;
00400 #endif
00401 {
00402   return i;
00403 }
00404 #endif
00405 
00406 #if ! defined yyoverflow || YYERROR_VERBOSE
00407 
00408 /* The parser invokes alloca or malloc; define the necessary symbols.  */
00409 
00410 # ifdef YYSTACK_USE_ALLOCA
00411 #  if YYSTACK_USE_ALLOCA
00412 #   ifdef __GNUC__
00413 #    define YYSTACK_ALLOC __builtin_alloca
00414 #   elif defined __BUILTIN_VA_ARG_INCR
00415 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
00416 #   elif defined _AIX
00417 #    define YYSTACK_ALLOC __alloca
00418 #   elif defined _MSC_VER
00419 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
00420 #    define alloca _alloca
00421 #   else
00422 #    define YYSTACK_ALLOC alloca
00423 #    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00424      || defined __cplusplus || defined _MSC_VER)
00425 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
00426 #     ifndef _STDLIB_H
00427 #      define _STDLIB_H 1
00428 #     endif
00429 #    endif
00430 #   endif
00431 #  endif
00432 # endif
00433 
00434 # ifdef YYSTACK_ALLOC
00435    /* Pacify GCC's `empty if-body' warning.  */
00436 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
00437 #  ifndef YYSTACK_ALLOC_MAXIMUM
00438     /* The OS might guarantee only one guard page at the bottom of the stack,
00439        and a page size can be as small as 4096 bytes.  So we cannot safely
00440        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
00441        to allow for a few compiler-allocated temporary stack slots.  */
00442 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
00443 #  endif
00444 # else
00445 #  define YYSTACK_ALLOC YYMALLOC
00446 #  define YYSTACK_FREE YYFREE
00447 #  ifndef YYSTACK_ALLOC_MAXIMUM
00448 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
00449 #  endif
00450 #  if (defined __cplusplus && ! defined _STDLIB_H \
00451        && ! ((defined YYMALLOC || defined malloc) \
00452         && (defined YYFREE || defined free)))
00453 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
00454 #   ifndef _STDLIB_H
00455 #    define _STDLIB_H 1
00456 #   endif
00457 #  endif
00458 #  ifndef YYMALLOC
00459 #   define YYMALLOC malloc
00460 #   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00461      || defined __cplusplus || defined _MSC_VER)
00462 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
00463 #   endif
00464 #  endif
00465 #  ifndef YYFREE
00466 #   define YYFREE free
00467 #   if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00468      || defined __cplusplus || defined _MSC_VER)
00469 void free (void *); /* INFRINGES ON USER NAME SPACE */
00470 #   endif
00471 #  endif
00472 # endif
00473 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
00474 
00475 
00476 #if (! defined yyoverflow \
00477      && (! defined __cplusplus \
00478     || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
00479         && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
00480 
00481 /* A type that is properly aligned for any stack member.  */
00482 union yyalloc
00483 {
00484   yytype_int16 yyss;
00485   YYSTYPE yyvs;
00486     YYLTYPE yyls;
00487 };
00488 
00489 /* The size of the maximum gap between one aligned stack and the next.  */
00490 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
00491 
00492 /* The size of an array large to enough to hold all stacks, each with
00493    N elements.  */
00494 # define YYSTACK_BYTES(N) \
00495      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
00496       + 2 * YYSTACK_GAP_MAXIMUM)
00497 
00498 /* Copy COUNT objects from FROM to TO.  The source and destination do
00499    not overlap.  */
00500 # ifndef YYCOPY
00501 #  if defined __GNUC__ && 1 < __GNUC__
00502 #   define YYCOPY(To, From, Count) \
00503       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
00504 #  else
00505 #   define YYCOPY(To, From, Count)     \
00506       do             \
00507    {              \
00508      YYSIZE_T yyi;            \
00509      for (yyi = 0; yyi < (Count); yyi++)  \
00510        (To)[yyi] = (From)[yyi];     \
00511    }              \
00512       while (YYID (0))
00513 #  endif
00514 # endif
00515 
00516 /* Relocate STACK from its old location to the new one.  The
00517    local variables YYSIZE and YYSTACKSIZE give the old and new number of
00518    elements in the stack, and YYPTR gives the new location of the
00519    stack.  Advance YYPTR to a properly aligned location for the next
00520    stack.  */
00521 # define YYSTACK_RELOCATE(Stack)             \
00522     do                           \
00523       {                          \
00524    YYSIZE_T yynewbytes;                \
00525    YYCOPY (&yyptr->Stack, Stack, yysize);          \
00526    Stack = &yyptr->Stack;                 \
00527    yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
00528    yyptr += yynewbytes / sizeof (*yyptr);          \
00529       }                          \
00530     while (YYID (0))
00531 
00532 #endif
00533 
00534 /* YYFINAL -- State number of the termination state.  */
00535 #define YYFINAL  10
00536 /* YYLAST -- Last index in YYTABLE.  */
00537 #define YYLAST   140
00538 
00539 /* YYNTOKENS -- Number of terminals.  */
00540 #define YYNTOKENS  24
00541 /* YYNNTS -- Number of nonterminals.  */
00542 #define YYNNTS  3
00543 /* YYNRULES -- Number of rules.  */
00544 #define YYNRULES  23
00545 /* YYNRULES -- Number of states.  */
00546 #define YYNSTATES  46
00547 
00548 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
00549 #define YYUNDEFTOK  2
00550 #define YYMAXUTOK   278
00551 
00552 #define YYTRANSLATE(YYX)                  \
00553   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
00554 
00555 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
00556 static const yytype_uint8 yytranslate[] =
00557 {
00558        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00559        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00560        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00561        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00562        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00563        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00564        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00565        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00566        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00567        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00568        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00569        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00570        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00571        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00572        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00573        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00574        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00575        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00576        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00577        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00578        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00579        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00580        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00581        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00582        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00583        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
00584        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
00585       15,    16,    17,    18,    19,    20,    21,    22,    23
00586 };
00587 
00588 #if YYDEBUG
00589 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
00590    YYRHS.  */
00591 static const yytype_uint8 yyprhs[] =
00592 {
00593        0,     0,     3,     5,     6,     8,    12,    16,    20,    24,
00594       28,    32,    36,    40,    44,    48,    52,    55,    58,    62,
00595       66,    70,    74,    78
00596 };
00597 
00598 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
00599 static const yytype_int8 yyrhs[] =
00600 {
00601       25,     0,    -1,    26,    -1,    -1,    23,    -1,    21,    26,
00602       22,    -1,    26,     5,    26,    -1,    26,     6,    26,    -1,
00603       26,    12,    26,    -1,    26,    11,    26,    -1,    26,    10,
00604       26,    -1,    26,     9,    26,    -1,    26,     8,    26,    -1,
00605       26,     7,    26,    -1,    26,    14,    26,    -1,    26,    13,
00606       26,    -1,    13,    26,    -1,    18,    26,    -1,    26,    17,
00607       26,    -1,    26,    16,    26,    -1,    26,    15,    26,    -1,
00608       26,    20,    26,    -1,    26,    19,    26,    -1,    26,     4,
00609       26,     3,    26,    -1
00610 };
00611 
00612 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
00613 static const yytype_uint16 yyrline[] =
00614 {
00615        0,   175,   175,   183,   190,   191,   195,   199,   203,   207,
00616      211,   215,   219,   223,   227,   231,   235,   239,   243,   247,
00617      251,   255,   259,   263
00618 };
00619 #endif
00620 
00621 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
00622 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
00623    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
00624 static const char *const yytname[] =
00625 {
00626   "$end", "error", "$undefined", "TOK_COLONCOLON", "TOK_COND", "TOK_OR",
00627   "TOK_AND", "TOK_NE", "TOK_LE", "TOK_GE", "TOK_LT", "TOK_GT", "TOK_EQ",
00628   "TOK_MINUS", "TOK_PLUS", "TOK_MOD", "TOK_DIV", "TOK_MULT", "TOK_COMPL",
00629   "TOK_EQTILDE", "TOK_COLON", "TOK_LP", "TOK_RP", "TOKEN", "$accept",
00630   "start", "expr", 0
00631 };
00632 #endif
00633 
00634 # ifdef YYPRINT
00635 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
00636    token YYLEX-NUM.  */
00637 static const yytype_uint16 yytoknum[] =
00638 {
00639        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
00640      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
00641      275,   276,   277,   278
00642 };
00643 # endif
00644 
00645 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
00646 static const yytype_uint8 yyr1[] =
00647 {
00648        0,    24,    25,    25,    26,    26,    26,    26,    26,    26,
00649       26,    26,    26,    26,    26,    26,    26,    26,    26,    26,
00650       26,    26,    26,    26
00651 };
00652 
00653 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
00654 static const yytype_uint8 yyr2[] =
00655 {
00656        0,     2,     1,     0,     1,     3,     3,     3,     3,     3,
00657        3,     3,     3,     3,     3,     3,     2,     2,     3,     3,
00658        3,     3,     3,     5
00659 };
00660 
00661 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
00662    STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
00663    means the default is an error.  */
00664 static const yytype_uint8 yydefact[] =
00665 {
00666        3,     0,     0,     0,     4,     0,     2,    16,    17,     0,
00667        1,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00668        0,     0,     0,     0,     0,     0,     0,     5,     0,     6,
00669        7,    13,    12,    11,    10,     9,     8,    15,    14,    20,
00670       19,    18,    22,    21,     0,    23
00671 };
00672 
00673 /* YYDEFGOTO[NTERM-NUM].  */
00674 static const yytype_int8 yydefgoto[] =
00675 {
00676       -1,     5,     6
00677 };
00678 
00679 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
00680    STATE-NUM.  */
00681 #define YYPACT_NINF -13
00682 static const yytype_int8 yypact[] =
00683 {
00684      109,   109,   109,   109,   -13,     6,    59,   106,   106,    22,
00685      -13,   109,   109,   109,   109,   109,   109,   109,   109,   109,
00686      109,   109,   109,   109,   109,   109,   109,   -13,    42,    90,
00687      104,   120,   120,   120,   120,   120,   120,   -12,   -12,   106,
00688      106,   106,   -13,   -13,   109,    75
00689 };
00690 
00691 /* YYPGOTO[NTERM-NUM].  */
00692 static const yytype_int8 yypgoto[] =
00693 {
00694      -13,   -13,    -1
00695 };
00696 
00697 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
00698    positive, shift that token.  If negative, reduce the rule which
00699    number is the opposite.  If zero, do what YYDEFACT says.
00700    If YYTABLE_NINF, syntax error.  */
00701 #define YYTABLE_NINF -1
00702 static const yytype_uint8 yytable[] =
00703 {
00704        7,     8,     9,    22,    23,    24,    10,    25,    26,     0,
00705       28,    29,    30,    31,    32,    33,    34,    35,    36,    37,
00706       38,    39,    40,    41,    42,    43,    11,    12,    13,    14,
00707       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
00708        0,    25,    26,    45,    27,    44,    11,    12,    13,    14,
00709       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
00710        0,    25,    26,    11,    12,    13,    14,    15,    16,    17,
00711       18,    19,    20,    21,    22,    23,    24,     0,    25,    26,
00712       12,    13,    14,    15,    16,    17,    18,    19,    20,    21,
00713       22,    23,    24,     0,    25,    26,    13,    14,    15,    16,
00714       17,    18,    19,    20,    21,    22,    23,    24,     0,    25,
00715       26,    14,    15,    16,    17,    18,    19,    20,    21,    22,
00716       23,    24,     1,    25,    26,    25,    26,     2,     0,     0,
00717        3,     0,     4,    20,    21,    22,    23,    24,     0,    25,
00718       26
00719 };
00720 
00721 static const yytype_int8 yycheck[] =
00722 {
00723        1,     2,     3,    15,    16,    17,     0,    19,    20,    -1,
00724       11,    12,    13,    14,    15,    16,    17,    18,    19,    20,
00725       21,    22,    23,    24,    25,    26,     4,     5,     6,     7,
00726        8,     9,    10,    11,    12,    13,    14,    15,    16,    17,
00727       -1,    19,    20,    44,    22,     3,     4,     5,     6,     7,
00728        8,     9,    10,    11,    12,    13,    14,    15,    16,    17,
00729       -1,    19,    20,     4,     5,     6,     7,     8,     9,    10,
00730       11,    12,    13,    14,    15,    16,    17,    -1,    19,    20,
00731        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
00732       15,    16,    17,    -1,    19,    20,     6,     7,     8,     9,
00733       10,    11,    12,    13,    14,    15,    16,    17,    -1,    19,
00734       20,     7,     8,     9,    10,    11,    12,    13,    14,    15,
00735       16,    17,    13,    19,    20,    19,    20,    18,    -1,    -1,
00736       21,    -1,    23,    13,    14,    15,    16,    17,    -1,    19,
00737       20
00738 };
00739 
00740 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
00741    symbol of state STATE-NUM.  */
00742 static const yytype_uint8 yystos[] =
00743 {
00744        0,    13,    18,    21,    23,    25,    26,    26,    26,    26,
00745        0,     4,     5,     6,     7,     8,     9,    10,    11,    12,
00746       13,    14,    15,    16,    17,    19,    20,    22,    26,    26,
00747       26,    26,    26,    26,    26,    26,    26,    26,    26,    26,
00748       26,    26,    26,    26,     3,    26
00749 };
00750 
00751 #define yyerrok      (yyerrstatus = 0)
00752 #define yyclearin (yychar = YYEMPTY)
00753 #define YYEMPTY      (-2)
00754 #define YYEOF     0
00755 
00756 #define YYACCEPT  goto yyacceptlab
00757 #define YYABORT      goto yyabortlab
00758 #define YYERROR      goto yyerrorlab
00759 
00760 
00761 /* Like YYERROR except do call yyerror.  This remains here temporarily
00762    to ease the transition to the new meaning of YYERROR, for GCC.
00763    Once GCC version 2 has supplanted version 1, this can go.  */
00764 
00765 #define YYFAIL    goto yyerrlab
00766 
00767 #define YYRECOVERING()  (!!yyerrstatus)
00768 
00769 #define YYBACKUP(Token, Value)               \
00770 do                      \
00771   if (yychar == YYEMPTY && yylen == 1)          \
00772     {                      \
00773       yychar = (Token);                \
00774       yylval = (Value);                \
00775       yytoken = YYTRANSLATE (yychar);           \
00776       YYPOPSTACK (1);                  \
00777       goto yybackup;                \
00778     }                      \
00779   else                        \
00780     {                      \
00781       yyerror (YY_("syntax error: cannot back up")); \
00782       YYERROR;                   \
00783     }                      \
00784 while (YYID (0))
00785 
00786 
00787 #define YYTERROR  1
00788 #define YYERRCODE 256
00789 
00790 
00791 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
00792    If N is 0, then set CURRENT to the empty location which ends
00793    the previous symbol: RHS[0] (always defined).  */
00794 
00795 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
00796 #ifndef YYLLOC_DEFAULT
00797 # define YYLLOC_DEFAULT(Current, Rhs, N)           \
00798     do                           \
00799       if (YYID (N))                                                    \
00800    {                       \
00801      (Current).first_line   = YYRHSLOC (Rhs, 1).first_line; \
00802      (Current).first_column = YYRHSLOC (Rhs, 1).first_column;  \
00803      (Current).last_line    = YYRHSLOC (Rhs, N).last_line;     \
00804      (Current).last_column  = YYRHSLOC (Rhs, N).last_column;   \
00805    }                       \
00806       else                       \
00807    {                       \
00808      (Current).first_line   = (Current).last_line   =    \
00809        YYRHSLOC (Rhs, 0).last_line;          \
00810      (Current).first_column = (Current).last_column =    \
00811        YYRHSLOC (Rhs, 0).last_column;           \
00812    }                       \
00813     while (YYID (0))
00814 #endif
00815 
00816 
00817 /* YY_LOCATION_PRINT -- Print the location on the stream.
00818    This macro was not mandated originally: define only if we know
00819    we won't break user code: when these are the locations we know.  */
00820 
00821 #ifndef YY_LOCATION_PRINT
00822 # if YYLTYPE_IS_TRIVIAL
00823 #  define YY_LOCATION_PRINT(File, Loc)       \
00824      fprintf (File, "%d.%d-%d.%d",        \
00825          (Loc).first_line, (Loc).first_column,  \
00826          (Loc).last_line,  (Loc).last_column)
00827 # else
00828 #  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
00829 # endif
00830 #endif
00831 
00832 
00833 /* YYLEX -- calling `yylex' with the right arguments.  */
00834 
00835 #ifdef YYLEX_PARAM
00836 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
00837 #else
00838 # define YYLEX yylex (&yylval, &yylloc)
00839 #endif
00840 
00841 /* Enable debugging if requested.  */
00842 #if YYDEBUG
00843 
00844 # ifndef YYFPRINTF
00845 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
00846 #  define YYFPRINTF fprintf
00847 # endif
00848 
00849 # define YYDPRINTF(Args)         \
00850 do {                 \
00851   if (yydebug)             \
00852     YYFPRINTF Args;           \
00853 } while (YYID (0))
00854 
00855 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)           \
00856 do {                            \
00857   if (yydebug)                        \
00858     {                           \
00859       YYFPRINTF (stderr, "%s ", Title);                 \
00860       yy_symbol_print (stderr,                    \
00861         Type, Value, Location); \
00862       YYFPRINTF (stderr, "\n");                   \
00863     }                           \
00864 } while (YYID (0))
00865 
00866 
00867 /*--------------------------------.
00868 | Print this symbol on YYOUTPUT.  |
00869 `--------------------------------*/
00870 
00871 /*ARGSUSED*/
00872 #if (defined __STDC__ || defined __C99__FUNC__ \
00873      || defined __cplusplus || defined _MSC_VER)
00874 static void
00875 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
00876 #else
00877 static void
00878 yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp)
00879     FILE *yyoutput;
00880     int yytype;
00881     YYSTYPE const * const yyvaluep;
00882     YYLTYPE const * const yylocationp;
00883 #endif
00884 {
00885   if (!yyvaluep)
00886     return;
00887   YYUSE (yylocationp);
00888 # ifdef YYPRINT
00889   if (yytype < YYNTOKENS)
00890     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
00891 # else
00892   YYUSE (yyoutput);
00893 # endif
00894   switch (yytype)
00895     {
00896       default:
00897    break;
00898     }
00899 }
00900 
00901 
00902 /*--------------------------------.
00903 | Print this symbol on YYOUTPUT.  |
00904 `--------------------------------*/
00905 
00906 #if (defined __STDC__ || defined __C99__FUNC__ \
00907      || defined __cplusplus || defined _MSC_VER)
00908 static void
00909 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
00910 #else
00911 static void
00912 yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp)
00913     FILE *yyoutput;
00914     int yytype;
00915     YYSTYPE const * const yyvaluep;
00916     YYLTYPE const * const yylocationp;
00917 #endif
00918 {
00919   if (yytype < YYNTOKENS)
00920     YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
00921   else
00922     YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
00923 
00924   YY_LOCATION_PRINT (yyoutput, *yylocationp);
00925   YYFPRINTF (yyoutput, ": ");
00926   yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp);
00927   YYFPRINTF (yyoutput, ")");
00928 }
00929 
00930 /*------------------------------------------------------------------.
00931 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
00932 | TOP (included).                                                   |
00933 `------------------------------------------------------------------*/
00934 
00935 #if (defined __STDC__ || defined __C99__FUNC__ \
00936      || defined __cplusplus || defined _MSC_VER)
00937 static void
00938 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
00939 #else
00940 static void
00941 yy_stack_print (bottom, top)
00942     yytype_int16 *bottom;
00943     yytype_int16 *top;
00944 #endif
00945 {
00946   YYFPRINTF (stderr, "Stack now");
00947   for (; bottom <= top; ++bottom)
00948     YYFPRINTF (stderr, " %d", *bottom);
00949   YYFPRINTF (stderr, "\n");
00950 }
00951 
00952 # define YY_STACK_PRINT(Bottom, Top)            \
00953 do {                       \
00954   if (yydebug)                   \
00955     yy_stack_print ((Bottom), (Top));           \
00956 } while (YYID (0))
00957 
00958 
00959 /*------------------------------------------------.
00960 | Report that the YYRULE is going to be reduced.  |
00961 `------------------------------------------------*/
00962 
00963 #if (defined __STDC__ || defined __C99__FUNC__ \
00964      || defined __cplusplus || defined _MSC_VER)
00965 static void
00966 yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule)
00967 #else
00968 static void
00969 yy_reduce_print (yyvsp, yylsp, yyrule)
00970     YYSTYPE *yyvsp;
00971     YYLTYPE *yylsp;
00972     int yyrule;
00973 #endif
00974 {
00975   int yynrhs = yyr2[yyrule];
00976   int yyi;
00977   unsigned long int yylno = yyrline[yyrule];
00978   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
00979         yyrule - 1, yylno);
00980   /* The symbols being reduced.  */
00981   for (yyi = 0; yyi < yynrhs; yyi++)
00982     {
00983       fprintf (stderr, "   $%d = ", yyi + 1);
00984       yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
00985              &(yyvsp[(yyi + 1) - (yynrhs)])
00986              , &(yylsp[(yyi + 1) - (yynrhs)])             );
00987       fprintf (stderr, "\n");
00988     }
00989 }
00990 
00991 # define YY_REDUCE_PRINT(Rule)      \
00992 do {              \
00993   if (yydebug)          \
00994     yy_reduce_print (yyvsp, yylsp, Rule); \
00995 } while (YYID (0))
00996 
00997 /* Nonzero means print parse trace.  It is left uninitialized so that
00998    multiple parsers can coexist.  */
00999 int yydebug;
01000 #else /* !YYDEBUG */
01001 # define YYDPRINTF(Args)
01002 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
01003 # define YY_STACK_PRINT(Bottom, Top)
01004 # define YY_REDUCE_PRINT(Rule)
01005 #endif /* !YYDEBUG */
01006 
01007 
01008 /* YYINITDEPTH -- initial size of the parser's stacks.  */
01009 #ifndef  YYINITDEPTH
01010 # define YYINITDEPTH 200
01011 #endif
01012 
01013 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
01014    if the built-in stack extension method is used).
01015 
01016    Do not make this value too large; the results are undefined if
01017    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
01018    evaluated with infinite-precision integer arithmetic.  */
01019 
01020 #ifndef YYMAXDEPTH
01021 # define YYMAXDEPTH 10000
01022 #endif
01023 
01024 
01025 
01026 #if YYERROR_VERBOSE
01027 
01028 # ifndef yystrlen
01029 #  if defined __GLIBC__ && defined _STRING_H
01030 #   define yystrlen strlen
01031 #  else
01032 /* Return the length of YYSTR.  */
01033 #if (defined __STDC__ || defined __C99__FUNC__ \
01034      || defined __cplusplus || defined _MSC_VER)
01035 static YYSIZE_T
01036 yystrlen (const char *yystr)
01037 #else
01038 static YYSIZE_T
01039 yystrlen (yystr)
01040     const char *yystr;
01041 #endif
01042 {
01043   YYSIZE_T yylen;
01044   for (yylen = 0; yystr[yylen]; yylen++)
01045     continue;
01046   return yylen;
01047 }
01048 #  endif
01049 # endif
01050 
01051 # ifndef yystpcpy
01052 #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
01053 #   define yystpcpy stpcpy
01054 #  else
01055 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
01056    YYDEST.  */
01057 #if (defined __STDC__ || defined __C99__FUNC__ \
01058      || defined __cplusplus || defined _MSC_VER)
01059 static char *
01060 yystpcpy (char *yydest, const char *yysrc)
01061 #else
01062 static char *
01063 yystpcpy (yydest, yysrc)
01064     char *yydest;
01065     const char *yysrc;
01066 #endif
01067 {
01068   char *yyd = yydest;
01069   const char *yys = yysrc;
01070 
01071   while ((*yyd++ = *yys++) != '\0')
01072     continue;
01073 
01074   return yyd - 1;
01075 }
01076 #  endif
01077 # endif
01078 
01079 # ifndef yytnamerr
01080 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
01081    quotes and backslashes, so that it's suitable for yyerror.  The
01082    heuristic is that double-quoting is unnecessary unless the string
01083    contains an apostrophe, a comma, or backslash (other than
01084    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
01085    null, do not copy; instead, return the length of what the result
01086    would have been.  */
01087 static