home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / programm / utility / bison.lha / Bison / bison.simple < prev    next >
Encoding:
Text File  |  1992-04-08  |  20.7 KB  |  866 lines

  1. /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
  2. #line 3 "bison.simple"
  3.  
  4. /* Skeleton output parser for bison,
  5.    Copyright (C) 1984, 1989, 1990 Bob Corbett and Richard Stallman
  6.  
  7.    This program is free software; you can redistribute it and/or modify
  8.    it under the terms of the GNU General Public License as published by
  9.    the Free Software Foundation; either version 1, or (at your option)
  10.    any later version.
  11.  
  12.    This program is distributed in the hope that it will be useful,
  13.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.    GNU General Public License for more details.
  16.  
  17.    You should have received a copy of the GNU General Public License
  18.    along with this program; if not, write to the Free Software
  19.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  20.  
  21.  
  22. #ifndef alloca
  23. #ifdef __GNUC__
  24. #define alloca __builtin_alloca
  25. #else /* not GNU C.  */
  26. #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__)
  27. #include <alloca.h>
  28. #else /* not sparc */
  29. #if defined (MSDOS) && !defined (__TURBOC__)
  30. #include <malloc.h>
  31. #else /* not MSDOS, or __TURBOC__ */
  32. #if defined(_AIX)
  33. #include <malloc.h>
  34.  #pragma alloca
  35. #endif /* not _AIX */
  36. #endif /* not MSDOS, or __TURBOC__ */
  37. #endif /* not sparc.  */
  38. #endif /* not GNU C.  */
  39. #endif /* alloca not defined.  */
  40.  
  41. /* This is the parser code that is written into each bison parser
  42.   when the %semantic_parser declaration is not specified in the grammar.
  43.   It was written by Richard Stallman by simplifying the hairy parser
  44.   used when %semantic_parser is specified.  */
  45.  
  46. /* Note: there must be only one dollar sign in this file.
  47.    It is replaced by the list of actions, each action
  48.    as one case of the switch.  */
  49.  
  50.  
  51.  
  52.  
  53.  
  54. #ifdef AMIGA
  55.  
  56. #define bzero(b, length) memset((b),'\0',(length))
  57. #define bcopy(b1, b2, length) memcpy((b1),(b2),(length))
  58. #define bcmp(b1, b2, length)  memcmp((b1),(b2),(length))
  59.  
  60. #include <stdlib.h>
  61.  
  62. /* extern char *calloc();*/
  63. /* extern void done();*/
  64.  
  65. /* extern char *program_name;*/
  66.  
  67. char *
  68. mallocate(n)
  69. register unsigned n;
  70. {
  71.   register char *block;
  72.  
  73.   /* Avoid uncertainty about what an arg of 0 will do.  */
  74.   if (n == 0)
  75.     n = 1;
  76.   block = calloc(n,1);
  77.   if (block == NULL)
  78.     {
  79.       fprintf(stderr, "Bison: memory exhausted\n");
  80.       /*done(1);*/ exit(1);
  81.     }
  82.  
  83.   return (block);
  84. }
  85.  
  86. /* This name is used by alloca.c.  */
  87.  
  88. char *
  89. xmalloc (n)
  90.      unsigned int n;
  91. {
  92.   return mallocate (n);
  93. }
  94.  
  95.  
  96. /*
  97.     alloca -- (mostly) portable public-domain implementation -- D A Gwyn
  98.  
  99.     last edit:    86/05/30    rms
  100.        include config.h, since on VMS it renames some symbols.
  101.        Use xmalloc instead of malloc.
  102.  
  103.     This implementation of the PWB library alloca() function,
  104.     which is used to allocate space off the run-time stack so
  105.     that it is automatically reclaimed upon procedure exit, 
  106.     was inspired by discussions with J. Q. Johnson of Cornell.
  107.  
  108.     It should work under any C implementation that uses an
  109.     actual procedure stack (as opposed to a linked list of
  110.     frames).  There are some preprocessor constants that can
  111.     be defined when compiling for your specific system, for
  112.     improved efficiency; however, the defaults should be okay.
  113.  
  114.     The general concept of this implementation is to keep
  115.     track of all alloca()-allocated blocks, and reclaim any
  116.     that are found to be deeper in the stack than the current
  117.     invocation.  This heuristic does not reclaim storage as
  118.     soon as it becomes invalid, but it will do so eventually.
  119.  
  120.     As a special case, alloca(0) reclaims storage without
  121.     allocating any.  It is a good idea to use alloca(0) in
  122.     your main control loop, etc. to force garbage collection.
  123. */
  124. #ifndef lint
  125. static char    SCCSid[] = "@(#)alloca.c    1.1";    /* for the "what" utility */
  126. #endif
  127.  
  128. #ifdef emacs
  129. #include "config.h"
  130. #ifdef static
  131. /* actually, only want this if static is defined as ""
  132.    -- this is for usg, in which emacs must undefine static
  133.    in order to make unexec workable
  134.    */
  135. #ifndef STACK_DIRECTION
  136. you
  137. lose
  138. -- must know STACK_DIRECTION at compile-time
  139. #endif /* STACK_DIRECTION undefined */
  140. #endif /* static */
  141. #endif /* emacs */
  142.  
  143. #ifdef __STDC__
  144. typedef void    *pointer;        /* generic pointer type */
  145. #else
  146. typedef char    *pointer;        /* generic pointer type */
  147. #endif
  148.  
  149. extern void    free();
  150. /* extern pointer    xmalloc();*/
  151.  
  152. /*
  153.     Define STACK_DIRECTION if you know the direction of stack
  154.     growth for your system; otherwise it will be automatically
  155.     deduced at run-time.
  156.  
  157.     STACK_DIRECTION > 0 => grows toward higher addresses
  158.     STACK_DIRECTION < 0 => grows toward lower addresses
  159.     STACK_DIRECTION = 0 => direction of growth unknown
  160. */
  161.  
  162. #ifndef STACK_DIRECTION
  163. #define    STACK_DIRECTION    0        /* direction unknown */
  164. #endif
  165.  
  166. #if STACK_DIRECTION != 0
  167.  
  168. #define    STACK_DIR    STACK_DIRECTION    /* known at compile-time */
  169.  
  170. #else    /* STACK_DIRECTION == 0; need run-time code */
  171.  
  172. static int    stack_dir;        /* 1 or -1 once known */
  173. #define    STACK_DIR    stack_dir
  174.  
  175. static void
  176. find_stack_direction (/* void */)
  177. {
  178.   static char    *addr = NULL;    /* address of first
  179.                    `dummy', once known */
  180.   auto char    dummy;        /* to get stack address */
  181.  
  182.   if (addr == NULL)
  183.     {                /* initial entry */
  184.       addr = &dummy;
  185.  
  186.       find_stack_direction ();    /* recurse once */
  187.     }
  188.   else                /* second entry */
  189.     if (&dummy > addr)
  190.       stack_dir = 1;        /* stack grew upward */
  191.     else
  192.       stack_dir = -1;        /* stack grew downward */
  193. }
  194.  
  195. #endif    /* STACK_DIRECTION == 0 */
  196.  
  197. /*
  198.     An "alloca header" is used to:
  199.     (a) chain together all alloca()ed blocks;
  200.     (b) keep track of stack depth.
  201.  
  202.     It is very important that sizeof(header) agree with malloc()
  203.     alignment chunk size.  The following default should work okay.
  204. */
  205.  
  206. #ifndef    ALIGN_SIZE
  207. #define    ALIGN_SIZE    sizeof(double)
  208. #endif
  209.  
  210. typedef union hdr
  211. {
  212.   char    align[ALIGN_SIZE];    /* to force sizeof(header) */
  213.   struct
  214.     {
  215.       union hdr *next;        /* for chaining headers */
  216.       char *deep;        /* for stack depth measure */
  217.     } h;
  218. } header;
  219.  
  220. /*
  221.     alloca( size ) returns a pointer to at least `size' bytes of
  222.     storage which will be automatically reclaimed upon exit from
  223.     the procedure that called alloca().  Originally, this space
  224.     was supposed to be taken from the current stack frame of the
  225.     caller, but that method cannot be made to work for some
  226.     implementations of C, for example under Gould's UTX/32.
  227. */
  228.  
  229. static header *last_alloca_header = NULL; /* -> last alloca header */
  230.  
  231. pointer
  232. alloca (size)            /* returns pointer to storage */
  233.      unsigned    size;        /* # bytes to allocate */
  234. {
  235.   auto char    probe;        /* probes stack depth: */
  236.   register char    *depth = &probe;
  237.  
  238. #if STACK_DIRECTION == 0
  239.   if (STACK_DIR == 0)        /* unknown growth direction */
  240.     find_stack_direction ();
  241. #endif
  242.  
  243.                 /* Reclaim garbage, defined as all alloca()ed storage that
  244.                    was allocated from deeper in the stack than currently. */
  245.  
  246.   {
  247.     register header    *hp;    /* traverses linked list */
  248.  
  249.     for (hp = last_alloca_header; hp != NULL;)
  250.       if ((STACK_DIR > 0 && hp->h.deep > depth)
  251.       || (STACK_DIR < 0 && hp->h.deep < depth))
  252.     {
  253.       register header    *np = hp->h.next;
  254.  
  255.       free ((pointer) hp);    /* collect garbage */
  256.  
  257.       hp = np;        /* -> next header */
  258.     }
  259.       else
  260.     break;            /* rest are not deeper */
  261.  
  262.     last_alloca_header = hp;    /* -> last valid storage */
  263.   }
  264.  
  265.   if (size == 0)
  266.     return NULL;        /* no allocation required */
  267.  
  268.   /* Allocate combined header + user data storage. */
  269.  
  270.   {
  271.     register pointer    new = xmalloc (sizeof (header) + size);
  272.     /* address of header */
  273.  
  274.     ((header *)new)->h.next = last_alloca_header;
  275.     ((header *)new)->h.deep = depth;
  276.  
  277.     last_alloca_header = (header *)new;
  278.  
  279.     /* User storage begins just after header. */
  280.  
  281.     return (pointer)((char *)new + sizeof(header));
  282.   }
  283. }
  284. #endif
  285.  
  286.  
  287.  
  288.  
  289.  
  290. #define yyerrok        (yyerrstatus = 0)
  291. #define yyclearin    (yychar = YYEMPTY)
  292. #define YYEMPTY        -2
  293. #define YYEOF        0
  294. #define YYACCEPT    return(0)
  295. #define YYABORT     return(1)
  296. #define YYERROR        goto yyerrlab1
  297. /* Like YYERROR except do call yyerror.
  298.    This remains here temporarily to ease the
  299.    transition to the new meaning of YYERROR, for GCC.
  300.    Once GCC version 2 has supplanted version 1, this can go.  */
  301. #define YYFAIL        goto yyerrlab
  302. #define YYRECOVERING()  (!!yyerrstatus)
  303. #define YYBACKUP(token, value) \
  304. do                                \
  305.   if (yychar == YYEMPTY && yylen == 1)                \
  306.     { yychar = (token), yylval = (value);            \
  307.       yychar1 = YYTRANSLATE (yychar);                \
  308.       YYPOPSTACK;                        \
  309.       goto yybackup;                        \
  310.     }                                \
  311.   else                                \
  312.     { yyerror ("syntax error: cannot back up"); YYERROR; }    \
  313. while (0)
  314.  
  315. #define YYTERROR    1
  316. #define YYERRCODE    256
  317.  
  318. #ifndef YYPURE
  319. #define YYLEX        yylex()
  320. #endif
  321.  
  322. #ifdef YYPURE
  323. #ifdef YYLSP_NEEDED
  324. #define YYLEX        yylex(&yylval, &yylloc)
  325. #else
  326. #define YYLEX        yylex(&yylval)
  327. #endif
  328. #endif
  329.  
  330. /* If nonreentrant, generate the variables here */
  331.  
  332. #ifndef YYPURE
  333.  
  334. int    yychar;            /*  the lookahead symbol        */
  335. YYSTYPE    yylval;            /*  the semantic value of the        */
  336.                 /*  lookahead symbol            */
  337.  
  338. #ifdef YYLSP_NEEDED
  339. YYLTYPE yylloc;            /*  location data for the lookahead    */
  340.                 /*  symbol                */
  341. #endif
  342.  
  343. int yynerrs;            /*  number of parse errors so far       */
  344. #endif  /* not YYPURE */
  345.  
  346. #if YYDEBUG != 0
  347. int yydebug;            /*  nonzero means print parse trace    */
  348. /* Since this is uninitialized, it does not stop multiple parsers
  349.    from coexisting.  */
  350. #endif
  351.  
  352. /*  YYINITDEPTH indicates the initial size of the parser's stacks    */
  353.  
  354. #ifndef    YYINITDEPTH
  355. #define YYINITDEPTH 200
  356. #endif
  357.  
  358. /*  YYMAXDEPTH is the maximum size the stacks can grow to
  359.     (effective only if the built-in stack extension method is used).  */
  360.  
  361. #if YYMAXDEPTH == 0
  362. #undef YYMAXDEPTH
  363. #endif
  364.  
  365. #ifndef YYMAXDEPTH
  366. #define YYMAXDEPTH 10000
  367. #endif
  368.  
  369. #if __GNUC__ > 1        /* GNU C and GNU C++ define this.  */
  370. #define __yy_bcopy(FROM,TO,COUNT)    __builtin_memcpy(TO,FROM,COUNT)
  371. #else                /* not GNU C or C++ */
  372. #ifndef __cplusplus
  373.  
  374. /* This is the most reliable way to avoid incompatibilities
  375.    in available built-in functions on various systems.  */
  376. static void
  377. __yy_bcopy (from, to, count)
  378.      char *from;
  379.      char *to;
  380.      int count;
  381. {
  382.   register char *f = from;
  383.   register char *t = to;
  384.   register int i = count;
  385.  
  386.   while (i-- > 0)
  387.     *t++ = *f++;
  388. }
  389.  
  390. #else /* __cplusplus */
  391.  
  392. /* This is the most reliable way to avoid incompatibilities
  393.    in available built-in functions on various systems.  */
  394. static void
  395. __yy_bcopy (char *from, char *to, int count)
  396. {
  397.   register char *f = from;
  398.   register char *t = to;
  399.   register int i = count;
  400.  
  401.   while (i-- > 0)
  402.     *t++ = *f++;
  403. }
  404.  
  405. #endif
  406. #endif
  407.  
  408. #line 169 "bison.simple"
  409. int
  410. yyparse()
  411. {
  412.   register int yystate;
  413.   register int yyn;
  414.   register short *yyssp;
  415.   register YYSTYPE *yyvsp;
  416.   int yyerrstatus;    /*  number of tokens to shift before error messages enabled */
  417.   int yychar1;        /*  lookahead token as an internal (translated) token number */
  418.  
  419.   short    yyssa[YYINITDEPTH];    /*  the state stack            */
  420.   YYSTYPE yyvsa[YYINITDEPTH];    /*  the semantic value stack        */
  421.  
  422.   short *yyss = yyssa;        /*  refer to the stacks thru separate pointers */
  423.   YYSTYPE *yyvs = yyvsa;    /*  to allow yyoverflow to reallocate them elsewhere */
  424.  
  425. #ifdef YYLSP_NEEDED
  426.   YYLTYPE yylsa[YYINITDEPTH];    /*  the location stack            */
  427.   YYLTYPE *yyls = yylsa;
  428.   YYLTYPE *yylsp;
  429.  
  430. #define YYPOPSTACK   (yyvsp--, yysp--, yylsp--)
  431. #else
  432. #define YYPOPSTACK   (yyvsp--, yysp--)
  433. #endif
  434.  
  435.   int yystacksize = YYINITDEPTH;
  436.  
  437. #ifdef YYPURE
  438.   int yychar;
  439.   YYSTYPE yylval;
  440.   int yynerrs;
  441. #ifdef YYLSP_NEEDED
  442.   YYLTYPE yylloc;
  443. #endif
  444. #endif
  445.  
  446.   YYSTYPE yyval;        /*  the variable used to return        */
  447.                 /*  semantic values from the action    */
  448.                 /*  routines                */
  449.  
  450.   int yylen;
  451.  
  452. #if YYDEBUG != 0
  453.   if (yydebug)
  454.     fprintf(stderr, "Starting parse\n");
  455. #endif
  456.  
  457.   yystate = 0;
  458.   yyerrstatus = 0;
  459.   yynerrs = 0;
  460.   yychar = YYEMPTY;        /* Cause a token to be read.  */
  461.  
  462.   /* Initialize stack pointers.
  463.      Waste one element of value and location stack
  464.      so that they stay on the same level as the state stack.  */
  465.  
  466.   yyssp = yyss - 1;
  467.   yyvsp = yyvs;
  468. #ifdef YYLSP_NEEDED
  469.   yylsp = yyls;
  470. #endif
  471.  
  472. /* Push a new state, which is found in  yystate  .  */
  473. /* In all cases, when you get here, the value and location stacks
  474.    have just been pushed. so pushing a state here evens the stacks.  */
  475. yynewstate:
  476.  
  477.   *++yyssp = yystate;
  478.  
  479.   if (yyssp >= yyss + yystacksize - 1)
  480.     {
  481.       /* Give user a chance to reallocate the stack */
  482.       /* Use copies of these so that the &'s don't force the real ones into memory. */
  483.       YYSTYPE *yyvs1 = yyvs;
  484.       short *yyss1 = yyss;
  485. #ifdef YYLSP_NEEDED
  486.       YYLTYPE *yyls1 = yyls;
  487. #endif
  488.  
  489.       /* Get the current used size of the three stacks, in elements.  */
  490.       int size = yyssp - yyss + 1;
  491.  
  492. #ifdef yyoverflow
  493.       /* Each stack pointer address is followed by the size of
  494.      the data in use in that stack, in bytes.  */
  495.       yyoverflow("parser stack overflow",
  496.          &yyss1, size * sizeof (*yyssp),
  497.          &yyvs1, size * sizeof (*yyvsp),
  498. #ifdef YYLSP_NEEDED
  499.          &yyls1, size * sizeof (*yylsp),
  500. #endif
  501.          &yystacksize);
  502.  
  503.       yyss = yyss1; yyvs = yyvs1;
  504. #ifdef YYLSP_NEEDED
  505.       yyls = yyls1;
  506. #endif
  507. #else /* no yyoverflow */
  508.       /* Extend the stack our own way.  */
  509.       if (yystacksize >= YYMAXDEPTH)
  510.     {
  511.       yyerror("parser stack overflow");
  512.       return 2;
  513.     }
  514.       yystacksize *= 2;
  515.       if (yystacksize > YYMAXDEPTH)
  516.     yystacksize = YYMAXDEPTH;
  517.       yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
  518.       __yy_bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
  519.       yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
  520.       __yy_bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
  521. #ifdef YYLSP_NEEDED
  522.       yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
  523.       __yy_bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
  524. #endif
  525. #endif /* no yyoverflow */
  526.  
  527.       yyssp = yyss + size - 1;
  528.       yyvsp = yyvs + size - 1;
  529. #ifdef YYLSP_NEEDED
  530.       yylsp = yyls + size - 1;
  531. #endif
  532.  
  533. #if YYDEBUG != 0
  534.       if (yydebug)
  535.     fprintf(stderr, "Stack size increased to %d\n", yystacksize);
  536. #endif
  537.  
  538.       if (yyssp >= yyss + yystacksize - 1)
  539.     YYABORT;
  540.     }
  541.  
  542. #if YYDEBUG != 0
  543.   if (yydebug)
  544.     fprintf(stderr, "Entering state %d\n", yystate);
  545. #endif
  546.  
  547.  yybackup:
  548.  
  549. /* Do appropriate processing given the current state.  */
  550. /* Read a lookahead token if we need one and don't already have one.  */
  551. /* yyresume: */
  552.  
  553.   /* First try to decide what to do without reference to lookahead token.  */
  554.  
  555.   yyn = yypact[yystate];
  556.   if (yyn == YYFLAG)
  557.     goto yydefault;
  558.  
  559.   /* Not known => get a lookahead token if don't already have one.  */
  560.  
  561.   /* yychar is either YYEMPTY or YYEOF
  562.      or a valid token in external form.  */
  563.  
  564.   if (yychar == YYEMPTY)
  565.     {
  566. #if YYDEBUG != 0
  567.       if (yydebug)
  568.     fprintf(stderr, "Reading a token: ");
  569. #endif
  570.       yychar = YYLEX;
  571.     }
  572.  
  573.   /* Convert token to internal form (in yychar1) for indexing tables with */
  574.  
  575.   if (yychar <= 0)        /* This means end of input. */
  576.     {
  577.       yychar1 = 0;
  578.       yychar = YYEOF;        /* Don't call YYLEX any more */
  579.  
  580. #if YYDEBUG != 0
  581.       if (yydebug)
  582.     fprintf(stderr, "Now at end of input.\n");
  583. #endif
  584.     }
  585.   else
  586.     {
  587.       yychar1 = YYTRANSLATE(yychar);
  588.  
  589. #if YYDEBUG != 0
  590.       if (yydebug)
  591.     {
  592.       fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
  593.       /* Give the individual parser a way to print the precise meaning
  594.          of a token, for further debugging info.  */
  595. #ifdef YYPRINT
  596.       YYPRINT (stderr, yychar, yylval);
  597. #endif
  598.       fprintf (stderr, ")\n");
  599.     }
  600. #endif
  601.     }
  602.  
  603.   yyn += yychar1;
  604.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
  605.     goto yydefault;
  606.  
  607.   yyn = yytable[yyn];
  608.  
  609.   /* yyn is what to do for this token type in this state.
  610.      Negative => reduce, -yyn is rule number.
  611.      Positive => shift, yyn is new state.
  612.        New state is final state => don't bother to shift,
  613.        just return success.
  614.      0, or most negative number => error.  */
  615.  
  616.   if (yyn < 0)
  617.     {
  618.       if (yyn == YYFLAG)
  619.     goto yyerrlab;
  620.       yyn = -yyn;
  621.       goto yyreduce;
  622.     }
  623.   else if (yyn == 0)
  624.     goto yyerrlab;
  625.  
  626.   if (yyn == YYFINAL)
  627.     YYACCEPT;
  628.  
  629.   /* Shift the lookahead token.  */
  630.  
  631. #if YYDEBUG != 0
  632.   if (yydebug)
  633.     fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
  634. #endif
  635.  
  636.   /* Discard the token being shifted unless it is eof.  */
  637.   if (yychar != YYEOF)
  638.     yychar = YYEMPTY;
  639.  
  640.   *++yyvsp = yylval;
  641. #ifdef YYLSP_NEEDED
  642.   *++yylsp = yylloc;
  643. #endif
  644.  
  645.   /* count tokens shifted since error; after three, turn off error status.  */
  646.   if (yyerrstatus) yyerrstatus--;
  647.  
  648.   yystate = yyn;
  649.   goto yynewstate;
  650.  
  651. /* Do the default action for the current state.  */
  652. yydefault:
  653.  
  654.   yyn = yydefact[yystate];
  655.   if (yyn == 0)
  656.     goto yyerrlab;
  657.  
  658. /* Do a reduction.  yyn is the number of a rule to reduce with.  */
  659. yyreduce:
  660.   yylen = yyr2[yyn];
  661.   yyval = yyvsp[1-yylen]; /* implement default value of the action */
  662.  
  663. #if YYDEBUG != 0
  664.   if (yydebug)
  665.     {
  666.       int i;
  667.  
  668.       fprintf (stderr, "Reducing via rule %d (line %d), ",
  669.            yyn, yyrline[yyn]);
  670.  
  671.       /* Print the symboles being reduced, and their result.  */
  672.       for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
  673.     fprintf (stderr, "%s ", yytname[yyrhs[i]]);
  674.       fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
  675.     }
  676. #endif
  677.  
  678. $   /* the action file gets copied in in place of this dollarsign */
  679. #line 440 "bison.simple"
  680.  
  681.   yyvsp -= yylen;
  682.   yyssp -= yylen;
  683. #ifdef YYLSP_NEEDED
  684.   yylsp -= yylen;
  685. #endif
  686.  
  687. #if YYDEBUG != 0
  688.   if (yydebug)
  689.     {
  690.       short *ssp1 = yyss - 1;
  691.       fprintf (stderr, "state stack now");
  692.       while (ssp1 != yyssp)
  693.     fprintf (stderr, " %d", *++ssp1);
  694.       fprintf (stderr, "\n");
  695.     }
  696. #endif
  697.  
  698.   *++yyvsp = yyval;
  699.  
  700. #ifdef YYLSP_NEEDED
  701.   yylsp++;
  702.   if (yylen == 0)
  703.     {
  704.       yylsp->first_line = yylloc.first_line;
  705.       yylsp->first_column = yylloc.first_column;
  706.       yylsp->last_line = (yylsp-1)->last_line;
  707.       yylsp->last_column = (yylsp-1)->last_column;
  708.       yylsp->text = 0;
  709.     }
  710.   else
  711.     {
  712.       yylsp->last_line = (yylsp+yylen-1)->last_line;
  713.       yylsp->last_column = (yylsp+yylen-1)->last_column;
  714.     }
  715. #endif
  716.  
  717.   /* Now "shift" the result of the reduction.
  718.      Determine what state that goes to,
  719.      based on the state we popped back to
  720.      and the rule number reduced by.  */
  721.  
  722.   yyn = yyr1[yyn];
  723.  
  724.   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
  725.   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
  726.     yystate = yytable[yystate];
  727.   else
  728.     yystate = yydefgoto[yyn - YYNTBASE];
  729.  
  730.   goto yynewstate;
  731.  
  732. yyerrlab:   /* here on detecting error */
  733.  
  734.   if (! yyerrstatus)
  735.     /* If not already recovering from an error, report this error.  */
  736.     {
  737.       ++yynerrs;
  738.  
  739. #ifdef YYERROR_VERBOSE
  740.       yyn = yypact[yystate];
  741.  
  742.       if (yyn > YYFLAG && yyn < YYLAST)
  743.     {
  744.       int size = 0;
  745.       char *msg;
  746.       int x, count;
  747.  
  748.       count = 0;
  749.       for (x = 0; x < (sizeof(yytname) / sizeof(char *)); x++)
  750.         if (yycheck[x + yyn] == x)
  751.           size += strlen(yytname[x]) + 15, count++;
  752.       msg = (char *) xmalloc(size + 15);
  753.       strcpy(msg, "parse error");
  754.  
  755.       if (count < 5)
  756.         {
  757.           count = 0;
  758.           for (x = 0; x < (sizeof(yytname) / sizeof(char *)); x++)
  759.         if (yycheck[x + yyn] == x)
  760.           {
  761.             strcat(msg, count == 0 ? ", expecting `" : " or `");
  762.             strcat(msg, yytname[x]);
  763.             strcat(msg, "'");
  764.             count++;
  765.           }
  766.         }
  767.       yyerror(msg);
  768.       free(msg);
  769.     }
  770.       else
  771. #endif /* YYERROR_VERBOSE */
  772.     yyerror("parse error");
  773.     }
  774.  
  775. yyerrlab1:   /* here on error raised explicitly by an action */
  776.  
  777.   if (yyerrstatus == 3)
  778.     {
  779.       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
  780.  
  781.       /* return failure if at end of input */
  782.       if (yychar == YYEOF)
  783.     YYABORT;
  784.  
  785. #if YYDEBUG != 0
  786.       if (yydebug)
  787.     fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
  788. #endif
  789.  
  790.       yychar = YYEMPTY;
  791.     }
  792.  
  793.   /* Else will try to reuse lookahead token
  794.      after shifting the error token.  */
  795.  
  796.   yyerrstatus = 3;        /* Each real token shifted decrements this */
  797.  
  798.   goto yyerrhandle;
  799.  
  800. yyerrdefault:  /* current state does not do anything special for the error token. */
  801.  
  802. #if 0
  803.   /* This is wrong; only states that explicitly want error tokens
  804.      should shift them.  */
  805.   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
  806.   if (yyn) goto yydefault;
  807. #endif
  808.  
  809. yyerrpop:   /* pop the current state because it cannot handle the error token */
  810.  
  811.   if (yyssp == yyss) YYABORT;
  812.   yyvsp--;
  813.   yystate = *--yyssp;
  814. #ifdef YYLSP_NEEDED
  815.   yylsp--;
  816. #endif
  817.  
  818. #if YYDEBUG != 0
  819.   if (yydebug)
  820.     {
  821.       short *ssp1 = yyss - 1;
  822.       fprintf (stderr, "Error: state stack now");
  823.       while (ssp1 != yyssp)
  824.     fprintf (stderr, " %d", *++ssp1);
  825.       fprintf (stderr, "\n");
  826.     }
  827. #endif
  828.  
  829. yyerrhandle:
  830.  
  831.   yyn = yypact[yystate];
  832.   if (yyn == YYFLAG)
  833.     goto yyerrdefault;
  834.  
  835.   yyn += YYTERROR;
  836.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
  837.     goto yyerrdefault;
  838.  
  839.   yyn = yytable[yyn];
  840.   if (yyn < 0)
  841.     {
  842.       if (yyn == YYFLAG)
  843.     goto yyerrpop;
  844.       yyn = -yyn;
  845.       goto yyreduce;
  846.     }
  847.   else if (yyn == 0)
  848.     goto yyerrpop;
  849.  
  850.   if (yyn == YYFINAL)
  851.     YYACCEPT;
  852.  
  853. #if YYDEBUG != 0
  854.   if (yydebug)
  855.     fprintf(stderr, "Shifting error token, ");
  856. #endif
  857.  
  858.   *++yyvsp = yylval;
  859. #ifdef YYLSP_NEEDED
  860.   *++yylsp = yylloc;
  861. #endif
  862.  
  863.   yystate = yyn;
  864.   goto yynewstate;
  865. }
  866.