Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

bif_parse.cc

Go to the documentation of this file.
00001 /* A Bison parser, made by GNU Bison 1.875c.  */
00002 
00003 /* Skeleton parser for Yacc-like parsing with Bison,
00004    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 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., 59 Temple Place - Suite 330,
00019    Boston, MA 02111-1307, 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 /* Written by Richard Stallman by simplifying the original so called
00027    ``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 /* Skeleton name.  */
00040 #define YYSKELETON_NAME "yacc.c"
00041 
00042 /* Pure parsers.  */
00043 #define YYPURE 0
00044 
00045 /* Using locations.  */
00046 #define YYLSP_NEEDED 0
00047 
00048 
00049 
00050 /* Tokens.  */
00051 #ifndef YYTOKENTYPE
00052 # define YYTOKENTYPE
00053    /* Put the tokens into the symbol table, so that GDB and other debuggers
00054       know about them.  */
00055    enum yytokentype {
00056      TOK_LPP = 258,
00057      TOK_RPP = 259,
00058      TOK_LPB = 260,
00059      TOK_RPB = 261,
00060      TOK_LPPB = 262,
00061      TOK_RPPB = 263,
00062      TOK_VAR_ARG = 264,
00063      TOK_BOOL = 265,
00064      TOK_FUNCTION = 266,
00065      TOK_REWRITER = 267,
00066      TOK_EVENT = 268,
00067      TOK_CONST = 269,
00068      TOK_ENUM = 270,
00069      TOK_WRITE = 271,
00070      TOK_PUSH = 272,
00071      TOK_EOF = 273,
00072      TOK_TRACE = 274,
00073      TOK_ARGS = 275,
00074      TOK_ARG = 276,
00075      TOK_ARGC = 277,
00076      TOK_ID = 278,
00077      TOK_ATTR = 279,
00078      TOK_CSTR = 280,
00079      TOK_LF = 281,
00080      TOK_WS = 282,
00081      TOK_COMMENT = 283,
00082      TOK_ATOM = 284,
00083      TOK_C_TOKEN = 285
00084    };
00085 #endif
00086 #define TOK_LPP 258
00087 #define TOK_RPP 259
00088 #define TOK_LPB 260
00089 #define TOK_RPB 261
00090 #define TOK_LPPB 262
00091 #define TOK_RPPB 263
00092 #define TOK_VAR_ARG 264
00093 #define TOK_BOOL 265
00094 #define TOK_FUNCTION 266
00095 #define TOK_REWRITER 267
00096 #define TOK_EVENT 268
00097 #define TOK_CONST 269
00098 #define TOK_ENUM 270
00099 #define TOK_WRITE 271
00100 #define TOK_PUSH 272
00101 #define TOK_EOF 273
00102 #define TOK_TRACE 274
00103 #define TOK_ARGS 275
00104 #define TOK_ARG 276
00105 #define TOK_ARGC 277
00106 #define TOK_ID 278
00107 #define TOK_ATTR 279
00108 #define TOK_CSTR 280
00109 #define TOK_LF 281
00110 #define TOK_WS 282
00111 #define TOK_COMMENT 283
00112 #define TOK_ATOM 284
00113 #define TOK_C_TOKEN 285
00114 
00115 
00116 
00117 
00118 /* Copy the first part of user declarations.  */
00119 #line 1 "../src/builtin-func.y"
00120 
00121 #include <vector>
00122 #include <stdio.h>
00123 #include <stdlib.h>
00124 
00125 extern int line_number;
00126 extern char* input_filename;
00127 
00128 #define print_line_directive(fp) fprintf(fp, "\n#line %d \"%s\"\n", line_number, input_filename)
00129 
00130 extern FILE* fp_bro_init;
00131 extern FILE* fp_func_def;
00132 extern FILE* fp_func_h;
00133 extern FILE* fp_func_init;
00134 extern FILE* fp_netvar_h;
00135 extern FILE* fp_netvar_def;
00136 extern FILE* fp_netvar_init;
00137 
00138 int in_c_code = 0;
00139 int definition_type;
00140 const char* bro_prefix;
00141 const char* c_prefix;
00142 
00143 enum {
00144         C_SEGMENT_DEF,
00145         FUNC_DEF,
00146         REWRITER_DEF,
00147         EVENT_DEF,
00148 };
00149 
00150 void set_definition_type(int type)
00151         {
00152         definition_type = type;
00153         switch ( type ) {
00154         case FUNC_DEF:
00155                 bro_prefix = "";
00156                 c_prefix = "bro_";
00157                 break;
00158 
00159         case REWRITER_DEF:
00160                 bro_prefix = "rewrite_";
00161                 c_prefix = "bro_rewrite_";
00162                 break;
00163 
00164         case EVENT_DEF:
00165                 bro_prefix = "";
00166                 break;
00167 
00168         case C_SEGMENT_DEF:
00169                 break;
00170         }
00171         }
00172 
00173 const char* arg_list_name = "BiF_ARGS";
00174 const char* trace_rewriter_name = "trace_rewriter";
00175 
00176 #include "bif_arg.h"
00177 
00178 int var_arg; // whether the number of arguments is variable
00179 std::vector<BuiltinFuncArg*> args;
00180 
00181 extern const char* decl_name;
00182 extern int yyerror(const char[]);
00183 extern int yylex();
00184 
00185 char* concat(char* str1, char* str2)
00186         {
00187         int len1 = strlen(str1);
00188         int len2 = strlen(str2);
00189 
00190         char* s = new char[len1 + len2 +1];
00191 
00192         memcpy(s, str1, len1);
00193         memcpy(s + len1, str2, len2);
00194 
00195         s[len1+len2] = '\0';
00196 
00197         return s;
00198         }
00199 
00200 
00201 /* Enabling traces.  */
00202 #ifndef YYDEBUG
00203 # define YYDEBUG 1
00204 #endif
00205 
00206 /* Enabling verbose error messages.  */
00207 #ifdef YYERROR_VERBOSE
00208 # undef YYERROR_VERBOSE
00209 # define YYERROR_VERBOSE 1
00210 #else
00211 # define YYERROR_VERBOSE 0
00212 #endif
00213 
00214 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
00215 #line 95 "../src/builtin-func.y"
00216 typedef union YYSTYPE {
00217         char* str;
00218         int val;
00219 } YYSTYPE;
00220 /* Line 191 of yacc.c.  */
00221 #line 222 "y.tab.c"
00222 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
00223 # define YYSTYPE_IS_DECLARED 1
00224 # define YYSTYPE_IS_TRIVIAL 1
00225 #endif
00226 
00227 
00228 
00229 /* Copy the second part of user declarations.  */
00230 
00231 
00232 /* Line 214 of yacc.c.  */
00233 #line 234 "y.tab.c"
00234 
00235 #if ! defined (yyoverflow) || YYERROR_VERBOSE
00236 
00237 /* The parser invokes alloca or malloc; define the necessary symbols.  */
00238 
00239 # ifdef YYSTACK_USE_ALLOCA
00240 #  if YYSTACK_USE_ALLOCA
00241 #   define YYSTACK_ALLOC alloca
00242 #  endif
00243 # else
00244 #  if defined (alloca) || defined (_ALLOCA_H)
00245 #   define YYSTACK_ALLOC alloca
00246 #  else
00247 #   ifdef __GNUC__
00248 #    define YYSTACK_ALLOC __builtin_alloca
00249 #   endif
00250 #  endif
00251 # endif
00252 
00253 # ifdef YYSTACK_ALLOC
00254    /* Pacify GCC's `empty if-body' warning. */
00255 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
00256 # else
00257 #  if defined (__STDC__) || defined (__cplusplus)
00258 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
00259 #   define YYSIZE_T size_t
00260 #  endif
00261 #  define YYSTACK_ALLOC malloc
00262 #  define YYSTACK_FREE free
00263 # endif
00264 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
00265 
00266 
00267 #if (! defined (yyoverflow) \
00268      && (! defined (__cplusplus) \
00269          || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
00270 
00271 /* A type that is properly aligned for any stack member.  */
00272 union yyalloc
00273 {
00274   short yyss;
00275   YYSTYPE yyvs;
00276   };
00277 
00278 /* The size of the maximum gap between one aligned stack and the next.  */
00279 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
00280 
00281 /* The size of an array large to enough to hold all stacks, each with
00282    N elements.  */
00283 # define YYSTACK_BYTES(N) \
00284      ((N) * (sizeof (short) + sizeof (YYSTYPE))                         \
00285       + YYSTACK_GAP_MAXIMUM)
00286 
00287 /* Copy COUNT objects from FROM to TO.  The source and destination do
00288    not overlap.  */
00289 # ifndef YYCOPY
00290 #  if defined (__GNUC__) && 1 < __GNUC__
00291 #   define YYCOPY(To, From, Count) \
00292       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
00293 #  else
00294 #   define YYCOPY(To, From, Count)              \
00295       do                                        \
00296         {                                       \
00297           register YYSIZE_T yyi;                \
00298           for (yyi = 0; yyi < (Count); yyi++)   \
00299             (To)[yyi] = (From)[yyi];            \
00300         }                                       \
00301       while (0)
00302 #  endif
00303 # endif
00304 
00305 /* Relocate STACK from its old location to the new one.  The
00306    local variables YYSIZE and YYSTACKSIZE give the old and new number of
00307    elements in the stack, and YYPTR gives the new location of the
00308    stack.  Advance YYPTR to a properly aligned location for the next
00309    stack.  */
00310 # define YYSTACK_RELOCATE(Stack)                                        \
00311     do                                                                  \
00312       {                                                                 \
00313         YYSIZE_T yynewbytes;                                            \
00314         YYCOPY (&yyptr->Stack, Stack, yysize);                          \
00315         Stack = &yyptr->Stack;                                          \
00316         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
00317         yyptr += yynewbytes / sizeof (*yyptr);                          \
00318       }                                                                 \
00319     while (0)
00320 
00321 #endif
00322 
00323 #if defined (__STDC__) || defined (__cplusplus)
00324    typedef signed char yysigned_char;
00325 #else
00326    typedef short yysigned_char;
00327 #endif
00328 
00329 /* YYFINAL -- State number of the termination state. */
00330 #define YYFINAL  3
00331 /* YYLAST -- Last index in YYTABLE.  */
00332 #define YYLAST   140
00333 
00334 /* YYNTOKENS -- Number of terminals. */
00335 #define YYNTOKENS  35
00336 /* YYNNTS -- Number of nonterminals. */
00337 #define YYNNTS  35
00338 /* YYNRULES -- Number of rules. */
00339 #define YYNRULES  60
00340 /* YYNRULES -- Number of states. */
00341 #define YYNSTATES  115
00342 
00343 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
00344 #define YYUNDEFTOK  2
00345 #define YYMAXUTOK   285
00346 
00347 #define YYTRANSLATE(YYX)                                                \
00348   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
00349 
00350 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
00351 static const unsigned char yytranslate[] =
00352 {
00353        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00354        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00355        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00356        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00357        2,     2,     2,     2,    31,     2,     2,     2,     2,     2,
00358        2,     2,     2,     2,     2,     2,     2,     2,    32,    33,
00359        2,    34,     2,     2,     2,     2,     2,     2,     2,     2,
00360        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00361        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00362        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00363        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00364        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00365        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00366        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00367        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00368        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00369        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00370        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00371        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00372        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00373        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00374        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00375        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00376        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00377        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00378        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
00379        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
00380       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
00381       25,    26,    27,    28,    29,    30
00382 };
00383 
00384 #if YYDEBUG
00385 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
00386    YYRHS.  */
00387 static const unsigned char yyprhs[] =
00388 {
00389        0,     0,     3,     7,     9,    11,    13,    15,    17,    19,
00390       21,    27,    33,    39,    43,    50,    56,    57,    62,    67,
00391       72,    73,    77,    79,    81,    83,    84,    87,    92,    96,
00392       98,   100,   102,   104,   110,   114,   120,   122,   127,   131,
00393      132,   133,   136,   139,   145,   147,   151,   153,   155,   157,
00394      159,   161,   163,   165,   167,   169,   171,   173,   176,   179,
00395      182
00396 };
00397 
00398 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
00399 static const yysigned_char yyrhs[] =
00400 {
00401       36,     0,    -1,    36,    37,    69,    -1,    69,    -1,    38,
00402       -1,    39,    -1,    40,    -1,    66,    -1,    41,    -1,    44,
00403       -1,    50,    69,    53,    51,    33,    -1,    48,    69,    52,
00404       51,    61,    -1,    49,    69,    53,    51,    61,    -1,    42,
00405       43,     6,    -1,    15,    69,    23,    69,     5,    69,    -1,
00406       43,    23,    69,    31,    69,    -1,    -1,    45,    46,    47,
00407       33,    -1,    14,    69,    23,    69,    -1,    34,    69,    10,
00408       69,    -1,    -1,    47,    24,    69,    -1,    11,    -1,    12,
00409       -1,    13,    -1,    -1,    53,    60,    -1,    54,    57,    56,
00410       69,    -1,    23,    69,    55,    -1,     3,    -1,     4,    -1,
00411       58,    -1,    69,    -1,    58,    31,    69,    59,    69,    -1,
00412       69,    59,    69,    -1,    23,    69,    32,    69,    23,    -1,
00413        9,    -1,    32,    69,    23,    69,    -1,    64,    67,    65,
00414       -1,    -1,    -1,     5,    62,    -1,     6,    63,    -1,     7,
00415       62,    67,    63,     8,    -1,    69,    -1,    67,    68,    69,
00416       -1,    23,    -1,    30,    -1,    21,    -1,    20,    -1,    22,
00417       -1,    19,    -1,    16,    -1,    17,    -1,    18,    -1,    25,
00418       -1,    29,    -1,    69,    27,    -1,    69,    26,    -1,    69,
00419       28,    -1,    -1
00420 };
00421 
00422 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
00423 static const unsigned short yyrline[] =
00424 {
00425        0,   102,   102,   104,   124,   125,   126,   127,   128,   129,
00426      132,   135,   138,   141,   158,   167,   172,   175,   185,   194,
00427      200,   201,   207,   211,   215,   220,   225,   230,   253,   305,
00428      309,   312,   313,   317,   318,   322,   324,   332,   341,   349,
00429      356,   359,   410,   418,   421,   423,   427,   429,   431,   433,
00430      435,   437,   439,   441,   443,   445,   447,   451,   453,   455,
00431      463
00432 };
00433 #endif
00434 
00435 #if YYDEBUG || YYERROR_VERBOSE
00436 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
00437    First, the terminals, then, starting at YYNTOKENS, nonterminals. */
00438 static const char *const yytname[] =
00439 {
00440   "$end", "error", "$undefined", "TOK_LPP", "TOK_RPP", "TOK_LPB",
00441   "TOK_RPB", "TOK_LPPB", "TOK_RPPB", "TOK_VAR_ARG", "TOK_BOOL",
00442   "TOK_FUNCTION", "TOK_REWRITER", "TOK_EVENT", "TOK_CONST", "TOK_ENUM",
00443   "TOK_WRITE", "TOK_PUSH", "TOK_EOF", "TOK_TRACE", "TOK_ARGS", "TOK_ARG",
00444   "TOK_ARGC", "TOK_ID", "TOK_ATTR", "TOK_CSTR", "TOK_LF", "TOK_WS",
00445   "TOK_COMMENT", "TOK_ATOM", "TOK_C_TOKEN", "','", "':'", "';'", "'='",
00446   "$accept", "definitions", "definition", "event_def", "func_def",
00447   "rewriter_def", "enum_def", "enum_def_1", "enum_list", "const_def",
00448   "const_def_1", "const_init", "opt_attr", "func_prefix",
00449   "rewriter_prefix", "event_prefix", "end_of_head", "typed_head",
00450   "plain_head", "head_1", "arg_begin", "arg_end", "args", "args_1", "arg",
00451   "return_type", "body", "c_code_begin", "c_code_end", "body_start",
00452   "body_end", "c_code_segment", "c_body", "c_atom", "opt_ws", 0
00453 };
00454 #endif
00455 
00456 # ifdef YYPRINT
00457 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
00458    token YYLEX-NUM.  */
00459 static const unsigned short yytoknum[] =
00460 {
00461        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
00462      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
00463      275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
00464      285,    44,    58,    59,    61
00465 };
00466 # endif
00467 
00468 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
00469 static const unsigned char yyr1[] =
00470 {
00471        0,    35,    36,    36,    37,    37,    37,    37,    37,    37,
00472       38,    39,    40,    41,    42,    43,    43,    44,    45,    46,
00473       47,    47,    48,    49,    50,    51,    52,    53,    54,    55,
00474       56,    57,    57,    58,    58,    59,    59,    60,    61,    62,
00475       63,    64,    65,    66,    67,    67,    68,    68,    68,    68,
00476       68,    68,    68,    68,    68,    68,    68,    69,    69,    69,
00477       69
00478 };
00479 
00480 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
00481 static const unsigned char yyr2[] =
00482 {
00483        0,     2,     3,     1,     1,     1,     1,     1,     1,     1,
00484        5,     5,     5,     3,     6,     5,     0,     4,     4,     4,
00485        0,     3,     1,     1,     1,     0,     2,     4,     3,     1,
00486        1,     1,     1,     5,     3,     5,     1,     4,     3,     0,
00487        0,     2,     2,     5,     1,     3,     1,     1,     1,     1,
00488        1,     1,     1,     1,     1,     1,     1,     2,     2,     2,
00489        0
00490 };
00491 
00492 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
00493    STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
00494    means the default is an error.  */
00495 static const unsigned char yydefact[] =
00496 {
00497       60,     0,     3,     1,    39,    22,    23,    24,    60,    60,
00498       60,     4,     5,     6,     8,    16,     9,     0,    60,    60,
00499       60,     7,    58,    57,    59,    60,     0,     0,     2,     0,
00500       60,    20,     0,     0,     0,    40,    44,    60,    60,    13,
00501       60,     0,     0,    60,    25,     0,    60,    25,    25,    52,
00502       53,    54,    51,    49,    48,    50,    46,    55,    56,    47,
00503        0,    60,    18,     0,     0,    60,    60,    17,     0,     0,
00504       60,    26,     0,    31,    32,     0,     0,    43,    45,    60,
00505       60,    19,    21,    29,    28,    39,    11,    60,     0,    30,
00506       60,    60,    36,    60,    60,    12,    10,    14,    15,    41,
00507        0,    60,    27,     0,     0,    34,    40,    38,    37,    60,
00508       60,    42,    33,     0,    35
00509 };
00510 
00511 /* YYDEFGOTO[NTERM-NUM]. */
00512 static const yysigned_char yydefgoto[] =
00513 {
00514       -1,     1,    10,    11,    12,    13,    14,    15,    29,    16,
00515       17,    31,    42,    18,    19,    20,    69,    44,    45,    46,
00516       84,    90,    72,    73,    94,    71,    86,    25,    60,    87,
00517      107,    21,    35,    61,    36
00518 };
00519 
00520 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
00521    STATE-NUM.  */
00522 #define YYPACT_NINF -47
00523 static const yysigned_char yypact[] =
00524 {
00525      -47,    60,   -14,   -47,   -47,   -47,   -47,   -47,   -47,   -47,
00526      -47,   -47,   -47,   -47,   -47,   -47,   -47,   -27,   -47,   -47,
00527      -47,   -47,   -47,   -47,   -47,   -47,    58,    69,   -14,     9,
00528      -47,   -47,    76,    76,    76,    95,   -14,   -47,   -47,   -47,
00529      -47,    -5,   -22,   -47,   -47,   -16,   -47,   -47,   -47,   -47,
00530      -47,   -47,   -47,   -47,   -47,   -47,   -47,   -47,   -47,   -47,
00531       25,   -47,   -14,     1,   100,   -47,   -47,   -47,    -2,    36,
00532      -47,   -47,    38,    16,     8,    36,    15,   -47,   -14,   -47,
00533      -47,   -14,   -14,   -47,   -47,   -47,   -47,   -47,   106,   -47,
00534      -47,   -47,   -47,   -47,   -47,   -47,   -47,   -14,   -14,   -47,
00535       33,   -47,   -14,     8,    50,   -14,   -47,   -47,   -14,   -47,
00536      -47,   -47,   -14,   112,   -47
00537 };
00538 
00539 /* YYPGOTO[NTERM-NUM].  */
00540 static const yysigned_char yypgoto[] =
00541 {
00542      -47,   -47,   -47,   -47,   -47,   -47,   -47,   -47,   -47,   -47,
00543      -47,   -47,   -47,   -47,   -47,   -47,   -44,   -47,    11,   -47,
00544      -47,   -47,   -47,   -47,   -46,   -47,   -11,   -26,   -38,   -47,
00545      -47,   -47,   -18,   -47,     0
00546 };
00547 
00548 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
00549    positive, shift that token.  If negative, reduce the rule which
00550    number is the opposite.  If zero, do what YYDEFACT says.
00551    If YYTABLE_NINF, syntax error.  */
00552 #define YYTABLE_NINF -1
00553 static const unsigned char yytable[] =
00554 {
00555        2,    83,    66,    75,    76,    65,    79,    30,    26,    27,
00556       28,    67,    22,    23,    24,    39,    70,    92,    32,    33,
00557       34,    22,    23,    24,    22,    23,    24,    22,    23,    24,
00558       41,    93,    40,    77,    22,    23,    24,    62,    63,   106,
00559       64,    85,    89,    68,    47,    48,    74,    91,    96,    49,
00560       50,    51,    52,    53,    54,    55,    56,   109,    57,    99,
00561        3,    78,    58,    59,    95,    81,    82,     4,   111,   100,
00562       88,     5,     6,     7,     8,     9,    22,    23,    24,    97,
00563       98,    37,   110,     0,    22,    23,    24,     0,     0,     0,
00564      102,   103,    38,   104,   105,    22,    23,    24,     0,    43,
00565        0,   108,    22,    23,    24,     0,     0,     0,     0,   112,
00566      113,    49,    50,    51,    52,    53,    54,    55,    56,     0,
00567       57,     0,     0,     0,    58,    59,    22,    23,    24,   101,
00568        0,    80,    22,    23,    24,   114,     0,     0,    22,    23,
00569       24
00570 };
00571 
00572 static const yysigned_char yycheck[] =
00573 {
00574        0,     3,    24,    47,    48,    10,     5,    34,     8,     9,
00575       10,    33,    26,    27,    28,     6,    32,     9,    18,    19,
00576       20,    26,    27,    28,    26,    27,    28,    26,    27,    28,
00577       30,    23,    23,     8,    26,    27,    28,    37,    38,     6,
00578       40,     5,     4,    43,    33,    34,    46,    31,    33,    16,
00579       17,    18,    19,    20,    21,    22,    23,   103,    25,    85,
00580        0,    61,    29,    30,    75,    65,    66,     7,   106,    87,
00581       70,    11,    12,    13,    14,    15,    26,    27,    28,    79,
00582       80,    23,    32,    -1,    26,    27,    28,    -1,    -1,    -1,
00583       90,    91,    23,    93,    94,    26,    27,    28,    -1,    23,
00584       -1,   101,    26,    27,    28,    -1,    -1,    -1,    -1,   109,
00585      110,    16,    17,    18,    19,    20,    21,    22,    23,    -1,
00586       25,    -1,    -1,    -1,    29,    30,    26,    27,    28,    23,
00587       -1,    31,    26,    27,    28,    23,    -1,    -1,    26,    27,
00588       28
00589 };
00590 
00591 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
00592    symbol of state STATE-NUM.  */
00593 static const unsigned char yystos[] =
00594 {
00595        0,    36,    69,     0,     7,    11,    12,    13,    14,    15,
00596       37,    38,    39,    40,    41,    42,    44,    45,    48,    49,
00597       50,    66,    26,    27,    28,    62,    69,    69,    69,    43,
00598       34,    46,    69,    69,    69,    67,    69,    23,    23,     6,
00599       23,    69,    47,    23,    52,    53,    54,    53,    53,    16,
00600       17,    18,    19,    20,    21,    22,    23,    25,    29,    30,
00601       63,    68,    69,    69,    69,    10,    24,    33,    69,    51,
00602       32,    60,    57,    58,    69,    51,    51,     8,    69,     5,
00603       31,    69,    69,     3,    55,     5,    61,    64,    69,     4,
00604       56,    31,     9,    23,    59,    61,    33,    69,    69,    62,
00605       67,    23,    69,    69,    69,    69,     6,    65,    69,    59,
00606       32,    63,    69,    69,    23
00607 };
00608 
00609 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
00610 # define YYSIZE_T __SIZE_TYPE__
00611 #endif
00612 #if ! defined (YYSIZE_T) && defined (size_t)
00613 # define YYSIZE_T size_t
00614 #endif
00615 #if ! defined (YYSIZE_T)
00616 # if defined (__STDC__) || defined (__cplusplus)
00617 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
00618 #  define YYSIZE_T size_t
00619 # endif
00620 #endif
00621 #if ! defined (YYSIZE_T)
00622 # define YYSIZE_T unsigned int
00623 #endif
00624 
00625 #define yyerrok         (yyerrstatus = 0)
00626 #define yyclearin       (yychar = YYEMPTY)
00627 #define YYEMPTY         (-2)
00628 #define YYEOF           0
00629 
00630 #define YYACCEPT        goto yyacceptlab
00631 #define YYABORT         goto yyabortlab
00632 #define YYERROR         goto yyerrorlab
00633 
00634 
00635 /* Like YYERROR except do call yyerror.  This remains here temporarily
00636    to ease the transition to the new meaning of YYERROR, for GCC.
00637    Once GCC version 2 has supplanted version 1, this can go.  */
00638 
00639 #define YYFAIL          goto yyerrlab
00640 
00641 #define YYRECOVERING()  (!!yyerrstatus)
00642 
00643 #define YYBACKUP(Token, Value)                                  \
00644 do                                                              \
00645   if (yychar == YYEMPTY && yylen == 1)                          \
00646     {                                                           \
00647       yychar = (Token);                                         \
00648       yylval = (Value);                                         \
00649       yytoken = YYTRANSLATE (yychar);                           \
00650       YYPOPSTACK;                                               \
00651       goto yybackup;                                            \
00652     }                                                           \
00653   else                                                          \
00654     {                                                           \
00655       yyerror ("syntax error: cannot back up");\
00656       YYERROR;                                                  \
00657     }                                                           \
00658 while (0)
00659 
00660 #define YYTERROR        1
00661 #define YYERRCODE       256
00662 
00663 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
00664    are run).  */
00665 
00666 #ifndef YYLLOC_DEFAULT
00667 # define YYLLOC_DEFAULT(Current, Rhs, N)                \
00668    ((Current).first_line   = (Rhs)[1].first_line,       \
00669     (Current).first_column = (Rhs)[1].first_column,     \
00670     (Current).last_line    = (Rhs)[N].last_line,        \
00671     (Current).last_column  = (Rhs)[N].last_column)
00672 #endif
00673 
00674 /* YYLEX -- calling `yylex' with the right arguments.  */
00675 
00676 #ifdef YYLEX_PARAM
00677 # define YYLEX yylex (YYLEX_PARAM)
00678 #else
00679 # define YYLEX yylex ()
00680 #endif
00681 
00682 /* Enable debugging if requested.  */
00683 #if YYDEBUG
00684 
00685 # ifndef YYFPRINTF
00686 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
00687 #  define YYFPRINTF fprintf
00688 # endif
00689 
00690 # define YYDPRINTF(Args)                        \
00691 do {                                            \
00692   if (yydebug)                                  \
00693     YYFPRINTF Args;                             \
00694 } while (0)
00695 
00696 # define YYDSYMPRINT(Args)                      \
00697 do {                                            \
00698   if (yydebug)                                  \
00699     yysymprint Args;                            \
00700 } while (0)
00701 
00702 # define YYDSYMPRINTF(Title, Token, Value, Location)            \
00703 do {                                                            \
00704   if (yydebug)                                                  \
00705     {                                                           \
00706       YYFPRINTF (stderr, "%s ", Title);                         \
00707       yysymprint (stderr,                                       \
00708                   Token, Value);        \
00709       YYFPRINTF (stderr, "\n");                                 \
00710     }                                                           \
00711 } while (0)
00712 
00713 /*------------------------------------------------------------------.
00714 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
00715 | TOP (included).                                                   |
00716 `------------------------------------------------------------------*/
00717 
00718 #if defined (__STDC__) || defined (__cplusplus)
00719 static void
00720 yy_stack_print (short *bottom, short *top)
00721 #else
00722 static void
00723 yy_stack_print (bottom, top)
00724     short *bottom;
00725     short *top;
00726 #endif
00727 {
00728   YYFPRINTF (stderr, "Stack now");
00729   for (/* Nothing. */; bottom <= top; ++bottom)
00730     YYFPRINTF (stderr, " %d", *bottom);
00731   YYFPRINTF (stderr, "\n");
00732 }
00733 
00734 # define YY_STACK_PRINT(Bottom, Top)                            \
00735 do {                                                            \
00736   if (yydebug)                                                  \
00737     yy_stack_print ((Bottom), (Top));                           \
00738 } while (0)
00739 
00740 
00741 /*------------------------------------------------.
00742 | Report that the YYRULE is going to be reduced.  |
00743 `------------------------------------------------*/
00744 
00745 #if defined (__STDC__) || defined (__cplusplus)
00746 static void
00747 yy_reduce_print (int yyrule)
00748 #else
00749 static void
00750 yy_reduce_print (yyrule)
00751     int yyrule;
00752 #endif
00753 {
00754   int yyi;
00755   unsigned int yylno = yyrline[yyrule];
00756   YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
00757              yyrule - 1, yylno);
00758   /* Print the symbols being reduced, and their result.  */
00759   for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
00760     YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
00761   YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
00762 }
00763 
00764 # define YY_REDUCE_PRINT(Rule)          \
00765 do {                                    \
00766   if (yydebug)                          \
00767     yy_reduce_print (Rule);             \
00768 } while (0)
00769 
00770 /* Nonzero means print parse trace.  It is left uninitialized so that
00771    multiple parsers can coexist.  */
00772 int yydebug;
00773 #else /* !YYDEBUG */
00774 # define YYDPRINTF(Args)
00775 # define YYDSYMPRINT(Args)
00776 # define YYDSYMPRINTF(Title, Token, Value, Location)
00777 # define YY_STACK_PRINT(Bottom, Top)
00778 # define YY_REDUCE_PRINT(Rule)
00779 #endif /* !YYDEBUG */
00780 
00781 
00782 /* YYINITDEPTH -- initial size of the parser's stacks.  */
00783 #ifndef YYINITDEPTH
00784 # define YYINITDEPTH 200
00785 #endif
00786 
00787 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
00788    if the built-in stack extension method is used).
00789 
00790    Do not make this value too large; the results are undefined if
00791    SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
00792    evaluated with infinite-precision integer arithmetic.  */
00793 
00794 #if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
00795 # undef YYMAXDEPTH
00796 #endif
00797 
00798 #ifndef YYMAXDEPTH
00799 # define YYMAXDEPTH 10000
00800 #endif
00801 
00802 
00803 
00804 #if YYERROR_VERBOSE
00805 
00806 # ifndef yystrlen
00807 #  if defined (__GLIBC__) && defined (_STRING_H)
00808 #   define yystrlen strlen
00809 #  else
00810 /* Return the length of YYSTR.  */
00811 static YYSIZE_T
00812 #   if defined (__STDC__) || defined (__cplusplus)
00813 yystrlen (const char *yystr)
00814 #   else
00815 yystrlen (yystr)
00816      const char *yystr;
00817 #   endif
00818 {
00819   register const char *yys = yystr;
00820 
00821   while (*yys++ != '\0')
00822     continue;
00823 
00824   return yys - yystr - 1;
00825 }
00826 #  endif
00827 # endif
00828 
00829 # ifndef yystpcpy
00830 #  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
00831 #   define yystpcpy stpcpy
00832 #  else
00833 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
00834    YYDEST.  */
00835 static char *
00836 #   if defined (__STDC__) || defined (__cplusplus)
00837 yystpcpy (char *yydest, const char *yysrc)
00838 #   else
00839 yystpcpy (yydest, yysrc)
00840      char *yydest;
00841      const char *yysrc;
00842 #   endif
00843 {
00844   register char *yyd = yydest;
00845   register const char *yys = yysrc;
00846 
00847   while ((*yyd++ = *yys++) != '\0')
00848     continue;
00849 
00850   return yyd - 1;
00851 }
00852 #  endif
00853 # endif
00854 
00855 #endif /* !YYERROR_VERBOSE */
00856 
00857 
00858 
00859 #if YYDEBUG
00860 /*--------------------------------.
00861 | Print this symbol on YYOUTPUT.  |
00862 `--------------------------------*/
00863 
00864 #if defined (__STDC__) || defined (__cplusplus)
00865 static void
00866 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
00867 #else
00868 static void
00869 yysymprint (yyoutput, yytype, yyvaluep)
00870     FILE *yyoutput;
00871     int yytype;
00872     YYSTYPE *yyvaluep;
00873 #endif
00874 {
00875   /* Pacify ``unused variable'' warnings.  */
00876   (void) yyvaluep;
00877 
00878   if (yytype < YYNTOKENS)
00879     {
00880       YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
00881 # ifdef YYPRINT
00882       YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
00883 # endif
00884     }
00885   else
00886     YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
00887 
00888   switch (yytype)
00889     {
00890       default:
00891         break;
00892     }
00893   YYFPRINTF (yyoutput, ")");
00894 }
00895 
00896 #endif /* ! YYDEBUG */
00897 /*-----------------------------------------------.
00898 | Release the memory associated to this symbol.  |
00899 `-----------------------------------------------*/
00900 
00901 #if defined (__STDC__) || defined (__cplusplus)
00902 static void
00903 yydestruct (int yytype, YYSTYPE *yyvaluep)
00904 #else
00905 static void
00906 yydestruct (yytype, yyvaluep)
00907     int yytype;
00908     YYSTYPE *yyvaluep;
00909 #endif
00910 {
00911   /* Pacify ``unused variable'' warnings.  */
00912   (void) yyvaluep;
00913 
00914   switch (yytype)
00915     {
00916 
00917       default:
00918         break;
00919     }
00920 }
00921 
00922 
00923 /* Prevent warnings from -Wmissing-prototypes.  */
00924 
00925 #ifdef YYPARSE_PARAM
00926 # if defined (__STDC__) || defined (__cplusplus)
00927 int yyparse (void *YYPARSE_PARAM);
00928 # else
00929 int yyparse ();
00930 # endif
00931 #else /* ! YYPARSE_PARAM */
00932 #if defined (__STDC__) || defined (__cplusplus)
00933 int yyparse (void);
00934 #else
00935 int yyparse ();
00936 #endif
00937 #endif /* ! YYPARSE_PARAM */
00938 
00939 
00940 
00941 /* The lookahead symbol.  */
00942 int yychar;
00943 
00944 /* The semantic value of the lookahead symbol.  */
00945 YYSTYPE yylval;
00946 
00947 /* Number of syntax errors so far.  */
00948 int yynerrs;
00949 
00950 
00951 
00952 /*----------.
00953 | yyparse.  |
00954 `----------*/
00955 
00956 #ifdef YYPARSE_PARAM
00957 # if defined (__STDC__) || defined (__cplusplus)
00958 int yyparse (void *YYPARSE_PARAM)
00959 # else
00960 int yyparse (YYPARSE_PARAM)
00961   void *YYPARSE_PARAM;
00962 # endif
00963 #else /* ! YYPARSE_PARAM */
00964 #if defined (__STDC__) || defined (__cplusplus)
00965 int
00966 yyparse (void)
00967 #else
00968 int
00969 yyparse ()
00970 
00971 #endif
00972 #endif
00973 {
00974   
00975   register int yystate;
00976   register int yyn;
00977   int yyresult;
00978   /* Number of tokens to shift before error messages enabled.  */
00979   int yyerrstatus;
00980   /* Lookahead token as an internal (translated) token number.  */
00981   int yytoken = 0;
00982 
00983   /* Three stacks and their tools:
00984      `yyss': related to states,
00985      `yyvs': related to semantic values,
00986      `yyls': related to locations.
00987 
00988      Refer to the stacks thru separate pointers, to allow yyoverflow
00989      to reallocate them elsewhere.  */
00990 
00991   /* The state stack.  */
00992   short yyssa[YYINITDEPTH];
00993   short *yyss = yyssa;
00994   register short *yyssp;
00995 
00996   /* The semantic value stack.  */
00997   YYSTYPE yyvsa[YYINITDEPTH];
00998   YYSTYPE *yyvs = yyvsa;
00999   register YYSTYPE *yyvsp;
01000 
01001 
01002 
01003 #define YYPOPSTACK   (yyvsp--, yyssp--)
01004 
01005   YYSIZE_T yystacksize = YYINITDEPTH;
01006 
01007   /* The variables used to return semantic value and location from the
01008      action routines.  */
01009   YYSTYPE yyval;
01010 
01011 
01012   /* When reducing, the number of symbols on the RHS of the reduced
01013      rule.  */
01014   int yylen;
01015 
01016   YYDPRINTF ((stderr, "Starting parse\n"));
01017 
01018   yystate = 0;
01019   yyerrstatus = 0;
01020   yynerrs = 0;
01021   yychar = YYEMPTY;             /* Cause a token to be read.  */
01022 
01023   /* Initialize stack pointers.
01024      Waste one element of value and location stack
01025      so that they stay on the same level as the state stack.
01026      The wasted elements are never initialized.  */
01027 
01028   yyssp = yyss;
01029   yyvsp = yyvs;
01030 
01031   goto yysetstate;
01032 
01033 /*------------------------------------------------------------.
01034 | yynewstate -- Push a new state, which is found in yystate.  |
01035 `------------------------------------------------------------*/
01036  yynewstate:
01037   /* In all cases, when you get here, the value and location stacks
01038      have just been pushed. so pushing a state here evens the stacks.
01039      */
01040   yyssp++;
01041 
01042  yysetstate:
01043   *yyssp = yystate;
01044 
01045   if (yyss + yystacksize - 1 <= yyssp)
01046     {
01047       /* Get the current used size of the three stacks, in elements.  */
01048       YYSIZE_T yysize = yyssp - yyss + 1;
01049 
01050 #ifdef yyoverflow
01051       {
01052         /* Give user a chance to reallocate the stack. Use copies of
01053            these so that the &'s don't force the real ones into
01054            memory.  */
01055         YYSTYPE *yyvs1 = yyvs;
01056         short *yyss1 = yyss;
01057 
01058 
01059         /* Each stack pointer address is followed by the size of the
01060            data in use in that stack, in bytes.  This used to be a
01061            conditional around just the two extra args, but that might
01062            be undefined if yyoverflow is a macro.  */
01063         yyoverflow ("parser stack overflow",
01064                     &yyss1, yysize * sizeof (*yyssp),
01065                     &yyvs1, yysize * sizeof (*yyvsp),
01066 
01067                     &yystacksize);
01068 
01069         yyss = yyss1;
01070         yyvs = yyvs1;
01071       }
01072 #else /* no yyoverflow */
01073 # ifndef YYSTACK_RELOCATE
01074       goto yyoverflowlab;
01075 # else
01076       /* Extend the stack our own way.  */
01077       if (YYMAXDEPTH <= yystacksize)
01078         goto yyoverflowlab;
01079       yystacksize *= 2;
01080       if (YYMAXDEPTH < yystacksize)
01081         yystacksize = YYMAXDEPTH;
01082 
01083       {
01084         short *yyss1 = yyss;
01085         union yyalloc *yyptr =
01086           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
01087         if (! yyptr)
01088           goto yyoverflowlab;
01089         YYSTACK_RELOCATE (yyss);
01090         YYSTACK_RELOCATE (yyvs);
01091 
01092 #  undef YYSTACK_RELOCATE
01093         if (yyss1 != yyssa)
01094           YYSTACK_FREE (yyss1);
01095       }
01096 # endif
01097 #endif /* no yyoverflow */
01098 
01099       yyssp = yyss + yysize - 1;
01100       yyvsp = yyvs + yysize - 1;
01101 
01102 
01103       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
01104                   (unsigned long int) yystacksize));
01105 
01106       if (yyss + yystacksize - 1 <= yyssp)
01107         YYABORT;
01108     }
01109 
01110   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
01111 
01112   goto yybackup;
01113 
01114 /*-----------.
01115 | yybackup.  |
01116 `-----------*/
01117 yybackup:
01118 
01119 /* Do appropriate processing given the current state.  */
01120 /* Read a lookahead token if we need one and don't already have one.  */
01121 /* yyresume: */
01122 
01123   /* First try to decide what to do without reference to lookahead token.  */
01124 
01125   yyn = yypact[yystate];
01126   if (yyn == YYPACT_NINF)
01127     goto yydefault;
01128 
01129   /* Not known => get a lookahead token if don't already have one.  */
01130 
01131   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
01132   if (yychar == YYEMPTY)
01133     {
01134       YYDPRINTF ((stderr, "Reading a token: "));
01135       yychar = YYLEX;
01136     }
01137 
01138   if (yychar <= YYEOF)
01139     {
01140       yychar = yytoken = YYEOF;
01141       YYDPRINTF ((stderr, "Now at end of input.\n"));
01142     }
01143   else
01144     {
01145       yytoken = YYTRANSLATE (yychar);
01146       YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
01147     }
01148 
01149   /* If the proper action on seeing token YYTOKEN is to reduce or to
01150      detect an error, take that action.  */
01151   yyn += yytoken;
01152   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
01153     goto yydefault;
01154   yyn = yytable[yyn];
01155   if (yyn <= 0)
01156     {
01157       if (yyn == 0 || yyn == YYTABLE_NINF)
01158         goto yyerrlab;
01159       yyn = -yyn;
01160       goto yyreduce;
01161     }
01162 
01163   if (yyn == YYFINAL)
01164     YYACCEPT;
01165 
01166   /* Shift the lookahead token.  */
01167   YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
01168 
01169   /* Discard the token being shifted unless it is eof.  */
01170   if (yychar != YYEOF)
01171     yychar = YYEMPTY;
01172 
01173   *++yyvsp = yylval;
01174 
01175 
01176   /* Count tokens shifted since error; after three, turn off error
01177      status.  */
01178   if (yyerrstatus)
01179     yyerrstatus--;
01180 
01181   yystate = yyn;
01182   goto yynewstate;
01183 
01184 
01185 /*-----------------------------------------------------------.
01186 | yydefault -- do the default action for the current state.  |
01187 `-----------------------------------------------------------*/
01188 yydefault:
01189   yyn = yydefact[yystate];
01190   if (yyn == 0)
01191     goto yyerrlab;
01192   goto yyreduce;
01193 
01194 
01195 /*-----------------------------.
01196 | yyreduce -- Do a reduction.  |
01197 `-----------------------------*/
01198 yyreduce:
01199   /* yyn is the number of a rule to reduce with.  */
01200   yylen = yyr2[yyn];
01201 
01202   /* If YYLEN is nonzero, implement the default value of the action:
01203      `$$ = $1'.
01204 
01205      Otherwise, the following line sets YYVAL to garbage.
01206      This behavior is undocumented and Bison
01207      users should not rely upon it.  Assigning to YYVAL
01208      unconditionally makes the parser a bit smaller, and it avoids a
01209      GCC warning that YYVAL may be used uninitialized.  */
01210   yyval = yyvsp[1-yylen];
01211 
01212 
01213   YY_REDUCE_PRINT (yyn);
01214   switch (yyn)
01215     {
01216         case 2:
01217 #line 103 "../src/builtin-func.y"
01218     { fprintf(fp_func_def, "%s", yyvsp[0].str); }
01219     break;
01220 
01221   case 3:
01222 #line 105 "../src/builtin-func.y"
01223     {
01224                         char auto_gen_comment[1024 + strlen(input_filename)];
01225 
01226                         sprintf(auto_gen_comment,
01227                                 "This file was automatically generated by bifcl from %s.",
01228                                 input_filename);
01229 
01230                         fprintf(fp_bro_init, "# %s\n\n", auto_gen_comment);
01231                         fprintf(fp_func_def, "// %s\n\n", auto_gen_comment);
01232                         fprintf(fp_func_h, "// %s\n\n", auto_gen_comment);
01233                         fprintf(fp_func_init, "// %s\n\n", auto_gen_comment);
01234                         fprintf(fp_netvar_def, "// %s\n\n", auto_gen_comment);
01235                         fprintf(fp_netvar_h, "// %s\n\n", auto_gen_comment);
01236                         fprintf(fp_netvar_init, "// %s\n\n", auto_gen_comment);
01237 
01238                         fprintf(fp_func_def, "%s", yyvsp[0].str);
01239                         }
01240     break;
01241 
01242   case 13:
01243 #line 142 "../src/builtin-func.y"
01244     {
01245                         // First, put an end to the enum type decl.
01246                         fprintf(fp_bro_init, "};\n");
01247                         fprintf(fp_netvar_h, "}; }\n");
01248 
01249                         // Now generate the netvar's.
01250                         fprintf(fp_netvar_h,
01251                                 "extern EnumType* enum_%s;\n", decl_name);
01252                         fprintf(fp_netvar_def,
01253                                 "EnumType* enum_%s;\n", decl_name);
01254                         fprintf(fp_netvar_init,
01255                                 "\tenum_%s = internal_type(\"%s\")->AsEnumType();\n",
01256                                 decl_name, decl_name);
01257                         }
01258     break;
01259 
01260   case 14:
01261 #line 159 "../src/builtin-func.y"
01262     {
01263                         decl_name = yyvsp[-3].str;
01264                         fprintf(fp_bro_init, "type %s: enum %s{%s", yyvsp[-3].str, yyvsp[-2].str, yyvsp[0].str);
01265                         fprintf(fp_netvar_h, "namespace BroEnum { ");
01266                         fprintf(fp_netvar_h, "enum %s {\n", yyvsp[-3].str);
01267                         }
01268     break;
01269 
01270   case 15:
01271 #line 168 "../src/builtin-func.y"
01272     {
01273                         fprintf(fp_bro_init, "%s%s,%s", yyvsp[-3].str, yyvsp[-2].str, yyvsp[0].str);
01274                         fprintf(fp_netvar_h, "\t%s,\n", yyvsp[-3].str);
01275                         }
01276     break;
01277 
01278   case 17:
01279 #line 176 "../src/builtin-func.y"
01280     {
01281                         fprintf(fp_bro_init, ";\n");
01282                         fprintf(fp_netvar_h, "extern int %s;\n", decl_name);
01283                         fprintf(fp_netvar_def, "int %s;\n", decl_name);
01284                         fprintf(fp_netvar_init, "\t%s = internal_val(\"%s\")->AsBool();\n",
01285                                 decl_name, decl_name);
01286                         }
01287     break;
01288 
01289   case 18:
01290 #line 186 "../src/builtin-func.y"
01291     {
01292                         decl_name = yyvsp[-1].str;
01293                         fprintf(fp_bro_init, "const%s", yyvsp[-2].str);
01294                         fprintf(fp_bro_init, "%s: bool%s", yyvsp[-1].str, yyvsp[0].str);
01295                         }
01296     break;
01297 
01298   case 19:
01299 #line 195 "../src/builtin-func.y"
01300     {
01301                         fprintf(fp_bro_init, "=%s%c%s", yyvsp[-2].str, (yyvsp[-1].val) ? 'T' : 'F', yyvsp[0].str);
01302                         }
01303     break;
01304 
01305   case 21:
01306 #line 202 "../src/builtin-func.y"
01307     {
01308                         fprintf(fp_bro_init, "%s%s", yyvsp[-1].str, yyvsp[0].str);
01309                         }
01310     break;
01311 
01312   case 22:
01313 #line 208 "../src/builtin-func.y"
01314     { set_definition_type(FUNC_DEF); }
01315     break;
01316 
01317   case 23:
01318 #line 212 "../src/builtin-func.y"
01319     { set_definition_type(REWRITER_DEF); }
01320     break;
01321 
01322   case 24:
01323 #line 216 "../src/builtin-func.y"
01324     { set_definition_type(EVENT_DEF); }
01325     break;
01326 
01327   case 25:
01328 #line 220 "../src/builtin-func.y"
01329     {
01330                         fprintf(fp_bro_init, ";\n");
01331                         }
01332     break;
01333 
01334   case 26:
01335 #line 226 "../src/builtin-func.y"
01336     {
01337                         }
01338     break;
01339 
01340   case 27:
01341 #line 231 "../src/builtin-func.y"
01342     {
01343                         if ( var_arg )
01344                                 fprintf(fp_bro_init, "va_args: any");
01345                         else
01346                                 {
01347                                 if ( definition_type == REWRITER_DEF )
01348                                         fprintf(fp_bro_init, "c: connection");
01349 
01350                                 for ( int i = 0; i < (int) args.size(); ++i )
01351                                         {
01352                                         if ( i > 0 || definition_type == REWRITER_DEF )
01353                                                 fprintf(fp_bro_init, ", ");
01354                                         args[i]->PrintBro(fp_bro_init);
01355                                         }
01356                                 }
01357 
01358                         fprintf(fp_bro_init, ")");
01359 
01360                         fprintf(fp_func_def, "%s", yyvsp[0].str);
01361                         }
01362     break;
01363 
01364   case 28:
01365 #line 254 "../src/builtin-func.y"
01366     {
01367                         const char* method_type = 0;
01368                         decl_name = yyvsp[-2].str;
01369 
01370                         print_line_directive(fp_func_def);
01371 
01372                         if ( definition_type == FUNC_DEF || definition_type == REWRITER_DEF )
01373                                 method_type = "function";
01374                         else if ( definition_type == EVENT_DEF )
01375                                 method_type = "event";
01376 
01377                         if ( method_type )
01378                                 fprintf(fp_bro_init,
01379                                         "global %s%s: %s%s(",
01380                                         bro_prefix, decl_name, method_type, yyvsp[-1].str);
01381 
01382                         if ( definition_type == FUNC_DEF || definition_type == REWRITER_DEF )
01383                                 {
01384                                 fprintf(fp_func_init,
01385                                         "\textern Val* %s%s(val_list*);\n",
01386                                         c_prefix, decl_name);
01387 
01388                                 fprintf(fp_func_init,
01389                                         "\t(void) new BuiltinFunc(%s%s, \"%s%s\", 0);\n",
01390                                         c_prefix, decl_name, bro_prefix, decl_name);
01391 
01392                                 fprintf(fp_func_h,
01393                                         "extern Val* %s%s(val_list*);\n",
01394                                         c_prefix, decl_name);
01395 
01396                                 fprintf(fp_func_def,
01397                                         "Val* %s%s(val_list* %s)",
01398                                         c_prefix, decl_name, arg_list_name);
01399                                 }
01400                         else if ( definition_type == EVENT_DEF )
01401                                 {
01402                                 fprintf(fp_netvar_h,
01403                                         "extern EventHandlerPtr %s;\n",
01404                                         decl_name);
01405 
01406                                 fprintf(fp_netvar_def,
01407                                         "EventHandlerPtr %s;\n",
01408                                         decl_name);
01409 
01410                                 fprintf(fp_netvar_init,
01411                                         "\t%s = internal_handler(\"%s\");\n",
01412                                         decl_name, decl_name);
01413                                 }
01414                         }
01415     break;
01416 
01417   case 29:
01418 #line 306 "../src/builtin-func.y"
01419     { args.clear(); var_arg = 0; }
01420     break;
01421 
01422   case 32:
01423 #line 314 "../src/builtin-func.y"
01424     { /* empty, to avoid yacc complaint about type clash */ }
01425     break;
01426 
01427   case 34:
01428 #line 319 "../src/builtin-func.y"
01429     { /* empty */ }
01430     break;
01431 
01432   case 35:
01433 #line 323 "../src/builtin-func.y"
01434     { args.push_back(new BuiltinFuncArg(yyvsp[-4].str, yyvsp[0].str)); }
01435     break;
01436 
01437   case 36:
01438 #line 325 "../src/builtin-func.y"
01439     {
01440                         if ( definition_type == EVENT_DEF )
01441                                 yyerror("events cannot have variable arguments");
01442                         var_arg = 1;
01443                         }
01444     break;
01445 
01446   case 37:
01447 #line 333 "../src/builtin-func.y"
01448     {
01449                         BuiltinFuncArg* ret = new BuiltinFuncArg("", yyvsp[-1].str);
01450                         ret->PrintBro(fp_bro_init);
01451                         delete ret;
01452                         fprintf(fp_func_def, "%s", yyvsp[0].str);
01453                         }
01454     break;
01455 
01456   case 38:
01457 #line 342 "../src/builtin-func.y"
01458     {
01459                         fprintf(fp_func_def, " // end of %s\n", decl_name);
01460                         print_line_directive(fp_func_def);
01461                         }
01462     break;
01463 
01464   case 39:
01465 #line 349 "../src/builtin-func.y"
01466     {
01467                         in_c_code = 1;
01468                         print_line_directive(fp_func_def);
01469                         }
01470     break;
01471 
01472   case 40:
01473 #line 356 "../src/builtin-func.y"
01474     { in_c_code = 0; }
01475     break;
01476 
01477   case 41:
01478 #line 360 "../src/builtin-func.y"
01479     {
01480                         int implicit_arg = 0;
01481                         int argc = args.size();
01482 
01483                         fprintf(fp_func_def, "{");
01484                         if ( definition_type == REWRITER_DEF )
01485                                 {
01486                                 implicit_arg = 1;
01487                                 ++argc;
01488                                 }
01489 
01490                         if ( argc > 0 || ! var_arg )
01491                                 fprintf(fp_func_def, "\n");
01492 
01493                         if ( ! var_arg )
01494                                 {
01495                                 fprintf(fp_func_def, "\tif ( %s->length() != %d )\n", arg_list_name, argc);
01496                                 fprintf(fp_func_def, "\t\t{\n");
01497                                 fprintf(fp_func_def,
01498                                         "\t\trun_time(\"%s() takes exactly %d argument(s)\");\n",
01499                                         decl_name, argc);
01500                                 fprintf(fp_func_def, "\t\treturn 0;\n");
01501                                 fprintf(fp_func_def, "\t\t}\n");
01502                                 }
01503                         else if ( argc > 0 )
01504                                 {
01505                                 fprintf(fp_func_def, "\tif ( %s->length() < %d )\n", arg_list_name, argc);
01506                                 fprintf(fp_func_def, "\t\t{\n");
01507                                 fprintf(fp_func_def,
01508                                         "\t\trun_time(\"%s() takes at least %d argument(s)\");\n",
01509                                         decl_name, argc);
01510                                 fprintf(fp_func_def, "\t\treturn 0;\n");
01511                                 fprintf(fp_func_def, "\t\t}\n");
01512                                 }
01513 
01514                         if ( definition_type == REWRITER_DEF )
01515                                 {
01516                                 fprintf(fp_func_def,
01517                                         "\tTCP_Rewriter* %s = get_trace_rewriter((*%s)[0]);\n",
01518                                         trace_rewriter_name,
01519                                         arg_list_name);
01520                                 fprintf(fp_func_def, "\tif ( ! trace_rewriter )\n");
01521                                 fprintf(fp_func_def, "\t\treturn 0;\n");
01522                                 }
01523                         for ( int i = 0; i < (int) args.size(); ++i )
01524                                 args[i]->PrintCDef(fp_func_def, i + implicit_arg);
01525                         print_line_directive(fp_func_def);
01526                         }
01527