Sat Nov 1 06:28:23 2008

Asterisk developer's documentation


ast_expr2.c

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