[comp.sources.amiga] v90i235: flex 2.3 - fast lexical analyzer generator, Part08/13

amiga-request@abcfd20.larc.nasa.gov (Amiga Sources/Binaries Moderator) (08/20/90)

Submitted-by: loftus@wpllabs.uucp (William P Loftus)
Posting-number: Volume 90, Issue 235
Archive-name: unix/flex-2.3/part08

#!/bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 8 (of 13)."
# Contents:  parse.c
# Wrapped by tadguy@abcfd20 on Sun Aug 19 18:41:47 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'parse.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'parse.c'\"
else
echo shar: Extracting \"'parse.c'\" \(45081 characters\)
sed "s/^X//" >'parse.c' <<'END_OF_FILE'
X
X/*  A Bison parser, made from parse.y  */
X
X#define	CHAR	258
X#define	NUMBER	259
X#define	SECTEND	260
X#define	SCDECL	261
X#define	XSCDECL	262
X#define	WHITESPACE	263
X#define	NAME	264
X#define	PREVCCL	265
X#define	EOF_OP	266
X
X#line 6 "parse.y"
X
X/*-
X * Copyright (c) 1990 The Regents of the University of California.
X * All rights reserved.
X *
X * This code is derived from software contributed to Berkeley by
X * Vern Paxson.
X * 
X * The United States Government has rights in this work pursuant
X * to contract no. DE-AC03-76SF00098 between the United States
X * Department of Energy and the University of California.
X *
X * Redistribution and use in source and binary forms are permitted provided
X * that: (1) source distributions retain this entire copyright notice and
X * comment, and (2) distributions including binaries display the following
X * acknowledgement:  ``This product includes software developed by the
X * University of California, Berkeley and its contributors'' in the
X * documentation or other materials provided with the distribution and in
X * all advertising materials mentioning features or use of this software.
X * Neither the name of the University nor the names of its contributors may
X * be used to endorse or promote products derived from this software without
X * specific prior written permission.
X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
X * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
X * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X */
X
X#ifndef lint
Xstatic char rcsid[] =
X    "@(#) $Header: /usr/fsys/odin/a/vern/flex/RCS/parse.y,v 2.7 90/06/27 23:48:31 vern Exp $ (LBL)";
X#endif
X
X#include "flexdef.h"
X
Xint pat, scnum, eps, headcnt, trailcnt, anyccl, lastchar, i, actvp, rulelen;
Xint trlcontxt, xcluflg, cclsorted, varlength, variable_trail_rule;
XChar clower();
Xvoid build_eof_action();
Xvoid yyerror( char * );
X
Xstatic int madeany = false;  /* whether we've made the '.' character class */
Xint previous_continued_action;	/* whether the previous rule's action was '|' */
X
X
X#ifndef YYLTYPE
Xtypedef
X  struct yyltype
X    {
X      int timestamp;
X      int first_line;
X      int first_column;
X      int last_line;
X      int last_column;
X      char *text;
X   }
X  yyltype;
X
X#define YYLTYPE yyltype
X#endif
X
X#define	YYACCEPT	return(0)
X#define	YYABORT	return(1)
X#define	YYERROR	goto yyerrlab
X#ifndef YYSTYPE
X#define YYSTYPE int
X#endif
X#ifndef stdin
X#include <stdio.h>
X#endif
X
X#ifndef __STDC__
X#define const
X#endif
X
X
X
X#define	YYFINAL		81
X#define	YYFLAG		-32768
X#define	YYNTBASE	32
X
X#define YYTRANSLATE(x) ((unsigned)(x) <= 266 ? yytranslate[x] : 51)
X
Xstatic const char yytranslate[] = {     0,
X     2,     2,     2,     2,     2,     2,     2,     2,     2,    12,
X     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
X     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
X     2,     2,     2,    26,     2,    17,     2,     2,     2,    27,
X    28,    20,    21,    16,    31,    25,    19,     2,     2,     2,
X     2,     2,     2,     2,     2,     2,     2,     2,     2,    14,
X     2,    15,    22,     2,     2,     2,     2,     2,     2,     2,
X     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
X     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
X    29,     2,    30,    13,     2,     2,     2,     2,     2,     2,
X     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
X     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
X     2,     2,    23,    18,    24,     2,     2,     2,     2,     2,
X     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
X     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
X     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
X     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
X     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
X     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
X     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
X     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
X     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
X     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
X     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
X     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
X     2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
X     6,     7,     8,     9,    10,    11
X};
X
Xstatic const short yyrline[] = {     0,
X    52,    76,    85,    86,    87,    91,    94,   104,   108,   111,
X   114,   118,   119,   122,   133,   153,   164,   188,   199,   202,
X   221,   225,   228,   238,   247,   251,   308,   311,   351,   367,
X   373,   378,   403,   411,   415,   422,   429,   436,   454,   468,
X   486,   508,   525,   532,   535,   538,   549,   552,   566,   594,
X   606,   614,   625
X};
X
Xstatic const char * const yytname[] = {     0,
X"error","$illegal.","CHAR","NUMBER","SECTEND","SCDECL","XSCDECL","WHITESPACE","NAME","PREVCCL",
X"EOF_OP","'\\n'","'^'","'<'","'>'","','","'$'","'|'","'/'","'*'",
X"'+'","'?'","'{'","'}'","'.'","'\"'","'('","')'","'['","']'",
X"'-'","goal"
X};
X
Xstatic const short yyr1[] = {     0,
X    32,    33,    34,    34,    34,    35,    36,    36,    37,    37,
X    37,    38,    38,    39,    40,    40,    40,    40,    40,    40,
X    40,    41,    42,    42,    42,    43,    43,    43,    43,    44,
X    44,    45,    46,    46,    47,    47,    47,    47,    47,    47,
X    47,    47,    47,    47,    47,    47,    48,    48,    49,    49,
X    49,    50,    50
X};
X
Xstatic const short yyr2[] = {     0,
X     5,     0,     5,     0,     2,     1,     1,     1,     3,     1,
X     1,     4,     0,     0,     3,     2,     2,     1,     2,     1,
X     1,     3,     3,     1,     1,     2,     3,     2,     1,     3,
X     1,     2,     2,     1,     2,     2,     2,     6,     5,     4,
X     1,     1,     1,     3,     3,     1,     3,     4,     4,     2,
X     0,     2,     0
X};
X
Xstatic const short yydefact[] = {     2,
X     0,     0,     0,     5,     6,     7,     8,    13,     0,    14,
X     0,     0,    11,    10,     0,    21,    46,    43,    20,     0,
X     0,    41,    53,     0,    51,     0,     0,    18,    29,     0,
X    31,    34,    42,     0,     3,    17,    25,    24,     0,     0,
X     0,    51,     0,    12,    19,     0,    16,    28,     0,    32,
X    26,    33,    35,    36,    37,     0,     9,    22,     0,    52,
X    44,    45,     0,    50,    47,    15,    30,    27,     0,    23,
X    48,     0,     0,    40,    49,     0,    39,    38,     0,     0,
X     0
X};
X
Xstatic const short yydefgoto[] = {    79,
X     1,     3,     8,     9,    15,    10,    12,    26,    27,    39,
X    28,    29,    30,    31,    32,    33,    43,    40
X};
X
Xstatic const short yypact[] = {-32768,
X    55,    -2,    63,-32768,-32768,-32768,-32768,-32768,    16,-32768,
X    12,     1,-32768,-32768,    51,-32768,-32768,-32768,-32768,    19,
X    33,-32768,-32768,    19,    -6,     8,    28,-32768,    54,    19,
X    19,    44,-32768,    38,-32768,-32768,-32768,-32768,    34,    14,
X   -10,-32768,     2,-32768,-32768,    19,-32768,-32768,    19,-32768,
X    57,    44,-32768,-32768,-32768,    48,-32768,-32768,    49,-32768,
X-32768,-32768,     3,     6,-32768,-32768,    19,-32768,    27,-32768,
X-32768,    73,    -1,-32768,-32768,    53,-32768,-32768,    78,    79,
X-32768
X};
X
Xstatic const short yypgoto[] = {-32768,
X-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
X   -11,    -5,-32768,    31,   -31,-32768,    39,-32768
X};
X
X
X#define	YYLAST		81
X
X
Xstatic const short yytable[] = {    52,
X    -1,    16,    76,    17,    64,    64,    42,    49,    36,     4,
X    18,    19,    13,    20,    21,    47,    60,    62,    41,    44,
X    14,    17,    77,    11,    51,    22,    23,    24,    18,    25,
X    17,    65,    71,    37,    66,    52,    72,    18,    45,    61,
X    46,    38,    73,    22,    23,    24,    57,    25,    58,    59,
X    74,    69,    22,    23,    24,     2,    25,    70,    34,    -4,
X    -4,    -4,    35,    53,    54,    55,    56,     5,     6,     7,
X    48,    49,    50,    68,    49,    75,    78,    80,    81,    67,
X    63
X};
X
Xstatic const short yycheck[] = {    31,
X     0,     1,     4,     3,     3,     3,    13,    18,    20,    12,
X    10,    11,     1,    13,    14,    27,     3,    28,    24,    12,
X     9,     3,    24,     8,    30,    25,    26,    27,    10,    29,
X     3,    30,    30,     1,    46,    67,    31,    10,    11,    26,
X    13,     9,    16,    25,    26,    27,     9,    29,    15,    16,
X    24,     4,    25,    26,    27,     1,    29,     9,     8,     5,
X     6,     7,    12,    20,    21,    22,    23,     5,     6,     7,
X    17,    18,    19,    17,    18,     3,    24,     0,     0,    49,
X    42
X};
X#define YYPURE 1
X
X#line 2 "bison.simple"
X
X/* Skeleton output parser for bison,
X   copyright (C) 1984 Bob Corbett and Richard Stallman
X
X                       NO WARRANTY
X
X  BECAUSE THIS PROGRAM IS LICENSED FREE OF CHARGE, WE PROVIDE ABSOLUTELY
XNO WARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW.  EXCEPT
XWHEN OTHERWISE STATED IN WRITING, FREE SOFTWARE FOUNDATION, INC,
XRICHARD M. STALLMAN AND/OR OTHER PARTIES PROVIDE THIS PROGRAM "AS IS"
XWITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
XBUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
XFITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY
XAND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE PROGRAM PROVE
XDEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
XCORRECTION.
X
X IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL RICHARD M.
XSTALLMAN, THE FREE SOFTWARE FOUNDATION, INC., AND/OR ANY OTHER PARTY
XWHO MAY MODIFY AND REDISTRIBUTE THIS PROGRAM AS PERMITTED BELOW, BE
XLIABLE TO YOU FOR DAMAGES, INCLUDING ANY LOST PROFITS, LOST MONIES, OR
XOTHER SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
XUSE OR INABILITY TO USE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR
XDATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR
XA FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS) THIS
XPROGRAM, EVEN IF YOU HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
XDAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY.
X
X                GENERAL PUBLIC LICENSE TO COPY
X
X  1. You may copy and distribute verbatim copies of this source file
Xas you receive it, in any medium, provided that you conspicuously and
Xappropriately publish on each copy a valid copyright notice "Copyright
X(C) 1985 Free Software Foundation, Inc."; and include following the
Xcopyright notice a verbatim copy of the above disclaimer of warranty
Xand of this License.  You may charge a distribution fee for the
Xphysical act of transferring a copy.
X
X  2. You may modify your copy or copies of this source file or
Xany portion of it, and copy and distribute such modifications under
Xthe terms of Paragraph 1 above, provided that you also do the following:
X
X    a) cause the modified files to carry prominent notices stating
X    that you changed the files and the date of any change; and
X
X    b) cause the whole of any work that you distribute or publish,
X    that in whole or in part contains or is a derivative of this
X    program or any part thereof, to be licensed at no charge to all
X    third parties on terms identical to those contained in this
X    License Agreement (except that you may choose to grant more extensive
X    warranty protection to some or all third parties, at your option).
X
X    c) You may charge a distribution fee for the physical act of
X    transferring a copy, and you may at your option offer warranty
X    protection in exchange for a fee.
X
XMere aggregation of another unrelated program with this program (or its
Xderivative) on a volume of a storage or distribution medium does not bring
Xthe other program under the scope of these terms.
X
X  3. You may copy and distribute this program (or a portion or derivative
Xof it, under Paragraph 2) in object code or executable form under the terms
Xof Paragraphs 1 and 2 above provided that you also do one of the following:
X
X    a) accompany it with the complete corresponding machine-readable
X    source code, which must be distributed under the terms of
X    Paragraphs 1 and 2 above; or,
X
X    b) accompany it with a written offer, valid for at least three
X    years, to give any third party free (except for a nominal
X    shipping charge) a complete machine-readable copy of the
X    corresponding source code, to be distributed under the terms of
X    Paragraphs 1 and 2 above; or,
X
X    c) accompany it with the information you received as to where the
X    corresponding source code may be obtained.  (This alternative is
X    allowed only for noncommercial distribution and only if you
X    received the program in object code or executable form alone.)
X
XFor an executable file, complete source code means all the source code for
Xall modules it contains; but, as a special exception, it need not include
Xsource code for modules which are standard libraries that accompany the
Xoperating system on which the executable file runs.
X
X  4. You may not copy, sublicense, distribute or transfer this program
Xexcept as expressly provided under this License Agreement.  Any attempt
Xotherwise to copy, sublicense, distribute or transfer this program is void and
Xyour rights to use the program under this License agreement shall be
Xautomatically terminated.  However, parties who have received computer
Xsoftware programs from you with this License Agreement will not have
Xtheir licenses terminated so long as such parties remain in full compliance.
X
X  5. If you wish to incorporate parts of this program into other free
Xprograms whose distribution conditions are different, write to the Free
XSoftware Foundation at 675 Mass Ave, Cambridge, MA 02139.  We have not yet
Xworked out a simple rule that can be stated here, but we will often permit
Xthis.  We will be guided by the two goals of preserving the free status of
Xall derivatives of our free software and of promoting the sharing and reuse of
Xsoftware.
X
X
XIn other words, you are welcome to use, share and improve this program.
XYou are forbidden to forbid anyone else to use, share and improve
Xwhat you give them.   Help stamp out software-hoarding!  */
X
X/* This is the parser code that is written into each bison parser
X  when the %semantic_parser declaration is not specified in the grammar.
X  It was written by Richard Stallman by simplifying the hairy parser
X  used when %semantic_parser is specified.  */
X
X/* Note: there must be only one dollar sign in this file.
X   It is replaced by the list of actions, each action
X   as one case of the switch.  */
X
X#ifdef AMIGA
X
X#define bzero(b, length) memset((b),'\0',(length))
X#define bcopy(b1, b2, length) memcpy((b1),(b2),(length))
X#define bcmp(b1, b2, length)  memcmp((b1),(b2),(length))
X
Xvoid
Xmemory_full ()
X{
X  printf ("Memory exhausted.\n");
X  exit(1);
X}
X
X
Xchar *
Xxmalloc (size)
X     int size;
X{
X  extern char *malloc ();
X  register char *ptr = malloc (size);
X  if (ptr != 0) return (ptr);
X  memory_full ();
X  /*NOTREACHED*/
X}
X
Xchar *
Xxrealloc (old, size)
X     char *old;
X     int size;
X{
X  extern char *realloc ();
X  register char *ptr = realloc (old, size);
X  if (ptr != 0) return (ptr);
X  memory_full ();
X  /*NOTREACHED*/
X}
X
Xchar *
Xxcalloc (number, size)
X     int number, size;
X{
X  extern char *malloc ();
X  register int total = number * size;
X  register char *ptr = malloc (total);
X  if (ptr != 0)
X    {
X      if (total > 100)
X        bzero (ptr, total);
X      else {
X        /* It's not too long, so loop, zeroing by longs.
X           It must be safe because malloc values are always well aligned.  */
X        register long *zp = (long *) ptr;
X        register long *zl = (long *) (ptr + total - 4);
X        register int i = total - 4;
X        while (zp < zl)
X          *zp++ = 0;
X        if (i < 0)
X          i = 0;
X        while (i < total)
X          ptr[i++] = 0;
X      }
X      return ptr;
X    }
X  memory_full ();
X  /*NOTREACHED*/
X}
X
X/*
X        alloca -- (mostly) portable public-domain implementation -- D A Gwyn
X
X        last edit:      86/05/30        rms
X           include config.h, since on VMS it renames some symbols.
X           Use xmalloc instead of malloc.
X
X        This implementation of the PWB library alloca() function,
X        which is used to allocate space off the run-time stack so
X        that it is automatically reclaimed upon procedure exit,
X        was inspired by discussions with J. Q. Johnson of Cornell.
X
X        It should work under any C implementation that uses an
X        actual procedure stack (as opposed to a linked list of
X        frames).  There are some preprocessor constants that can
X        be defined when compiling for your specific system, for
X        improved efficiency; however, the defaults should be okay.
X
X        The general concept of this implementation is to keep
X        track of all alloca()-allocated blocks, and reclaim any
X        that are found to be deeper in the stack than the current
X        invocation.  This heuristic does not reclaim storage as
X        soon as it becomes invalid, but it will do so eventually.
X
X        As a special case, alloca(0) reclaims storage without
X        allocating any.  It is a good idea to use alloca(0) in
X        your main control loop, etc. to force garbage collection.
X*/
X
Xtypedef char    *pointer;               /* generic pointer type */
X
Xextern void     free();
Xextern pointer  xmalloc();
X
X/*
X        Define STACK_DIRECTION if you know the direction of stack
X        growth for your system; otherwise it will be automatically
X        deduced at run-time.
X
X        STACK_DIRECTION > 0 => grows toward higher addresses
X        STACK_DIRECTION < 0 => grows toward lower addresses
X        STACK_DIRECTION = 0 => direction of growth unknown
X*/
X
X#define STACK_DIRECTION -1
X
X#define STACK_DIR       STACK_DIRECTION /* known at compile-time */
X
X/*
X        An "alloca header" is used to:
X        (a) chain together all alloca()ed blocks;
X        (b) keep track of stack depth.
X
X        It is very important that sizeof(header) agree with malloc()
X        alignment chunk size.  The following default should work okay.
X*/
X
X#ifndef ALIGN_SIZE
X#define ALIGN_SIZE      sizeof(double)
X#endif
X
Xtypedef union hdr
X{
X  char  align[ALIGN_SIZE];      /* to force sizeof(header) */
X  struct
X    {
X      union hdr *next;          /* for chaining headers */
X      char *deep;               /* for stack depth measure */
X    } h;
X} header;
X
X/*
X        alloca( size ) returns a pointer to at least `size' bytes of
X        storage which will be automatically reclaimed upon exit from
X        the procedure that called alloca().  Originally, this space
X        was supposed to be taken from the current stack frame of the
X        caller, but that method cannot be made to work for some
X        implementations of C, for example under Gould's UTX/32.
X*/
X
Xstatic header *last_alloca_header = NULL; /* -> last alloca header */
X
Xpointer
Xalloca (size)                   /* returns pointer to storage */
X     unsigned   size;           /* # bytes to allocate */
X{
X  auto char     probe;          /* probes stack depth: */
X  register char *depth = &probe;
X
X                                /* Reclaim garbage, defined as all alloca()ed storage that
X                                   was allocated from deeper in the stack than currently. */
X
X  {
X    register header     *hp;    /* traverses linked list */
X
X    for (hp = last_alloca_header; hp != NULL;)
X      if (STACK_DIR > 0 && hp->h.deep > depth
X          || STACK_DIR < 0 && hp->h.deep < depth)
X        {
X          register header       *np = hp->h.next;
X
X          free ((pointer) hp);  /* collect garbage */
X
X          hp = np;              /* -> next header */
X        }
X      else
X        break;                  /* rest are not deeper */
X
X    last_alloca_header = hp;    /* -> last valid storage */
X  }
X
X  if (size == 0)
X    return NULL;                /* no allocation required */
X
X  /* Allocate combined header + user data storage. */
X
X  {
X    register pointer    new = xmalloc (sizeof (header) + size);
X    /* address of header */
X
X    ((header *)new)->h.next = last_alloca_header;
X    ((header *)new)->h.deep = depth;
X
X    last_alloca_header = (header *)new;
X
X    /* User storage begins just after header. */
X
X    return (pointer)((char *)new + sizeof(header));
X  }
X}
X#endif
X
X
X
X#define yyerrok         (yyerrstatus = 0)
X#define yyclearin       (yychar = YYEMPTY)
X#define YYEMPTY         -2
X#define YYEOF           0
X#define YYFAIL          goto yyerrlab;
X
X#define YYTERROR        1
X
X#ifndef YYIMPURE
X#define YYLEX           yylex()
X#endif
X
X#ifndef YYPURE
X#define YYLEX           yylex(&yylval, &yylloc)
X#endif
X
X/* If nonreentrant, generate the variables here */
X
X#ifndef YYIMPURE
X
Xint     yychar;                 /*  the lookahead symbol                */
XYYSTYPE yylval;                 /*  the semantic value of the           */
X                                /*  lookahead symbol                    */
X
XYYLTYPE yylloc;                 /*  location data for the lookahead     */
X                                /*  symbol                              */
X
Xint yynerr;                     /*  number of parse errors so far       */
X
X#ifdef YYDEBUG
Xint yydebug = 0;                /*  nonzero means print parse trace     */
X#endif
X
X#endif  /* YYIMPURE */
X
X
X/*  YYMAXDEPTH indicates the initial size of the parser's stacks        */
X
X#ifndef YYMAXDEPTH
X#define YYMAXDEPTH 200
X#endif
X
X/*  YYMAXLIMIT is the maximum size the stacks can grow to
X    (effective only if the built-in stack extension method is used).  */
X
X#ifndef YYMAXLIMIT
X#define YYMAXLIMIT 10000
X#endif
X
X
X#line 165 "bison.simple"
Xint
Xyyparse()
X{
X  register int yystate;
X  register int yyn;
X  register short *yyssp;
X  register YYSTYPE *yyvsp;
X  YYLTYPE *yylsp;
X  int yyerrstatus;      /*  number of tokens to shift before error messages enabled */
X  int yychar1;          /*  lookahead token as an internal (translated) token number */
X
X  short yyssa[YYMAXDEPTH];      /*  the state stack                     */
X  YYSTYPE yyvsa[YYMAXDEPTH];    /*  the semantic value stack            */
X  YYLTYPE yylsa[YYMAXDEPTH];    /*  the location stack                  */
X
X  short *yyss = yyssa;          /*  refer to the stacks thru separate pointers */
X  YYSTYPE *yyvs = yyvsa;        /*  to allow yyoverflow to reallocate them elsewhere */
X  YYLTYPE *yyls = yylsa;
X
X  int yymaxdepth = YYMAXDEPTH;
X
X#ifndef YYPURE
X  int yychar;
X  YYSTYPE yylval;
X  YYLTYPE yylloc;
X#endif
X
X#ifdef YYDEBUG
X  extern int yydebug;
X#endif
X
X
X  YYSTYPE yyval;                /*  the variable used to return         */
X                                /*  semantic values from the action     */
X                                /*  routines                            */
X
X  int yylen;
X
X#ifdef YYDEBUG
X  if (yydebug)
X    fprintf(stderr, "Starting parse\n");
X#endif
X
X  yystate = 0;
X  yyerrstatus = 0;
X  yynerr = 0;
X  yychar = YYEMPTY;             /* Cause a token to be read.  */
X
X  /* Initialize stack pointers.
X     Waste one element of value and location stack
X     so that they stay on the same level as the state stack.  */
X
X  yyssp = yyss - 1;
X  yyvsp = yyvs;
X  yylsp = yyls;
X
X/* Push a new state, which is found in  yystate  .  */
X/* In all cases, when you get here, the value and location stacks
X   have just been pushed. so pushing a state here evens the stacks.  */
Xyynewstate:
X
X  *++yyssp = yystate;
X
X  if (yyssp >= yyss + yymaxdepth - 1)
X    {
X      /* Give user a chance to reallocate the stack */
X      /* Use copies of these so that the &'s don't force the real ones into memory. */
X      YYSTYPE *yyvs1 = yyvs;
X      YYLTYPE *yyls1 = yyls;
X      short *yyss1 = yyss;
X
X      /* Get the current used size of the three stacks, in elements.  */
X      int size = yyssp - yyss + 1;
X
X#ifdef yyoverflow
X      /* Each stack pointer address is followed by the size of
X         the data in use in that stack, in bytes.  */
X      yyoverflow("parser stack overflow",
X                 &yyss1, size * sizeof (*yyssp),
X                 &yyvs1, size * sizeof (*yyvsp),
X                 &yyls1, size * sizeof (*yylsp),
X                 &yymaxdepth);
X
X      yyss = yyss1; yyvs = yyvs1; yyls = yyls1;
X#else /* no yyoverflow */
X      /* Extend the stack our own way.  */
X      if (yymaxdepth >= YYMAXLIMIT)
X        yyerror("parser stack overflow");
X      yymaxdepth *= 2;
X      if (yymaxdepth > YYMAXLIMIT)
X        yymaxdepth = YYMAXLIMIT;
X      yyss = (short *) alloca (yymaxdepth * sizeof (*yyssp));
X      bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
X      yyvs = (YYSTYPE *) alloca (yymaxdepth * sizeof (*yyvsp));
X      bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
X#ifdef YYLSP_NEEDED
X      yyls = (YYLTYPE *) alloca (yymaxdepth * sizeof (*yylsp));
X      bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
X#endif
X#endif /* no yyoverflow */
X
X      yyssp = yyss + size - 1;
X      yyvsp = yyvs + size - 1;
X#ifdef YYLSP_NEEDED
X      yylsp = yyls + size - 1;
X#endif
X
X#ifdef YYDEBUG
X      if (yydebug)
X        fprintf(stderr, "Stack size increased to %d\n", yymaxdepth);
X#endif
X
X      if (yyssp >= yyss + yymaxdepth - 1)
X        YYERROR;
X    }
X
X#ifdef YYDEBUG
X  if (yydebug)
X    fprintf(stderr, "Entering state %d\n", yystate);
X#endif
X
X/* Do appropriate processing given the current state.  */
X/* Read a lookahead token if we need one and don't already have one.  */
Xyyresume:
X
X  /* First try to decide what to do without reference to lookahead token.  */
X
X  yyn = yypact[yystate];
X  if (yyn == YYFLAG)
X    goto yydefault;
X
X  /* Not known => get a lookahead token if don't already have one.  */
X
X  /* yychar is either YYEMPTY or YYEOF
X     or a valid token in external form.  */
X
X  if (yychar == YYEMPTY)
X    {
X#ifdef YYDEBUG
X      if (yydebug)
X        fprintf(stderr, "Reading a token: ");
X#endif
X      yychar = YYLEX;
X    }
X
X  /* Convert token to internal form (in yychar1) for indexing tables with */
X
X  if (yychar <= 0)              /* This means end of input. */
X    {
X      yychar1 = 0;
X      yychar = YYEOF;           /* Don't call YYLEX any more */
X
X#ifdef YYDEBUG
X      if (yydebug)
X        fprintf(stderr, "Now at end of input.\n");
X#endif
X    }
X  else
X    {
X      yychar1 = YYTRANSLATE(yychar);
X
X#ifdef YYDEBUG
X      if (yydebug)
X        fprintf(stderr, "Next token is %d (%s)\n", yychar, yytname[yychar1]);
X#endif
X    }
X
X  yyn += yychar1;
X  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
X    goto yydefault;
X
X  yyn = yytable[yyn];
X
X  /* yyn is what to do for this token type in this state.
X     Negative => reduce, -yyn is rule number.
X     Positive => shift, yyn is new state.
X       New state is final state => don't bother to shift,
X       just return success.
X     0, or most negative number => error.  */
X
X  if (yyn < 0)
X    {
X      if (yyn == YYFLAG)
X        goto yyerrlab;
X      yyn = -yyn;
X      goto yyreduce;
X    }
X  else if (yyn == 0)
X    goto yyerrlab;
X
X  if (yyn == YYFINAL)
X    YYACCEPT;
X
X  /* Shift the lookahead token.  */
X
X#ifdef YYDEBUG
X  if (yydebug)
X    fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
X#endif
X
X  /* Discard the token being shifted unless it is eof.  */
X  if (yychar != YYEOF)
X    yychar = YYEMPTY;
X
X  *++yyvsp = yylval;
X#ifdef YYLSP_NEEDED
X  *++yylsp = yylloc;
X#endif
X
X  /* count tokens shifted since error; after three, turn off error status.  */
X  if (yyerrstatus) yyerrstatus--;
X
X  yystate = yyn;
X  goto yynewstate;
X
X/* Do the default action for the current state.  */
Xyydefault:
X
X  yyn = yydefact[yystate];
X  if (yyn == 0)
X    goto yyerrlab;
X
X/* Do a reduction.  yyn is the number of a rule to reduce with.  */
Xyyreduce:
X  yylen = yyr2[yyn];
X  yyval = yyvsp[1-yylen]; /* implement default value of the action */
X
X#ifdef YYDEBUG
X  if (yydebug)
X    {
X      if (yylen == 1)
X        fprintf (stderr, "Reducing 1 value via line %d, ",
X                 yyrline[yyn]);
X      else
X        fprintf (stderr, "Reducing %d values via line %d, ",
X                 yylen, yyrline[yyn]);
X    }
X#endif
X
X
X  switch (yyn) {
X
Xcase 1:
X#line 53 "parse.y"
X{ /* add default rule */
X			int def_rule;
X
X			pat = cclinit();
X			cclnegate( pat );
X
X			def_rule = mkstate( -pat );
X
X			finish_rule( def_rule, false, 0, 0 );
X
X			for ( i = 1; i <= lastsc; ++i )
X			    scset[i] = mkbranch( scset[i], def_rule );
X
X			if ( spprdflt )
X			    fputs( "YY_FATAL_ERROR( \"flex scanner jammed\" )",
X				   temp_action_file );
X			else
X			    fputs( "ECHO", temp_action_file );
X
X			fputs( ";\n\tYY_BREAK\n", temp_action_file );
X			;
X    break;}
Xcase 2:
X#line 77 "parse.y"
X{
X			/* initialize for processing rules */
X
X			/* create default DFA start condition */
X			scinstal( "INITIAL", false );
X			;
X    break;}
Xcase 5:
X#line 88 "parse.y"
X{ synerr( "unknown error processing section 1" ); ;
X    break;}
Xcase 7:
X#line 95 "parse.y"
X{
X			/* these productions are separate from the s1object
X			 * rule because the semantics must be done before
X			 * we parse the remainder of an s1object
X			 */
X
X			xcluflg = false;
X			;
X    break;}
Xcase 8:
X#line 105 "parse.y"
X{ xcluflg = true; ;
X    break;}
Xcase 9:
X#line 109 "parse.y"
X{ scinstal( nmstr, xcluflg ); ;
X    break;}
Xcase 10:
X#line 112 "parse.y"
X{ scinstal( nmstr, xcluflg ); ;
X    break;}
Xcase 11:
X#line 115 "parse.y"
X{ synerr( "bad start condition list" ); ;
X    break;}
Xcase 14:
X#line 123 "parse.y"
X{
X			/* initialize for a parse of one rule */
X			trlcontxt = variable_trail_rule = varlength = false;
X			trailcnt = headcnt = rulelen = 0;
X			current_state_type = STATE_NORMAL;
X			previous_continued_action = continued_action;
X			new_rule();
X			;
X    break;}
Xcase 15:
X#line 134 "parse.y"
X{
X			pat = yyvsp[0];
X			finish_rule( pat, variable_trail_rule,
X				     headcnt, trailcnt );
X
X			for ( i = 1; i <= actvp; ++i )
X			    scbol[actvsc[i]] =
X				mkbranch( scbol[actvsc[i]], pat );
X
X			if ( ! bol_needed )
X			    {
X			    bol_needed = true;
X
X			    if ( performance_report )
X				pinpoint_message( 
X			    "'^' operator results in sub-optimal performance" );
X			    }
X			;
X    break;}
Xcase 16:
X#line 154 "parse.y"
X{
X			pat = yyvsp[0];
X			finish_rule( pat, variable_trail_rule,
X				     headcnt, trailcnt );
X
X			for ( i = 1; i <= actvp; ++i )
X			    scset[actvsc[i]] =
X				mkbranch( scset[actvsc[i]], pat );
X			;
X    break;}
Xcase 17:
X#line 165 "parse.y"
X{
X			pat = yyvsp[0];
X			finish_rule( pat, variable_trail_rule,
X				     headcnt, trailcnt );
X
X			/* add to all non-exclusive start conditions,
X			 * including the default (0) start condition
X			 */
X
X			for ( i = 1; i <= lastsc; ++i )
X			    if ( ! scxclu[i] )
X				scbol[i] = mkbranch( scbol[i], pat );
X
X			if ( ! bol_needed )
X			    {
X			    bol_needed = true;
X
X			    if ( performance_report )
X				pinpoint_message(
X			    "'^' operator results in sub-optimal performance" );
X			    }
X			;
X    break;}
Xcase 18:
X#line 189 "parse.y"
X{
X			pat = yyvsp[0];
X			finish_rule( pat, variable_trail_rule,
X				     headcnt, trailcnt );
X
X			for ( i = 1; i <= lastsc; ++i )
X			    if ( ! scxclu[i] )
X				scset[i] = mkbranch( scset[i], pat );
X			;
X    break;}
Xcase 19:
X#line 200 "parse.y"
X{ build_eof_action(); ;
X    break;}
Xcase 20:
X#line 203 "parse.y"
X{
X			/* this EOF applies to all start conditions
X			 * which don't already have EOF actions
X			 */
X			actvp = 0;
X
X			for ( i = 1; i <= lastsc; ++i )
X			    if ( ! sceof[i] )
X				actvsc[++actvp] = i;
X
X			if ( actvp == 0 )
X			    pinpoint_message(
X		"warning - all start conditions already have <<EOF>> rules" );
X
X			else
X			    build_eof_action();
X			;
X    break;}
Xcase 21:
X#line 222 "parse.y"
X{ synerr( "unrecognized rule" ); ;
X    break;}
Xcase 23:
X#line 229 "parse.y"
X{
X			if ( (scnum = sclookup( nmstr )) == 0 )
X			    format_pinpoint_message(
X				"undeclared start condition %s", nmstr );
X
X			else
X			    actvsc[++actvp] = scnum;
X			;
X    break;}
Xcase 24:
X#line 239 "parse.y"
X{
X			if ( (scnum = sclookup( nmstr )) == 0 )
X			    format_pinpoint_message(
X				"undeclared start condition %s", nmstr );
X			else
X			    actvsc[actvp = 1] = scnum;
X			;
X    break;}
Xcase 25:
X#line 248 "parse.y"
X{ synerr( "bad start condition list" ); ;
X    break;}
Xcase 26:
X#line 252 "parse.y"
X{
X			if ( transchar[lastst[yyvsp[0]]] != SYM_EPSILON )
X			    /* provide final transition \now/ so it
X			     * will be marked as a trailing context
X			     * state
X			     */
X			    yyvsp[0] = link_machines( yyvsp[0], mkstate( SYM_EPSILON ) );
X
X			mark_beginning_as_normal( yyvsp[0] );
X			current_state_type = STATE_NORMAL;
X
X			if ( previous_continued_action )
X			    {
X			    /* we need to treat this as variable trailing
X			     * context so that the backup does not happen
X			     * in the action but before the action switch
X			     * statement.  If the backup happens in the
X			     * action, then the rules "falling into" this
X			     * one's action will *also* do the backup,
X			     * erroneously.
X			     */
X			    if ( ! varlength || headcnt != 0 )
X				{
X				fprintf( stderr,
X    "%s: warning - trailing context rule at line %d made variable because\n",
X					 program_name, linenum );
X				fprintf( stderr,
X					 "      of preceding '|' action\n" );
X				}
X
X			    /* mark as variable */
X			    varlength = true;
X			    headcnt = 0;
X			    }
X
X			if ( varlength && headcnt == 0 )
X			    { /* variable trailing context rule */
X			    /* mark the first part of the rule as the accepting
X			     * "head" part of a trailing context rule
X			     */
X			    /* by the way, we didn't do this at the beginning
X			     * of this production because back then
X			     * current_state_type was set up for a trail
X			     * rule, and add_accept() can create a new
X			     * state ...
X			     */
X			    add_accept( yyvsp[-1], num_rules | YY_TRAILING_HEAD_MASK );
X			    variable_trail_rule = true;
X			    }
X			
X			else
X			    trailcnt = rulelen;
X
X			yyval = link_machines( yyvsp[-1], yyvsp[0] );
X			;
X    break;}
Xcase 27:
X#line 309 "parse.y"
X{ synerr( "trailing context used twice" ); ;
X    break;}
Xcase 28:
X#line 312 "parse.y"
X{
X			if ( trlcontxt )
X			    {
X			    synerr( "trailing context used twice" );
X			    yyval = mkstate( SYM_EPSILON );
X			    }
X
X			else if ( previous_continued_action )
X			    {
X			    /* see the comment in the rule for "re2 re"
X			     * above
X			     */
X			    if ( ! varlength || headcnt != 0 )
X				{
X				fprintf( stderr,
X    "%s: warning - trailing context rule at line %d made variable because\n",
X					 program_name, linenum );
X				fprintf( stderr,
X					 "      of preceding '|' action\n" );
X				}
X
X			    /* mark as variable */
X			    varlength = true;
X			    headcnt = 0;
X			    }
X
X			trlcontxt = true;
X
X			if ( ! varlength )
X			    headcnt = rulelen;
X
X			++rulelen;
X			trailcnt = 1;
X
X			eps = mkstate( SYM_EPSILON );
X			yyval = link_machines( yyvsp[-1],
X				 link_machines( eps, mkstate( '\n' ) ) );
X			;
X    break;}
Xcase 29:
X#line 352 "parse.y"
X{
X		        yyval = yyvsp[0];
X
X			if ( trlcontxt )
X			    {
X			    if ( varlength && headcnt == 0 )
X				/* both head and trail are variable-length */
X				variable_trail_rule = true;
X			    else
X				trailcnt = rulelen;
X			    }
X		        ;
X    break;}
Xcase 30:
X#line 368 "parse.y"
X{
X			varlength = true;
X			yyval = mkor( yyvsp[-2], yyvsp[0] );
X			;
X    break;}
Xcase 31:
X#line 374 "parse.y"
X{ yyval = yyvsp[0]; ;
X    break;}
Xcase 32:
X#line 379 "parse.y"
X{
X			/* this rule is written separately so
X			 * the reduction will occur before the trailing
X			 * series is parsed
X			 */
X
X			if ( trlcontxt )
X			    synerr( "trailing context used twice" );
X			else
X			    trlcontxt = true;
X
X			if ( varlength )
X			    /* we hope the trailing context is fixed-length */
X			    varlength = false;
X			else
X			    headcnt = rulelen;
X
X			rulelen = 0;
X
X			current_state_type = STATE_TRAILING_CONTEXT;
X			yyval = yyvsp[-1];
X			;
X    break;}
Xcase 33:
X#line 404 "parse.y"
X{
X			/* this is where concatenation of adjacent patterns
X			 * gets done
X			 */
X			yyval = link_machines( yyvsp[-1], yyvsp[0] );
X			;
X    break;}
Xcase 34:
X#line 412 "parse.y"
X{ yyval = yyvsp[0]; ;
X    break;}
Xcase 35:
X#line 416 "parse.y"
X{
X			varlength = true;
X
X			yyval = mkclos( yyvsp[-1] );
X			;
X    break;}
Xcase 36:
X#line 423 "parse.y"
X{
X			varlength = true;
X
X			yyval = mkposcl( yyvsp[-1] );
X			;
X    break;}
Xcase 37:
X#line 430 "parse.y"
X{
X			varlength = true;
X
X			yyval = mkopt( yyvsp[-1] );
X			;
X    break;}
Xcase 38:
X#line 437 "parse.y"
X{
X			varlength = true;
X
X			if ( yyvsp[-3] > yyvsp[-1] || yyvsp[-3] < 0 )
X			    {
X			    synerr( "bad iteration values" );
X			    yyval = yyvsp[-5];
X			    }
X			else
X			    {
X			    if ( yyvsp[-3] == 0 )
X				yyval = mkopt( mkrep( yyvsp[-5], yyvsp[-3], yyvsp[-1] ) );
X			    else
X				yyval = mkrep( yyvsp[-5], yyvsp[-3], yyvsp[-1] );
X			    }
X			;
X    break;}
Xcase 39:
X#line 455 "parse.y"
X{
X			varlength = true;
X
X			if ( yyvsp[-2] <= 0 )
X			    {
X			    synerr( "iteration value must be positive" );
X			    yyval = yyvsp[-4];
X			    }
X
X			else
X			    yyval = mkrep( yyvsp[-4], yyvsp[-2], INFINITY );
X			;
X    break;}
Xcase 40:
X#line 469 "parse.y"
X{
X			/* the singleton could be something like "(foo)",
X			 * in which case we have no idea what its length
X			 * is, so we punt here.
X			 */
X			varlength = true;
X
X			if ( yyvsp[-1] <= 0 )
X			    {
X			    synerr( "iteration value must be positive" );
X			    yyval = yyvsp[-3];
X			    }
X
X			else
X			    yyval = link_machines( yyvsp[-3], copysingl( yyvsp[-3], yyvsp[-1] - 1 ) );
X			;
X    break;}
Xcase 41:
X#line 487 "parse.y"
X{
X			if ( ! madeany )
X			    {
X			    /* create the '.' character class */
X			    anyccl = cclinit();
X			    ccladd( anyccl, '\n' );
X			    cclnegate( anyccl );
X
X			    if ( useecs )
X				mkeccl( ccltbl + cclmap[anyccl],
X					ccllen[anyccl], nextecm,
X					ecgroup, csize, csize );
X
X			    madeany = true;
X			    }
X
X			++rulelen;
X
X			yyval = mkstate( -anyccl );
X			;
X    break;}
Xcase 42:
X#line 509 "parse.y"
X{
X			if ( ! cclsorted )
X			    /* sort characters for fast searching.  We use a
X			     * shell sort since this list could be large.
X			     */
X			    cshell( ccltbl + cclmap[yyvsp[0]], ccllen[yyvsp[0]], true );
X
X			if ( useecs )
X			    mkeccl( ccltbl + cclmap[yyvsp[0]], ccllen[yyvsp[0]],
X				    nextecm, ecgroup, csize, csize );
X
X			++rulelen;
X
X			yyval = mkstate( -yyvsp[0] );
X			;
X    break;}
Xcase 43:
X#line 526 "parse.y"
X{
X			++rulelen;
X
X			yyval = mkstate( -yyvsp[0] );
X			;
X    break;}
Xcase 44:
X#line 533 "parse.y"
X{ yyval = yyvsp[-1]; ;
X    break;}
Xcase 45:
X#line 536 "parse.y"
X{ yyval = yyvsp[-1]; ;
X    break;}
Xcase 46:
X#line 539 "parse.y"
X{
X			++rulelen;
X
X			if ( caseins && yyvsp[0] >= 'A' && yyvsp[0] <= 'Z' )
X			    yyvsp[0] = clower( yyvsp[0] );
X
X			yyval = mkstate( yyvsp[0] );
X			;
X    break;}
Xcase 47:
X#line 550 "parse.y"
X{ yyval = yyvsp[-1]; ;
X    break;}
Xcase 48:
X#line 553 "parse.y"
X{
X			/* *Sigh* - to be compatible Unix lex, negated ccls
X			 * match newlines
X			 */
X#ifdef NOTDEF
X			ccladd( yyvsp[-1], '\n' ); /* negated ccls don't match '\n' */
X			cclsorted = false; /* because we added the newline */
X#endif
X			cclnegate( yyvsp[-1] );
X			yyval = yyvsp[-1];
X			;
X    break;}
Xcase 49:
X#line 567 "parse.y"
X{
X			if ( yyvsp[-2] > yyvsp[0] )
X			    synerr( "negative range in character class" );
X
X			else
X			    {
X			    if ( caseins )
X				{
X				if ( yyvsp[-2] >= 'A' && yyvsp[-2] <= 'Z' )
X				    yyvsp[-2] = clower( yyvsp[-2] );
X				if ( yyvsp[0] >= 'A' && yyvsp[0] <= 'Z' )
X				    yyvsp[0] = clower( yyvsp[0] );
X				}
X
X			    for ( i = yyvsp[-2]; i <= yyvsp[0]; ++i )
X			        ccladd( yyvsp[-3], i );
X
X			    /* keep track if this ccl is staying in alphabetical
X			     * order
X			     */
X			    cclsorted = cclsorted && (yyvsp[-2] > lastchar);
X			    lastchar = yyvsp[0];
X			    }
X
X			yyval = yyvsp[-3];
X			;
X    break;}
Xcase 50:
X#line 595 "parse.y"
X{
X			if ( caseins )
X			    if ( yyvsp[0] >= 'A' && yyvsp[0] <= 'Z' )
X				yyvsp[0] = clower( yyvsp[0] );
X
X			ccladd( yyvsp[-1], yyvsp[0] );
X			cclsorted = cclsorted && (yyvsp[0] > lastchar);
X			lastchar = yyvsp[0];
X			yyval = yyvsp[-1];
X			;
X    break;}
Xcase 51:
X#line 607 "parse.y"
X{
X			cclsorted = true;
X			lastchar = 0;
X			yyval = cclinit();
X			;
X    break;}
Xcase 52:
X#line 615 "parse.y"
X{
X			if ( caseins )
X			    if ( yyvsp[0] >= 'A' && yyvsp[0] <= 'Z' )
X				yyvsp[0] = clower( yyvsp[0] );
X
X			++rulelen;
X
X			yyval = link_machines( yyvsp[-1], mkstate( yyvsp[0] ) );
X			;
X    break;}
Xcase 53:
X#line 626 "parse.y"
X{ yyval = mkstate( SYM_EPSILON ); ;
X    break;}
X}
X   /* the action file gets copied in in place of this dollarsign */
X#line 303 "bison.simple"
X
X  yyvsp -= yylen;
X  yyssp -= yylen;
X#ifdef YYLSP_NEEDED
X  yylsp -= yylen;
X#endif
X
X#ifdef YYDEBUG
X  if (yydebug)
X    {
X      short *ssp1 = yyss - 1;
X      fprintf (stderr, "state stack now");
X      while (ssp1 != yyssp)
X        fprintf (stderr, " %d", *++ssp1);
X      fprintf (stderr, "\n");
X    }
X#endif
X
X  *++yyvsp = yyval;
X
X#ifdef YYLSP_NEEDED
X  yylsp++;
X  if (yylen == 0)
X    {
X      yylsp->first_line = yylloc.first_line;
X      yylsp->first_column = yylloc.first_column;
X      yylsp->last_line = (yylsp-1)->last_line;
X      yylsp->last_column = (yylsp-1)->last_column;
X      yylsp->text = 0;
X    }
X  else
X    {
X      yylsp->last_line = (yylsp+yylen-1)->last_line;
X      yylsp->last_column = (yylsp+yylen-1)->last_column;
X    }
X#endif
X
X  /* Now "shift" the result of the reduction.
X     Determine what state that goes to,
X     based on the state we popped back to
X     and the rule number reduced by.  */
X
X  yyn = yyr1[yyn];
X
X  yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
X  if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
X    yystate = yytable[yystate];
X  else
X    yystate = yydefgoto[yyn - YYNTBASE];
X
X  goto yynewstate;
X
Xyyerrlab:   /* here on detecting error */
X
X  if (! yyerrstatus)
X    /* If not already recovering from an error, report this error.  */
X    {
X      ++yynerr;
X      yyerror("parse error");
X    }
X
X  if (yyerrstatus == 3)
X    {
X      /* if just tried and failed to reuse lookahead token after an error, discard it.  */
X
X      /* return failure if at end of input */
X      if (yychar == YYEOF)
X        YYERROR;
X
X#ifdef YYDEBUG
X      if (yydebug)
X        fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
X#endif
X
X      yychar = YYEMPTY;
X    }
X
X  /* Else will try to reuse lookahead token
X     after shifting the error token.  */
X
X  yyerrstatus = 3;              /* Each real token shifted decrements this */
X
X  goto yyerrhandle;
X
Xyyerrdefault:  /* current state does not do anything special for the error token. */
X
X#if 0
X  /* This is wrong; only states that explicitly want error tokens
X     should shift them.  */
X  yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
X  if (yyn) goto yydefault;
X#endif
X
Xyyerrpop:   /* pop the current state because it cannot handle the error token */
X
X  if (yyssp == yyss) YYERROR;
X  yyvsp--;
X  yystate = *--yyssp;
X#ifdef YYLSP_NEEDED
X  yylsp--;
X#endif
X
X#ifdef YYDEBUG
X  if (yydebug)
X    {
X      short *ssp1 = yyss - 1;
X      fprintf (stderr, "Error: state stack now");
X      while (ssp1 != yyssp)
X        fprintf (stderr, " %d", *++ssp1);
X      fprintf (stderr, "\n");
X    }
X#endif
X
Xyyerrhandle:
X
X  yyn = yypact[yystate];
X  if (yyn == YYFLAG)
X    goto yyerrdefault;
X
X  yyn += YYTERROR;
X  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
X    goto yyerrdefault;
X
X  yyn = yytable[yyn];
X  if (yyn < 0)
X    {
X      if (yyn == YYFLAG)
X        goto yyerrpop;
X      yyn = -yyn;
X      goto yyreduce;
X    }
X  else if (yyn == 0)
X    goto yyerrpop;
X
X  if (yyn == YYFINAL)
X    YYACCEPT;
X
X#ifdef YYDEBUG
X  if (yydebug)
X    fprintf(stderr, "Shifting error token, ");
X#endif
X
X  *++yyvsp = yylval;
X#ifdef YYLSP_NEEDED
X  *++yylsp = yylloc;
X#endif
X
X  yystate = yyn;
X  goto yynewstate;
X}
X#line 629 "parse.y"
X
X
X
X/* build_eof_action - build the "<<EOF>>" action for the active start
X *                    conditions
X */
X
Xvoid build_eof_action()
X
X    {
X    register int i;
X
X    for ( i = 1; i <= actvp; ++i )
X	{
X	if ( sceof[actvsc[i]] )
X	    format_pinpoint_message(
X		"multiple <<EOF>> rules for start condition %s",
X		    scname[actvsc[i]] );
X
X	else
X	    {
X	    sceof[actvsc[i]] = true;
X	    fprintf( temp_action_file, "case YY_STATE_EOF(%s):\n",
X		     scname[actvsc[i]] );
X	    }
X	}
X
X    line_directive_out( temp_action_file );
X    }
X
X
X/* synerr - report a syntax error */
X
Xvoid synerr( str )
Xchar str[];
X
X    {
X    syntaxerror = true;
X    pinpoint_message( str );
X    }
X
X
X/* format_pinpoint_message - write out a message formatted with one string,
X *			     pinpointing its location
X */
X
Xvoid format_pinpoint_message( msg, arg )
Xchar msg[], arg[];
X
X    {
X    char errmsg[MAXLINE];
X
X    (void) sprintf( errmsg, msg, arg );
X    pinpoint_message( errmsg );
X    }
X
X
X/* pinpoint_message - write out a message, pinpointing its location */
X
Xvoid pinpoint_message( str )
Xchar str[];
X
X    {
X    fprintf( stderr, "\"%s\", line %d: %s\n", infilename, linenum, str );
X    }
X
X
X/* yyerror - eat up an error message from the parser;
X *	     currently, messages are ignore
X */
X
Xvoid yyerror( msg )
Xchar msg[];
X
X    {
X    }
END_OF_FILE
if test 45081 -ne `wc -c <'parse.c'`; then
    echo shar: \"'parse.c'\" unpacked with wrong size!
fi
# end of 'parse.c'
fi
echo shar: End of archive 8 \(of 13\).
cp /dev/null ark8isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 13 archives.
    rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0
-- 
Mail submissions (sources or binaries) to <amiga@uunet.uu.net>.
Mail comments to the moderator at <amiga-request@uunet.uu.net>.
Post requests for sources, and general discussion to comp.sys.amiga.