home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2002 April / pcpro0402.iso / essentials / graphics / Gimp / gimp-src-20001226.exe / src / gimp / unofficial-plug-ins / mathmap / parser.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-26  |  36.1 KB  |  1,176 lines

  1.  
  2. /*  A Bison parser, made from parser.y
  3.  by  GNU Bison version 1.25
  4.   */
  5.  
  6. #define YYBISON 1  /* Identify Bison output.  */
  7.  
  8. #define yyparse mmparse
  9. #define yylex mmlex
  10. #define yyerror mmerror
  11. #define yylval mmlval
  12. #define yychar mmchar
  13. #define yydebug mmdebug
  14. #define yynerrs mmnerrs
  15. #define    T_IDENT    258
  16. #define    T_STRING    259
  17. #define    T_INT    260
  18. #define    T_FLOAT    261
  19. #define    T_RANGE    262
  20. #define    T_IF    263
  21. #define    T_THEN    264
  22. #define    T_ELSE    265
  23. #define    T_END    266
  24. #define    T_WHILE    267
  25. #define    T_DO    268
  26. #define    T_OR    269
  27. #define    T_AND    270
  28. #define    T_EQUAL    271
  29. #define    T_LESSEQUAL    272
  30. #define    T_GREATEREQUAL    273
  31. #define    T_NOTEQUAL    274
  32. #define    UNARY    275
  33. #define    T_CONVERT    276
  34.  
  35. #line 25 "parser.y"
  36.  
  37. #include <stdio.h>
  38.  
  39. #include "mathmap.h"
  40. #include "exprtree.h"
  41. #include "builtins.h"
  42. #include "jump.h"
  43.  
  44. extern exprtree *theExprtree;
  45.  
  46. #line 36 "parser.y"
  47. typedef union {
  48.     ident ident;
  49.     exprtree *exprtree;
  50. } YYSTYPE;
  51. #include <stdio.h>
  52.  
  53. #ifndef __cplusplus
  54. #ifndef __STDC__
  55. #define const
  56. #endif
  57. #endif
  58.  
  59.  
  60.  
  61. #define    YYFINAL        104
  62. #define    YYFLAG        -32768
  63. #define    YYNTBASE    39
  64.  
  65. #define YYTRANSLATE(x) ((unsigned)(x) <= 276 ? yytranslate[x] : 47)
  66.  
  67. static const char yytranslate[] = {     0,
  68.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  69.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  70.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  71.      2,     2,    37,     2,     2,     2,    28,     2,     2,    35,
  72.     36,    26,    24,    38,    25,     2,    27,     2,     2,     2,
  73.      2,     2,     2,     2,     2,     2,     2,    31,    14,    19,
  74.     15,    20,     2,     2,     2,     2,     2,     2,     2,     2,
  75.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  76.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  77.     33,     2,    34,    29,     2,     2,     2,     2,     2,     2,
  78.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  79.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  80.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  81.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  82.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  83.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  84.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  85.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  86.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  87.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  88.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  89.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  90.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  91.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  92.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  93.      2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
  94.      6,     7,     8,     9,    10,    11,    12,    13,    16,    17,
  95.     18,    21,    22,    23,    30,    32
  96. };
  97.  
  98. #if YYDEBUG != 0
  99. static const short yyprhs[] = {     0,
  100.      0,     2,     4,     6,     8,    12,    17,    24,    28,    32,
  101.     36,    40,    44,    48,    52,    56,    60,    64,    68,    72,
  102.     76,    80,    84,    88,    91,    94,    98,   103,   108,   115,
  103.    119,   126,   130,   136,   144,   150,   156,   157,   159,   161,
  104.    165,   167,   171,   173,   177,   179,   182,   184
  105. };
  106.  
  107. static const short yyrhs[] = {    40,
  108.      0,     5,     0,     6,     0,     3,     0,    33,    42,    34,
  109.      0,     3,    33,    43,    34,     0,    35,    40,    36,    33,
  110.     43,    34,     0,     3,    31,    40,     0,     3,    32,    40,
  111.      0,    40,    24,    40,     0,    40,    25,    40,     0,    40,
  112.     26,    40,     0,    40,    27,    40,     0,    40,    28,    40,
  113.      0,    40,    29,    40,     0,    40,    18,    40,     0,    40,
  114.     19,    40,     0,    40,    20,    40,     0,    40,    21,    40,
  115.      0,    40,    22,    40,     0,    40,    23,    40,     0,    40,
  116.     16,    40,     0,    40,    17,    40,     0,    25,    40,     0,
  117.     37,    40,     0,    35,    40,    36,     0,     3,    35,    41,
  118.     36,     0,     3,    35,     4,    36,     0,     3,    35,     4,
  119.     38,    42,    36,     0,     3,    15,    40,     0,     3,    33,
  120.     43,    34,    15,    40,     0,    40,    14,    40,     0,     8,
  121.     40,     9,    40,    46,     0,     8,    40,     9,    40,    45,
  122.     40,    46,     0,    12,    40,    13,    40,    46,     0,    13,
  123.     40,    12,    40,    46,     0,     0,    42,     0,    40,     0,
  124.     42,    38,    40,     0,    44,     0,    43,    38,    44,     0,
  125.     40,     0,     5,     7,     5,     0,    10,     0,    14,    10,
  126.      0,    11,     0,    14,    11,     0
  127. };
  128.  
  129. #endif
  130.  
  131. #if YYDEBUG != 0
  132. static const short yyrline[] = { 0,
  133.     58,    61,    62,    63,    64,    65,    67,    68,    69,    70,
  134.     72,    74,    76,    78,    80,    82,    84,    86,    88,    91,
  135.     94,    97,    99,   101,   103,   105,   106,   108,   110,   112,
  136.    113,   115,   116,   118,   122,   124,   128,   129,   132,   133,
  137.    136,   137,   140,   141,   145,   146,   149,   150
  138. };
  139. #endif
  140.  
  141.  
  142. #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
  143.  
  144. static const char * const yytname[] = {   "$","error","$undefined.","T_IDENT",
  145. "T_STRING","T_INT","T_FLOAT","T_RANGE","T_IF","T_THEN","T_ELSE","T_END","T_WHILE",
  146. "T_DO","';'","'='","T_OR","T_AND","T_EQUAL","'<'","'>'","T_LESSEQUAL","T_GREATEREQUAL",
  147. "T_NOTEQUAL","'+'","'-'","'*'","'/'","'%'","'^'","UNARY","':'","T_CONVERT","'['",
  148. "']'","'('","')'","'!'","','","start","expr","arglist","exprlist","subscripts",
  149. "subscript","else","end", NULL
  150. };
  151. #endif
  152.  
  153. static const short yyr1[] = {     0,
  154.     39,    40,    40,    40,    40,    40,    40,    40,    40,    40,
  155.     40,    40,    40,    40,    40,    40,    40,    40,    40,    40,
  156.     40,    40,    40,    40,    40,    40,    40,    40,    40,    40,
  157.     40,    40,    40,    40,    40,    40,    41,    41,    42,    42,
  158.     43,    43,    44,    44,    45,    45,    46,    46
  159. };
  160.  
  161. static const short yyr2[] = {     0,
  162.      1,     1,     1,     1,     3,     4,     6,     3,     3,     3,
  163.      3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
  164.      3,     3,     3,     2,     2,     3,     4,     4,     6,     3,
  165.      6,     3,     5,     7,     5,     5,     0,     1,     1,     3,
  166.      1,     3,     1,     3,     1,     2,     1,     2
  167. };
  168.  
  169. static const short yydefact[] = {     0,
  170.      4,     2,     3,     0,     0,     0,     0,     0,     0,     0,
  171.      1,     0,     0,     0,     0,    37,     0,     0,     0,    24,
  172.     39,     0,     0,    25,     0,     0,     0,     0,     0,     0,
  173.      0,     0,     0,     0,     0,     0,     0,     0,     0,    30,
  174.      8,     9,     2,    43,     0,    41,     0,     0,    38,     0,
  175.      0,     0,     5,     0,    26,    32,    22,    23,    16,    17,
  176.     18,    19,    20,    21,    10,    11,    12,    13,    14,    15,
  177.      0,     6,     0,    28,     0,    27,     0,     0,     0,    40,
  178.      0,    44,     0,    42,     0,    45,    47,     0,     0,    33,
  179.      0,    35,    36,     0,    31,    29,    46,    48,     0,     7,
  180.     34,     0,     0,     0
  181. };
  182.  
  183. static const short yydefgoto[] = {   102,
  184.     21,    48,    22,    45,    46,    89,    90
  185. };
  186.  
  187. static const short yypact[] = {   107,
  188.      9,-32768,-32768,   107,   107,   107,   107,   107,   107,   107,
  189.    251,   107,   107,   107,   118,    74,   161,   235,   218,-32768,
  190.    251,    11,   140,-32768,   107,   107,   107,   107,   107,   107,
  191.    107,   107,   107,   107,   107,   107,   107,   107,   107,   265,
  192. -32768,-32768,     1,   251,    19,-32768,    10,   -25,   -16,   107,
  193.    107,   107,-32768,   107,    14,   265,   277,   277,    -8,    -8,
  194.     -8,    -8,    -8,    -8,   108,   108,    32,    32,    32,    32,
  195.     38,    48,   118,-32768,   107,-32768,   181,   200,   200,   251,
  196.    118,-32768,   107,-32768,    20,-32768,-32768,    59,   107,-32768,
  197.     92,-32768,-32768,    21,   265,-32768,-32768,-32768,   200,-32768,
  198. -32768,    66,    68,-32768
  199. };
  200.  
  201. static const short yypgoto[] = {-32768,
  202.      0,-32768,   -15,    -7,     2,-32768,   -76
  203. };
  204.  
  205.  
  206. #define    YYLAST        306
  207.  
  208.  
  209. static const short yytable[] = {    11,
  210.     49,    92,    93,    17,    18,    19,    20,    71,    23,    24,
  211.     76,    40,    41,    42,    44,    34,    35,    36,    37,    38,
  212.     39,    54,   101,    12,    56,    57,    58,    59,    60,    61,
  213.     62,    63,    64,    65,    66,    67,    68,    69,    70,    13,
  214.     14,    15,    82,    16,    53,    74,    81,    75,    54,    77,
  215.     78,    79,    72,    80,   100,    96,    73,    54,    73,    85,
  216.     39,     1,    83,     2,     3,   103,     4,   104,    97,    98,
  217.      5,     6,    44,    94,    84,     0,     1,    47,     2,     3,
  218.     44,     4,    95,     7,     0,     5,     6,    56,    99,     0,
  219.     56,     8,     0,     9,     1,    10,     2,     3,     7,     4,
  220.      0,     0,    98,     5,     6,     0,     8,     0,     9,     1,
  221.     10,     2,     3,     0,     4,     0,     7,     0,     5,     6,
  222.      1,     0,    43,     3,     8,     4,     9,     0,    10,     5,
  223.      6,     7,     0,    36,    37,    38,    39,     0,     0,     8,
  224.      0,     9,     7,    10,     0,     0,     0,     0,     0,     0,
  225.      8,     0,     9,    25,    10,    26,    27,    28,    29,    30,
  226.     31,    32,    33,    34,    35,    36,    37,    38,    39,    50,
  227.      0,     0,     0,     0,    25,    55,    26,    27,    28,    29,
  228.     30,    31,    32,    33,    34,    35,    36,    37,    38,    39,
  229.     86,    87,     0,     0,    88,     0,    26,    27,    28,    29,
  230.     30,    31,    32,    33,    34,    35,    36,    37,    38,    39,
  231.     87,     0,     0,    91,     0,    26,    27,    28,    29,    30,
  232.     31,    32,    33,    34,    35,    36,    37,    38,    39,    52,
  233.      0,    25,     0,    26,    27,    28,    29,    30,    31,    32,
  234.     33,    34,    35,    36,    37,    38,    39,    51,    25,     0,
  235.     26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
  236.     36,    37,    38,    39,    25,     0,    26,    27,    28,    29,
  237.     30,    31,    32,    33,    34,    35,    36,    37,    38,    39,
  238.     26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
  239.     36,    37,    38,    39,    28,    29,    30,    31,    32,    33,
  240.     34,    35,    36,    37,    38,    39
  241. };
  242.  
  243. static const short yycheck[] = {     0,
  244.     16,    78,    79,     4,     5,     6,     7,     7,     9,    10,
  245.     36,    12,    13,    14,    15,    24,    25,    26,    27,    28,
  246.     29,    38,    99,    15,    25,    26,    27,    28,    29,    30,
  247.     31,    32,    33,    34,    35,    36,    37,    38,    39,    31,
  248.     32,    33,     5,    35,    34,    36,    33,    38,    38,    50,
  249.     51,    52,    34,    54,    34,    36,    38,    38,    38,    75,
  250.     29,     3,    15,     5,     6,     0,     8,     0,    10,    11,
  251.     12,    13,    73,    81,    73,    -1,     3,     4,     5,     6,
  252.     81,     8,    83,    25,    -1,    12,    13,    88,    89,    -1,
  253.     91,    33,    -1,    35,     3,    37,     5,     6,    25,     8,
  254.     -1,    -1,    11,    12,    13,    -1,    33,    -1,    35,     3,
  255.     37,     5,     6,    -1,     8,    -1,    25,    -1,    12,    13,
  256.      3,    -1,     5,     6,    33,     8,    35,    -1,    37,    12,
  257.     13,    25,    -1,    26,    27,    28,    29,    -1,    -1,    33,
  258.     -1,    35,    25,    37,    -1,    -1,    -1,    -1,    -1,    -1,
  259.     33,    -1,    35,    14,    37,    16,    17,    18,    19,    20,
  260.     21,    22,    23,    24,    25,    26,    27,    28,    29,     9,
  261.     -1,    -1,    -1,    -1,    14,    36,    16,    17,    18,    19,
  262.     20,    21,    22,    23,    24,    25,    26,    27,    28,    29,
  263.     10,    11,    -1,    -1,    14,    -1,    16,    17,    18,    19,
  264.     20,    21,    22,    23,    24,    25,    26,    27,    28,    29,
  265.     11,    -1,    -1,    14,    -1,    16,    17,    18,    19,    20,
  266.     21,    22,    23,    24,    25,    26,    27,    28,    29,    12,
  267.     -1,    14,    -1,    16,    17,    18,    19,    20,    21,    22,
  268.     23,    24,    25,    26,    27,    28,    29,    13,    14,    -1,
  269.     16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
  270.     26,    27,    28,    29,    14,    -1,    16,    17,    18,    19,
  271.     20,    21,    22,    23,    24,    25,    26,    27,    28,    29,
  272.     16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
  273.     26,    27,    28,    29,    18,    19,    20,    21,    22,    23,
  274.     24,    25,    26,    27,    28,    29
  275. };
  276. /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
  277. #line 3 "/cygnus/cygwin-b20/share/bison.simple"
  278.  
  279. /* Skeleton output parser for bison,
  280.    Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
  281.  
  282.    This program is free software; you can redistribute it and/or modify
  283.    it under the terms of the GNU General Public License as published by
  284.    the Free Software Foundation; either version 2, or (at your option)
  285.    any later version.
  286.  
  287.    This program is distributed in the hope that it will be useful,
  288.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  289.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  290.    GNU General Public License for more details.
  291.  
  292.    You should have received a copy of the GNU General Public License
  293.    along with this program; if not, write to the Free Software
  294.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  295.  
  296. /* As a special exception, when this file is copied by Bison into a
  297.    Bison output file, you may use that output file without restriction.
  298.    This special exception was added by the Free Software Foundation
  299.    in version 1.24 of Bison.  */
  300.  
  301. #ifndef alloca
  302. #ifdef __GNUC__
  303. #define alloca __builtin_alloca
  304. #else /* not GNU C.  */
  305. #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
  306. #include <alloca.h>
  307. #else /* not sparc */
  308. #if defined (MSDOS) && !defined (__TURBOC__)
  309. #include <malloc.h>
  310. #else /* not MSDOS, or __TURBOC__ */
  311. #if defined(_AIX)
  312. #include <malloc.h>
  313.  #pragma alloca
  314. #else /* not MSDOS, __TURBOC__, or _AIX */
  315. #ifdef __hpux
  316. #ifdef __cplusplus
  317. extern "C" {
  318. void *alloca (unsigned int);
  319. };
  320. #else /* not __cplusplus */
  321. void *alloca ();
  322. #endif /* not __cplusplus */
  323. #endif /* __hpux */
  324. #endif /* not _AIX */
  325. #endif /* not MSDOS, or __TURBOC__ */
  326. #endif /* not sparc.  */
  327. #endif /* not GNU C.  */
  328. #endif /* alloca not defined.  */
  329.  
  330. /* This is the parser code that is written into each bison parser
  331.   when the %semantic_parser declaration is not specified in the grammar.
  332.   It was written by Richard Stallman by simplifying the hairy parser
  333.   used when %semantic_parser is specified.  */
  334.  
  335. /* Note: there must be only one dollar sign in this file.
  336.    It is replaced by the list of actions, each action
  337.    as one case of the switch.  */
  338.  
  339. #define yyerrok        (yyerrstatus = 0)
  340. #define yyclearin    (yychar = YYEMPTY)
  341. #define YYEMPTY        -2
  342. #define YYEOF        0
  343. #define YYACCEPT    return(0)
  344. #define YYABORT     return(1)
  345. #define YYERROR        goto yyerrlab1
  346. /* Like YYERROR except do call yyerror.
  347.    This remains here temporarily to ease the
  348.    transition to the new meaning of YYERROR, for GCC.
  349.    Once GCC version 2 has supplanted version 1, this can go.  */
  350. #define YYFAIL        goto yyerrlab
  351. #define YYRECOVERING()  (!!yyerrstatus)
  352. #define YYBACKUP(token, value) \
  353. do                                \
  354.   if (yychar == YYEMPTY && yylen == 1)                \
  355.     { yychar = (token), yylval = (value);            \
  356.       yychar1 = YYTRANSLATE (yychar);                \
  357.       YYPOPSTACK;                        \
  358.       goto yybackup;                        \
  359.     }                                \
  360.   else                                \
  361.     { yyerror ("syntax error: cannot back up"); YYERROR; }    \
  362. while (0)
  363.  
  364. #define YYTERROR    1
  365. #define YYERRCODE    256
  366.  
  367. #ifndef YYPURE
  368. #define YYLEX        yylex()
  369. #endif
  370.  
  371. #ifdef YYPURE
  372. #ifdef YYLSP_NEEDED
  373. #ifdef YYLEX_PARAM
  374. #define YYLEX        yylex(&yylval, &yylloc, YYLEX_PARAM)
  375. #else
  376. #define YYLEX        yylex(&yylval, &yylloc)
  377. #endif
  378. #else /* not YYLSP_NEEDED */
  379. #ifdef YYLEX_PARAM
  380. #define YYLEX        yylex(&yylval, YYLEX_PARAM)
  381. #else
  382. #define YYLEX        yylex(&yylval)
  383. #endif
  384. #endif /* not YYLSP_NEEDED */
  385. #endif
  386.  
  387. /* If nonreentrant, generate the variables here */
  388.  
  389. #ifndef YYPURE
  390.  
  391. int    yychar;            /*  the lookahead symbol        */
  392. YYSTYPE    yylval;            /*  the semantic value of the        */
  393.                 /*  lookahead symbol            */
  394.  
  395. #ifdef YYLSP_NEEDED
  396. YYLTYPE yylloc;            /*  location data for the lookahead    */
  397.                 /*  symbol                */
  398. #endif
  399.  
  400. int yynerrs;            /*  number of parse errors so far       */
  401. #endif  /* not YYPURE */
  402.  
  403. #if YYDEBUG != 0
  404. int yydebug;            /*  nonzero means print parse trace    */
  405. /* Since this is uninitialized, it does not stop multiple parsers
  406.    from coexisting.  */
  407. #endif
  408.  
  409. /*  YYINITDEPTH indicates the initial size of the parser's stacks    */
  410.  
  411. #ifndef    YYINITDEPTH
  412. #define YYINITDEPTH 200
  413. #endif
  414.  
  415. /*  YYMAXDEPTH is the maximum size the stacks can grow to
  416.     (effective only if the built-in stack extension method is used).  */
  417.  
  418. #if YYMAXDEPTH == 0
  419. #undef YYMAXDEPTH
  420. #endif
  421.  
  422. #ifndef YYMAXDEPTH
  423. #define YYMAXDEPTH 10000
  424. #endif
  425.  
  426. /* Prevent warning if -Wstrict-prototypes.  */
  427. #ifdef __GNUC__
  428. int yyparse (void);
  429. #endif
  430.  
  431. #if __GNUC__ > 1        /* GNU C and GNU C++ define this.  */
  432. #define __yy_memcpy(TO,FROM,COUNT)    __builtin_memcpy(TO,FROM,COUNT)
  433. #else                /* not GNU C or C++ */
  434. #ifndef __cplusplus
  435.  
  436. /* This is the most reliable way to avoid incompatibilities
  437.    in available built-in functions on various systems.  */
  438. static void
  439. __yy_memcpy (to, from, count)
  440.      char *to;
  441.      char *from;
  442.      int count;
  443. {
  444.   register char *f = from;
  445.   register char *t = to;
  446.   register int i = count;
  447.  
  448.   while (i-- > 0)
  449.     *t++ = *f++;
  450. }
  451.  
  452. #else /* __cplusplus */
  453.  
  454. /* This is the most reliable way to avoid incompatibilities
  455.    in available built-in functions on various systems.  */
  456. static void
  457. __yy_memcpy (char *to, char *from, int count)
  458. {
  459.   register char *f = from;
  460.   register char *t = to;
  461.   register int i = count;
  462.  
  463.   while (i-- > 0)
  464.     *t++ = *f++;
  465. }
  466.  
  467. #endif
  468. #endif
  469.  
  470. #line 196 "/cygnus/cygwin-b20/share/bison.simple"
  471.  
  472. /* The user can define YYPARSE_PARAM as the name of an argument to be passed
  473.    into yyparse.  The argument should have type void *.
  474.    It should actually point to an object.
  475.    Grammar actions can access the variable by casting it
  476.    to the proper pointer type.  */
  477.  
  478. #ifdef YYPARSE_PARAM
  479. #ifdef __cplusplus
  480. #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
  481. #define YYPARSE_PARAM_DECL
  482. #else /* not __cplusplus */
  483. #define YYPARSE_PARAM_ARG YYPARSE_PARAM
  484. #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
  485. #endif /* not __cplusplus */
  486. #else /* not YYPARSE_PARAM */
  487. #define YYPARSE_PARAM_ARG
  488. #define YYPARSE_PARAM_DECL
  489. #endif /* not YYPARSE_PARAM */
  490.  
  491. int
  492. yyparse(YYPARSE_PARAM_ARG)
  493.      YYPARSE_PARAM_DECL
  494. {
  495.   register int yystate;
  496.   register int yyn;
  497.   register short *yyssp;
  498.   register YYSTYPE *yyvsp;
  499.   int yyerrstatus;    /*  number of tokens to shift before error messages enabled */
  500.   int yychar1 = 0;        /*  lookahead token as an internal (translated) token number */
  501.  
  502.   short    yyssa[YYINITDEPTH];    /*  the state stack            */
  503.   YYSTYPE yyvsa[YYINITDEPTH];    /*  the semantic value stack        */
  504.  
  505.   short *yyss = yyssa;        /*  refer to the stacks thru separate pointers */
  506.   YYSTYPE *yyvs = yyvsa;    /*  to allow yyoverflow to reallocate them elsewhere */
  507.  
  508. #ifdef YYLSP_NEEDED
  509.   YYLTYPE yylsa[YYINITDEPTH];    /*  the location stack            */
  510.   YYLTYPE *yyls = yylsa;
  511.   YYLTYPE *yylsp;
  512.  
  513. #define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
  514. #else
  515. #define YYPOPSTACK   (yyvsp--, yyssp--)
  516. #endif
  517.  
  518.   int yystacksize = YYINITDEPTH;
  519.  
  520. #ifdef YYPURE
  521.   int yychar;
  522.   YYSTYPE yylval;
  523.   int yynerrs;
  524. #ifdef YYLSP_NEEDED
  525.   YYLTYPE yylloc;
  526. #endif
  527. #endif
  528.  
  529.   YYSTYPE yyval;        /*  the variable used to return        */
  530.                 /*  semantic values from the action    */
  531.                 /*  routines                */
  532.  
  533.   int yylen;
  534.  
  535. #if YYDEBUG != 0
  536.   if (yydebug)
  537.     fprintf(stderr, "Starting parse\n");
  538. #endif
  539.  
  540.   yystate = 0;
  541.   yyerrstatus = 0;
  542.   yynerrs = 0;
  543.   yychar = YYEMPTY;        /* Cause a token to be read.  */
  544.  
  545.   /* Initialize stack pointers.
  546.      Waste one element of value and location stack
  547.      so that they stay on the same level as the state stack.
  548.      The wasted elements are never initialized.  */
  549.  
  550.   yyssp = yyss - 1;
  551.   yyvsp = yyvs;
  552. #ifdef YYLSP_NEEDED
  553.   yylsp = yyls;
  554. #endif
  555.  
  556. /* Push a new state, which is found in  yystate  .  */
  557. /* In all cases, when you get here, the value and location stacks
  558.    have just been pushed. so pushing a state here evens the stacks.  */
  559. yynewstate:
  560.  
  561.   *++yyssp = yystate;
  562.  
  563.   if (yyssp >= yyss + yystacksize - 1)
  564.     {
  565.       /* Give user a chance to reallocate the stack */
  566.       /* Use copies of these so that the &'s don't force the real ones into memory. */
  567.       YYSTYPE *yyvs1 = yyvs;
  568.       short *yyss1 = yyss;
  569. #ifdef YYLSP_NEEDED
  570.       YYLTYPE *yyls1 = yyls;
  571. #endif
  572.  
  573.       /* Get the current used size of the three stacks, in elements.  */
  574.       int size = yyssp - yyss + 1;
  575.  
  576. #ifdef yyoverflow
  577.       /* Each stack pointer address is followed by the size of
  578.      the data in use in that stack, in bytes.  */
  579. #ifdef YYLSP_NEEDED
  580.       /* This used to be a conditional around just the two extra args,
  581.      but that might be undefined if yyoverflow is a macro.  */
  582.       yyoverflow("parser stack overflow",
  583.          &yyss1, size * sizeof (*yyssp),
  584.          &yyvs1, size * sizeof (*yyvsp),
  585.          &yyls1, size * sizeof (*yylsp),
  586.          &yystacksize);
  587. #else
  588.       yyoverflow("parser stack overflow",
  589.          &yyss1, size * sizeof (*yyssp),
  590.          &yyvs1, size * sizeof (*yyvsp),
  591.          &yystacksize);
  592. #endif
  593.  
  594.       yyss = yyss1; yyvs = yyvs1;
  595. #ifdef YYLSP_NEEDED
  596.       yyls = yyls1;
  597. #endif
  598. #else /* no yyoverflow */
  599.       /* Extend the stack our own way.  */
  600.       if (yystacksize >= YYMAXDEPTH)
  601.     {
  602.       yyerror("parser stack overflow");
  603.       return 2;
  604.     }
  605.       yystacksize *= 2;
  606.       if (yystacksize > YYMAXDEPTH)
  607.     yystacksize = YYMAXDEPTH;
  608.       yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
  609.       __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp));
  610.       yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
  611.       __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp));
  612. #ifdef YYLSP_NEEDED
  613.       yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
  614.       __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp));
  615. #endif
  616. #endif /* no yyoverflow */
  617.  
  618.       yyssp = yyss + size - 1;
  619.       yyvsp = yyvs + size - 1;
  620. #ifdef YYLSP_NEEDED
  621.       yylsp = yyls + size - 1;
  622. #endif
  623.  
  624. #if YYDEBUG != 0
  625.       if (yydebug)
  626.     fprintf(stderr, "Stack size increased to %d\n", yystacksize);
  627. #endif
  628.  
  629.       if (yyssp >= yyss + yystacksize - 1)
  630.     YYABORT;
  631.     }
  632.  
  633. #if YYDEBUG != 0
  634.   if (yydebug)
  635.     fprintf(stderr, "Entering state %d\n", yystate);
  636. #endif
  637.  
  638.   goto yybackup;
  639.  yybackup:
  640.  
  641. /* Do appropriate processing given the current state.  */
  642. /* Read a lookahead token if we need one and don't already have one.  */
  643. /* yyresume: */
  644.  
  645.   /* First try to decide what to do without reference to lookahead token.  */
  646.  
  647.   yyn = yypact[yystate];
  648.   if (yyn == YYFLAG)
  649.     goto yydefault;
  650.  
  651.   /* Not known => get a lookahead token if don't already have one.  */
  652.  
  653.   /* yychar is either YYEMPTY or YYEOF
  654.      or a valid token in external form.  */
  655.  
  656.   if (yychar == YYEMPTY)
  657.     {
  658. #if YYDEBUG != 0
  659.       if (yydebug)
  660.     fprintf(stderr, "Reading a token: ");
  661. #endif
  662.       yychar = YYLEX;
  663.     }
  664.  
  665.   /* Convert token to internal form (in yychar1) for indexing tables with */
  666.  
  667.   if (yychar <= 0)        /* This means end of input. */
  668.     {
  669.       yychar1 = 0;
  670.       yychar = YYEOF;        /* Don't call YYLEX any more */
  671.  
  672. #if YYDEBUG != 0
  673.       if (yydebug)
  674.     fprintf(stderr, "Now at end of input.\n");
  675. #endif
  676.     }
  677.   else
  678.     {
  679.       yychar1 = YYTRANSLATE(yychar);
  680.  
  681. #if YYDEBUG != 0
  682.       if (yydebug)
  683.     {
  684.       fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
  685.       /* Give the individual parser a way to print the precise meaning
  686.          of a token, for further debugging info.  */
  687. #ifdef YYPRINT
  688.       YYPRINT (stderr, yychar, yylval);
  689. #endif
  690.       fprintf (stderr, ")\n");
  691.     }
  692. #endif
  693.     }
  694.  
  695.   yyn += yychar1;
  696.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
  697.     goto yydefault;
  698.  
  699.   yyn = yytable[yyn];
  700.  
  701.   /* yyn is what to do for this token type in this state.
  702.      Negative => reduce, -yyn is rule number.
  703.      Positive => shift, yyn is new state.
  704.        New state is final state => don't bother to shift,
  705.        just return success.
  706.      0, or most negative number => error.  */
  707.  
  708.   if (yyn < 0)
  709.     {
  710.       if (yyn == YYFLAG)
  711.     goto yyerrlab;
  712.       yyn = -yyn;
  713.       goto yyreduce;
  714.     }
  715.   else if (yyn == 0)
  716.     goto yyerrlab;
  717.  
  718.   if (yyn == YYFINAL)
  719.     YYACCEPT;
  720.  
  721.   /* Shift the lookahead token.  */
  722.  
  723. #if YYDEBUG != 0
  724.   if (yydebug)
  725.     fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
  726. #endif
  727.  
  728.   /* Discard the token being shifted unless it is eof.  */
  729.   if (yychar != YYEOF)
  730.     yychar = YYEMPTY;
  731.  
  732.   *++yyvsp = yylval;
  733. #ifdef YYLSP_NEEDED
  734.   *++yylsp = yylloc;
  735. #endif
  736.  
  737.   /* count tokens shifted since error; after three, turn off error status.  */
  738.   if (yyerrstatus) yyerrstatus--;
  739.  
  740.   yystate = yyn;
  741.   goto yynewstate;
  742.  
  743. /* Do the default action for the current state.  */
  744. yydefault:
  745.  
  746.   yyn = yydefact[yystate];
  747.   if (yyn == 0)
  748.     goto yyerrlab;
  749.  
  750. /* Do a reduction.  yyn is the number of a rule to reduce with.  */
  751. yyreduce:
  752.   yylen = yyr2[yyn];
  753.   if (yylen > 0)
  754.     yyval = yyvsp[1-yylen]; /* implement default value of the action */
  755.  
  756. #if YYDEBUG != 0
  757.   if (yydebug)
  758.     {
  759.       int i;
  760.  
  761.       fprintf (stderr, "Reducing via rule %d (line %d), ",
  762.            yyn, yyrline[yyn]);
  763.  
  764.       /* Print the symbols being reduced, and their result.  */
  765.       for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
  766.     fprintf (stderr, "%s ", yytname[yyrhs[i]]);
  767.       fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
  768.     }
  769. #endif
  770.  
  771.  
  772.   switch (yyn) {
  773.  
  774. case 1:
  775. #line 58 "parser.y"
  776. { theExprtree = yyvsp[0].exprtree; ;
  777.     break;}
  778. case 2:
  779. #line 61 "parser.y"
  780. { yyval.exprtree = yyvsp[0].exprtree; ;
  781.     break;}
  782. case 3:
  783. #line 62 "parser.y"
  784. { yyval.exprtree = yyvsp[0].exprtree; ;
  785.     break;}
  786. case 4:
  787. #line 63 "parser.y"
  788. { yyval.exprtree = make_var(yyvsp[0].ident); ;
  789.     break;}
  790. case 5:
  791. #line 64 "parser.y"
  792. { yyval.exprtree = make_tuple(yyvsp[-1].exprtree); ;
  793.     break;}
  794. case 6:
  795. #line 66 "parser.y"
  796. { yyval.exprtree = make_select(make_var(yyvsp[-3].ident), make_tuple(yyvsp[-1].exprtree)); ;
  797.     break;}
  798. case 7:
  799. #line 67 "parser.y"
  800. { yyval.exprtree = make_select(yyvsp[-4].exprtree, make_tuple(yyvsp[-1].exprtree)); ;
  801.     break;}
  802. case 8:
  803. #line 68 "parser.y"
  804. { yyval.exprtree = make_cast(yyvsp[-2].ident, yyvsp[0].exprtree); ;
  805.     break;}
  806. case 9:
  807. #line 69 "parser.y"
  808. { yyval.exprtree = make_convert(yyvsp[-2].ident, yyvsp[0].exprtree); ;
  809.     break;}
  810. case 10:
  811. #line 70 "parser.y"
  812. { yyval.exprtree = make_function("__add",
  813.                                 exprlist_append(yyvsp[-2].exprtree, yyvsp[0].exprtree)); ;
  814.     break;}
  815. case 11:
  816. #line 72 "parser.y"
  817. { yyval.exprtree = make_function("__sub",
  818.                                 exprlist_append(yyvsp[-2].exprtree, yyvsp[0].exprtree)); ;
  819.     break;}
  820. case 12:
  821. #line 74 "parser.y"
  822. { yyval.exprtree = make_function("__mul",
  823.                                 exprlist_append(yyvsp[-2].exprtree, yyvsp[0].exprtree)); ;
  824.     break;}
  825. case 13:
  826. #line 76 "parser.y"
  827. { yyval.exprtree = make_function("__div",
  828.                                 exprlist_append(yyvsp[-2].exprtree, yyvsp[0].exprtree)); ;
  829.     break;}
  830. case 14:
  831. #line 78 "parser.y"
  832. { yyval.exprtree = make_function("__mod",
  833.                                 exprlist_append(yyvsp[-2].exprtree, yyvsp[0].exprtree)); ;
  834.     break;}
  835. case 15:
  836. #line 80 "parser.y"
  837. { yyval.exprtree = make_function("__pow",
  838.                                 exprlist_append(yyvsp[-2].exprtree, yyvsp[0].exprtree)); ;
  839.     break;}
  840. case 16:
  841. #line 82 "parser.y"
  842. { yyval.exprtree = make_function("__equal",
  843.                                 exprlist_append(yyvsp[-2].exprtree, yyvsp[0].exprtree)); ;
  844.     break;}
  845. case 17:
  846. #line 84 "parser.y"
  847. { yyval.exprtree = make_function("__less",
  848.                                 exprlist_append(yyvsp[-2].exprtree, yyvsp[0].exprtree)); ;
  849.     break;}
  850. case 18:
  851. #line 86 "parser.y"
  852. { yyval.exprtree = make_function("__greater",
  853.                                 exprlist_append(yyvsp[-2].exprtree, yyvsp[0].exprtree)); ;
  854.     break;}
  855. case 19:
  856. #line 89 "parser.y"
  857. { yyval.exprtree = make_function("__lessequal",
  858.                                 exprlist_append(yyvsp[-2].exprtree, yyvsp[0].exprtree)); ;
  859.     break;}
  860. case 20:
  861. #line 92 "parser.y"
  862. { yyval.exprtree = make_function("__greaterequal",
  863.                                 exprlist_append(yyvsp[-2].exprtree, yyvsp[0].exprtree)); ;
  864.     break;}
  865. case 21:
  866. #line 95 "parser.y"
  867. { yyval.exprtree = make_function("__notequal",
  868.                                 exprlist_append(yyvsp[-2].exprtree, yyvsp[0].exprtree)); ;
  869.     break;}
  870. case 22:
  871. #line 97 "parser.y"
  872. { yyval.exprtree = make_function("__or",
  873.                                 exprlist_append(yyvsp[-2].exprtree, yyvsp[0].exprtree)); ;
  874.     break;}
  875. case 23:
  876. #line 99 "parser.y"
  877. { yyval.exprtree = make_function("__and",
  878.                                 exprlist_append(yyvsp[-2].exprtree, yyvsp[0].exprtree)); ;
  879.     break;}
  880. case 24:
  881. #line 102 "parser.y"
  882. { yyval.exprtree = make_function("__neg", yyvsp[0].exprtree); ;
  883.     break;}
  884. case 25:
  885. #line 104 "parser.y"
  886. { yyval.exprtree = make_function("__not", yyvsp[0].exprtree); ;
  887.     break;}
  888. case 26:
  889. #line 105 "parser.y"
  890. { yyval.exprtree = yyvsp[-1].exprtree; ;
  891.     break;}
  892. case 27:
  893. #line 107 "parser.y"
  894. { yyval.exprtree = make_function(yyvsp[-3].ident, yyvsp[-1].exprtree); ;
  895.     break;}
  896. case 28:
  897. #line 109 "parser.y"
  898. { yyval.exprtree = make_userval(yyvsp[-3].ident, yyvsp[-1].ident, 0); ;
  899.     break;}
  900. case 29:
  901. #line 111 "parser.y"
  902. { yyval.exprtree = make_userval(yyvsp[-5].ident, yyvsp[-3].ident, yyvsp[-1].exprtree); ;
  903.     break;}
  904. case 30:
  905. #line 112 "parser.y"
  906. { yyval.exprtree = make_assignment(yyvsp[-2].ident, yyvsp[0].exprtree); ;
  907.     break;}
  908. case 31:
  909. #line 114 "parser.y"
  910. { yyval.exprtree = make_sub_assignment(yyvsp[-5].ident, make_tuple(yyvsp[-3].exprtree), yyvsp[0].exprtree); ;
  911.     break;}
  912. case 32:
  913. #line 115 "parser.y"
  914. { yyval.exprtree = make_sequence(yyvsp[-2].exprtree, yyvsp[0].exprtree); ;
  915.     break;}
  916. case 33:
  917. #line 117 "parser.y"
  918. { yyval.exprtree = make_if_then(yyvsp[-3].exprtree, yyvsp[-1].exprtree); ;
  919.     break;}
  920. case 34:
  921. #line 119 "parser.y"
  922. { yyval.exprtree = make_if_then_else(yyvsp[-5].exprtree,
  923.                                 yyvsp[-3].exprtree,
  924.                                 yyvsp[-1].exprtree); ;
  925.     break;}
  926. case 35:
  927. #line 123 "parser.y"
  928. { yyval.exprtree = make_while(yyvsp[-3].exprtree, yyvsp[-1].exprtree); ;
  929.     break;}
  930. case 36:
  931. #line 125 "parser.y"
  932. { yyval.exprtree = make_do_while(yyvsp[-3].exprtree, yyvsp[-1].exprtree); ;
  933.     break;}
  934. case 37:
  935. #line 128 "parser.y"
  936. { yyval.exprtree = 0; ;
  937.     break;}
  938. case 38:
  939. #line 129 "parser.y"
  940. { yyval.exprtree = yyvsp[0].exprtree; ;
  941.     break;}
  942. case 39:
  943. #line 132 "parser.y"
  944. { yyval.exprtree = yyvsp[0].exprtree; ;
  945.     break;}
  946. case 40:
  947. #line 133 "parser.y"
  948. { yyval.exprtree = exprlist_append(yyvsp[-2].exprtree, yyvsp[0].exprtree); ;
  949.     break;}
  950. case 41:
  951. #line 136 "parser.y"
  952. { yyval.exprtree = yyvsp[0].exprtree; ;
  953.     break;}
  954. case 42:
  955. #line 137 "parser.y"
  956. { yyval.exprtree = exprlist_append(yyvsp[-2].exprtree, yyvsp[0].exprtree); ;
  957.     break;}
  958. case 43:
  959. #line 140 "parser.y"
  960. { yyval.exprtree = yyvsp[0].exprtree; ;
  961.     break;}
  962. case 44:
  963. #line 141 "parser.y"
  964. { yyval.exprtree = make_range(yyvsp[-2].exprtree->val.tuple_const.data[1],
  965.                                                                yyvsp[0].exprtree->val.tuple_const.data[3]); ;
  966.     break;}
  967. }
  968.    /* the action file gets copied in in place of this dollarsign */
  969. #line 498 "/cygnus/cygwin-b20/share/bison.simple"
  970.  
  971.   yyvsp -= yylen;
  972.   yyssp -= yylen;
  973. #ifdef YYLSP_NEEDED
  974.   yylsp -= yylen;
  975. #endif
  976.  
  977. #if YYDEBUG != 0
  978.   if (yydebug)
  979.     {
  980.       short *ssp1 = yyss - 1;
  981.       fprintf (stderr, "state stack now");
  982.       while (ssp1 != yyssp)
  983.     fprintf (stderr, " %d", *++ssp1);
  984.       fprintf (stderr, "\n");
  985.     }
  986. #endif
  987.  
  988.   *++yyvsp = yyval;
  989.  
  990. #ifdef YYLSP_NEEDED
  991.   yylsp++;
  992.   if (yylen == 0)
  993.     {
  994.       yylsp->first_line = yylloc.first_line;
  995.       yylsp->first_column = yylloc.first_column;
  996.       yylsp->last_line = (yylsp-1)->last_line;
  997.       yylsp->last_column = (yylsp-1)->last_column;
  998.       yylsp->text = 0;
  999.     }
  1000.   else
  1001.     {
  1002.       yylsp->last_line = (yylsp+yylen-1)->last_line;
  1003.       yylsp->last_column = (yylsp+yylen-1)->last_column;
  1004.     }
  1005. #endif
  1006.  
  1007.   /* Now "shift" the result of the reduction.
  1008.      Determine what state that goes to,
  1009.      based on the state we popped back to
  1010.      and the rule number reduced by.  */
  1011.  
  1012.   yyn = yyr1[yyn];
  1013.  
  1014.   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
  1015.   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
  1016.     yystate = yytable[yystate];
  1017.   else
  1018.     yystate = yydefgoto[yyn - YYNTBASE];
  1019.  
  1020.   goto yynewstate;
  1021.  
  1022. yyerrlab:   /* here on detecting error */
  1023.  
  1024.   if (! yyerrstatus)
  1025.     /* If not already recovering from an error, report this error.  */
  1026.     {
  1027.       ++yynerrs;
  1028.  
  1029. #ifdef YYERROR_VERBOSE
  1030.       yyn = yypact[yystate];
  1031.  
  1032.       if (yyn > YYFLAG && yyn < YYLAST)
  1033.     {
  1034.       int size = 0;
  1035.       char *msg;
  1036.       int x, count;
  1037.  
  1038.       count = 0;
  1039.       /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
  1040.       for (x = (yyn < 0 ? -yyn : 0);
  1041.            x < (sizeof(yytname) / sizeof(char *)); x++)
  1042.         if (yycheck[x + yyn] == x)
  1043.           size += strlen(yytname[x]) + 15, count++;
  1044.       msg = (char *) malloc(size + 15);
  1045.       if (msg != 0)
  1046.         {
  1047.           strcpy(msg, "parse error");
  1048.  
  1049.           if (count < 5)
  1050.         {
  1051.           count = 0;
  1052.           for (x = (yyn < 0 ? -yyn : 0);
  1053.                x < (sizeof(yytname) / sizeof(char *)); x++)
  1054.             if (yycheck[x + yyn] == x)
  1055.               {
  1056.             strcat(msg, count == 0 ? ", expecting `" : " or `");
  1057.             strcat(msg, yytname[x]);
  1058.             strcat(msg, "'");
  1059.             count++;
  1060.               }
  1061.         }
  1062.           yyerror(msg);
  1063.           free(msg);
  1064.         }
  1065.       else
  1066.         yyerror ("parse error; also virtual memory exceeded");
  1067.     }
  1068.       else
  1069. #endif /* YYERROR_VERBOSE */
  1070.     yyerror("parse error");
  1071.     }
  1072.  
  1073.   goto yyerrlab1;
  1074. yyerrlab1:   /* here on error raised explicitly by an action */
  1075.  
  1076.   if (yyerrstatus == 3)
  1077.     {
  1078.       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
  1079.  
  1080.       /* return failure if at end of input */
  1081.       if (yychar == YYEOF)
  1082.     YYABORT;
  1083.  
  1084. #if YYDEBUG != 0
  1085.       if (yydebug)
  1086.     fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
  1087. #endif
  1088.  
  1089.       yychar = YYEMPTY;
  1090.     }
  1091.  
  1092.   /* Else will try to reuse lookahead token
  1093.      after shifting the error token.  */
  1094.  
  1095.   yyerrstatus = 3;        /* Each real token shifted decrements this */
  1096.  
  1097.   goto yyerrhandle;
  1098.  
  1099. yyerrdefault:  /* current state does not do anything special for the error token. */
  1100.  
  1101. #if 0
  1102.   /* This is wrong; only states that explicitly want error tokens
  1103.      should shift them.  */
  1104.   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
  1105.   if (yyn) goto yydefault;
  1106. #endif
  1107.  
  1108. yyerrpop:   /* pop the current state because it cannot handle the error token */
  1109.  
  1110.   if (yyssp == yyss) YYABORT;
  1111.   yyvsp--;
  1112.   yystate = *--yyssp;
  1113. #ifdef YYLSP_NEEDED
  1114.   yylsp--;
  1115. #endif
  1116.  
  1117. #if YYDEBUG != 0
  1118.   if (yydebug)
  1119.     {
  1120.       short *ssp1 = yyss - 1;
  1121.       fprintf (stderr, "Error: state stack now");
  1122.       while (ssp1 != yyssp)
  1123.     fprintf (stderr, " %d", *++ssp1);
  1124.       fprintf (stderr, "\n");
  1125.     }
  1126. #endif
  1127.  
  1128. yyerrhandle:
  1129.  
  1130.   yyn = yypact[yystate];
  1131.   if (yyn == YYFLAG)
  1132.     goto yyerrdefault;
  1133.  
  1134.   yyn += YYTERROR;
  1135.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
  1136.     goto yyerrdefault;
  1137.  
  1138.   yyn = yytable[yyn];
  1139.   if (yyn < 0)
  1140.     {
  1141.       if (yyn == YYFLAG)
  1142.     goto yyerrpop;
  1143.       yyn = -yyn;
  1144.       goto yyreduce;
  1145.     }
  1146.   else if (yyn == 0)
  1147.     goto yyerrpop;
  1148.  
  1149.   if (yyn == YYFINAL)
  1150.     YYACCEPT;
  1151.  
  1152. #if YYDEBUG != 0
  1153.   if (yydebug)
  1154.     fprintf(stderr, "Shifting error token, ");
  1155. #endif
  1156.  
  1157.   *++yyvsp = yylval;
  1158. #ifdef YYLSP_NEEDED
  1159.   *++yylsp = yylloc;
  1160. #endif
  1161.  
  1162.   yystate = yyn;
  1163.   goto yynewstate;
  1164. }
  1165. #line 153 "parser.y"
  1166.  
  1167.  
  1168. int
  1169. yyerror (char *s)
  1170. {
  1171.     sprintf(error_string, "Parse error.");
  1172.     JUMP(1);
  1173.  
  1174.     return 0;
  1175. }
  1176.