home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 1 / ARM_CLUB_CD.iso / contents / apps / languages / progs / flex / c / parse < prev    next >
Encoding:
Text File  |  1994-10-10  |  41.8 KB  |  1,707 lines

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