home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 1 / FFMCD01.bin / useful / dist / gnu / flex / build / parse.c next >
Encoding:
C/C++ Source or Header  |  1993-08-30  |  39.8 KB  |  1,602 lines

  1.  
  2. /*  A Bison parser, made from parse.y with Bison version GNU Bison version 1.21
  3.   */
  4.  
  5. #define YYBISON 1  /* Identify Bison output.  */
  6.  
  7. #define    CHAR    258
  8. #define    NUMBER    259
  9. #define    SECTEND    260
  10. #define    SCDECL    261
  11. #define    XSCDECL    262
  12. #define    WHITESPACE    263
  13. #define    NAME    264
  14. #define    PREVCCL    265
  15. #define    EOF_OP    266
  16.  
  17. #line 6 "parse.y"
  18.  
  19. /*-
  20.  * Copyright (c) 1990 The Regents of the University of California.
  21.  * All rights reserved.
  22.  *
  23.  * This code is derived from software contributed to Berkeley by
  24.  * Vern Paxson.
  25.  * 
  26.  * The United States Government has rights in this work pursuant
  27.  * to contract no. DE-AC03-76SF00098 between the United States
  28.  * Department of Energy and the University of California.
  29.  *
  30.  * Redistribution and use in source and binary forms are permitted provided
  31.  * that: (1) source distributions retain this entire copyright notice and
  32.  * comment, and (2) distributions including binaries display the following
  33.  * acknowledgement:  ``This product includes software developed by the
  34.  * University of California, Berkeley and its contributors'' in the
  35.  * documentation or other materials provided with the distribution and in
  36.  * all advertising materials mentioning features or use of this software.
  37.  * Neither the name of the University nor the names of its contributors may
  38.  * be used to endorse or promote products derived from this software without
  39.  * specific prior written permission.
  40.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
  41.  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  42.  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  43.  */
  44.  
  45. #ifndef lint
  46. static char rcsid[] =
  47.     "@(#) $Header: /usr/fsys/odin/a/vern/flex/RCS/parse.y,v 2.7 90/06/27 23:48:31 vern Exp $ (LBL)";
  48. #endif
  49.  
  50. #include "flexdef.h"
  51.  
  52. int pat, scnum, eps, headcnt, trailcnt, anyccl, lastchar, i, actvp, rulelen;
  53. int trlcontxt, xcluflg, cclsorted, varlength, variable_trail_rule;
  54. Char clower();
  55. void build_eof_action();
  56. void yyerror();
  57.  
  58. static int madeany = false;  /* whether we've made the '.' character class */
  59. int previous_continued_action;    /* whether the previous rule's action was '|' */
  60.  
  61.  
  62. #ifndef YYLTYPE
  63. typedef
  64.   struct yyltype
  65.     {
  66.       int timestamp;
  67.       int first_line;
  68.       int first_column;
  69.       int last_line;
  70.       int last_column;
  71.       char *text;
  72.    }
  73.   yyltype;
  74.  
  75. #define YYLTYPE yyltype
  76. #endif
  77.  
  78. #ifndef YYSTYPE
  79. #define YYSTYPE int
  80. #endif
  81. #include <stdio.h>
  82.  
  83. #ifndef __cplusplus
  84. #ifndef __STDC__
  85. #define const
  86. #endif
  87. #endif
  88.  
  89.  
  90.  
  91. #define    YYFINAL        81
  92. #define    YYFLAG        -32768
  93. #define    YYNTBASE    32
  94.  
  95. #define YYTRANSLATE(x) ((unsigned)(x) <= 266 ? yytranslate[x] : 51)
  96.  
  97. static const char yytranslate[] = {     0,
  98.      2,     2,     2,     2,     2,     2,     2,     2,     2,    12,
  99.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  100.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  101.      2,     2,     2,    26,     2,    17,     2,     2,     2,    27,
  102.     28,    20,    21,    16,    31,    25,    19,     2,     2,     2,
  103.      2,     2,     2,     2,     2,     2,     2,     2,     2,    14,
  104.      2,    15,    22,     2,     2,     2,     2,     2,     2,     2,
  105.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  106.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  107.     29,     2,    30,    13,     2,     2,     2,     2,     2,     2,
  108.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  109.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  110.      2,     2,    23,    18,    24,     2,     2,     2,     2,     2,
  111.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  112.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  113.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  114.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  115.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  116.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  117.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  118.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  119.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  120.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  121.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  122.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  123.      2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
  124.      6,     7,     8,     9,    10,    11
  125. };
  126.  
  127. #if YYDEBUG != 0
  128. static const short yyprhs[] = {     0,
  129.      0,     6,     7,    13,    14,    17,    19,    21,    23,    27,
  130.     29,    31,    36,    37,    38,    42,    45,    48,    50,    53,
  131.     55,    57,    61,    65,    67,    69,    72,    76,    79,    81,
  132.     85,    87,    90,    93,    95,    98,   101,   104,   111,   117,
  133.    122,   124,   126,   128,   132,   136,   138,   142,   147,   152,
  134.    155,   156,   159
  135. };
  136.  
  137. static const short yyrhs[] = {    33,
  138.     34,    35,    38,    39,     0,     0,    34,    36,     8,    37,
  139.     12,     0,     0,     1,    12,     0,     5,     0,     6,     0,
  140.      7,     0,    37,     8,     9,     0,     9,     0,     1,     0,
  141.     38,    39,    40,    12,     0,     0,     0,    41,    13,    43,
  142.      0,    41,    43,     0,    13,    43,     0,    43,     0,    41,
  143.     11,     0,    11,     0,     1,     0,    14,    42,    15,     0,
  144.     42,    16,     9,     0,     9,     0,     1,     0,    45,    44,
  145.      0,    45,    44,    17,     0,    44,    17,     0,    44,     0,
  146.     44,    18,    46,     0,    46,     0,    44,    19,     0,    46,
  147.     47,     0,    47,     0,    47,    20,     0,    47,    21,     0,
  148.     47,    22,     0,    47,    23,     4,    16,     4,    24,     0,
  149.     47,    23,     4,    16,    24,     0,    47,    23,     4,    24,
  150.      0,    25,     0,    48,     0,    10,     0,    26,    50,    26,
  151.      0,    27,    44,    28,     0,     3,     0,    29,    49,    30,
  152.      0,    29,    13,    49,    30,     0,    49,     3,    31,     3,
  153.      0,    49,     3,     0,     0,    50,     3,     0,     0
  154. };
  155.  
  156. #endif
  157.  
  158. #if YYDEBUG != 0
  159. static const short yyrline[] = { 0,
  160.     52,    76,    85,    86,    87,    91,    94,   104,   108,   111,
  161.    114,   118,   119,   122,   133,   153,   164,   188,   199,   202,
  162.    221,   225,   228,   238,   247,   251,   308,   311,   363,   379,
  163.    385,   390,   415,   423,   427,   434,   441,   448,   474,   488,
  164.    506,   528,   545,   552,   555,   558,   569,   572,   586,   614,
  165.    626,   634,   645
  166. };
  167.  
  168. static const char * const yytname[] = {   "$","error","$illegal.","CHAR","NUMBER",
  169. "SECTEND","SCDECL","XSCDECL","WHITESPACE","NAME","PREVCCL","EOF_OP","'\\n'",
  170. "'^'","'<'","'>'","','","'$'","'|'","'/'","'*'","'+'","'?'","'{'","'}'","'.'",
  171. "'\"'","'('","')'","'['","']'","'-'","goal","initlex","sect1","sect1end","startconddecl",
  172. "namelist1","sect2","initforrule","flexrule","scon","namelist2","rule","re",
  173. "re2","series","singleton","fullccl","ccl","string",""
  174. };
  175. #endif
  176.  
  177. static const short yyr1[] = {     0,
  178.     32,    33,    34,    34,    34,    35,    36,    36,    37,    37,
  179.     37,    38,    38,    39,    40,    40,    40,    40,    40,    40,
  180.     40,    41,    42,    42,    42,    43,    43,    43,    43,    44,
  181.     44,    45,    46,    46,    47,    47,    47,    47,    47,    47,
  182.     47,    47,    47,    47,    47,    47,    48,    48,    49,    49,
  183.     49,    50,    50
  184. };
  185.  
  186. static const short yyr2[] = {     0,
  187.      5,     0,     5,     0,     2,     1,     1,     1,     3,     1,
  188.      1,     4,     0,     0,     3,     2,     2,     1,     2,     1,
  189.      1,     3,     3,     1,     1,     2,     3,     2,     1,     3,
  190.      1,     2,     2,     1,     2,     2,     2,     6,     5,     4,
  191.      1,     1,     1,     3,     3,     1,     3,     4,     4,     2,
  192.      0,     2,     0
  193. };
  194.  
  195. static const short yydefact[] = {     2,
  196.      0,     0,     0,     5,     6,     7,     8,    13,     0,    14,
  197.      0,     0,    11,    10,     0,    21,    46,    43,    20,     0,
  198.      0,    41,    53,     0,    51,     0,     0,    18,    29,     0,
  199.     31,    34,    42,     0,     3,    17,    25,    24,     0,     0,
  200.      0,    51,     0,    12,    19,     0,    16,    28,     0,    32,
  201.     26,    33,    35,    36,    37,     0,     9,    22,     0,    52,
  202.     44,    45,     0,    50,    47,    15,    30,    27,     0,    23,
  203.     48,     0,     0,    40,    49,     0,    39,    38,     0,     0,
  204.      0
  205. };
  206.  
  207. static const short yydefgoto[] = {    79,
  208.      1,     3,     8,     9,    15,    10,    12,    26,    27,    39,
  209.     28,    29,    30,    31,    32,    33,    43,    40
  210. };
  211.  
  212. static const short yypact[] = {-32768,
  213.     55,    -2,    63,-32768,-32768,-32768,-32768,-32768,    16,-32768,
  214.     12,     1,-32768,-32768,    51,-32768,-32768,-32768,-32768,    19,
  215.     33,-32768,-32768,    19,    -6,     8,    28,-32768,    54,    19,
  216.     19,    44,-32768,    38,-32768,-32768,-32768,-32768,    34,    14,
  217.    -10,-32768,     2,-32768,-32768,    19,-32768,-32768,    19,-32768,
  218.     57,    44,-32768,-32768,-32768,    48,-32768,-32768,    49,-32768,
  219. -32768,-32768,     3,     6,-32768,-32768,    19,-32768,    27,-32768,
  220. -32768,    73,    -1,-32768,-32768,    53,-32768,-32768,    78,    79,
  221. -32768
  222. };
  223.  
  224. static const short yypgoto[] = {-32768,
  225. -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  226.    -11,    -5,-32768,    31,   -31,-32768,    39,-32768
  227. };
  228.  
  229.  
  230. #define    YYLAST        81
  231.  
  232.  
  233. static const short yytable[] = {    52,
  234.     -1,    16,    76,    17,    64,    64,    42,    49,    36,     4,
  235.     18,    19,    13,    20,    21,    47,    60,    62,    41,    44,
  236.     14,    17,    77,    11,    51,    22,    23,    24,    18,    25,
  237.     17,    65,    71,    37,    66,    52,    72,    18,    45,    61,
  238.     46,    38,    73,    22,    23,    24,    57,    25,    58,    59,
  239.     74,    69,    22,    23,    24,     2,    25,    70,    34,    -4,
  240.     -4,    -4,    35,    53,    54,    55,    56,     5,     6,     7,
  241.     48,    49,    50,    68,    49,    75,    78,    80,    81,    67,
  242.     63
  243. };
  244.  
  245. static const short yycheck[] = {    31,
  246.      0,     1,     4,     3,     3,     3,    13,    18,    20,    12,
  247.     10,    11,     1,    13,    14,    27,     3,    28,    24,    12,
  248.      9,     3,    24,     8,    30,    25,    26,    27,    10,    29,
  249.      3,    30,    30,     1,    46,    67,    31,    10,    11,    26,
  250.     13,     9,    16,    25,    26,    27,     9,    29,    15,    16,
  251.     24,     4,    25,    26,    27,     1,    29,     9,     8,     5,
  252.      6,     7,    12,    20,    21,    22,    23,     5,     6,     7,
  253.     17,    18,    19,    17,    18,     3,    24,     0,     0,    49,
  254.     42
  255. };
  256. /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
  257. #line 3 "/usr/local/lib/bison.simple"
  258.  
  259. /* Skeleton output parser for bison,
  260.    Copyright (C) 1984, 1989, 1990 Bob Corbett and Richard Stallman
  261.  
  262.    This program is free software; you can redistribute it and/or modify
  263.    it under the terms of the GNU General Public License as published by
  264.    the Free Software Foundation; either version 1, or (at your option)
  265.    any later version.
  266.  
  267.    This program is distributed in the hope that it will be useful,
  268.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  269.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  270.    GNU General Public License for more details.
  271.  
  272.    You should have received a copy of the GNU General Public License
  273.    along with this program; if not, write to the Free Software
  274.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  275.  
  276.  
  277. #ifndef alloca
  278. #ifdef __GNUC__
  279. #define alloca __builtin_alloca
  280. #else /* not GNU C.  */
  281. #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
  282. #include <alloca.h>
  283. #else /* not sparc */
  284. #if defined (MSDOS) && !defined (__TURBOC__)
  285. #include <malloc.h>
  286. #else /* not MSDOS, or __TURBOC__ */
  287. #if defined(_AIX)
  288. #include <malloc.h>
  289.  #pragma alloca
  290. #else /* not MSDOS, __TURBOC__, or _AIX */
  291. #ifdef __hpux
  292. #ifdef __cplusplus
  293. extern "C" {
  294. void *alloca (unsigned int);
  295. };
  296. #else /* not __cplusplus */
  297. void *alloca (unsigned int);
  298. #endif /* not __cplusplus */
  299. #endif /* __hpux */
  300. #endif /* not _AIX */
  301. #endif /* not MSDOS, or __TURBOC__ */
  302. #endif /* not sparc.  */
  303. #endif /* not GNU C.  */
  304. #endif /* alloca not defined.  */
  305.  
  306. /* This is the parser code that is written into each bison parser
  307.   when the %semantic_parser declaration is not specified in the grammar.
  308.   It was written by Richard Stallman by simplifying the hairy parser
  309.   used when %semantic_parser is specified.  */
  310.  
  311. /* Note: there must be only one dollar sign in this file.
  312.    It is replaced by the list of actions, each action
  313.    as one case of the switch.  */
  314.  
  315. #define yyerrok        (yyerrstatus = 0)
  316. #define yyclearin    (yychar = YYEMPTY)
  317. #define YYEMPTY        -2
  318. #define YYEOF        0
  319. #define YYACCEPT    return(0)
  320. #define YYABORT     return(1)
  321. #define YYERROR        goto yyerrlab1
  322. /* Like YYERROR except do call yyerror.
  323.    This remains here temporarily to ease the
  324.    transition to the new meaning of YYERROR, for GCC.
  325.    Once GCC version 2 has supplanted version 1, this can go.  */
  326. #define YYFAIL        goto yyerrlab
  327. #define YYRECOVERING()  (!!yyerrstatus)
  328. #define YYBACKUP(token, value) \
  329. do                                \
  330.   if (yychar == YYEMPTY && yylen == 1)                \
  331.     { yychar = (token), yylval = (value);            \
  332.       yychar1 = YYTRANSLATE (yychar);                \
  333.       YYPOPSTACK;                        \
  334.       goto yybackup;                        \
  335.     }                                \
  336.   else                                \
  337.     { yyerror ("syntax error: cannot back up"); YYERROR; }    \
  338. while (0)
  339.  
  340. #define YYTERROR    1
  341. #define YYERRCODE    256
  342.  
  343. #ifndef YYPURE
  344. #define YYLEX        yylex()
  345. #endif
  346.  
  347. #ifdef YYPURE
  348. #ifdef YYLSP_NEEDED
  349. #define YYLEX        yylex(&yylval, &yylloc)
  350. #else
  351. #define YYLEX        yylex(&yylval)
  352. #endif
  353. #endif
  354.  
  355. /* If nonreentrant, generate the variables here */
  356.  
  357. #ifndef YYPURE
  358.  
  359. int    yychar;            /*  the lookahead symbol        */
  360. YYSTYPE    yylval;            /*  the semantic value of the        */
  361.                 /*  lookahead symbol            */
  362.  
  363. #ifdef YYLSP_NEEDED
  364. YYLTYPE yylloc;            /*  location data for the lookahead    */
  365.                 /*  symbol                */
  366. #endif
  367.  
  368. int yynerrs;            /*  number of parse errors so far       */
  369. #endif  /* not YYPURE */
  370.  
  371. #if YYDEBUG != 0
  372. int yydebug;            /*  nonzero means print parse trace    */
  373. /* Since this is uninitialized, it does not stop multiple parsers
  374.    from coexisting.  */
  375. #endif
  376.  
  377. /*  YYINITDEPTH indicates the initial size of the parser's stacks    */
  378.  
  379. #ifndef    YYINITDEPTH
  380. #define YYINITDEPTH 200
  381. #endif
  382.  
  383. /*  YYMAXDEPTH is the maximum size the stacks can grow to
  384.     (effective only if the built-in stack extension method is used).  */
  385.  
  386. #if YYMAXDEPTH == 0
  387. #undef YYMAXDEPTH
  388. #endif
  389.  
  390. #ifndef YYMAXDEPTH
  391. #define YYMAXDEPTH 10000
  392. #endif
  393.  
  394. /* Prevent warning if -Wstrict-prototypes.  */
  395. #ifdef __GNUC__
  396. int yyparse (void);
  397. #endif
  398.  
  399. #if __GNUC__ > 1        /* GNU C and GNU C++ define this.  */
  400. #define __yy_bcopy(FROM,TO,COUNT)    __builtin_memcpy(TO,FROM,COUNT)
  401. #else                /* not GNU C or C++ */
  402. #ifndef __cplusplus
  403.  
  404. /* This is the most reliable way to avoid incompatibilities
  405.    in available built-in functions on various systems.  */
  406. static void
  407. __yy_bcopy (from, to, count)
  408.      char *from;
  409.      char *to;
  410.      int count;
  411. {
  412.   register char *f = from;
  413.   register char *t = to;
  414.   register int i = count;
  415.  
  416.   while (i-- > 0)
  417.     *t++ = *f++;
  418. }
  419.  
  420. #else /* __cplusplus */
  421.  
  422. /* This is the most reliable way to avoid incompatibilities
  423.    in available built-in functions on various systems.  */
  424. static void
  425. __yy_bcopy (char *from, char *to, int count)
  426. {
  427.   register char *f = from;
  428.   register char *t = to;
  429.   register int i = count;
  430.  
  431.   while (i-- > 0)
  432.     *t++ = *f++;
  433. }
  434.  
  435. #endif
  436. #endif
  437.  
  438. #line 184 "/usr/local/lib/bison.simple"
  439. int
  440. yyparse()
  441. {
  442.   register int yystate;
  443.   register int yyn;
  444.   register short *yyssp;
  445.   register YYSTYPE *yyvsp;
  446.   int yyerrstatus;    /*  number of tokens to shift before error messages enabled */
  447.   int yychar1;        /*  lookahead token as an internal (translated) token number */
  448.  
  449.   short    yyssa[YYINITDEPTH];    /*  the state stack            */
  450.   YYSTYPE yyvsa[YYINITDEPTH];    /*  the semantic value stack        */
  451.  
  452.   short *yyss = yyssa;        /*  refer to the stacks thru separate pointers */
  453.   YYSTYPE *yyvs = yyvsa;    /*  to allow yyoverflow to reallocate them elsewhere */
  454.  
  455. #ifdef YYLSP_NEEDED
  456.   YYLTYPE yylsa[YYINITDEPTH];    /*  the location stack            */
  457.   YYLTYPE *yyls = yylsa;
  458.   YYLTYPE *yylsp;
  459.  
  460. #define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
  461. #else
  462. #define YYPOPSTACK   (yyvsp--, yyssp--)
  463. #endif
  464.  
  465.   int yystacksize = YYINITDEPTH;
  466.  
  467. #ifdef YYPURE
  468.   int yychar;
  469.   YYSTYPE yylval;
  470.   int yynerrs;
  471. #ifdef YYLSP_NEEDED
  472.   YYLTYPE yylloc;
  473. #endif
  474. #endif
  475.  
  476.   YYSTYPE yyval;        /*  the variable used to return        */
  477.                 /*  semantic values from the action    */
  478.                 /*  routines                */
  479.  
  480.   int yylen;
  481.  
  482. #if YYDEBUG != 0
  483.   if (yydebug)
  484.     fprintf(stderr, "Starting parse\n");
  485. #endif
  486.  
  487.   yystate = 0;
  488.   yyerrstatus = 0;
  489.   yynerrs = 0;
  490.   yychar = YYEMPTY;        /* Cause a token to be read.  */
  491.  
  492.   /* Initialize stack pointers.
  493.      Waste one element of value and location stack
  494.      so that they stay on the same level as the state stack.
  495.      The wasted elements are never initialized.  */
  496.  
  497.   yyssp = yyss - 1;
  498.   yyvsp = yyvs;
  499. #ifdef YYLSP_NEEDED
  500.   yylsp = yyls;
  501. #endif
  502.  
  503. /* Push a new state, which is found in  yystate  .  */
  504. /* In all cases, when you get here, the value and location stacks
  505.    have just been pushed. so pushing a state here evens the stacks.  */
  506. yynewstate:
  507.  
  508.   *++yyssp = yystate;
  509.  
  510.   if (yyssp >= yyss + yystacksize - 1)
  511.     {
  512.       /* Give user a chance to reallocate the stack */
  513.       /* Use copies of these so that the &'s don't force the real ones into memory. */
  514.       YYSTYPE *yyvs1 = yyvs;
  515.       short *yyss1 = yyss;
  516. #ifdef YYLSP_NEEDED
  517.       YYLTYPE *yyls1 = yyls;
  518. #endif
  519.  
  520.       /* Get the current used size of the three stacks, in elements.  */
  521.       int size = yyssp - yyss + 1;
  522.  
  523. #ifdef yyoverflow
  524.       /* Each stack pointer address is followed by the size of
  525.      the data in use in that stack, in bytes.  */
  526.       yyoverflow("parser stack overflow",
  527.          &yyss1, size * sizeof (*yyssp),
  528.          &yyvs1, size * sizeof (*yyvsp),
  529. #ifdef YYLSP_NEEDED
  530.          &yyls1, size * sizeof (*yylsp),
  531. #endif
  532.          &yystacksize);
  533.  
  534.       yyss = yyss1; yyvs = yyvs1;
  535. #ifdef YYLSP_NEEDED
  536.       yyls = yyls1;
  537. #endif
  538. #else /* no yyoverflow */
  539.       /* Extend the stack our own way.  */
  540.       if (yystacksize >= YYMAXDEPTH)
  541.     {
  542.       yyerror("parser stack overflow");
  543.       return 2;
  544.     }
  545.       yystacksize *= 2;
  546.       if (yystacksize > YYMAXDEPTH)
  547.     yystacksize = YYMAXDEPTH;
  548.       yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
  549.       __yy_bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
  550.       yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
  551.       __yy_bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
  552. #ifdef YYLSP_NEEDED
  553.       yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
  554.       __yy_bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
  555. #endif
  556. #endif /* no yyoverflow */
  557.  
  558.       yyssp = yyss + size - 1;
  559.       yyvsp = yyvs + size - 1;
  560. #ifdef YYLSP_NEEDED
  561.       yylsp = yyls + size - 1;
  562. #endif
  563.  
  564. #if YYDEBUG != 0
  565.       if (yydebug)
  566.     fprintf(stderr, "Stack size increased to %d\n", yystacksize);
  567. #endif
  568.  
  569.       if (yyssp >= yyss + yystacksize - 1)
  570.     YYABORT;
  571.     }
  572.  
  573. #if YYDEBUG != 0
  574.   if (yydebug)
  575.     fprintf(stderr, "Entering state %d\n", yystate);
  576. #endif
  577.  
  578.   goto yybackup;
  579.  yybackup:
  580.  
  581. /* Do appropriate processing given the current state.  */
  582. /* Read a lookahead token if we need one and don't already have one.  */
  583. /* yyresume: */
  584.  
  585.   /* First try to decide what to do without reference to lookahead token.  */
  586.  
  587.   yyn = yypact[yystate];
  588.   if (yyn == YYFLAG)
  589.     goto yydefault;
  590.  
  591.   /* Not known => get a lookahead token if don't already have one.  */
  592.  
  593.   /* yychar is either YYEMPTY or YYEOF
  594.      or a valid token in external form.  */
  595.  
  596.   if (yychar == YYEMPTY)
  597.     {
  598. #if YYDEBUG != 0
  599.       if (yydebug)
  600.     fprintf(stderr, "Reading a token: ");
  601. #endif
  602.       yychar = YYLEX;
  603.     }
  604.  
  605.   /* Convert token to internal form (in yychar1) for indexing tables with */
  606.  
  607.   if (yychar <= 0)        /* This means end of input. */
  608.     {
  609.       yychar1 = 0;
  610.       yychar = YYEOF;        /* Don't call YYLEX any more */
  611.  
  612. #if YYDEBUG != 0
  613.       if (yydebug)
  614.     fprintf(stderr, "Now at end of input.\n");
  615. #endif
  616.     }
  617.   else
  618.     {
  619.       yychar1 = YYTRANSLATE(yychar);
  620.  
  621. #if YYDEBUG != 0
  622.       if (yydebug)
  623.     {
  624.       fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
  625.       /* Give the individual parser a way to print the precise meaning
  626.          of a token, for further debugging info.  */
  627. #ifdef YYPRINT
  628.       YYPRINT (stderr, yychar, yylval);
  629. #endif
  630.       fprintf (stderr, ")\n");
  631.     }
  632. #endif
  633.     }
  634.  
  635.   yyn += yychar1;
  636.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
  637.     goto yydefault;
  638.  
  639.   yyn = yytable[yyn];
  640.  
  641.   /* yyn is what to do for this token type in this state.
  642.      Negative => reduce, -yyn is rule number.
  643.      Positive => shift, yyn is new state.
  644.        New state is final state => don't bother to shift,
  645.        just return success.
  646.      0, or most negative number => error.  */
  647.  
  648.   if (yyn < 0)
  649.     {
  650.       if (yyn == YYFLAG)
  651.     goto yyerrlab;
  652.       yyn = -yyn;
  653.       goto yyreduce;
  654.     }
  655.   else if (yyn == 0)
  656.     goto yyerrlab;
  657.  
  658.   if (yyn == YYFINAL)
  659.     YYACCEPT;
  660.  
  661.   /* Shift the lookahead token.  */
  662.  
  663. #if YYDEBUG != 0
  664.   if (yydebug)
  665.     fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
  666. #endif
  667.  
  668.   /* Discard the token being shifted unless it is eof.  */
  669.   if (yychar != YYEOF)
  670.     yychar = YYEMPTY;
  671.  
  672.   *++yyvsp = yylval;
  673. #ifdef YYLSP_NEEDED
  674.   *++yylsp = yylloc;
  675. #endif
  676.  
  677.   /* count tokens shifted since error; after three, turn off error status.  */
  678.   if (yyerrstatus) yyerrstatus--;
  679.  
  680.   yystate = yyn;
  681.   goto yynewstate;
  682.  
  683. /* Do the default action for the current state.  */
  684. yydefault:
  685.  
  686.   yyn = yydefact[yystate];
  687.   if (yyn == 0)
  688.     goto yyerrlab;
  689.  
  690. /* Do a reduction.  yyn is the number of a rule to reduce with.  */
  691. yyreduce:
  692.   yylen = yyr2[yyn];
  693.   yyval = yyvsp[1-yylen]; /* implement default value of the action */
  694.  
  695. #if YYDEBUG != 0
  696.   if (yydebug)
  697.     {
  698.       int i;
  699.  
  700.       fprintf (stderr, "Reducing via rule %d (line %d), ",
  701.            yyn, yyrline[yyn]);
  702.  
  703.       /* Print the symbols being reduced, and their result.  */
  704.       for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
  705.     fprintf (stderr, "%s ", yytname[yyrhs[i]]);
  706.       fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
  707.     }
  708. #endif
  709.  
  710.  
  711.   switch (yyn) {
  712.  
  713. case 1:
  714. #line 53 "parse.y"
  715. { /* add default rule */
  716.             int def_rule;
  717.  
  718.             pat = cclinit();
  719.             cclnegate( pat );
  720.  
  721.             def_rule = mkstate( -pat );
  722.  
  723.             finish_rule( def_rule, false, 0, 0 );
  724.  
  725.             for ( i = 1; i <= lastsc; ++i )
  726.                 scset[i] = mkbranch( scset[i], def_rule );
  727.  
  728.             if ( spprdflt )
  729.                 fputs( "YY_FATAL_ERROR( \"flex scanner jammed\" )",
  730.                    temp_action_file );
  731.             else
  732.                 fputs( "ECHO", temp_action_file );
  733.  
  734.             fputs( ";\n\tYY_BREAK\n", temp_action_file );
  735.             ;
  736.     break;}
  737. case 2:
  738. #line 77 "parse.y"
  739. {
  740.             /* initialize for processing rules */
  741.  
  742.             /* create default DFA start condition */
  743.             scinstal( "INITIAL", false );
  744.             ;
  745.     break;}
  746. case 5:
  747. #line 88 "parse.y"
  748. { synerr( "unknown error processing section 1" ); ;
  749.     break;}
  750. case 7:
  751. #line 95 "parse.y"
  752. {
  753.             /* these productions are separate from the s1object
  754.              * rule because the semantics must be done before
  755.              * we parse the remainder of an s1object
  756.              */
  757.  
  758.             xcluflg = false;
  759.             ;
  760.     break;}
  761. case 8:
  762. #line 105 "parse.y"
  763. { xcluflg = true; ;
  764.     break;}
  765. case 9:
  766. #line 109 "parse.y"
  767. { scinstal( nmstr, xcluflg ); ;
  768.     break;}
  769. case 10:
  770. #line 112 "parse.y"
  771. { scinstal( nmstr, xcluflg ); ;
  772.     break;}
  773. case 11:
  774. #line 115 "parse.y"
  775. { synerr( "bad start condition list" ); ;
  776.     break;}
  777. case 14:
  778. #line 123 "parse.y"
  779. {
  780.             /* initialize for a parse of one rule */
  781.             trlcontxt = variable_trail_rule = varlength = false;
  782.             trailcnt = headcnt = rulelen = 0;
  783.             current_state_type = STATE_NORMAL;
  784.             previous_continued_action = continued_action;
  785.             new_rule();
  786.             ;
  787.     break;}
  788. case 15:
  789. #line 134 "parse.y"
  790. {
  791.             pat = yyvsp[0];
  792.             finish_rule( pat, variable_trail_rule,
  793.                      headcnt, trailcnt );
  794.  
  795.             for ( i = 1; i <= actvp; ++i )
  796.                 scbol[actvsc[i]] =
  797.                 mkbranch( scbol[actvsc[i]], pat );
  798.  
  799.             if ( ! bol_needed )
  800.                 {
  801.                 bol_needed = true;
  802.  
  803.                 if ( performance_report )
  804.                 pinpoint_message( 
  805.                 "'^' operator results in sub-optimal performance" );
  806.                 }
  807.             ;
  808.     break;}
  809. case 16:
  810. #line 154 "parse.y"
  811. {
  812.             pat = yyvsp[0];
  813.             finish_rule( pat, variable_trail_rule,
  814.                      headcnt, trailcnt );
  815.  
  816.             for ( i = 1; i <= actvp; ++i )
  817.                 scset[actvsc[i]] =
  818.                 mkbranch( scset[actvsc[i]], pat );
  819.             ;
  820.     break;}
  821. case 17:
  822. #line 165 "parse.y"
  823. {
  824.             pat = yyvsp[0];
  825.             finish_rule( pat, variable_trail_rule,
  826.                      headcnt, trailcnt );
  827.  
  828.             /* add to all non-exclusive start conditions,
  829.              * including the default (0) start condition
  830.              */
  831.  
  832.             for ( i = 1; i <= lastsc; ++i )
  833.                 if ( ! scxclu[i] )
  834.                 scbol[i] = mkbranch( scbol[i], pat );
  835.  
  836.             if ( ! bol_needed )
  837.                 {
  838.                 bol_needed = true;
  839.  
  840.                 if ( performance_report )
  841.                 pinpoint_message(
  842.                 "'^' operator results in sub-optimal performance" );
  843.                 }
  844.             ;
  845.     break;}
  846. case 18:
  847. #line 189 "parse.y"
  848. {
  849.             pat = yyvsp[0];
  850.             finish_rule( pat, variable_trail_rule,
  851.                      headcnt, trailcnt );
  852.  
  853.             for ( i = 1; i <= lastsc; ++i )
  854.                 if ( ! scxclu[i] )
  855.                 scset[i] = mkbranch( scset[i], pat );
  856.             ;
  857.     break;}
  858. case 19:
  859. #line 200 "parse.y"
  860. { build_eof_action(); ;
  861.     break;}
  862. case 20:
  863. #line 203 "parse.y"
  864. {
  865.             /* this EOF applies to all start conditions
  866.              * which don't already have EOF actions
  867.              */
  868.             actvp = 0;
  869.  
  870.             for ( i = 1; i <= lastsc; ++i )
  871.                 if ( ! sceof[i] )
  872.                 actvsc[++actvp] = i;
  873.  
  874.             if ( actvp == 0 )
  875.                 pinpoint_message(
  876.         "warning - all start conditions already have <<EOF>> rules" );
  877.  
  878.             else
  879.                 build_eof_action();
  880.             ;
  881.     break;}
  882. case 21:
  883. #line 222 "parse.y"
  884. { synerr( "unrecognized rule" ); ;
  885.     break;}
  886. case 23:
  887. #line 229 "parse.y"
  888. {
  889.             if ( (scnum = sclookup( nmstr )) == 0 )
  890.                 format_pinpoint_message(
  891.                 "undeclared start condition %s", nmstr );
  892.  
  893.             else
  894.                 actvsc[++actvp] = scnum;
  895.             ;
  896.     break;}
  897. case 24:
  898. #line 239 "parse.y"
  899. {
  900.             if ( (scnum = sclookup( nmstr )) == 0 )
  901.                 format_pinpoint_message(
  902.                 "undeclared start condition %s", nmstr );
  903.             else
  904.                 actvsc[actvp = 1] = scnum;
  905.             ;
  906.     break;}
  907. case 25:
  908. #line 248 "parse.y"
  909. { synerr( "bad start condition list" ); ;
  910.     break;}
  911. case 26:
  912. #line 252 "parse.y"
  913. {
  914.             if ( transchar[lastst[yyvsp[0]]] != SYM_EPSILON )
  915.                 /* provide final transition \now/ so it
  916.                  * will be marked as a trailing context
  917.                  * state
  918.                  */
  919.                 yyvsp[0] = link_machines( yyvsp[0], mkstate( SYM_EPSILON ) );
  920.  
  921.             mark_beginning_as_normal( yyvsp[0] );
  922.             current_state_type = STATE_NORMAL;
  923.  
  924.             if ( previous_continued_action )
  925.                 {
  926.                 /* we need to treat this as variable trailing
  927.                  * context so that the backup does not happen
  928.                  * in the action but before the action switch
  929.                  * statement.  If the backup happens in the
  930.                  * action, then the rules "falling into" this
  931.                  * one's action will *also* do the backup,
  932.                  * erroneously.
  933.                  */
  934.                 if ( ! varlength || headcnt != 0 )
  935.                 {
  936.                 fprintf( stderr,
  937.     "%s: warning - trailing context rule at line %d made variable because\n",
  938.                      program_name, linenum );
  939.                 fprintf( stderr,
  940.                      "      of preceding '|' action\n" );
  941.                 }
  942.  
  943.                 /* mark as variable */
  944.                 varlength = true;
  945.                 headcnt = 0;
  946.                 }
  947.  
  948.             if ( varlength && headcnt == 0 )
  949.                 { /* variable trailing context rule */
  950.                 /* mark the first part of the rule as the accepting
  951.                  * "head" part of a trailing context rule
  952.                  */
  953.                 /* by the way, we didn't do this at the beginning
  954.                  * of this production because back then
  955.                  * current_state_type was set up for a trail
  956.                  * rule, and add_accept() can create a new
  957.                  * state ...
  958.                  */
  959.                 add_accept( yyvsp[-1], num_rules | YY_TRAILING_HEAD_MASK );
  960.                 variable_trail_rule = true;
  961.                 }
  962.             
  963.             else
  964.                 trailcnt = rulelen;
  965.  
  966.             yyval = link_machines( yyvsp[-1], yyvsp[0] );
  967.             ;
  968.     break;}
  969. case 27:
  970. #line 309 "parse.y"
  971. { synerr( "trailing context used twice" ); ;
  972.     break;}
  973. case 28:
  974. #line 312 "parse.y"
  975. {
  976.             if ( trlcontxt )
  977.                 {
  978.                 synerr( "trailing context used twice" );
  979.                 yyval = mkstate( SYM_EPSILON );
  980.                 }
  981.  
  982.             else if ( previous_continued_action )
  983.                 {
  984.                 /* see the comment in the rule for "re2 re"
  985.                  * above
  986.                  */
  987.                 if ( ! varlength || headcnt != 0 )
  988.                 {
  989.                 fprintf( stderr,
  990.     "%s: warning - trailing context rule at line %d made variable because\n",
  991.                      program_name, linenum );
  992.                 fprintf( stderr,
  993.                      "      of preceding '|' action\n" );
  994.                 }
  995.  
  996.                 /* mark as variable */
  997.                 varlength = true;
  998.                 headcnt = 0;
  999.                 }
  1000.  
  1001.             if ( varlength && headcnt == 0 )
  1002.                 {
  1003.                 /* again, see the comment in the rule for "re2 re"
  1004.                  * above
  1005.                  */
  1006.                 add_accept( yyvsp[-1], num_rules | YY_TRAILING_HEAD_MASK );
  1007.                 variable_trail_rule = true;
  1008.                 }
  1009.  
  1010.             else
  1011.                 {
  1012.                 if ( ! varlength )
  1013.                 headcnt = rulelen;
  1014.  
  1015.                 ++rulelen;
  1016.                 trailcnt = 1;
  1017.                 }
  1018.  
  1019.             trlcontxt = true;
  1020.  
  1021.             eps = mkstate( SYM_EPSILON );
  1022.             yyval = link_machines( yyvsp[-1],
  1023.                  link_machines( eps, mkstate( '\n' ) ) );
  1024.             ;
  1025.     break;}
  1026. case 29:
  1027. #line 364 "parse.y"
  1028. {
  1029.                 yyval = yyvsp[0];
  1030.  
  1031.             if ( trlcontxt )
  1032.                 {
  1033.                 if ( varlength && headcnt == 0 )
  1034.                 /* both head and trail are variable-length */
  1035.                 variable_trail_rule = true;
  1036.                 else
  1037.                 trailcnt = rulelen;
  1038.                 }
  1039.                 ;
  1040.     break;}
  1041. case 30:
  1042. #line 380 "parse.y"
  1043. {
  1044.             varlength = true;
  1045.             yyval = mkor( yyvsp[-2], yyvsp[0] );
  1046.             ;
  1047.     break;}
  1048. case 31:
  1049. #line 386 "parse.y"
  1050. { yyval = yyvsp[0]; ;
  1051.     break;}
  1052. case 32:
  1053. #line 391 "parse.y"
  1054. {
  1055.             /* this rule is written separately so
  1056.              * the reduction will occur before the trailing
  1057.              * series is parsed
  1058.              */
  1059.  
  1060.             if ( trlcontxt )
  1061.                 synerr( "trailing context used twice" );
  1062.             else
  1063.                 trlcontxt = true;
  1064.  
  1065.             if ( varlength )
  1066.                 /* we hope the trailing context is fixed-length */
  1067.                 varlength = false;
  1068.             else
  1069.                 headcnt = rulelen;
  1070.  
  1071.             rulelen = 0;
  1072.  
  1073.             current_state_type = STATE_TRAILING_CONTEXT;
  1074.             yyval = yyvsp[-1];
  1075.             ;
  1076.     break;}
  1077. case 33:
  1078. #line 416 "parse.y"
  1079. {
  1080.             /* this is where concatenation of adjacent patterns
  1081.              * gets done
  1082.              */
  1083.             yyval = link_machines( yyvsp[-1], yyvsp[0] );
  1084.             ;
  1085.     break;}
  1086. case 34:
  1087. #line 424 "parse.y"
  1088. { yyval = yyvsp[0]; ;
  1089.     break;}
  1090. case 35:
  1091. #line 428 "parse.y"
  1092. {
  1093.             varlength = true;
  1094.  
  1095.             yyval = mkclos( yyvsp[-1] );
  1096.             ;
  1097.     break;}
  1098. case 36:
  1099. #line 435 "parse.y"
  1100. {
  1101.             varlength = true;
  1102.  
  1103.             yyval = mkposcl( yyvsp[-1] );
  1104.             ;
  1105.     break;}
  1106. case 37:
  1107. #line 442 "parse.y"
  1108. {
  1109.             varlength = true;
  1110.  
  1111.             yyval = mkopt( yyvsp[-1] );
  1112.             ;
  1113.     break;}
  1114. case 38:
  1115. #line 449 "parse.y"
  1116. {
  1117.             varlength = true;
  1118.  
  1119.             if ( yyvsp[-3] > yyvsp[-1] || yyvsp[-3] < 0 )
  1120.                 {
  1121.                 synerr( "bad iteration values" );
  1122.                 yyval = yyvsp[-5];
  1123.                 }
  1124.             else
  1125.                 {
  1126.                 if ( yyvsp[-3] == 0 )
  1127.                 {
  1128.                 if ( yyvsp[-1] <= 0 )
  1129.                     {
  1130.                     synerr( "bad iteration values" );
  1131.                     yyval = yyvsp[-5];
  1132.                     }
  1133.                 else
  1134.                     yyval = mkopt( mkrep( yyvsp[-5], 1, yyvsp[-1] ) );
  1135.                 }
  1136.                 else
  1137.                 yyval = mkrep( yyvsp[-5], yyvsp[-3], yyvsp[-1] );
  1138.                 }
  1139.             ;
  1140.     break;}
  1141. case 39:
  1142. #line 475 "parse.y"
  1143. {
  1144.             varlength = true;
  1145.  
  1146.             if ( yyvsp[-2] <= 0 )
  1147.                 {
  1148.                 synerr( "iteration value must be positive" );
  1149.                 yyval = yyvsp[-4];
  1150.                 }
  1151.  
  1152.             else
  1153.                 yyval = mkrep( yyvsp[-4], yyvsp[-2], INFINITY );
  1154.             ;
  1155.     break;}
  1156. case 40:
  1157. #line 489 "parse.y"
  1158. {
  1159.             /* the singleton could be something like "(foo)",
  1160.              * in which case we have no idea what its length
  1161.              * is, so we punt here.
  1162.              */
  1163.             varlength = true;
  1164.  
  1165.             if ( yyvsp[-1] <= 0 )
  1166.                 {
  1167.                 synerr( "iteration value must be positive" );
  1168.                 yyval = yyvsp[-3];
  1169.                 }
  1170.  
  1171.             else
  1172.                 yyval = link_machines( yyvsp[-3], copysingl( yyvsp[-3], yyvsp[-1] - 1 ) );
  1173.             ;
  1174.     break;}
  1175. case 41:
  1176. #line 507 "parse.y"
  1177. {
  1178.             if ( ! madeany )
  1179.                 {
  1180.                 /* create the '.' character class */
  1181.                 anyccl = cclinit();
  1182.                 ccladd( anyccl, '\n' );
  1183.                 cclnegate( anyccl );
  1184.  
  1185.                 if ( useecs )
  1186.                 mkeccl( ccltbl + cclmap[anyccl],
  1187.                     ccllen[anyccl], nextecm,
  1188.                     ecgroup, csize, csize );
  1189.  
  1190.                 madeany = true;
  1191.                 }
  1192.  
  1193.             ++rulelen;
  1194.  
  1195.             yyval = mkstate( -anyccl );
  1196.             ;
  1197.     break;}
  1198. case 42:
  1199. #line 529 "parse.y"
  1200. {
  1201.             if ( ! cclsorted )
  1202.                 /* sort characters for fast searching.  We use a
  1203.                  * shell sort since this list could be large.
  1204.                  */
  1205.                 cshell( ccltbl + cclmap[yyvsp[0]], ccllen[yyvsp[0]], true );
  1206.  
  1207.             if ( useecs )
  1208.                 mkeccl( ccltbl + cclmap[yyvsp[0]], ccllen[yyvsp[0]],
  1209.                     nextecm, ecgroup, csize, csize );
  1210.  
  1211.             ++rulelen;
  1212.  
  1213.             yyval = mkstate( -yyvsp[0] );
  1214.             ;
  1215.     break;}
  1216. case 43:
  1217. #line 546 "parse.y"
  1218. {
  1219.             ++rulelen;
  1220.  
  1221.             yyval = mkstate( -yyvsp[0] );
  1222.             ;
  1223.     break;}
  1224. case 44:
  1225. #line 553 "parse.y"
  1226. { yyval = yyvsp[-1]; ;
  1227.     break;}
  1228. case 45:
  1229. #line 556 "parse.y"
  1230. { yyval = yyvsp[-1]; ;
  1231.     break;}
  1232. case 46:
  1233. #line 559 "parse.y"
  1234. {
  1235.             ++rulelen;
  1236.  
  1237.             if ( caseins && yyvsp[0] >= 'A' && yyvsp[0] <= 'Z' )
  1238.                 yyvsp[0] = clower( yyvsp[0] );
  1239.  
  1240.             yyval = mkstate( yyvsp[0] );
  1241.             ;
  1242.     break;}
  1243. case 47:
  1244. #line 570 "parse.y"
  1245. { yyval = yyvsp[-1]; ;
  1246.     break;}
  1247. case 48:
  1248. #line 573 "parse.y"
  1249. {
  1250.             /* *Sigh* - to be compatible Unix lex, negated ccls
  1251.              * match newlines
  1252.              */
  1253. #ifdef NOTDEF
  1254.             ccladd( yyvsp[-1], '\n' ); /* negated ccls don't match '\n' */
  1255.             cclsorted = false; /* because we added the newline */
  1256. #endif
  1257.             cclnegate( yyvsp[-1] );
  1258.             yyval = yyvsp[-1];
  1259.             ;
  1260.     break;}
  1261. case 49:
  1262. #line 587 "parse.y"
  1263. {
  1264.             if ( yyvsp[-2] > yyvsp[0] )
  1265.                 synerr( "negative range in character class" );
  1266.  
  1267.             else
  1268.                 {
  1269.                 if ( caseins )
  1270.                 {
  1271.                 if ( yyvsp[-2] >= 'A' && yyvsp[-2] <= 'Z' )
  1272.                     yyvsp[-2] = clower( yyvsp[-2] );
  1273.                 if ( yyvsp[0] >= 'A' && yyvsp[0] <= 'Z' )
  1274.                     yyvsp[0] = clower( yyvsp[0] );
  1275.                 }
  1276.  
  1277.                 for ( i = yyvsp[-2]; i <= yyvsp[0]; ++i )
  1278.                     ccladd( yyvsp[-3], i );
  1279.  
  1280.                 /* keep track if this ccl is staying in alphabetical
  1281.                  * order
  1282.                  */
  1283.                 cclsorted = cclsorted && (yyvsp[-2] > lastchar);
  1284.                 lastchar = yyvsp[0];
  1285.                 }
  1286.  
  1287.             yyval = yyvsp[-3];
  1288.             ;
  1289.     break;}
  1290. case 50:
  1291. #line 615 "parse.y"
  1292. {
  1293.             if ( caseins )
  1294.                 if ( yyvsp[0] >= 'A' && yyvsp[0] <= 'Z' )
  1295.                 yyvsp[0] = clower( yyvsp[0] );
  1296.  
  1297.             ccladd( yyvsp[-1], yyvsp[0] );
  1298.             cclsorted = cclsorted && (yyvsp[0] > lastchar);
  1299.             lastchar = yyvsp[0];
  1300.             yyval = yyvsp[-1];
  1301.             ;
  1302.     break;}
  1303. case 51:
  1304. #line 627 "parse.y"
  1305. {
  1306.             cclsorted = true;
  1307.             lastchar = 0;
  1308.             yyval = cclinit();
  1309.             ;
  1310.     break;}
  1311. case 52:
  1312. #line 635 "parse.y"
  1313. {
  1314.             if ( caseins )
  1315.                 if ( yyvsp[0] >= 'A' && yyvsp[0] <= 'Z' )
  1316.                 yyvsp[0] = clower( yyvsp[0] );
  1317.  
  1318.             ++rulelen;
  1319.  
  1320.             yyval = link_machines( yyvsp[-1], mkstate( yyvsp[0] ) );
  1321.             ;
  1322.     break;}
  1323. case 53:
  1324. #line 646 "parse.y"
  1325. { yyval = mkstate( SYM_EPSILON ); ;
  1326.     break;}
  1327. }
  1328.    /* the action file gets copied in in place of this dollarsign */
  1329. #line 457 "/usr/local/lib/bison.simple"
  1330.  
  1331.   yyvsp -= yylen;
  1332.   yyssp -= yylen;
  1333. #ifdef YYLSP_NEEDED
  1334.   yylsp -= yylen;
  1335. #endif
  1336.  
  1337. #if YYDEBUG != 0
  1338.   if (yydebug)
  1339.     {
  1340.       short *ssp1 = yyss - 1;
  1341.       fprintf (stderr, "state stack now");
  1342.       while (ssp1 != yyssp)
  1343.     fprintf (stderr, " %d", *++ssp1);
  1344.       fprintf (stderr, "\n");
  1345.     }
  1346. #endif
  1347.  
  1348.   *++yyvsp = yyval;
  1349.  
  1350. #ifdef YYLSP_NEEDED
  1351.   yylsp++;
  1352.   if (yylen == 0)
  1353.     {
  1354.       yylsp->first_line = yylloc.first_line;
  1355.       yylsp->first_column = yylloc.first_column;
  1356.       yylsp->last_line = (yylsp-1)->last_line;
  1357.       yylsp->last_column = (yylsp-1)->last_column;
  1358.       yylsp->text = 0;
  1359.     }
  1360.   else
  1361.     {
  1362.       yylsp->last_line = (yylsp+yylen-1)->last_line;
  1363.       yylsp->last_column = (yylsp+yylen-1)->last_column;
  1364.     }
  1365. #endif
  1366.  
  1367.   /* Now "shift" the result of the reduction.
  1368.      Determine what state that goes to,
  1369.      based on the state we popped back to
  1370.      and the rule number reduced by.  */
  1371.  
  1372.   yyn = yyr1[yyn];
  1373.  
  1374.   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
  1375.   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
  1376.     yystate = yytable[yystate];
  1377.   else
  1378.     yystate = yydefgoto[yyn - YYNTBASE];
  1379.  
  1380.   goto yynewstate;
  1381.  
  1382. yyerrlab:   /* here on detecting error */
  1383.  
  1384.   if (! yyerrstatus)
  1385.     /* If not already recovering from an error, report this error.  */
  1386.     {
  1387.       ++yynerrs;
  1388.  
  1389. #ifdef YYERROR_VERBOSE
  1390.       yyn = yypact[yystate];
  1391.  
  1392.       if (yyn > YYFLAG && yyn < YYLAST)
  1393.     {
  1394.       int size = 0;
  1395.       char *msg;
  1396.       int x, count;
  1397.  
  1398.       count = 0;
  1399.       /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
  1400.       for (x = (yyn < 0 ? -yyn : 0);
  1401.            x < (sizeof(yytname) / sizeof(char *)); x++)
  1402.         if (yycheck[x + yyn] == x)
  1403.           size += strlen(yytname[x]) + 15, count++;
  1404.       msg = (char *) malloc(size + 15);
  1405.       if (msg != 0)
  1406.         {
  1407.           strcpy(msg, "parse error");
  1408.  
  1409.           if (count < 5)
  1410.         {
  1411.           count = 0;
  1412.           for (x = (yyn < 0 ? -yyn : 0);
  1413.                x < (sizeof(yytname) / sizeof(char *)); x++)
  1414.             if (yycheck[x + yyn] == x)
  1415.               {
  1416.             strcat(msg, count == 0 ? ", expecting `" : " or `");
  1417.             strcat(msg, yytname[x]);
  1418.             strcat(msg, "'");
  1419.             count++;
  1420.               }
  1421.         }
  1422.           yyerror(msg);
  1423.           free(msg);
  1424.         }
  1425.       else
  1426.         yyerror ("parse error; also virtual memory exceeded");
  1427.     }
  1428.       else
  1429. #endif /* YYERROR_VERBOSE */
  1430.     yyerror("parse error");
  1431.     }
  1432.  
  1433.   goto yyerrlab1;
  1434. yyerrlab1:   /* here on error raised explicitly by an action */
  1435.  
  1436.   if (yyerrstatus == 3)
  1437.     {
  1438.       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
  1439.  
  1440.       /* return failure if at end of input */
  1441.       if (yychar == YYEOF)
  1442.     YYABORT;
  1443.  
  1444. #if YYDEBUG != 0
  1445.       if (yydebug)
  1446.     fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
  1447. #endif
  1448.  
  1449.       yychar = YYEMPTY;
  1450.     }
  1451.  
  1452.   /* Else will try to reuse lookahead token
  1453.      after shifting the error token.  */
  1454.  
  1455.   yyerrstatus = 3;        /* Each real token shifted decrements this */
  1456.  
  1457.   goto yyerrhandle;
  1458.  
  1459. yyerrdefault:  /* current state does not do anything special for the error token. */
  1460.  
  1461. #if 0
  1462.   /* This is wrong; only states that explicitly want error tokens
  1463.      should shift them.  */
  1464.   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
  1465.   if (yyn) goto yydefault;
  1466. #endif
  1467.  
  1468. yyerrpop:   /* pop the current state because it cannot handle the error token */
  1469.  
  1470.   if (yyssp == yyss) YYABORT;
  1471.   yyvsp--;
  1472.   yystate = *--yyssp;
  1473. #ifdef YYLSP_NEEDED
  1474.   yylsp--;
  1475. #endif
  1476.  
  1477. #if YYDEBUG != 0
  1478.   if (yydebug)
  1479.     {
  1480.       short *ssp1 = yyss - 1;
  1481.       fprintf (stderr, "Error: state stack now");
  1482.       while (ssp1 != yyssp)
  1483.     fprintf (stderr, " %d", *++ssp1);
  1484.       fprintf (stderr, "\n");
  1485.     }
  1486. #endif
  1487.  
  1488. yyerrhandle:
  1489.  
  1490.   yyn = yypact[yystate];
  1491.   if (yyn == YYFLAG)
  1492.     goto yyerrdefault;
  1493.  
  1494.   yyn += YYTERROR;
  1495.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
  1496.     goto yyerrdefault;
  1497.  
  1498.   yyn = yytable[yyn];
  1499.   if (yyn < 0)
  1500.     {
  1501.       if (yyn == YYFLAG)
  1502.     goto yyerrpop;
  1503.       yyn = -yyn;
  1504.       goto yyreduce;
  1505.     }
  1506.   else if (yyn == 0)
  1507.     goto yyerrpop;
  1508.  
  1509.   if (yyn == YYFINAL)
  1510.     YYACCEPT;
  1511.  
  1512. #if YYDEBUG != 0
  1513.   if (yydebug)
  1514.     fprintf(stderr, "Shifting error token, ");
  1515. #endif
  1516.  
  1517.   *++yyvsp = yylval;
  1518. #ifdef YYLSP_NEEDED
  1519.   *++yylsp = yylloc;
  1520. #endif
  1521.  
  1522.   yystate = yyn;
  1523.   goto yynewstate;
  1524. }
  1525. #line 649 "parse.y"
  1526.  
  1527.  
  1528.  
  1529. /* build_eof_action - build the "<<EOF>>" action for the active start
  1530.  *                    conditions
  1531.  */
  1532.  
  1533. void build_eof_action()
  1534.  
  1535.     {
  1536.     register int i;
  1537.  
  1538.     for ( i = 1; i <= actvp; ++i )
  1539.     {
  1540.     if ( sceof[actvsc[i]] )
  1541.         format_pinpoint_message(
  1542.         "multiple <<EOF>> rules for start condition %s",
  1543.             scname[actvsc[i]] );
  1544.  
  1545.     else
  1546.         {
  1547.         sceof[actvsc[i]] = true;
  1548.         fprintf( temp_action_file, "case YY_STATE_EOF(%s):\n",
  1549.              scname[actvsc[i]] );
  1550.         }
  1551.     }
  1552.  
  1553.     line_directive_out( temp_action_file );
  1554.     }
  1555.  
  1556.  
  1557. /* synerr - report a syntax error */
  1558.  
  1559. void synerr( str )
  1560. char str[];
  1561.  
  1562.     {
  1563.     syntaxerror = true;
  1564.     pinpoint_message( str );
  1565.     }
  1566.  
  1567.  
  1568. /* format_pinpoint_message - write out a message formatted with one string,
  1569.  *                 pinpointing its location
  1570.  */
  1571.  
  1572. void format_pinpoint_message( msg, arg )
  1573. char msg[], arg[];
  1574.  
  1575.     {
  1576.     char errmsg[MAXLINE];
  1577.  
  1578.     (void) sprintf( errmsg, msg, arg );
  1579.     pinpoint_message( errmsg );
  1580.     }
  1581.  
  1582.  
  1583. /* pinpoint_message - write out a message, pinpointing its location */
  1584.  
  1585. void pinpoint_message( str )
  1586. char str[];
  1587.  
  1588.     {
  1589.     fprintf( stderr, "\"%s\", line %d: %s\n", infilename, linenum, str );
  1590.     }
  1591.  
  1592.  
  1593. /* yyerror - eat up an error message from the parser;
  1594.  *         currently, messages are ignore
  1595.  */
  1596.  
  1597. void yyerror( msg )
  1598. char msg[];
  1599.  
  1600.     {
  1601.     }
  1602.