[3031] | 1 |
|
---|
| 2 | /* A Bison parser, made from parse.y
|
---|
| 3 | by GNU Bison version 1.28 */
|
---|
| 4 |
|
---|
| 5 | #define YYBISON 1 /* Identify Bison output. */
|
---|
| 6 |
|
---|
| 7 | #define CHAR 257
|
---|
| 8 | #define NUMBER 258
|
---|
| 9 | #define SECTEND 259
|
---|
| 10 | #define SCDECL 260
|
---|
| 11 | #define XSCDECL 261
|
---|
| 12 | #define NAME 262
|
---|
| 13 | #define PREVCCL 263
|
---|
| 14 | #define EOF_OP 264
|
---|
| 15 | #define OPTION_OP 265
|
---|
| 16 | #define OPT_OUTFILE 266
|
---|
| 17 | #define OPT_PREFIX 267
|
---|
| 18 | #define OPT_YYCLASS 268
|
---|
| 19 | #define OPT_HEADER 269
|
---|
| 20 | #define OPT_TABLES 270
|
---|
| 21 | #define CCE_ALNUM 271
|
---|
| 22 | #define CCE_ALPHA 272
|
---|
| 23 | #define CCE_BLANK 273
|
---|
| 24 | #define CCE_CNTRL 274
|
---|
| 25 | #define CCE_DIGIT 275
|
---|
| 26 | #define CCE_GRAPH 276
|
---|
| 27 | #define CCE_LOWER 277
|
---|
| 28 | #define CCE_PRINT 278
|
---|
| 29 | #define CCE_PUNCT 279
|
---|
| 30 | #define CCE_SPACE 280
|
---|
| 31 | #define CCE_UPPER 281
|
---|
| 32 | #define CCE_XDIGIT 282
|
---|
| 33 | #define BEGIN_REPEAT_POSIX 283
|
---|
| 34 | #define END_REPEAT_POSIX 284
|
---|
| 35 | #define BEGIN_REPEAT_FLEX 285
|
---|
| 36 | #define END_REPEAT_FLEX 286
|
---|
| 37 |
|
---|
| 38 | #line 29 "parse.y"
|
---|
| 39 |
|
---|
| 40 | /* Copyright (c) 1990 The Regents of the University of California. */
|
---|
| 41 | /* All rights reserved. */
|
---|
| 42 |
|
---|
| 43 | /* This code is derived from software contributed to Berkeley by */
|
---|
| 44 | /* Vern Paxson. */
|
---|
| 45 |
|
---|
| 46 | /* The United States Government has rights in this work pursuant */
|
---|
| 47 | /* to contract no. DE-AC03-76SF00098 between the United States */
|
---|
| 48 | /* Department of Energy and the University of California. */
|
---|
| 49 |
|
---|
| 50 | /* This file is part of flex. */
|
---|
| 51 |
|
---|
| 52 | /* Redistribution and use in source and binary forms, with or without */
|
---|
| 53 | /* modification, are permitted provided that the following conditions */
|
---|
| 54 | /* are met: */
|
---|
| 55 |
|
---|
| 56 | /* 1. Redistributions of source code must retain the above copyright */
|
---|
| 57 | /* notice, this list of conditions and the following disclaimer. */
|
---|
| 58 | /* 2. Redistributions in binary form must reproduce the above copyright */
|
---|
| 59 | /* notice, this list of conditions and the following disclaimer in the */
|
---|
| 60 | /* documentation and/or other materials provided with the distribution. */
|
---|
| 61 |
|
---|
| 62 | /* Neither the name of the University nor the names of its contributors */
|
---|
| 63 | /* may be used to endorse or promote products derived from this software */
|
---|
| 64 | /* without specific prior written permission. */
|
---|
| 65 |
|
---|
| 66 | /* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */
|
---|
| 67 | /* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
|
---|
| 68 | /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
|
---|
| 69 | /* PURPOSE. */
|
---|
| 70 |
|
---|
| 71 | /* Some versions of bison are broken in that they use alloca() but don't
|
---|
| 72 | * declare it properly. The following is the patented (just kidding!)
|
---|
| 73 | * #ifdef chud to fix the problem, courtesy of Francois Pinard.
|
---|
| 74 | */
|
---|
| 75 | #ifdef YYBISON
|
---|
| 76 | /* AIX requires this to be the first thing in the file. What a piece. */
|
---|
| 77 | # ifdef _AIX
|
---|
| 78 | #pragma alloca
|
---|
| 79 | # endif
|
---|
| 80 | #endif
|
---|
| 81 |
|
---|
| 82 | #include "flexdef.h"
|
---|
| 83 | #include "tables.h"
|
---|
| 84 |
|
---|
| 85 | /* The remainder of the alloca() cruft has to come after including flexdef.h,
|
---|
| 86 | * so HAVE_ALLOCA_H is (possibly) defined.
|
---|
| 87 | */
|
---|
| 88 | #ifdef YYBISON
|
---|
| 89 | # ifdef __GNUC__
|
---|
| 90 | # ifndef alloca
|
---|
| 91 | # define alloca __builtin_alloca
|
---|
| 92 | # endif
|
---|
| 93 | # else
|
---|
| 94 | # if HAVE_ALLOCA_H
|
---|
| 95 | # include <alloca.h>
|
---|
| 96 | # else
|
---|
| 97 | # ifdef __hpux
|
---|
| 98 | void *alloca ();
|
---|
| 99 | # else
|
---|
| 100 | # ifdef __TURBOC__
|
---|
| 101 | # include <malloc.h>
|
---|
| 102 | # else
|
---|
| 103 | char *alloca ();
|
---|
| 104 | # endif
|
---|
| 105 | # endif
|
---|
| 106 | # endif
|
---|
| 107 | # endif
|
---|
| 108 | #endif
|
---|
| 109 |
|
---|
| 110 | /* Bletch, ^^^^ that was ugly! */
|
---|
| 111 |
|
---|
| 112 |
|
---|
| 113 | int pat, scnum, eps, headcnt, trailcnt, anyccl, lastchar, i, rulelen;
|
---|
| 114 | int trlcontxt, xcluflg, currccl, cclsorted, varlength, variable_trail_rule;
|
---|
| 115 |
|
---|
| 116 | int *scon_stk;
|
---|
| 117 | int scon_stk_ptr;
|
---|
| 118 |
|
---|
| 119 | static int madeany = false; /* whether we've made the '.' character class */
|
---|
| 120 | int previous_continued_action; /* whether the previous rule's action was '|' */
|
---|
| 121 |
|
---|
| 122 | #define format_warn3(fmt, a1, a2) \
|
---|
| 123 | do{ \
|
---|
| 124 | char fw3_msg[MAXLINE];\
|
---|
| 125 | snprintf( fw3_msg, MAXLINE,(fmt), (a1), (a2) );\
|
---|
| 126 | warn( fw3_msg );\
|
---|
| 127 | }while(0)
|
---|
| 128 |
|
---|
| 129 | /* Expand a POSIX character class expression. */
|
---|
| 130 | #define CCL_EXPR(func) \
|
---|
| 131 | do{ \
|
---|
| 132 | int c; \
|
---|
| 133 | for ( c = 0; c < csize; ++c ) \
|
---|
| 134 | if ( isascii(c) && func(c) ) \
|
---|
| 135 | ccladd( currccl, c ); \
|
---|
| 136 | }while(0)
|
---|
| 137 |
|
---|
| 138 | /* While POSIX defines isblank(), it's not ANSI C. */
|
---|
| 139 | #define IS_BLANK(c) ((c) == ' ' || (c) == '\t')
|
---|
| 140 |
|
---|
| 141 | /* On some over-ambitious machines, such as DEC Alpha's, the default
|
---|
| 142 | * token type is "long" instead of "int"; this leads to problems with
|
---|
| 143 | * declaring yylval in flexdef.h. But so far, all the yacc's I've seen
|
---|
| 144 | * wrap their definitions of YYSTYPE with "#ifndef YYSTYPE"'s, so the
|
---|
| 145 | * following should ensure that the default token type is "int".
|
---|
| 146 | */
|
---|
| 147 | #define YYSTYPE int
|
---|
| 148 |
|
---|
| 149 | #ifndef YYSTYPE
|
---|
| 150 | #define YYSTYPE int
|
---|
| 151 | #endif
|
---|
| 152 | #include <stdio.h>
|
---|
| 153 |
|
---|
| 154 | #ifndef __cplusplus
|
---|
| 155 | #ifndef __STDC__
|
---|
| 156 | #define const
|
---|
| 157 | #endif
|
---|
| 158 | #endif
|
---|
| 159 |
|
---|
| 160 |
|
---|
| 161 |
|
---|
| 162 | #define YYFINAL 120
|
---|
| 163 | #define YYFLAG -32768
|
---|
| 164 | #define YYNTBASE 54
|
---|
| 165 |
|
---|
| 166 | #define YYTRANSLATE(x) ((unsigned)(x) <= 286 ? yytranslate[x] : 79)
|
---|
| 167 |
|
---|
| 168 | static const char yytranslate[] = { 0,
|
---|
| 169 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 34,
|
---|
| 170 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
| 171 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
| 172 | 2, 2, 2, 48, 2, 42, 2, 2, 2, 49,
|
---|
| 173 | 50, 40, 45, 41, 53, 47, 44, 2, 2, 2,
|
---|
| 174 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 38,
|
---|
| 175 | 33, 39, 46, 2, 2, 2, 2, 2, 2, 2,
|
---|
| 176 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
| 177 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
| 178 | 51, 2, 52, 37, 2, 2, 2, 2, 2, 2,
|
---|
| 179 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
| 180 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
| 181 | 2, 2, 35, 43, 36, 2, 2, 2, 2, 2,
|
---|
| 182 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
| 183 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
| 184 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
| 185 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
| 186 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
| 187 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
| 188 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
| 189 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
| 190 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
| 191 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
| 192 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
| 193 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
---|
| 194 | 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
|
---|
| 195 | 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
|
---|
| 196 | 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
|
---|
| 197 | 27, 28, 29, 30, 31, 32
|
---|
| 198 | };
|
---|
| 199 |
|
---|
| 200 | #if YYDEBUG != 0
|
---|
| 201 | static const short yyprhs[] = { 0,
|
---|
| 202 | 0, 6, 7, 11, 14, 15, 17, 19, 21, 23,
|
---|
| 203 | 26, 28, 30, 33, 36, 37, 41, 45, 49, 53,
|
---|
| 204 | 57, 63, 69, 70, 71, 74, 76, 78, 80, 81,
|
---|
| 205 | 86, 90, 91, 95, 97, 99, 101, 104, 108, 111,
|
---|
| 206 | 113, 117, 119, 122, 125, 127, 134, 140, 145, 148,
|
---|
| 207 | 151, 154, 161, 167, 172, 174, 176, 178, 182, 186,
|
---|
| 208 | 188, 192, 197, 202, 205, 208, 209, 211, 213, 215,
|
---|
| 209 | 217, 219, 221, 223, 225, 227, 229, 231, 233, 236
|
---|
| 210 | };
|
---|
| 211 |
|
---|
| 212 | static const short yyrhs[] = { 55,
|
---|
| 213 | 56, 57, 63, 64, 0, 0, 56, 58, 59, 0,
|
---|
| 214 | 56, 60, 0, 0, 1, 0, 5, 0, 6, 0,
|
---|
| 215 | 7, 0, 59, 8, 0, 8, 0, 1, 0, 11,
|
---|
| 216 | 61, 0, 61, 62, 0, 0, 12, 33, 8, 0,
|
---|
| 217 | 13, 33, 8, 0, 14, 33, 8, 0, 15, 33,
|
---|
| 218 | 8, 0, 16, 33, 8, 0, 63, 67, 64, 65,
|
---|
| 219 | 34, 0, 63, 67, 35, 63, 36, 0, 0, 0,
|
---|
| 220 | 37, 70, 0, 70, 0, 10, 0, 1, 0, 0,
|
---|
| 221 | 38, 66, 68, 39, 0, 38, 40, 39, 0, 0,
|
---|
| 222 | 68, 41, 69, 0, 69, 0, 1, 0, 8, 0,
|
---|
| 223 | 72, 71, 0, 72, 71, 42, 0, 71, 42, 0,
|
---|
| 224 | 71, 0, 71, 43, 73, 0, 73, 0, 71, 44,
|
---|
| 225 | 0, 73, 74, 0, 74, 0, 73, 29, 4, 41,
|
---|
| 226 | 4, 30, 0, 73, 29, 4, 41, 30, 0, 73,
|
---|
| 227 | 29, 4, 30, 0, 74, 40, 0, 74, 45, 0,
|
---|
| 228 | 74, 46, 0, 74, 31, 4, 41, 4, 32, 0,
|
---|
| 229 | 74, 31, 4, 41, 32, 0, 74, 31, 4, 32,
|
---|
| 230 | 0, 47, 0, 75, 0, 9, 0, 48, 78, 48,
|
---|
| 231 | 0, 49, 71, 50, 0, 3, 0, 51, 76, 52,
|
---|
| 232 | 0, 51, 37, 76, 52, 0, 76, 3, 53, 3,
|
---|
| 233 | 0, 76, 3, 0, 76, 77, 0, 0, 17, 0,
|
---|
| 234 | 18, 0, 19, 0, 20, 0, 21, 0, 22, 0,
|
---|
| 235 | 23, 0, 24, 0, 25, 0, 26, 0, 27, 0,
|
---|
| 236 | 28, 0, 78, 3, 0, 0
|
---|
| 237 | };
|
---|
| 238 |
|
---|
| 239 | #endif
|
---|
| 240 |
|
---|
| 241 | #if YYDEBUG != 0
|
---|
| 242 | static const short yyrline[] = { 0,
|
---|
| 243 | 142, 171, 179, 180, 181, 182, 186, 194, 197, 201,
|
---|
| 244 | 204, 207, 211, 214, 215, 218, 223, 225, 227, 229,
|
---|
| 245 | 233, 235, 237, 240, 253, 289, 313, 336, 340, 344,
|
---|
| 246 | 347, 364, 368, 370, 372, 376, 399, 455, 458, 501,
|
---|
| 247 | 519, 525, 530, 557, 565, 568, 596, 610, 632, 639,
|
---|
| 248 | 645, 651, 679, 693, 712, 734, 755, 765, 768, 771,
|
---|
| 249 | 785, 788, 795, 849, 860, 867, 875, 876, 877, 878,
|
---|
| 250 | 879, 880, 881, 882, 883, 884, 885, 891, 894, 907
|
---|
| 251 | };
|
---|
| 252 | #endif
|
---|
| 253 |
|
---|
| 254 |
|
---|
| 255 | #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
|
---|
| 256 |
|
---|
| 257 | static const char * const yytname[] = { "$","error","$undefined.","CHAR","NUMBER",
|
---|
| 258 | "SECTEND","SCDECL","XSCDECL","NAME","PREVCCL","EOF_OP","OPTION_OP","OPT_OUTFILE",
|
---|
| 259 | "OPT_PREFIX","OPT_YYCLASS","OPT_HEADER","OPT_TABLES","CCE_ALNUM","CCE_ALPHA",
|
---|
| 260 | "CCE_BLANK","CCE_CNTRL","CCE_DIGIT","CCE_GRAPH","CCE_LOWER","CCE_PRINT","CCE_PUNCT",
|
---|
| 261 | "CCE_SPACE","CCE_UPPER","CCE_XDIGIT","BEGIN_REPEAT_POSIX","END_REPEAT_POSIX",
|
---|
| 262 | "BEGIN_REPEAT_FLEX","END_REPEAT_FLEX","'='","'\\n'","'{'","'}'","'^'","'<'",
|
---|
| 263 | "'>'","'*'","','","'$'","'|'","'/'","'+'","'?'","'.'","'\\\"'","'('","')'","'['",
|
---|
| 264 | "']'","'-'","goal","initlex","sect1","sect1end","startconddecl","namelist1",
|
---|
| 265 | "options","optionlist","option","sect2","initforrule","flexrule","scon_stk_ptr",
|
---|
| 266 | "scon","namelist2","sconname","rule","re","re2","series","singleton","fullccl",
|
---|
| 267 | "ccl","ccl_expr","string", NULL
|
---|
| 268 | };
|
---|
| 269 | #endif
|
---|
| 270 |
|
---|
| 271 | static const short yyr1[] = { 0,
|
---|
| 272 | 54, 55, 56, 56, 56, 56, 57, 58, 58, 59,
|
---|
| 273 | 59, 59, 60, 61, 61, 62, 62, 62, 62, 62,
|
---|
| 274 | 63, 63, 63, 64, 65, 65, 65, 65, 66, 67,
|
---|
| 275 | 67, 67, 68, 68, 68, 69, 70, 70, 70, 70,
|
---|
| 276 | 71, 71, 72, 73, 73, 73, 73, 73, 74, 74,
|
---|
| 277 | 74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
|
---|
| 278 | 75, 75, 76, 76, 76, 76, 77, 77, 77, 77,
|
---|
| 279 | 77, 77, 77, 77, 77, 77, 77, 77, 78, 78
|
---|
| 280 | };
|
---|
| 281 |
|
---|
| 282 | static const short yyr2[] = { 0,
|
---|
| 283 | 5, 0, 3, 2, 0, 1, 1, 1, 1, 2,
|
---|
| 284 | 1, 1, 2, 2, 0, 3, 3, 3, 3, 3,
|
---|
| 285 | 5, 5, 0, 0, 2, 1, 1, 1, 0, 4,
|
---|
| 286 | 3, 0, 3, 1, 1, 1, 2, 3, 2, 1,
|
---|
| 287 | 3, 1, 2, 2, 1, 6, 5, 4, 2, 2,
|
---|
| 288 | 2, 6, 5, 4, 1, 1, 1, 3, 3, 1,
|
---|
| 289 | 3, 4, 4, 2, 2, 0, 1, 1, 1, 1,
|
---|
| 290 | 1, 1, 1, 1, 1, 1, 1, 1, 2, 0
|
---|
| 291 | };
|
---|
| 292 |
|
---|
| 293 | static const short yydefact[] = { 2,
|
---|
| 294 | 0, 6, 0, 7, 8, 9, 15, 23, 0, 4,
|
---|
| 295 | 13, 32, 12, 11, 3, 0, 0, 0, 0, 0,
|
---|
| 296 | 14, 29, 1, 24, 10, 0, 0, 0, 0, 0,
|
---|
| 297 | 0, 0, 23, 0, 16, 17, 18, 19, 20, 31,
|
---|
| 298 | 35, 36, 0, 34, 32, 28, 60, 57, 27, 0,
|
---|
| 299 | 55, 80, 0, 66, 0, 26, 40, 0, 42, 45,
|
---|
| 300 | 56, 30, 0, 22, 25, 0, 0, 66, 0, 21,
|
---|
| 301 | 39, 0, 43, 37, 0, 44, 0, 49, 50, 51,
|
---|
| 302 | 33, 79, 58, 59, 0, 64, 67, 68, 69, 70,
|
---|
| 303 | 71, 72, 73, 74, 75, 76, 77, 78, 61, 65,
|
---|
| 304 | 41, 38, 0, 0, 62, 0, 48, 0, 54, 0,
|
---|
| 305 | 63, 0, 47, 0, 53, 46, 52, 0, 0, 0
|
---|
| 306 | };
|
---|
| 307 |
|
---|
| 308 | static const short yydefgoto[] = { 118,
|
---|
| 309 | 1, 3, 8, 9, 15, 10, 11, 21, 12, 23,
|
---|
| 310 | 55, 32, 24, 43, 44, 56, 57, 58, 59, 60,
|
---|
| 311 | 61, 69, 100, 66
|
---|
| 312 | };
|
---|
| 313 |
|
---|
| 314 | static const short yypact[] = {-32768,
|
---|
| 315 | 75,-32768, 61,-32768,-32768,-32768,-32768,-32768, 29,-32768,
|
---|
| 316 | 83, 6,-32768,-32768, 24, -19, 9, 32, 37, 46,
|
---|
| 317 | -32768, 47,-32768, 57,-32768, 96, 100, 101, 102, 103,
|
---|
| 318 | 73, 30,-32768, -1,-32768,-32768,-32768,-32768,-32768,-32768,
|
---|
| 319 | -32768,-32768, -28,-32768, 67,-32768,-32768,-32768,-32768, 26,
|
---|
| 320 | -32768,-32768, 26, 76, 80,-32768, 58, 26, 42, 38,
|
---|
| 321 | -32768,-32768, 107,-32768,-32768, 1, -9,-32768, 0,-32768,
|
---|
| 322 | -32768, 26,-32768, 64, 112, 38, 113,-32768,-32768,-32768,
|
---|
| 323 | -32768,-32768,-32768,-32768, 36, 65,-32768,-32768,-32768,-32768,
|
---|
| 324 | -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
|
---|
| 325 | 42,-32768, -25, 53,-32768, 116,-32768, 3,-32768, 8,
|
---|
| 326 | -32768, 90,-32768, 89,-32768,-32768,-32768, 122, 123,-32768
|
---|
| 327 | };
|
---|
| 328 |
|
---|
| 329 | static const short yypgoto[] = {-32768,
|
---|
| 330 | -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 91, 104,
|
---|
| 331 | -32768,-32768,-32768,-32768, 62, 77, -43,-32768, 54, -58,
|
---|
| 332 | -32768, 63,-32768,-32768
|
---|
| 333 | };
|
---|
| 334 |
|
---|
| 335 |
|
---|
| 336 | #define YYLAST 131
|
---|
| 337 |
|
---|
| 338 |
|
---|
| 339 | static const short yytable[] = { 46,
|
---|
| 340 | 76, 47, 86, 82, 107, -24, 112, 48, 49, 67,
|
---|
| 341 | 62, 114, 63, 26, 74, 108, 87, 88, 89, 90,
|
---|
| 342 | 91, 92, 93, 94, 95, 96, 97, 98, 47, 13,
|
---|
| 343 | 41, 25, 113, 72, 48, 50, 14, 42, 86, 115,
|
---|
| 344 | 84, 27, 76, 22, 47, 51, 52, 53, 83, 54,
|
---|
| 345 | 48, 99, 87, 88, 89, 90, 91, 92, 93, 94,
|
---|
| 346 | 95, 96, 97, 98, 28, 4, 5, 6, 77, 29,
|
---|
| 347 | 75, 7, 51, 52, 53, 2, 54, 78, 30, -5,
|
---|
| 348 | -5, -5, 79, 80, 109, -5, 31, 105, 51, 52,
|
---|
| 349 | 53, 33, 54, 110, 16, 17, 18, 19, 20, 71,
|
---|
| 350 | 72, 73, 64, 35, 22, 102, 72, 36, 37, 38,
|
---|
| 351 | 39, 40, 68, 70, 42, 103, 104, 106, 111, 116,
|
---|
| 352 | 117, 119, 120, 45, 81, 101, 65, 34, 0, 0,
|
---|
| 353 | 85
|
---|
| 354 | };
|
---|
| 355 |
|
---|
| 356 | static const short yycheck[] = { 1,
|
---|
| 357 | 59, 3, 3, 3, 30, 0, 4, 9, 10, 53,
|
---|
| 358 | 39, 4, 41, 33, 58, 41, 17, 18, 19, 20,
|
---|
| 359 | 21, 22, 23, 24, 25, 26, 27, 28, 3, 1,
|
---|
| 360 | 1, 8, 30, 43, 9, 37, 8, 8, 3, 32,
|
---|
| 361 | 50, 33, 101, 38, 3, 47, 48, 49, 48, 51,
|
---|
| 362 | 9, 52, 17, 18, 19, 20, 21, 22, 23, 24,
|
---|
| 363 | 25, 26, 27, 28, 33, 5, 6, 7, 31, 33,
|
---|
| 364 | 29, 11, 47, 48, 49, 1, 51, 40, 33, 5,
|
---|
| 365 | 6, 7, 45, 46, 32, 11, 40, 52, 47, 48,
|
---|
| 366 | 49, 35, 51, 41, 12, 13, 14, 15, 16, 42,
|
---|
| 367 | 43, 44, 36, 8, 38, 42, 43, 8, 8, 8,
|
---|
| 368 | 8, 39, 37, 34, 8, 4, 4, 53, 3, 30,
|
---|
| 369 | 32, 0, 0, 33, 63, 72, 50, 24, -1, -1,
|
---|
| 370 | 68
|
---|
| 371 | };
|
---|
| 372 | /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
|
---|
| 373 | #line 3 "/usr/lib/bison.simple"
|
---|
| 374 | /* This file comes from bison-1.28. */
|
---|
| 375 |
|
---|
| 376 | /* Skeleton output parser for bison,
|
---|
| 377 | Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
|
---|
| 378 |
|
---|
| 379 | This program is free software; you can redistribute it and/or modify
|
---|
| 380 | it under the terms of the GNU General Public License as published by
|
---|
| 381 | the Free Software Foundation; either version 2, or (at your option)
|
---|
| 382 | any later version.
|
---|
| 383 |
|
---|
| 384 | This program is distributed in the hope that it will be useful,
|
---|
| 385 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 386 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 387 | GNU General Public License for more details.
|
---|
| 388 |
|
---|
| 389 | You should have received a copy of the GNU General Public License
|
---|
| 390 | along with this program; if not, write to the Free Software
|
---|
| 391 | Foundation, Inc., 59 Temple Place - Suite 330,
|
---|
| 392 | Boston, MA 02111-1307, USA. */
|
---|
| 393 |
|
---|
| 394 | /* As a special exception, when this file is copied by Bison into a
|
---|
| 395 | Bison output file, you may use that output file without restriction.
|
---|
| 396 | This special exception was added by the Free Software Foundation
|
---|
| 397 | in version 1.24 of Bison. */
|
---|
| 398 |
|
---|
| 399 | /* This is the parser code that is written into each bison parser
|
---|
| 400 | when the %semantic_parser declaration is not specified in the grammar.
|
---|
| 401 | It was written by Richard Stallman by simplifying the hairy parser
|
---|
| 402 | used when %semantic_parser is specified. */
|
---|
| 403 |
|
---|
| 404 | #ifndef YYSTACK_USE_ALLOCA
|
---|
| 405 | #ifdef alloca
|
---|
| 406 | #define YYSTACK_USE_ALLOCA
|
---|
| 407 | #else /* alloca not defined */
|
---|
| 408 | #ifdef __GNUC__
|
---|
| 409 | #define YYSTACK_USE_ALLOCA
|
---|
| 410 | #define alloca __builtin_alloca
|
---|
| 411 | #else /* not GNU C. */
|
---|
| 412 | #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
|
---|
| 413 | #define YYSTACK_USE_ALLOCA
|
---|
| 414 | #include <alloca.h>
|
---|
| 415 | #else /* not sparc */
|
---|
| 416 | /* We think this test detects Watcom and Microsoft C. */
|
---|
| 417 | /* This used to test MSDOS, but that is a bad idea
|
---|
| 418 | since that symbol is in the user namespace. */
|
---|
| 419 | #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
|
---|
| 420 | #if 0 /* No need for malloc.h, which pollutes the namespace;
|
---|
| 421 | instead, just don't use alloca. */
|
---|
| 422 | #include <malloc.h>
|
---|
| 423 | #endif
|
---|
| 424 | #else /* not MSDOS, or __TURBOC__ */
|
---|
| 425 | #if defined(_AIX)
|
---|
| 426 | /* I don't know what this was needed for, but it pollutes the namespace.
|
---|
| 427 | So I turned it off. rms, 2 May 1997. */
|
---|
| 428 | /* #include <malloc.h> */
|
---|
| 429 | #pragma alloca
|
---|
| 430 | #define YYSTACK_USE_ALLOCA
|
---|
| 431 | #else /* not MSDOS, or __TURBOC__, or _AIX */
|
---|
| 432 | #if 0
|
---|
| 433 | #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
|
---|
| 434 | and on HPUX 10. Eventually we can turn this on. */
|
---|
| 435 | #define YYSTACK_USE_ALLOCA
|
---|
| 436 | #define alloca __builtin_alloca
|
---|
| 437 | #endif /* __hpux */
|
---|
| 438 | #endif
|
---|
| 439 | #endif /* not _AIX */
|
---|
| 440 | #endif /* not MSDOS, or __TURBOC__ */
|
---|
| 441 | #endif /* not sparc */
|
---|
| 442 | #endif /* not GNU C */
|
---|
| 443 | #endif /* alloca not defined */
|
---|
| 444 | #endif /* YYSTACK_USE_ALLOCA not defined */
|
---|
| 445 |
|
---|
| 446 | #ifdef YYSTACK_USE_ALLOCA
|
---|
| 447 | #define YYSTACK_ALLOC alloca
|
---|
| 448 | #else
|
---|
| 449 | #define YYSTACK_ALLOC malloc
|
---|
| 450 | #endif
|
---|
| 451 |
|
---|
| 452 | /* Note: there must be only one dollar sign in this file.
|
---|
| 453 | It is replaced by the list of actions, each action
|
---|
| 454 | as one case of the switch. */
|
---|
| 455 |
|
---|
| 456 | #define yyerrok (yyerrstatus = 0)
|
---|
| 457 | #define yyclearin (yychar = YYEMPTY)
|
---|
| 458 | #define YYEMPTY -2
|
---|
| 459 | #define YYEOF 0
|
---|
| 460 | #define YYACCEPT goto yyacceptlab
|
---|
| 461 | #define YYABORT goto yyabortlab
|
---|
| 462 | #define YYERROR goto yyerrlab1
|
---|
| 463 | /* Like YYERROR except do call yyerror.
|
---|
| 464 | This remains here temporarily to ease the
|
---|
| 465 | transition to the new meaning of YYERROR, for GCC.
|
---|
| 466 | Once GCC version 2 has supplanted version 1, this can go. */
|
---|
| 467 | #define YYFAIL goto yyerrlab
|
---|
| 468 | #define YYRECOVERING() (!!yyerrstatus)
|
---|
| 469 | #define YYBACKUP(token, value) \
|
---|
| 470 | do \
|
---|
| 471 | if (yychar == YYEMPTY && yylen == 1) \
|
---|
| 472 | { yychar = (token), yylval = (value); \
|
---|
| 473 | yychar1 = YYTRANSLATE (yychar); \
|
---|
| 474 | YYPOPSTACK; \
|
---|
| 475 | goto yybackup; \
|
---|
| 476 | } \
|
---|
| 477 | else \
|
---|
| 478 | { yyerror ("syntax error: cannot back up"); YYERROR; } \
|
---|
| 479 | while (0)
|
---|
| 480 |
|
---|
| 481 | #define YYTERROR 1
|
---|
| 482 | #define YYERRCODE 256
|
---|
| 483 |
|
---|
| 484 | #ifndef YYPURE
|
---|
| 485 | #define YYLEX yylex()
|
---|
| 486 | #endif
|
---|
| 487 |
|
---|
| 488 | #ifdef YYPURE
|
---|
| 489 | #ifdef YYLSP_NEEDED
|
---|
| 490 | #ifdef YYLEX_PARAM
|
---|
| 491 | #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
|
---|
| 492 | #else
|
---|
| 493 | #define YYLEX yylex(&yylval, &yylloc)
|
---|
| 494 | #endif
|
---|
| 495 | #else /* not YYLSP_NEEDED */
|
---|
| 496 | #ifdef YYLEX_PARAM
|
---|
| 497 | #define YYLEX yylex(&yylval, YYLEX_PARAM)
|
---|
| 498 | #else
|
---|
| 499 | #define YYLEX yylex(&yylval)
|
---|
| 500 | #endif
|
---|
| 501 | #endif /* not YYLSP_NEEDED */
|
---|
| 502 | #endif
|
---|
| 503 |
|
---|
| 504 | /* If nonreentrant, generate the variables here */
|
---|
| 505 |
|
---|
| 506 | #ifndef YYPURE
|
---|
| 507 |
|
---|
| 508 | int yychar; /* the lookahead symbol */
|
---|
| 509 | YYSTYPE yylval; /* the semantic value of the */
|
---|
| 510 | /* lookahead symbol */
|
---|
| 511 |
|
---|
| 512 | #ifdef YYLSP_NEEDED
|
---|
| 513 | YYLTYPE yylloc; /* location data for the lookahead */
|
---|
| 514 | /* symbol */
|
---|
| 515 | #endif
|
---|
| 516 |
|
---|
| 517 | int yynerrs; /* number of parse errors so far */
|
---|
| 518 | #endif /* not YYPURE */
|
---|
| 519 |
|
---|
| 520 | #if YYDEBUG != 0
|
---|
| 521 | int yydebug; /* nonzero means print parse trace */
|
---|
| 522 | /* Since this is uninitialized, it does not stop multiple parsers
|
---|
| 523 | from coexisting. */
|
---|
| 524 | #endif
|
---|
| 525 |
|
---|
| 526 | /* YYINITDEPTH indicates the initial size of the parser's stacks */
|
---|
| 527 |
|
---|
| 528 | #ifndef YYINITDEPTH
|
---|
| 529 | #define YYINITDEPTH 200
|
---|
| 530 | #endif
|
---|
| 531 |
|
---|
| 532 | /* YYMAXDEPTH is the maximum size the stacks can grow to
|
---|
| 533 | (effective only if the built-in stack extension method is used). */
|
---|
| 534 |
|
---|
| 535 | #if YYMAXDEPTH == 0
|
---|
| 536 | #undef YYMAXDEPTH
|
---|
| 537 | #endif
|
---|
| 538 |
|
---|
| 539 | #ifndef YYMAXDEPTH
|
---|
| 540 | #define YYMAXDEPTH 10000
|
---|
| 541 | #endif
|
---|
| 542 | |
---|
| 543 |
|
---|
| 544 | /* Define __yy_memcpy. Note that the size argument
|
---|
| 545 | should be passed with type unsigned int, because that is what the non-GCC
|
---|
| 546 | definitions require. With GCC, __builtin_memcpy takes an arg
|
---|
| 547 | of type size_t, but it can handle unsigned int. */
|
---|
| 548 |
|
---|
| 549 | #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
|
---|
| 550 | #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
|
---|
| 551 | #else /* not GNU C or C++ */
|
---|
| 552 | #ifndef __cplusplus
|
---|
| 553 |
|
---|
| 554 | /* This is the most reliable way to avoid incompatibilities
|
---|
| 555 | in available built-in functions on various systems. */
|
---|
| 556 | static void
|
---|
| 557 | __yy_memcpy (to, from, count)
|
---|
| 558 | char *to;
|
---|
| 559 | char *from;
|
---|
| 560 | unsigned int count;
|
---|
| 561 | {
|
---|
| 562 | register char *f = from;
|
---|
| 563 | register char *t = to;
|
---|
| 564 | register int i = count;
|
---|
| 565 |
|
---|
| 566 | while (i-- > 0)
|
---|
| 567 | *t++ = *f++;
|
---|
| 568 | }
|
---|
| 569 |
|
---|
| 570 | #else /* __cplusplus */
|
---|
| 571 |
|
---|
| 572 | /* This is the most reliable way to avoid incompatibilities
|
---|
| 573 | in available built-in functions on various systems. */
|
---|
| 574 | static void
|
---|
| 575 | __yy_memcpy (char *to, char *from, unsigned int count)
|
---|
| 576 | {
|
---|
| 577 | register char *t = to;
|
---|
| 578 | register char *f = from;
|
---|
| 579 | register int i = count;
|
---|
| 580 |
|
---|
| 581 | while (i-- > 0)
|
---|
| 582 | *t++ = *f++;
|
---|
| 583 | }
|
---|
| 584 |
|
---|
| 585 | #endif
|
---|
| 586 | #endif
|
---|
| 587 | |
---|
| 588 |
|
---|
| 589 | #line 217 "/usr/lib/bison.simple"
|
---|
| 590 |
|
---|
| 591 | /* The user can define YYPARSE_PARAM as the name of an argument to be passed
|
---|
| 592 | into yyparse. The argument should have type void *.
|
---|
| 593 | It should actually point to an object.
|
---|
| 594 | Grammar actions can access the variable by casting it
|
---|
| 595 | to the proper pointer type. */
|
---|
| 596 |
|
---|
| 597 | #ifdef YYPARSE_PARAM
|
---|
| 598 | #ifdef __cplusplus
|
---|
| 599 | #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
|
---|
| 600 | #define YYPARSE_PARAM_DECL
|
---|
| 601 | #else /* not __cplusplus */
|
---|
| 602 | #define YYPARSE_PARAM_ARG YYPARSE_PARAM
|
---|
| 603 | #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
|
---|
| 604 | #endif /* not __cplusplus */
|
---|
| 605 | #else /* not YYPARSE_PARAM */
|
---|
| 606 | #define YYPARSE_PARAM_ARG
|
---|
| 607 | #define YYPARSE_PARAM_DECL
|
---|
| 608 | #endif /* not YYPARSE_PARAM */
|
---|
| 609 |
|
---|
| 610 | /* Prevent warning if -Wstrict-prototypes. */
|
---|
| 611 | #ifdef __GNUC__
|
---|
| 612 | #ifdef YYPARSE_PARAM
|
---|
| 613 | int yyparse (void *);
|
---|
| 614 | #else
|
---|
| 615 | int yyparse (void);
|
---|
| 616 | #endif
|
---|
| 617 | #endif
|
---|
| 618 |
|
---|
| 619 | int
|
---|
| 620 | yyparse(YYPARSE_PARAM_ARG)
|
---|
| 621 | YYPARSE_PARAM_DECL
|
---|
| 622 | {
|
---|
| 623 | register int yystate;
|
---|
| 624 | register int yyn;
|
---|
| 625 | register short *yyssp;
|
---|
| 626 | register YYSTYPE *yyvsp;
|
---|
| 627 | int yyerrstatus; /* number of tokens to shift before error messages enabled */
|
---|
| 628 | int yychar1 = 0; /* lookahead token as an internal (translated) token number */
|
---|
| 629 |
|
---|
| 630 | short yyssa[YYINITDEPTH]; /* the state stack */
|
---|
| 631 | YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
|
---|
| 632 |
|
---|
| 633 | short *yyss = yyssa; /* refer to the stacks thru separate pointers */
|
---|
| 634 | YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
|
---|
| 635 |
|
---|
| 636 | #ifdef YYLSP_NEEDED
|
---|
| 637 | YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
|
---|
| 638 | YYLTYPE *yyls = yylsa;
|
---|
| 639 | YYLTYPE *yylsp;
|
---|
| 640 |
|
---|
| 641 | #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
|
---|
| 642 | #else
|
---|
| 643 | #define YYPOPSTACK (yyvsp--, yyssp--)
|
---|
| 644 | #endif
|
---|
| 645 |
|
---|
| 646 | int yystacksize = YYINITDEPTH;
|
---|
| 647 | int yyfree_stacks = 0;
|
---|
| 648 |
|
---|
| 649 | #ifdef YYPURE
|
---|
| 650 | int yychar;
|
---|
| 651 | YYSTYPE yylval;
|
---|
| 652 | int yynerrs;
|
---|
| 653 | #ifdef YYLSP_NEEDED
|
---|
| 654 | YYLTYPE yylloc;
|
---|
| 655 | #endif
|
---|
| 656 | #endif
|
---|
| 657 |
|
---|
| 658 | YYSTYPE yyval; /* the variable used to return */
|
---|
| 659 | /* semantic values from the action */
|
---|
| 660 | /* routines */
|
---|
| 661 |
|
---|
| 662 | int yylen;
|
---|
| 663 |
|
---|
| 664 | #if YYDEBUG != 0
|
---|
| 665 | if (yydebug)
|
---|
| 666 | fprintf(stderr, "Starting parse\n");
|
---|
| 667 | #endif
|
---|
| 668 |
|
---|
| 669 | yystate = 0;
|
---|
| 670 | yyerrstatus = 0;
|
---|
| 671 | yynerrs = 0;
|
---|
| 672 | yychar = YYEMPTY; /* Cause a token to be read. */
|
---|
| 673 |
|
---|
| 674 | /* Initialize stack pointers.
|
---|
| 675 | Waste one element of value and location stack
|
---|
| 676 | so that they stay on the same level as the state stack.
|
---|
| 677 | The wasted elements are never initialized. */
|
---|
| 678 |
|
---|
| 679 | yyssp = yyss - 1;
|
---|
| 680 | yyvsp = yyvs;
|
---|
| 681 | #ifdef YYLSP_NEEDED
|
---|
| 682 | yylsp = yyls;
|
---|
| 683 | #endif
|
---|
| 684 |
|
---|
| 685 | /* Push a new state, which is found in yystate . */
|
---|
| 686 | /* In all cases, when you get here, the value and location stacks
|
---|
| 687 | have just been pushed. so pushing a state here evens the stacks. */
|
---|
| 688 | yynewstate:
|
---|
| 689 |
|
---|
| 690 | *++yyssp = yystate;
|
---|
| 691 |
|
---|
| 692 | if (yyssp >= yyss + yystacksize - 1)
|
---|
| 693 | {
|
---|
| 694 | /* Give user a chance to reallocate the stack */
|
---|
| 695 | /* Use copies of these so that the &'s don't force the real ones into memory. */
|
---|
| 696 | YYSTYPE *yyvs1 = yyvs;
|
---|
| 697 | short *yyss1 = yyss;
|
---|
| 698 | #ifdef YYLSP_NEEDED
|
---|
| 699 | YYLTYPE *yyls1 = yyls;
|
---|
| 700 | #endif
|
---|
| 701 |
|
---|
| 702 | /* Get the current used size of the three stacks, in elements. */
|
---|
| 703 | int size = yyssp - yyss + 1;
|
---|
| 704 |
|
---|
| 705 | #ifdef yyoverflow
|
---|
| 706 | /* Each stack pointer address is followed by the size of
|
---|
| 707 | the data in use in that stack, in bytes. */
|
---|
| 708 | #ifdef YYLSP_NEEDED
|
---|
| 709 | /* This used to be a conditional around just the two extra args,
|
---|
| 710 | but that might be undefined if yyoverflow is a macro. */
|
---|
| 711 | yyoverflow("parser stack overflow",
|
---|
| 712 | &yyss1, size * sizeof (*yyssp),
|
---|
| 713 | &yyvs1, size * sizeof (*yyvsp),
|
---|
| 714 | &yyls1, size * sizeof (*yylsp),
|
---|
| 715 | &yystacksize);
|
---|
| 716 | #else
|
---|
| 717 | yyoverflow("parser stack overflow",
|
---|
| 718 | &yyss1, size * sizeof (*yyssp),
|
---|
| 719 | &yyvs1, size * sizeof (*yyvsp),
|
---|
| 720 | &yystacksize);
|
---|
| 721 | #endif
|
---|
| 722 |
|
---|
| 723 | yyss = yyss1; yyvs = yyvs1;
|
---|
| 724 | #ifdef YYLSP_NEEDED
|
---|
| 725 | yyls = yyls1;
|
---|
| 726 | #endif
|
---|
| 727 | #else /* no yyoverflow */
|
---|
| 728 | /* Extend the stack our own way. */
|
---|
| 729 | if (yystacksize >= YYMAXDEPTH)
|
---|
| 730 | {
|
---|
| 731 | yyerror("parser stack overflow");
|
---|
| 732 | if (yyfree_stacks)
|
---|
| 733 | {
|
---|
| 734 | free (yyss);
|
---|
| 735 | free (yyvs);
|
---|
| 736 | #ifdef YYLSP_NEEDED
|
---|
| 737 | free (yyls);
|
---|
| 738 | #endif
|
---|
| 739 | }
|
---|
| 740 | return 2;
|
---|
| 741 | }
|
---|
| 742 | yystacksize *= 2;
|
---|
| 743 | if (yystacksize > YYMAXDEPTH)
|
---|
| 744 | yystacksize = YYMAXDEPTH;
|
---|
| 745 | #ifndef YYSTACK_USE_ALLOCA
|
---|
| 746 | yyfree_stacks = 1;
|
---|
| 747 | #endif
|
---|
| 748 | yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
|
---|
| 749 | __yy_memcpy ((char *)yyss, (char *)yyss1,
|
---|
| 750 | size * (unsigned int) sizeof (*yyssp));
|
---|
| 751 | yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
|
---|
| 752 | __yy_memcpy ((char *)yyvs, (char *)yyvs1,
|
---|
| 753 | size * (unsigned int) sizeof (*yyvsp));
|
---|
| 754 | #ifdef YYLSP_NEEDED
|
---|
| 755 | yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
|
---|
| 756 | __yy_memcpy ((char *)yyls, (char *)yyls1,
|
---|
| 757 | size * (unsigned int) sizeof (*yylsp));
|
---|
| 758 | #endif
|
---|
| 759 | #endif /* no yyoverflow */
|
---|
| 760 |
|
---|
| 761 | yyssp = yyss + size - 1;
|
---|
| 762 | yyvsp = yyvs + size - 1;
|
---|
| 763 | #ifdef YYLSP_NEEDED
|
---|
| 764 | yylsp = yyls + size - 1;
|
---|
| 765 | #endif
|
---|
| 766 |
|
---|
| 767 | #if YYDEBUG != 0
|
---|
| 768 | if (yydebug)
|
---|
| 769 | fprintf(stderr, "Stack size increased to %d\n", yystacksize);
|
---|
| 770 | #endif
|
---|
| 771 |
|
---|
| 772 | if (yyssp >= yyss + yystacksize - 1)
|
---|
| 773 | YYABORT;
|
---|
| 774 | }
|
---|
| 775 |
|
---|
| 776 | #if YYDEBUG != 0
|
---|
| 777 | if (yydebug)
|
---|
| 778 | fprintf(stderr, "Entering state %d\n", yystate);
|
---|
| 779 | #endif
|
---|
| 780 |
|
---|
| 781 | goto yybackup;
|
---|
| 782 | yybackup:
|
---|
| 783 |
|
---|
| 784 | /* Do appropriate processing given the current state. */
|
---|
| 785 | /* Read a lookahead token if we need one and don't already have one. */
|
---|
| 786 | /* yyresume: */
|
---|
| 787 |
|
---|
| 788 | /* First try to decide what to do without reference to lookahead token. */
|
---|
| 789 |
|
---|
| 790 | yyn = yypact[yystate];
|
---|
| 791 | if (yyn == YYFLAG)
|
---|
| 792 | goto yydefault;
|
---|
| 793 |
|
---|
| 794 | /* Not known => get a lookahead token if don't already have one. */
|
---|
| 795 |
|
---|
| 796 | /* yychar is either YYEMPTY or YYEOF
|
---|
| 797 | or a valid token in external form. */
|
---|
| 798 |
|
---|
| 799 | if (yychar == YYEMPTY)
|
---|
| 800 | {
|
---|
| 801 | #if YYDEBUG != 0
|
---|
| 802 | if (yydebug)
|
---|
| 803 | fprintf(stderr, "Reading a token: ");
|
---|
| 804 | #endif
|
---|
| 805 | yychar = YYLEX;
|
---|
| 806 | }
|
---|
| 807 |
|
---|
| 808 | /* Convert token to internal form (in yychar1) for indexing tables with */
|
---|
| 809 |
|
---|
| 810 | if (yychar <= 0) /* This means end of input. */
|
---|
| 811 | {
|
---|
| 812 | yychar1 = 0;
|
---|
| 813 | yychar = YYEOF; /* Don't call YYLEX any more */
|
---|
| 814 |
|
---|
| 815 | #if YYDEBUG != 0
|
---|
| 816 | if (yydebug)
|
---|
| 817 | fprintf(stderr, "Now at end of input.\n");
|
---|
| 818 | #endif
|
---|
| 819 | }
|
---|
| 820 | else
|
---|
| 821 | {
|
---|
| 822 | yychar1 = YYTRANSLATE(yychar);
|
---|
| 823 |
|
---|
| 824 | #if YYDEBUG != 0
|
---|
| 825 | if (yydebug)
|
---|
| 826 | {
|
---|
| 827 | fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
|
---|
| 828 | /* Give the individual parser a way to print the precise meaning
|
---|
| 829 | of a token, for further debugging info. */
|
---|
| 830 | #ifdef YYPRINT
|
---|
| 831 | YYPRINT (stderr, yychar, yylval);
|
---|
| 832 | #endif
|
---|
| 833 | fprintf (stderr, ")\n");
|
---|
| 834 | }
|
---|
| 835 | #endif
|
---|
| 836 | }
|
---|
| 837 |
|
---|
| 838 | yyn += yychar1;
|
---|
| 839 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
|
---|
| 840 | goto yydefault;
|
---|
| 841 |
|
---|
| 842 | yyn = yytable[yyn];
|
---|
| 843 |
|
---|
| 844 | /* yyn is what to do for this token type in this state.
|
---|
| 845 | Negative => reduce, -yyn is rule number.
|
---|
| 846 | Positive => shift, yyn is new state.
|
---|
| 847 | New state is final state => don't bother to shift,
|
---|
| 848 | just return success.
|
---|
| 849 | 0, or most negative number => error. */
|
---|
| 850 |
|
---|
| 851 | if (yyn < 0)
|
---|
| 852 | {
|
---|
| 853 | if (yyn == YYFLAG)
|
---|
| 854 | goto yyerrlab;
|
---|
| 855 | yyn = -yyn;
|
---|
| 856 | goto yyreduce;
|
---|
| 857 | }
|
---|
| 858 | else if (yyn == 0)
|
---|
| 859 | goto yyerrlab;
|
---|
| 860 |
|
---|
| 861 | if (yyn == YYFINAL)
|
---|
| 862 | YYACCEPT;
|
---|
| 863 |
|
---|
| 864 | /* Shift the lookahead token. */
|
---|
| 865 |
|
---|
| 866 | #if YYDEBUG != 0
|
---|
| 867 | if (yydebug)
|
---|
| 868 | fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
|
---|
| 869 | #endif
|
---|
| 870 |
|
---|
| 871 | /* Discard the token being shifted unless it is eof. */
|
---|
| 872 | if (yychar != YYEOF)
|
---|
| 873 | yychar = YYEMPTY;
|
---|
| 874 |
|
---|
| 875 | *++yyvsp = yylval;
|
---|
| 876 | #ifdef YYLSP_NEEDED
|
---|
| 877 | *++yylsp = yylloc;
|
---|
| 878 | #endif
|
---|
| 879 |
|
---|
| 880 | /* count tokens shifted since error; after three, turn off error status. */
|
---|
| 881 | if (yyerrstatus) yyerrstatus--;
|
---|
| 882 |
|
---|
| 883 | yystate = yyn;
|
---|
| 884 | goto yynewstate;
|
---|
| 885 |
|
---|
| 886 | /* Do the default action for the current state. */
|
---|
| 887 | yydefault:
|
---|
| 888 |
|
---|
| 889 | yyn = yydefact[yystate];
|
---|
| 890 | if (yyn == 0)
|
---|
| 891 | goto yyerrlab;
|
---|
| 892 |
|
---|
| 893 | /* Do a reduction. yyn is the number of a rule to reduce with. */
|
---|
| 894 | yyreduce:
|
---|
| 895 | yylen = yyr2[yyn];
|
---|
| 896 | if (yylen > 0)
|
---|
| 897 | yyval = yyvsp[1-yylen]; /* implement default value of the action */
|
---|
| 898 |
|
---|
| 899 | #if YYDEBUG != 0
|
---|
| 900 | if (yydebug)
|
---|
| 901 | {
|
---|
| 902 | int i;
|
---|
| 903 |
|
---|
| 904 | fprintf (stderr, "Reducing via rule %d (line %d), ",
|
---|
| 905 | yyn, yyrline[yyn]);
|
---|
| 906 |
|
---|
| 907 | /* Print the symbols being reduced, and their result. */
|
---|
| 908 | for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
|
---|
| 909 | fprintf (stderr, "%s ", yytname[yyrhs[i]]);
|
---|
| 910 | fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
|
---|
| 911 | }
|
---|
| 912 | #endif
|
---|
| 913 |
|
---|
| 914 |
|
---|
| 915 | switch (yyn) {
|
---|
| 916 |
|
---|
| 917 | case 1:
|
---|
| 918 | #line 143 "parse.y"
|
---|
| 919 | { /* add default rule */
|
---|
| 920 | int def_rule;
|
---|
| 921 |
|
---|
| 922 | pat = cclinit();
|
---|
| 923 | cclnegate( pat );
|
---|
| 924 |
|
---|
| 925 | def_rule = mkstate( -pat );
|
---|
| 926 |
|
---|
| 927 | /* Remember the number of the default rule so we
|
---|
| 928 | * don't generate "can't match" warnings for it.
|
---|
| 929 | */
|
---|
| 930 | default_rule = num_rules;
|
---|
| 931 |
|
---|
| 932 | finish_rule( def_rule, false, 0, 0, 0);
|
---|
| 933 |
|
---|
| 934 | for ( i = 1; i <= lastsc; ++i )
|
---|
| 935 | scset[i] = mkbranch( scset[i], def_rule );
|
---|
| 936 |
|
---|
| 937 | if ( spprdflt )
|
---|
| 938 | add_action(
|
---|
| 939 | "YY_FATAL_ERROR( \"flex scanner jammed\" )" );
|
---|
| 940 | else
|
---|
| 941 | add_action( "ECHO" );
|
---|
| 942 |
|
---|
| 943 | add_action( ";\n\tYY_BREAK\n" );
|
---|
| 944 | ;
|
---|
| 945 | break;}
|
---|
| 946 | case 2:
|
---|
| 947 | #line 172 "parse.y"
|
---|
| 948 | { /* initialize for processing rules */
|
---|
| 949 |
|
---|
| 950 | /* Create default DFA start condition. */
|
---|
| 951 | scinstal( "INITIAL", false );
|
---|
| 952 | ;
|
---|
| 953 | break;}
|
---|
| 954 | case 6:
|
---|
| 955 | #line 183 "parse.y"
|
---|
| 956 | { synerr( _("unknown error processing section 1") ); ;
|
---|
| 957 | break;}
|
---|
| 958 | case 7:
|
---|
| 959 | #line 187 "parse.y"
|
---|
| 960 | {
|
---|
| 961 | check_options();
|
---|
| 962 | scon_stk = allocate_integer_array( lastsc + 1 );
|
---|
| 963 | scon_stk_ptr = 0;
|
---|
| 964 | ;
|
---|
| 965 | break;}
|
---|
| 966 | case 8:
|
---|
| 967 | #line 195 "parse.y"
|
---|
| 968 | { xcluflg = false; ;
|
---|
| 969 | break;}
|
---|
| 970 | case 9:
|
---|
| 971 | #line 198 "parse.y"
|
---|
| 972 | { xcluflg = true; ;
|
---|
| 973 | break;}
|
---|
| 974 | case 10:
|
---|
| 975 | #line 202 "parse.y"
|
---|
| 976 | { scinstal( nmstr, xcluflg ); ;
|
---|
| 977 | break;}
|
---|
| 978 | case 11:
|
---|
| 979 | #line 205 "parse.y"
|
---|
| 980 | { scinstal( nmstr, xcluflg ); ;
|
---|
| 981 | break;}
|
---|
| 982 | case 12:
|
---|
| 983 | #line 208 "parse.y"
|
---|
| 984 | { synerr( _("bad start condition list") ); ;
|
---|
| 985 | break;}
|
---|
| 986 | case 16:
|
---|
| 987 | #line 219 "parse.y"
|
---|
| 988 | {
|
---|
| 989 | outfilename = copy_string( nmstr );
|
---|
| 990 | did_outfilename = 1;
|
---|
| 991 | ;
|
---|
| 992 | break;}
|
---|
| 993 | case 17:
|
---|
| 994 | #line 224 "parse.y"
|
---|
| 995 | { prefix = copy_string( nmstr ); ;
|
---|
| 996 | break;}
|
---|
| 997 | case 18:
|
---|
| 998 | #line 226 "parse.y"
|
---|
| 999 | { yyclass = copy_string( nmstr ); ;
|
---|
| 1000 | break;}
|
---|
| 1001 | case 19:
|
---|
| 1002 | #line 228 "parse.y"
|
---|
| 1003 | { headerfilename = copy_string( nmstr ); ;
|
---|
| 1004 | break;}
|
---|
| 1005 | case 20:
|
---|
| 1006 | #line 230 "parse.y"
|
---|
| 1007 | { tablesext = true; tablesfilename = copy_string( nmstr ); ;
|
---|
| 1008 | break;}
|
---|
| 1009 | case 21:
|
---|
| 1010 | #line 234 "parse.y"
|
---|
| 1011 | { scon_stk_ptr = yyvsp[-3]; ;
|
---|
| 1012 | break;}
|
---|
| 1013 | case 22:
|
---|
| 1014 | #line 236 "parse.y"
|
---|
| 1015 | { scon_stk_ptr = yyvsp[-3]; ;
|
---|
| 1016 | break;}
|
---|
| 1017 | case 24:
|
---|
| 1018 | #line 241 "parse.y"
|
---|
| 1019 | {
|
---|
| 1020 | /* Initialize for a parse of one rule. */
|
---|
| 1021 | trlcontxt = variable_trail_rule = varlength = false;
|
---|
| 1022 | trailcnt = headcnt = rulelen = 0;
|
---|
| 1023 | current_state_type = STATE_NORMAL;
|
---|
| 1024 | previous_continued_action = continued_action;
|
---|
| 1025 | in_rule = true;
|
---|
| 1026 |
|
---|
| 1027 | new_rule();
|
---|
| 1028 | ;
|
---|
| 1029 | break;}
|
---|
| 1030 | case 25:
|
---|
| 1031 | #line 254 "parse.y"
|
---|
| 1032 | {
|
---|
| 1033 | pat = yyvsp[0];
|
---|
| 1034 | finish_rule( pat, variable_trail_rule,
|
---|
| 1035 | headcnt, trailcnt , previous_continued_action);
|
---|
| 1036 |
|
---|
| 1037 | if ( scon_stk_ptr > 0 )
|
---|
| 1038 | {
|
---|
| 1039 | for ( i = 1; i <= scon_stk_ptr; ++i )
|
---|
| 1040 | scbol[scon_stk[i]] =
|
---|
| 1041 | mkbranch( scbol[scon_stk[i]],
|
---|
| 1042 | pat );
|
---|
| 1043 | }
|
---|
| 1044 |
|
---|
| 1045 | else
|
---|
| 1046 | {
|
---|
| 1047 | /* Add to all non-exclusive start conditions,
|
---|
| 1048 | * including the default (0) start condition.
|
---|
| 1049 | */
|
---|
| 1050 |
|
---|
| 1051 | for ( i = 1; i <= lastsc; ++i )
|
---|
| 1052 | if ( ! scxclu[i] )
|
---|
| 1053 | scbol[i] = mkbranch( scbol[i],
|
---|
| 1054 | pat );
|
---|
| 1055 | }
|
---|
| 1056 |
|
---|
| 1057 | if ( ! bol_needed )
|
---|
| 1058 | {
|
---|
| 1059 | bol_needed = true;
|
---|
| 1060 |
|
---|
| 1061 | if ( performance_report > 1 )
|
---|
| 1062 | pinpoint_message(
|
---|
| 1063 | "'^' operator results in sub-optimal performance" );
|
---|
| 1064 | }
|
---|
| 1065 | ;
|
---|
| 1066 | break;}
|
---|
| 1067 | case 26:
|
---|
| 1068 | #line 290 "parse.y"
|
---|
| 1069 | {
|
---|
| 1070 | pat = yyvsp[0];
|
---|
| 1071 | finish_rule( pat, variable_trail_rule,
|
---|
| 1072 | headcnt, trailcnt , previous_continued_action);
|
---|
| 1073 |
|
---|
| 1074 | if ( scon_stk_ptr > 0 )
|
---|
| 1075 | {
|
---|
| 1076 | for ( i = 1; i <= scon_stk_ptr; ++i )
|
---|
| 1077 | scset[scon_stk[i]] =
|
---|
| 1078 | mkbranch( scset[scon_stk[i]],
|
---|
| 1079 | pat );
|
---|
| 1080 | }
|
---|
| 1081 |
|
---|
| 1082 | else
|
---|
| 1083 | {
|
---|
| 1084 | for ( i = 1; i <= lastsc; ++i )
|
---|
| 1085 | if ( ! scxclu[i] )
|
---|
| 1086 | scset[i] =
|
---|
| 1087 | mkbranch( scset[i],
|
---|
| 1088 | pat );
|
---|
| 1089 | }
|
---|
| 1090 | ;
|
---|
| 1091 | break;}
|
---|
| 1092 | case 27:
|
---|
| 1093 | #line 314 "parse.y"
|
---|
| 1094 | {
|
---|
| 1095 | if ( scon_stk_ptr > 0 )
|
---|
| 1096 | build_eof_action();
|
---|
| 1097 |
|
---|
| 1098 | else
|
---|
| 1099 | {
|
---|
| 1100 | /* This EOF applies to all start conditions
|
---|
| 1101 | * which don't already have EOF actions.
|
---|
| 1102 | */
|
---|
| 1103 | for ( i = 1; i <= lastsc; ++i )
|
---|
| 1104 | if ( ! sceof[i] )
|
---|
| 1105 | scon_stk[++scon_stk_ptr] = i;
|
---|
| 1106 |
|
---|
| 1107 | if ( scon_stk_ptr == 0 )
|
---|
| 1108 | warn(
|
---|
| 1109 | "all start conditions already have <<EOF>> rules" );
|
---|
| 1110 |
|
---|
| 1111 | else
|
---|
| 1112 | build_eof_action();
|
---|
| 1113 | }
|
---|
| 1114 | ;
|
---|
| 1115 | break;}
|
---|
| 1116 | case 28:
|
---|
| 1117 | #line 337 "parse.y"
|
---|
| 1118 | { synerr( _("unrecognized rule") ); ;
|
---|
| 1119 | break;}
|
---|
| 1120 | case 29:
|
---|
| 1121 | #line 341 "parse.y"
|
---|
| 1122 | { yyval = scon_stk_ptr; ;
|
---|
| 1123 | break;}
|
---|
| 1124 | case 30:
|
---|
| 1125 | #line 345 "parse.y"
|
---|
| 1126 | { yyval = yyvsp[-2]; ;
|
---|
| 1127 | break;}
|
---|
| 1128 | case 31:
|
---|
| 1129 | #line 348 "parse.y"
|
---|
| 1130 | {
|
---|
| 1131 | yyval = scon_stk_ptr;
|
---|
| 1132 |
|
---|
| 1133 | for ( i = 1; i <= lastsc; ++i )
|
---|
| 1134 | {
|
---|
| 1135 | int j;
|
---|
| 1136 |
|
---|
| 1137 | for ( j = 1; j <= scon_stk_ptr; ++j )
|
---|
| 1138 | if ( scon_stk[j] == i )
|
---|
| 1139 | break;
|
---|
| 1140 |
|
---|
| 1141 | if ( j > scon_stk_ptr )
|
---|
| 1142 | scon_stk[++scon_stk_ptr] = i;
|
---|
| 1143 | }
|
---|
| 1144 | ;
|
---|
| 1145 | break;}
|
---|
| 1146 | case 32:
|
---|
| 1147 | #line 365 "parse.y"
|
---|
| 1148 | { yyval = scon_stk_ptr; ;
|
---|
| 1149 | break;}
|
---|
| 1150 | case 35:
|
---|
| 1151 | #line 373 "parse.y"
|
---|
| 1152 | { synerr( _("bad start condition list") ); ;
|
---|
| 1153 | break;}
|
---|
| 1154 | case 36:
|
---|
| 1155 | #line 377 "parse.y"
|
---|
| 1156 | {
|
---|
| 1157 | if ( (scnum = sclookup( nmstr )) == 0 )
|
---|
| 1158 | format_pinpoint_message(
|
---|
| 1159 | "undeclared start condition %s",
|
---|
| 1160 | nmstr );
|
---|
| 1161 | else
|
---|
| 1162 | {
|
---|
| 1163 | for ( i = 1; i <= scon_stk_ptr; ++i )
|
---|
| 1164 | if ( scon_stk[i] == scnum )
|
---|
| 1165 | {
|
---|
| 1166 | format_warn(
|
---|
| 1167 | "<%s> specified twice",
|
---|
| 1168 | scname[scnum] );
|
---|
| 1169 | break;
|
---|
| 1170 | }
|
---|
| 1171 |
|
---|
| 1172 | if ( i > scon_stk_ptr )
|
---|
| 1173 | scon_stk[++scon_stk_ptr] = scnum;
|
---|
| 1174 | }
|
---|
| 1175 | ;
|
---|
| 1176 | break;}
|
---|
| 1177 | case 37:
|
---|
| 1178 | #line 400 "parse.y"
|
---|
| 1179 | {
|
---|
| 1180 | if ( transchar[lastst[yyvsp[0]]] != SYM_EPSILON )
|
---|
| 1181 | /* Provide final transition \now/ so it
|
---|
| 1182 | * will be marked as a trailing context
|
---|
| 1183 | * state.
|
---|
| 1184 | */
|
---|
| 1185 | yyvsp[0] = link_machines( yyvsp[0],
|
---|
| 1186 | mkstate( SYM_EPSILON ) );
|
---|
| 1187 |
|
---|
| 1188 | mark_beginning_as_normal( yyvsp[0] );
|
---|
| 1189 | current_state_type = STATE_NORMAL;
|
---|
| 1190 |
|
---|
| 1191 | if ( previous_continued_action )
|
---|
| 1192 | {
|
---|
| 1193 | /* We need to treat this as variable trailing
|
---|
| 1194 | * context so that the backup does not happen
|
---|
| 1195 | * in the action but before the action switch
|
---|
| 1196 | * statement. If the backup happens in the
|
---|
| 1197 | * action, then the rules "falling into" this
|
---|
| 1198 | * one's action will *also* do the backup,
|
---|
| 1199 | * erroneously.
|
---|
| 1200 | */
|
---|
| 1201 | if ( ! varlength || headcnt != 0 )
|
---|
| 1202 | warn(
|
---|
| 1203 | "trailing context made variable due to preceding '|' action" );
|
---|
| 1204 |
|
---|
| 1205 | /* Mark as variable. */
|
---|
| 1206 | varlength = true;
|
---|
| 1207 | headcnt = 0;
|
---|
| 1208 |
|
---|
| 1209 | }
|
---|
| 1210 |
|
---|
| 1211 | if ( lex_compat || (varlength && headcnt == 0) )
|
---|
| 1212 | { /* variable trailing context rule */
|
---|
| 1213 | /* Mark the first part of the rule as the
|
---|
| 1214 | * accepting "head" part of a trailing
|
---|
| 1215 | * context rule.
|
---|
| 1216 | *
|
---|
| 1217 | * By the way, we didn't do this at the
|
---|
| 1218 | * beginning of this production because back
|
---|
| 1219 | * then current_state_type was set up for a
|
---|
| 1220 | * trail rule, and add_accept() can create
|
---|
| 1221 | * a new state ...
|
---|
| 1222 | */
|
---|
| 1223 | add_accept( yyvsp[-1],
|
---|
| 1224 | num_rules | YY_TRAILING_HEAD_MASK );
|
---|
| 1225 | variable_trail_rule = true;
|
---|
| 1226 | }
|
---|
| 1227 |
|
---|
| 1228 | else
|
---|
| 1229 | trailcnt = rulelen;
|
---|
| 1230 |
|
---|
| 1231 | yyval = link_machines( yyvsp[-1], yyvsp[0] );
|
---|
| 1232 | ;
|
---|
| 1233 | break;}
|
---|
| 1234 | case 38:
|
---|
| 1235 | #line 456 "parse.y"
|
---|
| 1236 | { synerr( _("trailing context used twice") ); ;
|
---|
| 1237 | break;}
|
---|
| 1238 | case 39:
|
---|
| 1239 | #line 459 "parse.y"
|
---|
| 1240 | {
|
---|
| 1241 | headcnt = 0;
|
---|
| 1242 | trailcnt = 1;
|
---|
| 1243 | rulelen = 1;
|
---|
| 1244 | varlength = false;
|
---|
| 1245 |
|
---|
| 1246 | current_state_type = STATE_TRAILING_CONTEXT;
|
---|
| 1247 |
|
---|
| 1248 | if ( trlcontxt )
|
---|
| 1249 | {
|
---|
| 1250 | synerr( _("trailing context used twice") );
|
---|
| 1251 | yyval = mkstate( SYM_EPSILON );
|
---|
| 1252 | }
|
---|
| 1253 |
|
---|
| 1254 | else if ( previous_continued_action )
|
---|
| 1255 | {
|
---|
| 1256 | /* See the comment in the rule for "re2 re"
|
---|
| 1257 | * above.
|
---|
| 1258 | */
|
---|
| 1259 | warn(
|
---|
| 1260 | "trailing context made variable due to preceding '|' action" );
|
---|
| 1261 |
|
---|
| 1262 | varlength = true;
|
---|
| 1263 | }
|
---|
| 1264 |
|
---|
| 1265 | if ( lex_compat || varlength )
|
---|
| 1266 | {
|
---|
| 1267 | /* Again, see the comment in the rule for
|
---|
| 1268 | * "re2 re" above.
|
---|
| 1269 | */
|
---|
| 1270 | add_accept( yyvsp[-1],
|
---|
| 1271 | num_rules | YY_TRAILING_HEAD_MASK );
|
---|
| 1272 | variable_trail_rule = true;
|
---|
| 1273 | }
|
---|
| 1274 |
|
---|
| 1275 | trlcontxt = true;
|
---|
| 1276 |
|
---|
| 1277 | eps = mkstate( SYM_EPSILON );
|
---|
| 1278 | yyval = link_machines( yyvsp[-1],
|
---|
| 1279 | link_machines( eps, mkstate( '\n' ) ) );
|
---|
| 1280 | ;
|
---|
| 1281 | break;}
|
---|
| 1282 | case 40:
|
---|
| 1283 | #line 502 "parse.y"
|
---|
| 1284 | {
|
---|
| 1285 | yyval = yyvsp[0];
|
---|
| 1286 |
|
---|
| 1287 | if ( trlcontxt )
|
---|
| 1288 | {
|
---|
| 1289 | if ( lex_compat || (varlength && headcnt == 0) )
|
---|
| 1290 | /* Both head and trail are
|
---|
| 1291 | * variable-length.
|
---|
| 1292 | */
|
---|
| 1293 | variable_trail_rule = true;
|
---|
| 1294 | else
|
---|
| 1295 | trailcnt = rulelen;
|
---|
| 1296 | }
|
---|
| 1297 | ;
|
---|
| 1298 | break;}
|
---|
| 1299 | case 41:
|
---|
| 1300 | #line 520 "parse.y"
|
---|
| 1301 | {
|
---|
| 1302 | varlength = true;
|
---|
| 1303 | yyval = mkor( yyvsp[-2], yyvsp[0] );
|
---|
| 1304 | ;
|
---|
| 1305 | break;}
|
---|
| 1306 | case 42:
|
---|
| 1307 | #line 526 "parse.y"
|
---|
| 1308 | { yyval = yyvsp[0]; ;
|
---|
| 1309 | break;}
|
---|
| 1310 | case 43:
|
---|
| 1311 | #line 531 "parse.y"
|
---|
| 1312 | {
|
---|
| 1313 | /* This rule is written separately so the
|
---|
| 1314 | * reduction will occur before the trailing
|
---|
| 1315 | * series is parsed.
|
---|
| 1316 | */
|
---|
| 1317 |
|
---|
| 1318 | if ( trlcontxt )
|
---|
| 1319 | synerr( _("trailing context used twice") );
|
---|
| 1320 | else
|
---|
| 1321 | trlcontxt = true;
|
---|
| 1322 |
|
---|
| 1323 | if ( varlength )
|
---|
| 1324 | /* We hope the trailing context is
|
---|
| 1325 | * fixed-length.
|
---|
| 1326 | */
|
---|
| 1327 | varlength = false;
|
---|
| 1328 | else
|
---|
| 1329 | headcnt = rulelen;
|
---|
| 1330 |
|
---|
| 1331 | rulelen = 0;
|
---|
| 1332 |
|
---|
| 1333 | current_state_type = STATE_TRAILING_CONTEXT;
|
---|
| 1334 | yyval = yyvsp[-1];
|
---|
| 1335 | ;
|
---|
| 1336 | break;}
|
---|
| 1337 | case 44:
|
---|
| 1338 | #line 558 "parse.y"
|
---|
| 1339 | {
|
---|
| 1340 | /* This is where concatenation of adjacent patterns
|
---|
| 1341 | * gets done.
|
---|
| 1342 | */
|
---|
| 1343 | yyval = link_machines( yyvsp[-1], yyvsp[0] );
|
---|
| 1344 | ;
|
---|
| 1345 | break;}
|
---|
| 1346 | case 45:
|
---|
| 1347 | #line 566 "parse.y"
|
---|
| 1348 | { yyval = yyvsp[0]; ;
|
---|
| 1349 | break;}
|
---|
| 1350 | case 46:
|
---|
| 1351 | #line 569 "parse.y"
|
---|
| 1352 | {
|
---|
| 1353 | varlength = true;
|
---|
| 1354 |
|
---|
| 1355 | if ( yyvsp[-3] > yyvsp[-1] || yyvsp[-3] < 0 )
|
---|
| 1356 | {
|
---|
| 1357 | synerr( _("bad iteration values") );
|
---|
| 1358 | yyval = yyvsp[-5];
|
---|
| 1359 | }
|
---|
| 1360 | else
|
---|
| 1361 | {
|
---|
| 1362 | if ( yyvsp[-3] == 0 )
|
---|
| 1363 | {
|
---|
| 1364 | if ( yyvsp[-1] <= 0 )
|
---|
| 1365 | {
|
---|
| 1366 | synerr(
|
---|
| 1367 | _("bad iteration values") );
|
---|
| 1368 | yyval = yyvsp[-5];
|
---|
| 1369 | }
|
---|
| 1370 | else
|
---|
| 1371 | yyval = mkopt(
|
---|
| 1372 | mkrep( yyvsp[-5], 1, yyvsp[-1] ) );
|
---|
| 1373 | }
|
---|
| 1374 | else
|
---|
| 1375 | yyval = mkrep( yyvsp[-5], yyvsp[-3], yyvsp[-1] );
|
---|
| 1376 | }
|
---|
| 1377 | ;
|
---|
| 1378 | break;}
|
---|
| 1379 | case 47:
|
---|
| 1380 | #line 597 "parse.y"
|
---|
| 1381 | {
|
---|
| 1382 | varlength = true;
|
---|
| 1383 |
|
---|
| 1384 | if ( yyvsp[-2] <= 0 )
|
---|
| 1385 | {
|
---|
| 1386 | synerr( _("iteration value must be positive") );
|
---|
| 1387 | yyval = yyvsp[-4];
|
---|
| 1388 | }
|
---|
| 1389 |
|
---|
| 1390 | else
|
---|
| 1391 | yyval = mkrep( yyvsp[-4], yyvsp[-2], INFINITE_REPEAT );
|
---|
| 1392 | ;
|
---|
| 1393 | break;}
|
---|
| 1394 | case 48:
|
---|
| 1395 | #line 611 "parse.y"
|
---|
| 1396 | {
|
---|
| 1397 | /* The series could be something like "(foo)",
|
---|
| 1398 | * in which case we have no idea what its length
|
---|
| 1399 | * is, so we punt here.
|
---|
| 1400 | */
|
---|
| 1401 | varlength = true;
|
---|
| 1402 |
|
---|
| 1403 | if ( yyvsp[-1] <= 0 )
|
---|
| 1404 | {
|
---|
| 1405 | synerr( _("iteration value must be positive")
|
---|
| 1406 | );
|
---|
| 1407 | yyval = yyvsp[-3];
|
---|
| 1408 | }
|
---|
| 1409 |
|
---|
| 1410 | else
|
---|
| 1411 | yyval = link_machines( yyvsp[-3],
|
---|
| 1412 | copysingl( yyvsp[-3], yyvsp[-1] - 1 ) );
|
---|
| 1413 | ;
|
---|
| 1414 | break;}
|
---|
| 1415 | case 49:
|
---|
| 1416 | #line 633 "parse.y"
|
---|
| 1417 | {
|
---|
| 1418 | varlength = true;
|
---|
| 1419 |
|
---|
| 1420 | yyval = mkclos( yyvsp[-1] );
|
---|
| 1421 | ;
|
---|
| 1422 | break;}
|
---|
| 1423 | case 50:
|
---|
| 1424 | #line 640 "parse.y"
|
---|
| 1425 | {
|
---|
| 1426 | varlength = true;
|
---|
| 1427 | yyval = mkposcl( yyvsp[-1] );
|
---|
| 1428 | ;
|
---|
| 1429 | break;}
|
---|
| 1430 | case 51:
|
---|
| 1431 | #line 646 "parse.y"
|
---|
| 1432 | {
|
---|
| 1433 | varlength = true;
|
---|
| 1434 | yyval = mkopt( yyvsp[-1] );
|
---|
| 1435 | ;
|
---|
| 1436 | break;}
|
---|
| 1437 | case 52:
|
---|
| 1438 | #line 652 "parse.y"
|
---|
| 1439 | {
|
---|
| 1440 | varlength = true;
|
---|
| 1441 |
|
---|
| 1442 | if ( yyvsp[-3] > yyvsp[-1] || yyvsp[-3] < 0 )
|
---|
| 1443 | {
|
---|
| 1444 | synerr( _("bad iteration values") );
|
---|
| 1445 | yyval = yyvsp[-5];
|
---|
| 1446 | }
|
---|
| 1447 | else
|
---|
| 1448 | {
|
---|
| 1449 | if ( yyvsp[-3] == 0 )
|
---|
| 1450 | {
|
---|
| 1451 | if ( yyvsp[-1] <= 0 )
|
---|
| 1452 | {
|
---|
| 1453 | synerr(
|
---|
| 1454 | _("bad iteration values") );
|
---|
| 1455 | yyval = yyvsp[-5];
|
---|
| 1456 | }
|
---|
| 1457 | else
|
---|
| 1458 | yyval = mkopt(
|
---|
| 1459 | mkrep( yyvsp[-5], 1, yyvsp[-1] ) );
|
---|
| 1460 | }
|
---|
| 1461 | else
|
---|
| 1462 | yyval = mkrep( yyvsp[-5], yyvsp[-3], yyvsp[-1] );
|
---|
| 1463 | }
|
---|
| 1464 | ;
|
---|
| 1465 | break;}
|
---|
| 1466 | case 53:
|
---|
| 1467 | #line 680 "parse.y"
|
---|
| 1468 | {
|
---|
| 1469 | varlength = true;
|
---|
| 1470 |
|
---|
| 1471 | if ( yyvsp[-2] <= 0 )
|
---|
| 1472 | {
|
---|
| 1473 | synerr( _("iteration value must be positive") );
|
---|
| 1474 | yyval = yyvsp[-4];
|
---|
| 1475 | }
|
---|
| 1476 |
|
---|
| 1477 | else
|
---|
| 1478 | yyval = mkrep( yyvsp[-4], yyvsp[-2], INFINITE_REPEAT );
|
---|
| 1479 | ;
|
---|
| 1480 | break;}
|
---|
| 1481 | case 54:
|
---|
| 1482 | #line 694 "parse.y"
|
---|
| 1483 | {
|
---|
| 1484 | /* The singleton could be something like "(foo)",
|
---|
| 1485 | * in which case we have no idea what its length
|
---|
| 1486 | * is, so we punt here.
|
---|
| 1487 | */
|
---|
| 1488 | varlength = true;
|
---|
| 1489 |
|
---|
| 1490 | if ( yyvsp[-1] <= 0 )
|
---|
| 1491 | {
|
---|
| 1492 | synerr( _("iteration value must be positive") );
|
---|
| 1493 | yyval = yyvsp[-3];
|
---|
| 1494 | }
|
---|
| 1495 |
|
---|
| 1496 | else
|
---|
| 1497 | yyval = link_machines( yyvsp[-3],
|
---|
| 1498 | copysingl( yyvsp[-3], yyvsp[-1] - 1 ) );
|
---|
| 1499 | ;
|
---|
| 1500 | break;}
|
---|
| 1501 | case 55:
|
---|
| 1502 | #line 713 "parse.y"
|
---|
| 1503 | {
|
---|
| 1504 | if ( ! madeany )
|
---|
| 1505 | {
|
---|
| 1506 | /* Create the '.' character class. */
|
---|
| 1507 | anyccl = cclinit();
|
---|
| 1508 | ccladd( anyccl, '\n' );
|
---|
| 1509 | cclnegate( anyccl );
|
---|
| 1510 |
|
---|
| 1511 | if ( useecs )
|
---|
| 1512 | mkeccl( ccltbl + cclmap[anyccl],
|
---|
| 1513 | ccllen[anyccl], nextecm,
|
---|
| 1514 | ecgroup, csize, csize );
|
---|
| 1515 |
|
---|
| 1516 | madeany = true;
|
---|
| 1517 | }
|
---|
| 1518 |
|
---|
| 1519 | ++rulelen;
|
---|
| 1520 |
|
---|
| 1521 | yyval = mkstate( -anyccl );
|
---|
| 1522 | ;
|
---|
| 1523 | break;}
|
---|
| 1524 | case 56:
|
---|
| 1525 | #line 735 "parse.y"
|
---|
| 1526 | {
|
---|
| 1527 | if ( ! cclsorted )
|
---|
| 1528 | /* Sort characters for fast searching. We
|
---|
| 1529 | * use a shell sort since this list could
|
---|
| 1530 | * be large.
|
---|
| 1531 | */
|
---|
| 1532 | cshell( ccltbl + cclmap[yyvsp[0]], ccllen[yyvsp[0]], true );
|
---|
| 1533 |
|
---|
| 1534 | if ( useecs )
|
---|
| 1535 | mkeccl( ccltbl + cclmap[yyvsp[0]], ccllen[yyvsp[0]],
|
---|
| 1536 | nextecm, ecgroup, csize, csize );
|
---|
| 1537 |
|
---|
| 1538 | ++rulelen;
|
---|
| 1539 |
|
---|
| 1540 | if (ccl_has_nl[yyvsp[0]])
|
---|
| 1541 | rule_has_nl[num_rules] = true;
|
---|
| 1542 |
|
---|
| 1543 | yyval = mkstate( -yyvsp[0] );
|
---|
| 1544 | ;
|
---|
| 1545 | break;}
|
---|
| 1546 | case 57:
|
---|
| 1547 | #line 756 "parse.y"
|
---|
| 1548 | {
|
---|
| 1549 | ++rulelen;
|
---|
| 1550 |
|
---|
| 1551 | if (ccl_has_nl[yyvsp[0]])
|
---|
| 1552 | rule_has_nl[num_rules] = true;
|
---|
| 1553 |
|
---|
| 1554 | yyval = mkstate( -yyvsp[0] );
|
---|
| 1555 | ;
|
---|
| 1556 | break;}
|
---|
| 1557 | case 58:
|
---|
| 1558 | #line 766 "parse.y"
|
---|
| 1559 | { yyval = yyvsp[-1]; ;
|
---|
| 1560 | break;}
|
---|
| 1561 | case 59:
|
---|
| 1562 | #line 769 "parse.y"
|
---|
| 1563 | { yyval = yyvsp[-1]; ;
|
---|
| 1564 | break;}
|
---|
| 1565 | case 60:
|
---|
| 1566 | #line 772 "parse.y"
|
---|
| 1567 | {
|
---|
| 1568 | ++rulelen;
|
---|
| 1569 |
|
---|
| 1570 | if ( caseins && yyvsp[0] >= 'A' && yyvsp[0] <= 'Z' )
|
---|
| 1571 | yyvsp[0] = clower( yyvsp[0] );
|
---|
| 1572 |
|
---|
| 1573 | if (yyvsp[0] == nlch)
|
---|
| 1574 | rule_has_nl[num_rules] = true;
|
---|
| 1575 |
|
---|
| 1576 | yyval = mkstate( yyvsp[0] );
|
---|
| 1577 | ;
|
---|
| 1578 | break;}
|
---|
| 1579 | case 61:
|
---|
| 1580 | #line 786 "parse.y"
|
---|
| 1581 | { yyval = yyvsp[-1]; ;
|
---|
| 1582 | break;}
|
---|
| 1583 | case 62:
|
---|
| 1584 | #line 789 "parse.y"
|
---|
| 1585 | {
|
---|
| 1586 | cclnegate( yyvsp[-1] );
|
---|
| 1587 | yyval = yyvsp[-1];
|
---|
| 1588 | ;
|
---|
| 1589 | break;}
|
---|
| 1590 | case 63:
|
---|
| 1591 | #line 796 "parse.y"
|
---|
| 1592 | {
|
---|
| 1593 |
|
---|
| 1594 | if (caseins)
|
---|
| 1595 | {
|
---|
| 1596 | /* Squish the character range to lowercase only if BOTH
|
---|
| 1597 | * ends of the range are uppercase.
|
---|
| 1598 | */
|
---|
| 1599 | if (isupper (yyvsp[-2]) && isupper (yyvsp[0]))
|
---|
| 1600 | {
|
---|
| 1601 | yyvsp[-2] = tolower (yyvsp[-2]);
|
---|
| 1602 | yyvsp[0] = tolower (yyvsp[0]);
|
---|
| 1603 | }
|
---|
| 1604 |
|
---|
| 1605 | /* If one end of the range has case and the other
|
---|
| 1606 | * does not, or the cases are different, then we're not
|
---|
| 1607 | * sure what range the user is trying to express.
|
---|
| 1608 | * Examples: [@-z] or [S-t]
|
---|
| 1609 | */
|
---|
| 1610 | else if (has_case (yyvsp[-2]) != has_case (yyvsp[0])
|
---|
| 1611 | || (has_case (yyvsp[-2]) && (b_islower (yyvsp[-2]) != b_islower (yyvsp[0]))))
|
---|
| 1612 | format_warn3 (
|
---|
| 1613 | _("the character range [%c-%c] is ambiguous in a case-insensitive scanner"),
|
---|
| 1614 | yyvsp[-2], yyvsp[0]);
|
---|
| 1615 |
|
---|
| 1616 | /* If the range spans uppercase characters but not
|
---|
| 1617 | * lowercase (or vice-versa), then should we automatically
|
---|
| 1618 | * include lowercase characters in the range?
|
---|
| 1619 | * Example: [@-_] spans [a-z] but not [A-Z]
|
---|
| 1620 | */
|
---|
| 1621 | else if (!has_case (yyvsp[-2]) && !has_case (yyvsp[0]) && !range_covers_case (yyvsp[-2], yyvsp[0]))
|
---|
| 1622 | format_warn3 (
|
---|
| 1623 | _("the character range [%c-%c] is ambiguous in a case-insensitive scanner"),
|
---|
| 1624 | yyvsp[-2], yyvsp[0]);
|
---|
| 1625 | }
|
---|
| 1626 |
|
---|
| 1627 | if ( yyvsp[-2] > yyvsp[0] )
|
---|
| 1628 | synerr( _("negative range in character class") );
|
---|
| 1629 |
|
---|
| 1630 | else
|
---|
| 1631 | {
|
---|
| 1632 | for ( i = yyvsp[-2]; i <= yyvsp[0]; ++i )
|
---|
| 1633 | ccladd( yyvsp[-3], i );
|
---|
| 1634 |
|
---|
| 1635 | /* Keep track if this ccl is staying in
|
---|
| 1636 | * alphabetical order.
|
---|
| 1637 | */
|
---|
| 1638 | cclsorted = cclsorted && (yyvsp[-2] > lastchar);
|
---|
| 1639 | lastchar = yyvsp[0];
|
---|
| 1640 | }
|
---|
| 1641 |
|
---|
| 1642 | yyval = yyvsp[-3];
|
---|
| 1643 | ;
|
---|
| 1644 | break;}
|
---|
| 1645 | case 64:
|
---|
| 1646 | #line 850 "parse.y"
|
---|
| 1647 | {
|
---|
| 1648 | if ( caseins && yyvsp[0] >= 'A' && yyvsp[0] <= 'Z' )
|
---|
| 1649 | yyvsp[0] = clower( yyvsp[0] );
|
---|
| 1650 |
|
---|
| 1651 | ccladd( yyvsp[-1], yyvsp[0] );
|
---|
| 1652 | cclsorted = cclsorted && (yyvsp[0] > lastchar);
|
---|
| 1653 | lastchar = yyvsp[0];
|
---|
| 1654 | yyval = yyvsp[-1];
|
---|
| 1655 | ;
|
---|
| 1656 | break;}
|
---|
| 1657 | case 65:
|
---|
| 1658 | #line 861 "parse.y"
|
---|
| 1659 | {
|
---|
| 1660 | /* Too hard to properly maintain cclsorted. */
|
---|
| 1661 | cclsorted = false;
|
---|
| 1662 | yyval = yyvsp[-1];
|
---|
| 1663 | ;
|
---|
| 1664 | break;}
|
---|
| 1665 | case 66:
|
---|
| 1666 | #line 868 "parse.y"
|
---|
| 1667 | {
|
---|
| 1668 | cclsorted = true;
|
---|
| 1669 | lastchar = 0;
|
---|
| 1670 | currccl = yyval = cclinit();
|
---|
| 1671 | ;
|
---|
| 1672 | break;}
|
---|
| 1673 | case 67:
|
---|
| 1674 | #line 875 "parse.y"
|
---|
| 1675 | { CCL_EXPR(isalnum); ;
|
---|
| 1676 | break;}
|
---|
| 1677 | case 68:
|
---|
| 1678 | #line 876 "parse.y"
|
---|
| 1679 | { CCL_EXPR(isalpha); ;
|
---|
| 1680 | break;}
|
---|
| 1681 | case 69:
|
---|
| 1682 | #line 877 "parse.y"
|
---|
| 1683 | { CCL_EXPR(IS_BLANK); ;
|
---|
| 1684 | break;}
|
---|
| 1685 | case 70:
|
---|
| 1686 | #line 878 "parse.y"
|
---|
| 1687 | { CCL_EXPR(iscntrl); ;
|
---|
| 1688 | break;}
|
---|
| 1689 | case 71:
|
---|
| 1690 | #line 879 "parse.y"
|
---|
| 1691 | { CCL_EXPR(isdigit); ;
|
---|
| 1692 | break;}
|
---|
| 1693 | case 72:
|
---|
| 1694 | #line 880 "parse.y"
|
---|
| 1695 | { CCL_EXPR(isgraph); ;
|
---|
| 1696 | break;}
|
---|
| 1697 | case 73:
|
---|
| 1698 | #line 881 "parse.y"
|
---|
| 1699 | { CCL_EXPR(islower); ;
|
---|
| 1700 | break;}
|
---|
| 1701 | case 74:
|
---|
| 1702 | #line 882 "parse.y"
|
---|
| 1703 | { CCL_EXPR(isprint); ;
|
---|
| 1704 | break;}
|
---|
| 1705 | case 75:
|
---|
| 1706 | #line 883 "parse.y"
|
---|
| 1707 | { CCL_EXPR(ispunct); ;
|
---|
| 1708 | break;}
|
---|
| 1709 | case 76:
|
---|
| 1710 | #line 884 "parse.y"
|
---|
| 1711 | { CCL_EXPR(isspace); ;
|
---|
| 1712 | break;}
|
---|
| 1713 | case 77:
|
---|
| 1714 | #line 885 "parse.y"
|
---|
| 1715 | {
|
---|
| 1716 | if ( caseins )
|
---|
| 1717 | CCL_EXPR(islower);
|
---|
| 1718 | else
|
---|
| 1719 | CCL_EXPR(isupper);
|
---|
| 1720 | ;
|
---|
| 1721 | break;}
|
---|
| 1722 | case 78:
|
---|
| 1723 | #line 891 "parse.y"
|
---|
| 1724 | { CCL_EXPR(isxdigit); ;
|
---|
| 1725 | break;}
|
---|
| 1726 | case 79:
|
---|
| 1727 | #line 895 "parse.y"
|
---|
| 1728 | {
|
---|
| 1729 | if ( caseins && yyvsp[0] >= 'A' && yyvsp[0] <= 'Z' )
|
---|
| 1730 | yyvsp[0] = clower( yyvsp[0] );
|
---|
| 1731 |
|
---|
| 1732 | if ( yyvsp[0] == nlch )
|
---|
| 1733 | rule_has_nl[num_rules] = true;
|
---|
| 1734 |
|
---|
| 1735 | ++rulelen;
|
---|
| 1736 |
|
---|
| 1737 | yyval = link_machines( yyvsp[-1], mkstate( yyvsp[0] ) );
|
---|
| 1738 | ;
|
---|
| 1739 | break;}
|
---|
| 1740 | case 80:
|
---|
| 1741 | #line 908 "parse.y"
|
---|
| 1742 | { yyval = mkstate( SYM_EPSILON ); ;
|
---|
| 1743 | break;}
|
---|
| 1744 | }
|
---|
| 1745 | /* the action file gets copied in in place of this dollarsign */
|
---|
| 1746 | #line 543 "/usr/lib/bison.simple"
|
---|
| 1747 | |
---|
| 1748 |
|
---|
| 1749 | yyvsp -= yylen;
|
---|
| 1750 | yyssp -= yylen;
|
---|
| 1751 | #ifdef YYLSP_NEEDED
|
---|
| 1752 | yylsp -= yylen;
|
---|
| 1753 | #endif
|
---|
| 1754 |
|
---|
| 1755 | #if YYDEBUG != 0
|
---|
| 1756 | if (yydebug)
|
---|
| 1757 | {
|
---|
| 1758 | short *ssp1 = yyss - 1;
|
---|
| 1759 | fprintf (stderr, "state stack now");
|
---|
| 1760 | while (ssp1 != yyssp)
|
---|
| 1761 | fprintf (stderr, " %d", *++ssp1);
|
---|
| 1762 | fprintf (stderr, "\n");
|
---|
| 1763 | }
|
---|
| 1764 | #endif
|
---|
| 1765 |
|
---|
| 1766 | *++yyvsp = yyval;
|
---|
| 1767 |
|
---|
| 1768 | #ifdef YYLSP_NEEDED
|
---|
| 1769 | yylsp++;
|
---|
| 1770 | if (yylen == 0)
|
---|
| 1771 | {
|
---|
| 1772 | yylsp->first_line = yylloc.first_line;
|
---|
| 1773 | yylsp->first_column = yylloc.first_column;
|
---|
| 1774 | yylsp->last_line = (yylsp-1)->last_line;
|
---|
| 1775 | yylsp->last_column = (yylsp-1)->last_column;
|
---|
| 1776 | yylsp->text = 0;
|
---|
| 1777 | }
|
---|
| 1778 | else
|
---|
| 1779 | {
|
---|
| 1780 | yylsp->last_line = (yylsp+yylen-1)->last_line;
|
---|
| 1781 | yylsp->last_column = (yylsp+yylen-1)->last_column;
|
---|
| 1782 | }
|
---|
| 1783 | #endif
|
---|
| 1784 |
|
---|
| 1785 | /* Now "shift" the result of the reduction.
|
---|
| 1786 | Determine what state that goes to,
|
---|
| 1787 | based on the state we popped back to
|
---|
| 1788 | and the rule number reduced by. */
|
---|
| 1789 |
|
---|
| 1790 | yyn = yyr1[yyn];
|
---|
| 1791 |
|
---|
| 1792 | yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
|
---|
| 1793 | if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
|
---|
| 1794 | yystate = yytable[yystate];
|
---|
| 1795 | else
|
---|
| 1796 | yystate = yydefgoto[yyn - YYNTBASE];
|
---|
| 1797 |
|
---|
| 1798 | goto yynewstate;
|
---|
| 1799 |
|
---|
| 1800 | yyerrlab: /* here on detecting error */
|
---|
| 1801 |
|
---|
| 1802 | if (! yyerrstatus)
|
---|
| 1803 | /* If not already recovering from an error, report this error. */
|
---|
| 1804 | {
|
---|
| 1805 | ++yynerrs;
|
---|
| 1806 |
|
---|
| 1807 | #ifdef YYERROR_VERBOSE
|
---|
| 1808 | yyn = yypact[yystate];
|
---|
| 1809 |
|
---|
| 1810 | if (yyn > YYFLAG && yyn < YYLAST)
|
---|
| 1811 | {
|
---|
| 1812 | int size = 0;
|
---|
| 1813 | char *msg;
|
---|
| 1814 | int x, count;
|
---|
| 1815 |
|
---|
| 1816 | count = 0;
|
---|
| 1817 | /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
|
---|
| 1818 | for (x = (yyn < 0 ? -yyn : 0);
|
---|
| 1819 | x < (sizeof(yytname) / sizeof(char *)); x++)
|
---|
| 1820 | if (yycheck[x + yyn] == x)
|
---|
| 1821 | size += strlen(yytname[x]) + 15, count++;
|
---|
| 1822 | msg = (char *) malloc(size + 15);
|
---|
| 1823 | if (msg != 0)
|
---|
| 1824 | {
|
---|
| 1825 | strcpy(msg, "parse error");
|
---|
| 1826 |
|
---|
| 1827 | if (count < 5)
|
---|
| 1828 | {
|
---|
| 1829 | count = 0;
|
---|
| 1830 | for (x = (yyn < 0 ? -yyn : 0);
|
---|
| 1831 | x < (sizeof(yytname) / sizeof(char *)); x++)
|
---|
| 1832 | if (yycheck[x + yyn] == x)
|
---|
| 1833 | {
|
---|
| 1834 | strcat(msg, count == 0 ? ", expecting `" : " or `");
|
---|
| 1835 | strcat(msg, yytname[x]);
|
---|
| 1836 | strcat(msg, "'");
|
---|
| 1837 | count++;
|
---|
| 1838 | }
|
---|
| 1839 | }
|
---|
| 1840 | yyerror(msg);
|
---|
| 1841 | free(msg);
|
---|
| 1842 | }
|
---|
| 1843 | else
|
---|
| 1844 | yyerror ("parse error; also virtual memory exceeded");
|
---|
| 1845 | }
|
---|
| 1846 | else
|
---|
| 1847 | #endif /* YYERROR_VERBOSE */
|
---|
| 1848 | yyerror("parse error");
|
---|
| 1849 | }
|
---|
| 1850 |
|
---|
| 1851 | goto yyerrlab1;
|
---|
| 1852 | yyerrlab1: /* here on error raised explicitly by an action */
|
---|
| 1853 |
|
---|
| 1854 | if (yyerrstatus == 3)
|
---|
| 1855 | {
|
---|
| 1856 | /* if just tried and failed to reuse lookahead token after an error, discard it. */
|
---|
| 1857 |
|
---|
| 1858 | /* return failure if at end of input */
|
---|
| 1859 | if (yychar == YYEOF)
|
---|
| 1860 | YYABORT;
|
---|
| 1861 |
|
---|
| 1862 | #if YYDEBUG != 0
|
---|
| 1863 | if (yydebug)
|
---|
| 1864 | fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
|
---|
| 1865 | #endif
|
---|
| 1866 |
|
---|
| 1867 | yychar = YYEMPTY;
|
---|
| 1868 | }
|
---|
| 1869 |
|
---|
| 1870 | /* Else will try to reuse lookahead token
|
---|
| 1871 | after shifting the error token. */
|
---|
| 1872 |
|
---|
| 1873 | yyerrstatus = 3; /* Each real token shifted decrements this */
|
---|
| 1874 |
|
---|
| 1875 | goto yyerrhandle;
|
---|
| 1876 |
|
---|
| 1877 | yyerrdefault: /* current state does not do anything special for the error token. */
|
---|
| 1878 |
|
---|
| 1879 | #if 0
|
---|
| 1880 | /* This is wrong; only states that explicitly want error tokens
|
---|
| 1881 | should shift them. */
|
---|
| 1882 | yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
|
---|
| 1883 | if (yyn) goto yydefault;
|
---|
| 1884 | #endif
|
---|
| 1885 |
|
---|
| 1886 | yyerrpop: /* pop the current state because it cannot handle the error token */
|
---|
| 1887 |
|
---|
| 1888 | if (yyssp == yyss) YYABORT;
|
---|
| 1889 | yyvsp--;
|
---|
| 1890 | yystate = *--yyssp;
|
---|
| 1891 | #ifdef YYLSP_NEEDED
|
---|
| 1892 | yylsp--;
|
---|
| 1893 | #endif
|
---|
| 1894 |
|
---|
| 1895 | #if YYDEBUG != 0
|
---|
| 1896 | if (yydebug)
|
---|
| 1897 | {
|
---|
| 1898 | short *ssp1 = yyss - 1;
|
---|
| 1899 | fprintf (stderr, "Error: state stack now");
|
---|
| 1900 | while (ssp1 != yyssp)
|
---|
| 1901 | fprintf (stderr, " %d", *++ssp1);
|
---|
| 1902 | fprintf (stderr, "\n");
|
---|
| 1903 | }
|
---|
| 1904 | #endif
|
---|
| 1905 |
|
---|
| 1906 | yyerrhandle:
|
---|
| 1907 |
|
---|
| 1908 | yyn = yypact[yystate];
|
---|
| 1909 | if (yyn == YYFLAG)
|
---|
| 1910 | goto yyerrdefault;
|
---|
| 1911 |
|
---|
| 1912 | yyn += YYTERROR;
|
---|
| 1913 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
|
---|
| 1914 | goto yyerrdefault;
|
---|
| 1915 |
|
---|
| 1916 | yyn = yytable[yyn];
|
---|
| 1917 | if (yyn < 0)
|
---|
| 1918 | {
|
---|
| 1919 | if (yyn == YYFLAG)
|
---|
| 1920 | goto yyerrpop;
|
---|
| 1921 | yyn = -yyn;
|
---|
| 1922 | goto yyreduce;
|
---|
| 1923 | }
|
---|
| 1924 | else if (yyn == 0)
|
---|
| 1925 | goto yyerrpop;
|
---|
| 1926 |
|
---|
| 1927 | if (yyn == YYFINAL)
|
---|
| 1928 | YYACCEPT;
|
---|
| 1929 |
|
---|
| 1930 | #if YYDEBUG != 0
|
---|
| 1931 | if (yydebug)
|
---|
| 1932 | fprintf(stderr, "Shifting error token, ");
|
---|
| 1933 | #endif
|
---|
| 1934 |
|
---|
| 1935 | *++yyvsp = yylval;
|
---|
| 1936 | #ifdef YYLSP_NEEDED
|
---|
| 1937 | *++yylsp = yylloc;
|
---|
| 1938 | #endif
|
---|
| 1939 |
|
---|
| 1940 | yystate = yyn;
|
---|
| 1941 | goto yynewstate;
|
---|
| 1942 |
|
---|
| 1943 | yyacceptlab:
|
---|
| 1944 | /* YYACCEPT comes here. */
|
---|
| 1945 | if (yyfree_stacks)
|
---|
| 1946 | {
|
---|
| 1947 | free (yyss);
|
---|
| 1948 | free (yyvs);
|
---|
| 1949 | #ifdef YYLSP_NEEDED
|
---|
| 1950 | free (yyls);
|
---|
| 1951 | #endif
|
---|
| 1952 | }
|
---|
| 1953 | return 0;
|
---|
| 1954 |
|
---|
| 1955 | yyabortlab:
|
---|
| 1956 | /* YYABORT comes here. */
|
---|
| 1957 | if (yyfree_stacks)
|
---|
| 1958 | {
|
---|
| 1959 | free (yyss);
|
---|
| 1960 | free (yyvs);
|
---|
| 1961 | #ifdef YYLSP_NEEDED
|
---|
| 1962 | free (yyls);
|
---|
| 1963 | #endif
|
---|
| 1964 | }
|
---|
| 1965 | return 1;
|
---|
| 1966 | }
|
---|
| 1967 | #line 911 "parse.y"
|
---|
| 1968 |
|
---|
| 1969 |
|
---|
| 1970 |
|
---|
| 1971 | /* build_eof_action - build the "<<EOF>>" action for the active start
|
---|
| 1972 | * conditions
|
---|
| 1973 | */
|
---|
| 1974 |
|
---|
| 1975 | void build_eof_action()
|
---|
| 1976 | {
|
---|
| 1977 | register int i;
|
---|
| 1978 | char action_text[MAXLINE];
|
---|
| 1979 |
|
---|
| 1980 | for ( i = 1; i <= scon_stk_ptr; ++i )
|
---|
| 1981 | {
|
---|
| 1982 | if ( sceof[scon_stk[i]] )
|
---|
| 1983 | format_pinpoint_message(
|
---|
| 1984 | "multiple <<EOF>> rules for start condition %s",
|
---|
| 1985 | scname[scon_stk[i]] );
|
---|
| 1986 |
|
---|
| 1987 | else
|
---|
| 1988 | {
|
---|
| 1989 | sceof[scon_stk[i]] = true;
|
---|
| 1990 | sprintf( action_text, "case YY_STATE_EOF(%s):\n",
|
---|
| 1991 | scname[scon_stk[i]] );
|
---|
| 1992 | add_action( action_text );
|
---|
| 1993 | }
|
---|
| 1994 | }
|
---|
| 1995 |
|
---|
| 1996 | line_directive_out( (FILE *) 0, 1 );
|
---|
| 1997 |
|
---|
| 1998 | /* This isn't a normal rule after all - don't count it as
|
---|
| 1999 | * such, so we don't have any holes in the rule numbering
|
---|
| 2000 | * (which make generating "rule can never match" warnings
|
---|
| 2001 | * more difficult.
|
---|
| 2002 | */
|
---|
| 2003 | --num_rules;
|
---|
| 2004 | ++num_eof_rules;
|
---|
| 2005 | }
|
---|
| 2006 |
|
---|
| 2007 |
|
---|
| 2008 | /* format_synerr - write out formatted syntax error */
|
---|
| 2009 |
|
---|
| 2010 | void format_synerr( msg, arg )
|
---|
| 2011 | const char *msg, arg[];
|
---|
| 2012 | {
|
---|
| 2013 | char errmsg[MAXLINE];
|
---|
| 2014 |
|
---|
| 2015 | (void) sprintf( errmsg, msg, arg );
|
---|
| 2016 | synerr( errmsg );
|
---|
| 2017 | }
|
---|
| 2018 |
|
---|
| 2019 |
|
---|
| 2020 | /* synerr - report a syntax error */
|
---|
| 2021 |
|
---|
| 2022 | void synerr( str )
|
---|
| 2023 | const char *str;
|
---|
| 2024 | {
|
---|
| 2025 | syntaxerror = true;
|
---|
| 2026 | pinpoint_message( str );
|
---|
| 2027 | }
|
---|
| 2028 |
|
---|
| 2029 |
|
---|
| 2030 | /* format_warn - write out formatted warning */
|
---|
| 2031 |
|
---|
| 2032 | void format_warn( msg, arg )
|
---|
| 2033 | const char *msg, arg[];
|
---|
| 2034 | {
|
---|
| 2035 | char warn_msg[MAXLINE];
|
---|
| 2036 |
|
---|
| 2037 | (void) sprintf( warn_msg, msg, arg );
|
---|
| 2038 | warn( warn_msg );
|
---|
| 2039 | }
|
---|
| 2040 |
|
---|
| 2041 |
|
---|
| 2042 | /* warn - report a warning, unless -w was given */
|
---|
| 2043 |
|
---|
| 2044 | void warn( str )
|
---|
| 2045 | const char *str;
|
---|
| 2046 | {
|
---|
| 2047 | line_warning( str, linenum );
|
---|
| 2048 | }
|
---|
| 2049 |
|
---|
| 2050 | /* format_pinpoint_message - write out a message formatted with one string,
|
---|
| 2051 | * pinpointing its location
|
---|
| 2052 | */
|
---|
| 2053 |
|
---|
| 2054 | void format_pinpoint_message( msg, arg )
|
---|
| 2055 | const char *msg, arg[];
|
---|
| 2056 | {
|
---|
| 2057 | char errmsg[MAXLINE];
|
---|
| 2058 |
|
---|
| 2059 | (void) sprintf( errmsg, msg, arg );
|
---|
| 2060 | pinpoint_message( errmsg );
|
---|
| 2061 | }
|
---|
| 2062 |
|
---|
| 2063 |
|
---|
| 2064 | /* pinpoint_message - write out a message, pinpointing its location */
|
---|
| 2065 |
|
---|
| 2066 | void pinpoint_message( str )
|
---|
| 2067 | const char *str;
|
---|
| 2068 | {
|
---|
| 2069 | line_pinpoint( str, linenum );
|
---|
| 2070 | }
|
---|
| 2071 |
|
---|
| 2072 |
|
---|
| 2073 | /* line_warning - report a warning at a given line, unless -w was given */
|
---|
| 2074 |
|
---|
| 2075 | void line_warning( str, line )
|
---|
| 2076 | const char *str;
|
---|
| 2077 | int line;
|
---|
| 2078 | {
|
---|
| 2079 | char warning[MAXLINE];
|
---|
| 2080 |
|
---|
| 2081 | if ( ! nowarn )
|
---|
| 2082 | {
|
---|
| 2083 | sprintf( warning, "warning, %s", str );
|
---|
| 2084 | line_pinpoint( warning, line );
|
---|
| 2085 | }
|
---|
| 2086 | }
|
---|
| 2087 |
|
---|
| 2088 |
|
---|
| 2089 | /* line_pinpoint - write out a message, pinpointing it at the given line */
|
---|
| 2090 |
|
---|
| 2091 | void line_pinpoint( str, line )
|
---|
| 2092 | const char *str;
|
---|
| 2093 | int line;
|
---|
| 2094 | {
|
---|
| 2095 | fprintf( stderr, "%s:%d: %s\n", infilename, line, str );
|
---|
| 2096 | }
|
---|
| 2097 |
|
---|
| 2098 |
|
---|
| 2099 | /* yyerror - eat up an error message from the parser;
|
---|
| 2100 | * currently, messages are ignore
|
---|
| 2101 | */
|
---|
| 2102 |
|
---|
| 2103 | void yyerror( msg )
|
---|
| 2104 | const char *msg;
|
---|
| 2105 | {
|
---|
| 2106 | }
|
---|