home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / gwm18a.zip / y.tab.c < prev    next >
C/C++ Source or Header  |  1995-07-03  |  19KB  |  845 lines

  1.  
  2. # line 2 "wool.yac"
  3. /* Copyright 1989 GROUPE BULL -- See license conditions in file COPYRIGHT
  4.  * Copyright 1989 Massachusetts Institute of Technology
  5.  */
  6. /***************************\
  7. *                 *
  8. *  Yacc grammar for Wool   *
  9. *                 *
  10. \***************************/
  11.  
  12. #include <stdio.h>
  13. #include <ctype.h>
  14. #include "EXTERN.h"
  15. #include "wool.h"
  16. #include "wl_atom.h"
  17. #include "wl_coll.h"
  18. #include "wl_list.h"
  19. #include "INTERN.h"
  20. #include "yacc.h"
  21. #if defined SVR4
  22. #define SYSV
  23. #endif
  24. #ifdef SYSV
  25. #include <string.h>
  26. #else /* SYSV */
  27. #include <strings.h>
  28. #endif /* SYSV */
  29.  
  30.  
  31. # line 31 "wool.yac"
  32. typedef union
  33. #ifdef __cplusplus
  34.     YYSTYPE
  35. #endif
  36. {
  37.     WOOL_OBJECT wool_object;
  38.     WOOL_Collection wool_collection;
  39. } YYSTYPE;
  40. # define END_OF_FILE 257
  41. # define STRING 258
  42. # define NON_CLOSED_STRING 259
  43. # define QUOTECHAR 260
  44. # define NUMBER 261
  45. # define HEX_NUMBER 262
  46. # define LEFTPAR 263
  47. # define RIGHTPAR 264
  48. # define LEFTBRA 265
  49. # define RIGHTBRA 266
  50. # define NAME 267
  51.  
  52. #include <malloc.h>
  53. #include <memory.h>
  54. #include <values.h>
  55.  
  56. #ifdef __cplusplus
  57.  
  58. #ifndef yyerror
  59.     void yyerror(const char *);
  60. #endif
  61.  
  62. #ifndef yylex
  63. #ifdef __EXTERN_C__
  64.     extern "C" { int yylex(void); }
  65. #else
  66.     int yylex(void);
  67. #endif
  68. #endif
  69.     int yyparse(void);
  70.  
  71. #endif
  72. #define yyclearin yychar = -1
  73. #define yyerrok yyerrflag = 0
  74. extern int yychar;
  75. extern int yyerrflag;
  76. YYSTYPE yylval;
  77. YYSTYPE yyval;
  78. typedef int yytabelem;
  79. #ifndef YYMAXDEPTH
  80. #define YYMAXDEPTH 150
  81. #endif
  82. #if YYMAXDEPTH > 0
  83. int yy_yys[YYMAXDEPTH], *yys = yy_yys;
  84. YYSTYPE yy_yyv[YYMAXDEPTH], *yyv = yy_yyv;
  85. #else    /* user does initial allocation */
  86. int *yys;
  87. YYSTYPE *yyv;
  88. #endif
  89. static int yymaxdepth = YYMAXDEPTH;
  90. # define YYERRCODE 256
  91.  
  92. # line 93 "wool.yac"
  93.  
  94.  
  95. #include "lex.yy.c"    /* lexical created by lex */
  96.  
  97. yyerror(s)
  98. char *s;
  99. {
  100.     wool_error(SYNTAX_ERROR, s);
  101. }
  102.  
  103. /*
  104.  * Some routines to deal with strings:
  105.  */
  106.  
  107. /*
  108.  * strip_string strips strings from \, ", etc... 
  109.  * copies string raw_string to string stripped_string
  110.  */
  111.  
  112. static char *stripped_string;
  113. static int   stripped_string_limit;
  114.  
  115. char *strip_string(raw_string)
  116. char *raw_string;
  117. {
  118.     register char  *p, *q, c;
  119.     int num;
  120.  
  121.     if ((int) strlen(raw_string) > stripped_string_limit) {
  122.     stripped_string_limit = strlen(raw_string);
  123.     stripped_string = (char *)
  124.         Realloc(stripped_string, stripped_string_limit);
  125.     }
  126.     for (p = raw_string + 1, q = stripped_string; *p; p++, q++) {
  127.     switch (*p) {
  128.     case '"':
  129.         *q = '\0';
  130.         break;
  131.     case '\\':
  132.         switch (*(++p)) {
  133.         case '\n':
  134.         q--;
  135.         break;
  136.         case 'n':
  137.         *q = '\n';
  138.         break;
  139.         case 'r':
  140.         *q = '\r';
  141.         break;
  142.         case 't':
  143.         *q = '\t';
  144.         break;
  145.         case 'e':
  146.         *q = '\033';
  147.         break;
  148.         case 'x':
  149.         sscanf(++p,"%2x",&num);
  150.         *q = num;
  151.         p++;
  152.         break;
  153.         default:
  154.         if ((*p <= '9') && (*p >= '0')) {
  155.             *q = (char)
  156.             (*p - '0') * 64 + (*(++p) - '0') * 8 + *(++p) - '0';
  157.         } else {
  158.             *q = *p;
  159.         }
  160.         }
  161.         break;
  162.     default:
  163.         *q = *p;
  164.     }
  165.     }
  166.     return stripped_string;
  167. }
  168. yytabelem yyexca[] ={
  169. -1, 1,
  170.     0, -1,
  171.     -2, 0,
  172.     };
  173. # define YYNPROD 16
  174. # define YYLAST 53
  175. yytabelem yyact[]={
  176.  
  177.     13,    19,    10,    12,    11,     8,     9,     5,    18,     6,
  178.      0,     7,    13,     4,    10,    12,    11,     8,     9,     5,
  179.      3,     6,    13,     7,    10,    12,    11,     8,     9,     5,
  180.      2,     6,    21,     7,    13,     0,    10,    12,    11,     8,
  181.      9,     5,    17,     6,    15,     7,    20,    20,     1,     0,
  182.      0,    16,    14 };
  183. yytabelem yypact[]={
  184.  
  185.   -244,-10000000,-10000000,  -244,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,
  186. -10000000,  -222,-10000000,-10000000,-10000000,  -256,  -234,-10000000,-10000000,-10000000,
  187. -10000000,-10000000 };
  188. yytabelem yypgo[]={
  189.  
  190.      0,    30,    48,    44 };
  191. yytabelem yyr1[]={
  192.  
  193.      0,     2,     2,     2,     1,     1,     1,     1,     1,     1,
  194.      1,     1,     1,     1,     3,     3 };
  195. yytabelem yyr2[]={
  196.  
  197.      0,     3,     5,     3,     7,     7,     3,     3,     3,     3,
  198.      5,     3,     7,     3,     5,     1 };
  199. yytabelem yychk[]={
  200.  
  201. -10000000,    -2,    -1,   264,   257,   263,   265,   267,   261,   262,
  202.    258,   260,   259,   256,    -2,    -3,    -3,    -1,   264,   257,
  203.     -1,   266 };
  204. yytabelem yydef[]={
  205.  
  206.      0,    -2,     1,     0,     3,    15,    15,     6,     7,     8,
  207.      9,     0,    11,    13,     2,     0,     0,    10,     4,    12,
  208.     14,     5 };
  209. typedef struct
  210. #ifdef __cplusplus
  211.     yytoktype
  212. #endif
  213. { char *t_name; int t_val; } yytoktype;
  214. #ifndef YYDEBUG
  215. #    define YYDEBUG    0    /* don't allow debugging */
  216. #endif
  217.  
  218. #if YYDEBUG
  219.  
  220. yytoktype yytoks[] =
  221. {
  222.     "END_OF_FILE",    257,
  223.     "STRING",    258,
  224.     "NON_CLOSED_STRING",    259,
  225.     "QUOTECHAR",    260,
  226.     "NUMBER",    261,
  227.     "HEX_NUMBER",    262,
  228.     "LEFTPAR",    263,
  229.     "RIGHTPAR",    264,
  230.     "LEFTBRA",    265,
  231.     "RIGHTBRA",    266,
  232.     "NAME",    267,
  233.     "-unknown-",    -1    /* ends search */
  234. };
  235.  
  236. char * yyreds[] =
  237. {
  238.     "-no such reduction-",
  239.     "main_s_exp : s_expression",
  240.     "main_s_exp : RIGHTPAR main_s_exp",
  241.     "main_s_exp : END_OF_FILE",
  242.     "s_expression : LEFTPAR list_of_s_expressions RIGHTPAR",
  243.     "s_expression : LEFTBRA list_of_s_expressions RIGHTBRA",
  244.     "s_expression : NAME",
  245.     "s_expression : NUMBER",
  246.     "s_expression : HEX_NUMBER",
  247.     "s_expression : STRING",
  248.     "s_expression : QUOTECHAR s_expression",
  249.     "s_expression : NON_CLOSED_STRING",
  250.     "s_expression : LEFTPAR list_of_s_expressions END_OF_FILE",
  251.     "s_expression : error",
  252.     "list_of_s_expressions : list_of_s_expressions s_expression",
  253.     "list_of_s_expressions : /* empty */",
  254. };
  255. #endif /* YYDEBUG */
  256. /*
  257.  * Copyright (c) 1993 by Sun Microsystems, Inc.
  258.  */
  259.  
  260. #pragma ident    "@(#)yaccpar    6.12    93/06/07 SMI"
  261.  
  262. /*
  263. ** Skeleton parser driver for yacc output
  264. */
  265.  
  266. /*
  267. ** yacc user known macros and defines
  268. */
  269. #define YYERROR        goto yyerrlab
  270. #define YYACCEPT    return(0)
  271. #define YYABORT        return(1)
  272. #define YYBACKUP( newtoken, newvalue )\
  273. {\
  274.     if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\
  275.     {\
  276.         yyerror( "syntax error - cannot backup" );\
  277.         goto yyerrlab;\
  278.     }\
  279.     yychar = newtoken;\
  280.     yystate = *yyps;\
  281.     yylval = newvalue;\
  282.     goto yynewstate;\
  283. }
  284. #define YYRECOVERING()    (!!yyerrflag)
  285. #define YYNEW(type)    malloc(sizeof(type) * yynewmax)
  286. #define YYCOPY(to, from, type) \
  287.     (type *) memcpy(to, (char *) from, yynewmax * sizeof(type))
  288. #define YYENLARGE( from, type) \
  289.     (type *) realloc((char *) from, yynewmax * sizeof(type))
  290. #ifndef YYDEBUG
  291. #    define YYDEBUG    1    /* make debugging available */
  292. #endif
  293.  
  294. /*
  295. ** user known globals
  296. */
  297. int yydebug;            /* set to 1 to get debugging */
  298.  
  299. /*
  300. ** driver internal defines
  301. */
  302. #define YYFLAG        (-10000000)
  303.  
  304. /*
  305. ** global variables used by the parser
  306. */
  307. YYSTYPE *yypv;            /* top of value stack */
  308. int *yyps;            /* top of state stack */
  309.  
  310. int yystate;            /* current state */
  311. int yytmp;            /* extra var (lasts between blocks) */
  312.  
  313. int yynerrs;            /* number of errors */
  314. int yyerrflag;            /* error recovery flag */
  315. int yychar;            /* current input token number */
  316.  
  317.  
  318.  
  319. #ifdef YYNMBCHARS
  320. #define YYLEX()        yycvtok(yylex())
  321. /*
  322. ** yycvtok - return a token if i is a wchar_t value that exceeds 255.
  323. **    If i<255, i itself is the token.  If i>255 but the neither 
  324. **    of the 30th or 31st bit is on, i is already a token.
  325. */
  326. #if defined(__STDC__) || defined(__cplusplus)
  327. int yycvtok(int i)
  328. #else
  329. int yycvtok(i) int i;
  330. #endif
  331. {
  332.     int first = 0;
  333.     int last = YYNMBCHARS - 1;
  334.     int mid;
  335.     wchar_t j;
  336.  
  337.     if(i&0x60000000){/*Must convert to a token. */
  338.         if( yymbchars[last].character < i ){
  339.             return i;/*Giving up*/
  340.         }
  341.         while ((last>=first)&&(first>=0)) {/*Binary search loop*/
  342.             mid = (first+last)/2;
  343.             j = yymbchars[mid].character;
  344.             if( j==i ){/*Found*/ 
  345.                 return yymbchars[mid].tvalue;
  346.             }else if( j<i ){
  347.                 first = mid + 1;
  348.             }else{
  349.                 last = mid -1;
  350.             }
  351.         }
  352.         /*No entry in the table.*/
  353.         return i;/* Giving up.*/
  354.     }else{/* i is already a token. */
  355.         return i;
  356.     }
  357. }
  358. #else/*!YYNMBCHARS*/
  359. #define YYLEX()        yylex()
  360. #endif/*!YYNMBCHARS*/
  361.  
  362. /*
  363. ** yyparse - return 0 if worked, 1 if syntax error not recovered from
  364. */
  365. #if defined(__STDC__) || defined(__cplusplus)
  366. int yyparse(void)
  367. #else
  368. int yyparse()
  369. #endif
  370. {
  371.     register YYSTYPE *yypvt;    /* top of value stack for $vars */
  372.  
  373. #if defined(__cplusplus) || defined(lint)
  374. /*
  375.     hacks to please C++ and lint - goto's inside switch should never be
  376.     executed; yypvt is set to 0 to avoid "used before set" warning.
  377. */
  378.     static int __yaccpar_lint_hack__ = 0;
  379.     switch (__yaccpar_lint_hack__)
  380.     {
  381.         case 1: goto yyerrlab;
  382.         case 2: goto yynewstate;
  383.     }
  384.     yypvt = 0;
  385. #endif
  386.  
  387.     /*
  388.     ** Initialize externals - yyparse may be called more than once
  389.     */
  390.     yypv = &yyv[-1];
  391.     yyps = &yys[-1];
  392.     yystate = 0;
  393.     yytmp = 0;
  394.     yynerrs = 0;
  395.     yyerrflag = 0;
  396.     yychar = -1;
  397.  
  398. #if YYMAXDEPTH <= 0
  399.     if (yymaxdepth <= 0)
  400.     {
  401.         if ((yymaxdepth = YYEXPAND(0)) <= 0)
  402.         {
  403.             yyerror("yacc initialization error");
  404.             YYABORT;
  405.         }
  406.     }
  407. #endif
  408.  
  409.     {
  410.         register YYSTYPE *yy_pv;    /* top of value stack */
  411.         register int *yy_ps;        /* top of state stack */
  412.         register int yy_state;        /* current state */
  413.         register int  yy_n;        /* internal state number info */
  414.     goto yystack;    /* moved from 6 lines above to here to please C++ */
  415.  
  416.         /*
  417.         ** get globals into registers.
  418.         ** branch to here only if YYBACKUP was called.
  419.         */
  420.     yynewstate:
  421.         yy_pv = yypv;
  422.         yy_ps = yyps;
  423.         yy_state = yystate;
  424.         goto yy_newstate;
  425.  
  426.         /*
  427.         ** get globals into registers.
  428.         ** either we just started, or we just finished a reduction
  429.         */
  430.     yystack:
  431.         yy_pv = yypv;
  432.         yy_ps = yyps;
  433.         yy_state = yystate;
  434.  
  435.         /*
  436.         ** top of for (;;) loop while no reductions done
  437.         */
  438.     yy_stack:
  439.         /*
  440.         ** put a state and value onto the stacks
  441.         */
  442. #if YYDEBUG
  443.         /*
  444.         ** if debugging, look up token value in list of value vs.
  445.         ** name pairs.  0 and negative (-1) are special values.
  446.         ** Note: linear search is used since time is not a real
  447.         ** consideration while debugging.
  448.         */
  449.         if ( yydebug )
  450.         {
  451.             register int yy_i;
  452.  
  453.             printf( "State %d, token ", yy_state );
  454.             if ( yychar == 0 )
  455.                 printf( "end-of-file\n" );
  456.             else if ( yychar < 0 )
  457.                 printf( "-none-\n" );
  458.             else
  459.             {
  460.                 for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
  461.                     yy_i++ )
  462.                 {
  463.                     if ( yytoks[yy_i].t_val == yychar )
  464.                         break;
  465.                 }
  466.                 printf( "%s\n", yytoks[yy_i].t_name );
  467.             }
  468.         }
  469. #endif /* YYDEBUG */
  470.         if ( ++yy_ps >= &yys[ yymaxdepth ] )    /* room on stack? */
  471.         {
  472.             /*
  473.             ** reallocate and recover.  Note that pointers
  474.             ** have to be reset, or bad things will happen
  475.             */
  476.             int yyps_index = (yy_ps - yys);
  477.             int yypv_index = (yy_pv - yyv);
  478.             int yypvt_index = (yypvt - yyv);
  479.             int yynewmax;
  480. #ifdef YYEXPAND
  481.             yynewmax = YYEXPAND(yymaxdepth);
  482. #else
  483.             yynewmax = 2 * yymaxdepth;    /* double table size */
  484.             if (yymaxdepth == YYMAXDEPTH)    /* first time growth */
  485.             {
  486.                 char *newyys = (char *)YYNEW(int);
  487.                 char *newyyv = (char *)YYNEW(YYSTYPE);
  488.                 if (newyys != 0 && newyyv != 0)
  489.                 {
  490.                     yys = YYCOPY(newyys, yys, int);
  491.                     yyv = YYCOPY(newyyv, yyv, YYSTYPE);
  492.                 }
  493.                 else
  494.                     yynewmax = 0;    /* failed */
  495.             }
  496.             else                /* not first time */
  497.             {
  498.                 yys = YYENLARGE(yys, int);
  499.                 yyv = YYENLARGE(yyv, YYSTYPE);
  500.                 if (yys == 0 || yyv == 0)
  501.                     yynewmax = 0;    /* failed */
  502.             }
  503. #endif
  504.             if (yynewmax <= yymaxdepth)    /* tables not expanded */
  505.             {
  506.                 yyerror( "yacc stack overflow" );
  507.                 YYABORT;
  508.             }
  509.             yymaxdepth = yynewmax;
  510.  
  511.             yy_ps = yys + yyps_index;
  512.             yy_pv = yyv + yypv_index;
  513.             yypvt = yyv + yypvt_index;
  514.         }
  515.         *yy_ps = yy_state;
  516.         *++yy_pv = yyval;
  517.  
  518.         /*
  519.         ** we have a new state - find out what to do
  520.         */
  521.     yy_newstate:
  522.         if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG )
  523.             goto yydefault;        /* simple state */
  524. #if YYDEBUG
  525.         /*
  526.         ** if debugging, need to mark whether new token grabbed
  527.         */
  528.         yytmp = yychar < 0;
  529. #endif
  530.         if ( ( yychar < 0 ) && ( ( yychar = YYLEX() ) < 0 ) )
  531.             yychar = 0;        /* reached EOF */
  532. #if YYDEBUG
  533.         if ( yydebug && yytmp )
  534.         {
  535.             register int yy_i;
  536.  
  537.             printf( "Received token " );
  538.             if ( yychar == 0 )
  539.                 printf( "end-of-file\n" );
  540.             else if ( yychar < 0 )
  541.                 printf( "-none-\n" );
  542.             else
  543.             {
  544.                 for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
  545.                     yy_i++ )
  546.                 {
  547.                     if ( yytoks[yy_i].t_val == yychar )
  548.                         break;
  549.                 }
  550.                 printf( "%s\n", yytoks[yy_i].t_name );
  551.             }
  552.         }
  553. #endif /* YYDEBUG */
  554.         if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) )
  555.             goto yydefault;
  556.         if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar )    /*valid shift*/
  557.         {
  558.             yychar = -1;
  559.             yyval = yylval;
  560.             yy_state = yy_n;
  561.             if ( yyerrflag > 0 )
  562.                 yyerrflag--;
  563.             goto yy_stack;
  564.         }
  565.  
  566.     yydefault:
  567.         if ( ( yy_n = yydef[ yy_state ] ) == -2 )
  568.         {
  569. #if YYDEBUG
  570.             yytmp = yychar < 0;
  571. #endif
  572.             if ( ( yychar < 0 ) && ( ( yychar = YYLEX() ) < 0 ) )
  573.                 yychar = 0;        /* reached EOF */
  574. #if YYDEBUG
  575.             if ( yydebug && yytmp )
  576.             {
  577.                 register int yy_i;
  578.  
  579.                 printf( "Received token " );
  580.                 if ( yychar == 0 )
  581.                     printf( "end-of-file\n" );
  582.                 else if ( yychar < 0 )
  583.                     printf( "-none-\n" );
  584.                 else
  585.                 {
  586.                     for ( yy_i = 0;
  587.                         yytoks[yy_i].t_val >= 0;
  588.                         yy_i++ )
  589.                     {
  590.                         if ( yytoks[yy_i].t_val
  591.                             == yychar )
  592.                         {
  593.                             break;
  594.                         }
  595.                     }
  596.                     printf( "%s\n", yytoks[yy_i].t_name );
  597.                 }
  598.             }
  599. #endif /* YYDEBUG */
  600.             /*
  601.             ** look through exception table
  602.             */
  603.             {
  604.                 register int *yyxi = yyexca;
  605.  
  606.                 while ( ( *yyxi != -1 ) ||
  607.                     ( yyxi[1] != yy_state ) )
  608.                 {
  609.                     yyxi += 2;
  610.                 }
  611.                 while ( ( *(yyxi += 2) >= 0 ) &&
  612.                     ( *yyxi != yychar ) )
  613.                     ;
  614.                 if ( ( yy_n = yyxi[1] ) < 0 )
  615.                     YYACCEPT;
  616.             }
  617.         }
  618.  
  619.         /*
  620.         ** check for syntax error
  621.         */
  622.         if ( yy_n == 0 )    /* have an error */
  623.         {
  624.             /* no worry about speed here! */
  625.             switch ( yyerrflag )
  626.             {
  627.             case 0:        /* new error */
  628.                 yyerror( "syntax error" );
  629.                 goto skip_init;
  630.             yyerrlab:
  631.                 /*
  632.                 ** get globals into registers.
  633.                 ** we have a user generated syntax type error
  634.                 */
  635.                 yy_pv = yypv;
  636.                 yy_ps = yyps;
  637.                 yy_state = yystate;
  638.             skip_init:
  639.                 yynerrs++;
  640.                 /* FALLTHRU */
  641.             case 1:
  642.             case 2:        /* incompletely recovered error */
  643.                     /* try again... */
  644.                 yyerrflag = 3;
  645.                 /*
  646.                 ** find state where "error" is a legal
  647.                 ** shift action
  648.                 */
  649.                 while ( yy_ps >= yys )
  650.                 {
  651.                     yy_n = yypact[ *yy_ps ] + YYERRCODE;
  652.                     if ( yy_n >= 0 && yy_n < YYLAST &&
  653.                         yychk[yyact[yy_n]] == YYERRCODE)                    {
  654.                         /*
  655.                         ** simulate shift of "error"
  656.                         */
  657.                         yy_state = yyact[ yy_n ];
  658.                         goto yy_stack;
  659.                     }
  660.                     /*
  661.                     ** current state has no shift on
  662.                     ** "error", pop stack
  663.                     */
  664. #if YYDEBUG
  665. #    define _POP_ "Error recovery pops state %d, uncovers state %d\n"
  666.                     if ( yydebug )
  667.                         printf( _POP_, *yy_ps,
  668.                             yy_ps[-1] );
  669. #    undef _POP_
  670. #endif
  671.                     yy_ps--;
  672.                     yy_pv--;
  673.                 }
  674.                 /*
  675.                 ** there is no state on stack with "error" as
  676.                 ** a valid shift.  give up.
  677.                 */
  678.                 YYABORT;
  679.             case 3:        /* no shift yet; eat a token */
  680. #if YYDEBUG
  681.                 /*
  682.                 ** if debugging, look up token in list of
  683.                 ** pairs.  0 and negative shouldn't occur,
  684.                 ** but since timing doesn't matter when
  685.                 ** debugging, it doesn't hurt to leave the
  686.                 ** tests here.
  687.                 */
  688.                 if ( yydebug )
  689.                 {
  690.                     register int yy_i;
  691.  
  692.                     printf( "Error recovery discards " );
  693.                     if ( yychar == 0 )
  694.                         printf( "token end-of-file\n" );
  695.                     else if ( yychar < 0 )
  696.                         printf( "token -none-\n" );
  697.                     else
  698.                     {
  699.                         for ( yy_i = 0;
  700.                             yytoks[yy_i].t_val >= 0;
  701.                             yy_i++ )
  702.                         {
  703.                             if ( yytoks[yy_i].t_val
  704.                                 == yychar )
  705.                             {
  706.                                 break;
  707.                             }
  708.                         }
  709.                         printf( "token %s\n",
  710.                             yytoks[yy_i].t_name );
  711.                     }
  712.                 }
  713. #endif /* YYDEBUG */
  714.                 if ( yychar == 0 )    /* reached EOF. quit */
  715.                     YYABORT;
  716.                 yychar = -1;
  717.                 goto yy_newstate;
  718.             }
  719.         }/* end if ( yy_n == 0 ) */
  720.         /*
  721.         ** reduction by production yy_n
  722.         ** put stack tops, etc. so things right after switch
  723.         */
  724. #if YYDEBUG
  725.         /*
  726.         ** if debugging, print the string that is the user's
  727.         ** specification of the reduction which is just about
  728.         ** to be done.
  729.         */
  730.         if ( yydebug )
  731.             printf( "Reduce by (%d) \"%s\"\n",
  732.                 yy_n, yyreds[ yy_n ] );
  733. #endif
  734.         yytmp = yy_n;            /* value to switch over */
  735.         yypvt = yy_pv;            /* $vars top of value stack */
  736.         /*
  737.         ** Look in goto table for next state
  738.         ** Sorry about using yy_state here as temporary
  739.         ** register variable, but why not, if it works...
  740.         ** If yyr2[ yy_n ] doesn't have the low order bit
  741.         ** set, then there is no action to be done for
  742.         ** this reduction.  So, no saving & unsaving of
  743.         ** registers done.  The only difference between the
  744.         ** code just after the if and the body of the if is
  745.         ** the goto yy_stack in the body.  This way the test
  746.         ** can be made before the choice of what to do is needed.
  747.         */
  748.         {
  749.             /* length of production doubled with extra bit */
  750.             register int yy_len = yyr2[ yy_n ];
  751.  
  752.             if ( !( yy_len & 01 ) )
  753.             {
  754.                 yy_len >>= 1;
  755.                 yyval = ( yy_pv -= yy_len )[1];    /* $$ = $1 */
  756.                 yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
  757.                     *( yy_ps -= yy_len ) + 1;
  758.                 if ( yy_state >= YYLAST ||
  759.                     yychk[ yy_state =
  760.                     yyact[ yy_state ] ] != -yy_n )
  761.                 {
  762.                     yy_state = yyact[ yypgo[ yy_n ] ];
  763.                 }
  764.                 goto yy_stack;
  765.             }
  766.             yy_len >>= 1;
  767.             yyval = ( yy_pv -= yy_len )[1];    /* $$ = $1 */
  768.             yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
  769.                 *( yy_ps -= yy_len ) + 1;
  770.             if ( yy_state >= YYLAST ||
  771.                 yychk[ yy_state = yyact[ yy_state ] ] != -yy_n )
  772.             {
  773.                 yy_state = yyact[ yypgo[ yy_n ] ];
  774.             }
  775.         }
  776.                     /* save until reenter driver code */
  777.         yystate = yy_state;
  778.         yyps = yy_ps;
  779.         yypv = yy_pv;
  780.     }
  781.     /*
  782.     ** code supplied by user is placed in this switch
  783.     */
  784.     switch( yytmp )
  785.     {
  786.         
  787. case 1:
  788. # line 48 "wool.yac"
  789. {yyval.wool_object = wool_read_expr = yypvt[-0].wool_object;
  790.              YYACCEPT;} break;
  791. case 2:
  792. # line 51 "wool.yac"
  793. {yyval.wool_object = wool_read_expr = yypvt[-0].wool_object;
  794.              YYACCEPT;} break;
  795. case 3:
  796. # line 54 "wool.yac"
  797. {yyval.wool_object = wool_read_expr = NULL;
  798.              YYACCEPT;} break;
  799. case 4:
  800. # line 59 "wool.yac"
  801. {yyval.wool_object = (WOOL_OBJECT) WLList_make(yypvt[-1].wool_collection);} break;
  802. case 5:
  803. # line 61 "wool.yac"
  804. {yyval.wool_object = WLCollection_progn(yypvt[-1].wool_collection);} break;
  805. case 6:
  806. # line 63 "wool.yac"
  807. {yyval.wool_object = (WOOL_OBJECT) wool_atom(yytext);} break;
  808. case 7:
  809. # line 65 "wool.yac"
  810. {yyval.wool_object = (WOOL_OBJECT) 
  811.                WLNumber_make((Num) atoi(yytext));} break;
  812. case 8:
  813. # line 68 "wool.yac"
  814. {int num;
  815.              sscanf(yytext+2,"%x",&num);
  816.              yyval.wool_object = (WOOL_OBJECT) WLNumber_make((Num) num);} break;
  817. case 9:
  818. # line 72 "wool.yac"
  819. {yyval.wool_object = (WOOL_OBJECT)
  820.                 WLString_make(strip_string(yytext));} break;
  821. case 10:
  822. # line 75 "wool.yac"
  823. {yyval.wool_object = (WOOL_OBJECT) WLQuotedExpr_make(yypvt[-0].wool_object);} break;
  824. case 11:
  825. # line 77 "wool.yac"
  826. {yyval.wool_object = NIL;
  827.             yyerror("Non closed string");} break;
  828. case 12:
  829. # line 80 "wool.yac"
  830. {yyval.wool_object = NIL;
  831.             yyerror("Lacking \")\" at the end of file!");} break;
  832. case 13:
  833. # line 83 "wool.yac"
  834. {yyval.wool_object = NIL;} break;
  835. case 14:
  836. # line 87 "wool.yac"
  837. {yyval.wool_collection = WLCollection_add(yypvt[-1].wool_collection, yypvt[-0].wool_object);} break;
  838. case 15:
  839. # line 89 "wool.yac"
  840. {yyval.wool_collection = WLCollection_make();} break;
  841.     }
  842.     goto yystack;        /* reset registers in driver code */
  843. }
  844.  
  845.