home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 9 / FreshFishVol9-CD2.bin / bbs / gnu / gdb-4.14-src.lha / gdb-4.14 / gdb / m2-exp.tab.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-04  |  63.2 KB  |  2,144 lines

  1.  
  2. /*  A Bison parser, made from ./m2-exp.y with Bison version GNU Bison version 1.22
  3.   */
  4.  
  5. #define YYBISON 1  /* Identify Bison output.  */
  6.  
  7. #define    INT    258
  8. #define    HEX    259
  9. #define    ERROR    260
  10. #define    UINT    261
  11. #define    M2_TRUE    262
  12. #define    M2_FALSE    263
  13. #define    CHAR    264
  14. #define    FLOAT    265
  15. #define    STRING    266
  16. #define    NAME    267
  17. #define    BLOCKNAME    268
  18. #define    IDENT    269
  19. #define    VARNAME    270
  20. #define    TYPENAME    271
  21. #define    SIZE    272
  22. #define    CAP    273
  23. #define    ORD    274
  24. #define    HIGH    275
  25. #define    ABS    276
  26. #define    MIN_FUNC    277
  27. #define    MAX_FUNC    278
  28. #define    FLOAT_FUNC    279
  29. #define    VAL    280
  30. #define    CHR    281
  31. #define    ODD    282
  32. #define    TRUNC    283
  33. #define    INC    284
  34. #define    DEC    285
  35. #define    INCL    286
  36. #define    EXCL    287
  37. #define    COLONCOLON    288
  38. #define    LAST    289
  39. #define    REGNAME    290
  40. #define    INTERNAL_VAR    291
  41. #define    ABOVE_COMMA    292
  42. #define    ASSIGN    293
  43. #define    LEQ    294
  44. #define    GEQ    295
  45. #define    NOTEQUAL    296
  46. #define    IN    297
  47. #define    OROR    298
  48. #define    LOGICAL_AND    299
  49. #define    DIV    300
  50. #define    MOD    301
  51. #define    UNARY    302
  52. #define    DOT    303
  53. #define    NOT    304
  54. #define    QID    305
  55.  
  56. #line 40 "./m2-exp.y"
  57.  
  58.  
  59. #include "defs.h"
  60. #include <string.h>
  61. #include "expression.h"
  62. #include "language.h"
  63. #include "value.h"
  64. #include "parser-defs.h"
  65. #include "m2-lang.h"
  66. #include "bfd.h" /* Required by objfiles.h.  */
  67. #include "symfile.h" /* Required by objfiles.h.  */
  68. #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
  69.  
  70. /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
  71.    as well as gratuitiously global symbol names, so we can have multiple
  72.    yacc generated parsers in gdb.  Note that these are only the variables
  73.    produced by yacc.  If other parser generators (bison, byacc, etc) produce
  74.    additional global names that conflict at link time, then those parser
  75.    generators need to be fixed instead of adding those names to this list. */
  76.  
  77. #define    yymaxdepth m2_maxdepth
  78. #define    yyparse    m2_parse
  79. #define    yylex    m2_lex
  80. #define    yyerror    m2_error
  81. #define    yylval    m2_lval
  82. #define    yychar    m2_char
  83. #define    yydebug    m2_debug
  84. #define    yypact    m2_pact
  85. #define    yyr1    m2_r1
  86. #define    yyr2    m2_r2
  87. #define    yydef    m2_def
  88. #define    yychk    m2_chk
  89. #define    yypgo    m2_pgo
  90. #define    yyact    m2_act
  91. #define    yyexca    m2_exca
  92. #define    yyerrflag m2_errflag
  93. #define    yynerrs    m2_nerrs
  94. #define    yyps    m2_ps
  95. #define    yypv    m2_pv
  96. #define    yys    m2_s
  97. #define    yy_yys    m2_yys
  98. #define    yystate    m2_state
  99. #define    yytmp    m2_tmp
  100. #define    yyv    m2_v
  101. #define    yy_yyv    m2_yyv
  102. #define    yyval    m2_val
  103. #define    yylloc    m2_lloc
  104. #define    yyreds    m2_reds        /* With YYDEBUG defined */
  105. #define    yytoks    m2_toks        /* With YYDEBUG defined */
  106.  
  107. #ifndef YYDEBUG
  108. #define    YYDEBUG    0        /* Default to no yydebug support */
  109. #endif
  110.  
  111. int
  112. yyparse PARAMS ((void));
  113.  
  114. static int
  115. yylex PARAMS ((void));
  116.  
  117. void
  118. yyerror PARAMS ((char *));
  119.  
  120. #if 0
  121. static char *
  122. make_qualname PARAMS ((char *, char *));
  123. #endif
  124.  
  125. static int
  126. parse_number PARAMS ((int));
  127.  
  128. /* The sign of the number being parsed. */
  129. static int number_sign = 1;
  130.  
  131. /* The block that the module specified by the qualifer on an identifer is
  132.    contained in, */
  133. #if 0
  134. static struct block *modblock=0;
  135. #endif
  136.  
  137.  
  138. #line 126 "./m2-exp.y"
  139. typedef union
  140.   {
  141.     LONGEST lval;
  142.     unsigned LONGEST ulval;
  143.     double dval;
  144.     struct symbol *sym;
  145.     struct type *tval;
  146.     struct stoken sval;
  147.     int voidval;
  148.     struct block *bval;
  149.     enum exp_opcode opcode;
  150.     struct internalvar *ivar;
  151.  
  152.     struct type **tvec;
  153.     int *ivec;
  154.   } YYSTYPE;
  155.  
  156. #ifndef YYLTYPE
  157. typedef
  158.   struct yyltype
  159.     {
  160.       int timestamp;
  161.       int first_line;
  162.       int first_column;
  163.       int last_line;
  164.       int last_column;
  165.       char *text;
  166.    }
  167.   yyltype;
  168.  
  169. #define YYLTYPE yyltype
  170. #endif
  171.  
  172. #include <stdio.h>
  173.  
  174. #ifndef __cplusplus
  175. #ifndef __STDC__
  176. #define const
  177. #endif
  178. #endif
  179.  
  180.  
  181.  
  182. #define    YYFINAL        183
  183. #define    YYFLAG        -32768
  184. #define    YYNTBASE    70
  185.  
  186. #define YYTRANSLATE(x) ((unsigned)(x) <= 305 ? yytranslate[x] : 84)
  187.  
  188. static const char yytranslate[] = {     0,
  189.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  190.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  191.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  192.      2,     2,     2,     2,    46,     2,     2,    50,     2,    62,
  193.     66,    54,    52,    37,    53,     2,    55,     2,     2,     2,
  194.      2,     2,     2,     2,     2,     2,     2,     2,     2,    40,
  195.     44,    41,     2,    51,     2,     2,     2,     2,     2,     2,
  196.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  197.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  198.     61,     2,    69,    59,     2,     2,     2,     2,     2,     2,
  199.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  200.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  201.      2,     2,    67,     2,    68,    64,     2,     2,     2,     2,
  202.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  203.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  204.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  205.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  206.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  207.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  208.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  209.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  210.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  211.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  212.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  213.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  214.      2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
  215.      6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
  216.     16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
  217.     26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
  218.     36,    38,    39,    42,    43,    45,    47,    48,    49,    56,
  219.     57,    58,    60,    63,    65
  220. };
  221.  
  222. #if YYDEBUG != 0
  223. static const short yyprhs[] = {     0,
  224.      0,     2,     4,     6,     9,    10,    14,    17,    20,    22,
  225.     24,    29,    34,    39,    44,    49,    54,    59,    66,    71,
  226.     76,    81,    84,    89,    96,   101,   108,   112,   114,   118,
  227.    125,   132,   136,   141,   142,   148,   149,   155,   156,   158,
  228.    162,   164,   168,   173,   178,   182,   186,   190,   194,   198,
  229.    202,   206,   210,   214,   218,   222,   226,   230,   234,   238,
  230.    242,   246,   250,   252,   254,   256,   258,   260,   262,   264,
  231.    266,   268,   273,   275,   277,   279,   283,   285,   287,   291,
  232.    293
  233. };
  234.  
  235. static const short yyrhs[] = {    72,
  236.      0,    71,     0,    83,     0,    72,    59,     0,     0,    53,
  237.     73,    72,     0,    52,    72,     0,    74,    72,     0,    63,
  238.      0,    64,     0,    18,    62,    72,    66,     0,    19,    62,
  239.     72,    66,     0,    21,    62,    72,    66,     0,    20,    62,
  240.     72,    66,     0,    22,    62,    83,    66,     0,    23,    62,
  241.     83,    66,     0,    24,    62,    72,    66,     0,    25,    62,
  242.     83,    37,    72,    66,     0,    26,    62,    72,    66,     0,
  243.     27,    62,    72,    66,     0,    28,    62,    72,    66,     0,
  244.     17,    72,     0,    29,    62,    72,    66,     0,    29,    62,
  245.     72,    37,    72,    66,     0,    30,    62,    72,    66,     0,
  246.     30,    62,    72,    37,    72,    66,     0,    72,    60,    12,
  247.      0,    75,     0,    72,    47,    75,     0,    31,    62,    72,
  248.     37,    72,    66,     0,    32,    62,    72,    37,    72,    66,
  249.      0,    67,    78,    68,     0,    83,    67,    78,    68,     0,
  250.      0,    72,    61,    76,    79,    69,     0,     0,    72,    62,
  251.     77,    78,    66,     0,     0,    72,     0,    78,    37,    72,
  252.      0,    72,     0,    79,    37,    72,     0,    67,    83,    68,
  253.     72,     0,    83,    62,    72,    66,     0,    62,    72,    66,
  254.      0,    72,    51,    72,     0,    72,    54,    72,     0,    72,
  255.     55,    72,     0,    72,    56,    72,     0,    72,    57,    72,
  256.      0,    72,    52,    72,     0,    72,    53,    72,     0,    72,
  257.     44,    72,     0,    72,    45,    72,     0,    72,    46,    72,
  258.      0,    72,    42,    72,     0,    72,    43,    72,     0,    72,
  259.     40,    72,     0,    72,    41,    72,     0,    72,    49,    72,
  260.      0,    72,    48,    72,     0,    72,    39,    72,     0,     7,
  261.      0,     8,     0,     3,     0,     6,     0,     9,     0,    10,
  262.      0,    82,     0,    34,     0,    35,     0,    17,    62,    83,
  263.     66,     0,    11,     0,    81,     0,    13,     0,    80,    33,
  264.     13,     0,    81,     0,    36,     0,    80,    33,    12,     0,
  265.     12,     0,    16,     0
  266. };
  267.  
  268. #endif
  269.  
  270. #if YYDEBUG != 0
  271. static const short yyrline[] = { 0,
  272.    197,   198,   201,   210,   213,   215,   220,   224,   228,   229,
  273.    232,   236,   240,   244,   248,   254,   260,   264,   270,   274,
  274.    278,   282,   287,   291,   297,   301,   307,   313,   316,   320,
  275.    324,   327,   329,   335,   340,   346,   350,   356,   359,   363,
  276.    368,   373,   378,   384,   390,   398,   402,   406,   410,   414,
  277.    418,   422,   426,   430,   432,   436,   440,   444,   448,   452,
  278.    456,   460,   467,   473,   479,   486,   495,   503,   510,   514,
  279.    520,   526,   533,   540,   544,   553,   565,   573,   580,   596,
  280.    647
  281. };
  282.  
  283. static const char * const yytname[] = {   "$","error","$illegal.","INT","HEX",
  284. "ERROR","UINT","M2_TRUE","M2_FALSE","CHAR","FLOAT","STRING","NAME","BLOCKNAME",
  285. "IDENT","VARNAME","TYPENAME","SIZE","CAP","ORD","HIGH","ABS","MIN_FUNC","MAX_FUNC",
  286. "FLOAT_FUNC","VAL","CHR","ODD","TRUNC","INC","DEC","INCL","EXCL","COLONCOLON",
  287. "LAST","REGNAME","INTERNAL_VAR","','","ABOVE_COMMA","ASSIGN","'<'","'>'","LEQ",
  288. "GEQ","'='","NOTEQUAL","'#'","IN","OROR","LOGICAL_AND","'&'","'@'","'+'","'-'",
  289. "'*'","'/'","DIV","MOD","UNARY","'^'","DOT","'['","'('","NOT","'~'","QID","')'",
  290. "'{'","'}'","']'","start","type_exp","exp","@1","not_exp","set","@2","@3","arglist",
  291. "non_empty_arglist","block","fblock","variable","type",""
  292. };
  293. #endif
  294.  
  295. static const short yyr1[] = {     0,
  296.     70,    70,    71,    72,    73,    72,    72,    72,    74,    74,
  297.     72,    72,    72,    72,    72,    72,    72,    72,    72,    72,
  298.     72,    72,    72,    72,    72,    72,    72,    72,    72,    72,
  299.     72,    75,    75,    76,    72,    77,    72,    78,    78,    78,
  300.     79,    79,    72,    72,    72,    72,    72,    72,    72,    72,
  301.     72,    72,    72,    72,    72,    72,    72,    72,    72,    72,
  302.     72,    72,    72,    72,    72,    72,    72,    72,    72,    72,
  303.     72,    72,    72,    80,    81,    81,    82,    82,    82,    82,
  304.     83
  305. };
  306.  
  307. static const short yyr2[] = {     0,
  308.      1,     1,     1,     2,     0,     3,     2,     2,     1,     1,
  309.      4,     4,     4,     4,     4,     4,     4,     6,     4,     4,
  310.      4,     2,     4,     6,     4,     6,     3,     1,     3,     6,
  311.      6,     3,     4,     0,     5,     0,     5,     0,     1,     3,
  312.      1,     3,     4,     4,     3,     3,     3,     3,     3,     3,
  313.      3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
  314.      3,     3,     1,     1,     1,     1,     1,     1,     1,     1,
  315.      1,     4,     1,     1,     1,     3,     1,     1,     3,     1,
  316.      1
  317. };
  318.  
  319. static const short yydefact[] = {     0,
  320.     65,    66,    63,    64,    67,    68,    73,    80,    75,    81,
  321.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  322.      0,     0,     0,     0,     0,     0,    70,    71,    78,     0,
  323.      5,     0,     9,    10,    38,     2,     1,     0,    28,     0,
  324.     77,    69,     3,     0,    22,     0,     0,     0,     0,     0,
  325.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  326.      0,     7,     0,     0,    39,     0,     0,     0,     0,     0,
  327.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  328.      0,     0,     0,     0,     0,     4,     0,    34,    36,     8,
  329.      0,     0,    38,     0,     0,     0,     0,     0,     0,     0,
  330.      0,     0,     0,     0,     0,     0,     0,     0,     0,     6,
  331.     45,     0,    32,     0,    62,    58,    59,    56,    57,    53,
  332.     54,    55,    38,    29,     0,    61,    60,    46,    51,    52,
  333.     47,    48,    49,    50,    27,     0,    38,    79,    76,     0,
  334.      0,    72,    11,    12,    14,    13,    15,    16,    17,     0,
  335.     19,    20,    21,     0,    23,     0,    25,     0,     0,    40,
  336.     43,    41,     0,     0,    44,    33,     0,     0,     0,     0,
  337.      0,     0,    35,    37,    18,    24,    26,    30,    31,    42,
  338.      0,     0,     0
  339. };
  340.  
  341. static const short yydefgoto[] = {   181,
  342.     36,    65,    63,    38,    39,   136,   137,    66,   163,    40,
  343.     41,    42,    46
  344. };
  345.  
  346. static const short yypact[] = {   157,
  347. -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  348.    219,   -35,   -28,   -19,   -17,    -8,     2,     3,     4,     5,
  349.     14,    25,    26,    28,    29,    34,-32768,-32768,-32768,   157,
  350. -32768,   157,-32768,-32768,   157,-32768,   774,   157,-32768,    -4,
  351.     65,-32768,   -36,   157,   -20,   -36,   157,   157,   157,   157,
  352.     12,    12,   157,    12,   157,   157,   157,   157,   157,   157,
  353.    157,   -20,   157,   304,   774,   -32,   -43,   157,   157,   157,
  354.    157,   157,   157,   157,   157,   -15,   157,   157,   157,   157,
  355.    157,   157,   157,   157,   157,-32768,    50,-32768,-32768,   -20,
  356.     -5,   157,   157,    27,   332,   360,   388,   416,    31,    33,
  357.    444,    63,   472,   500,   528,   248,   276,   724,   750,   -20,
  358. -32768,   157,-32768,   157,   798,   -39,   -39,   -39,   -39,   -39,
  359.    -39,   -39,   157,-32768,    37,    64,    78,   142,    87,    87,
  360.    -20,   -20,   -20,   -20,-32768,   157,   157,-32768,-32768,   556,
  361.    -31,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   157,
  362. -32768,-32768,-32768,   157,-32768,   157,-32768,   157,   157,   774,
  363.    -20,   774,   -34,   -33,-32768,-32768,   584,   612,   640,   668,
  364.    696,   157,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   774,
  365.    101,   106,-32768
  366. };
  367.  
  368. static const short yypgoto[] = {-32768,
  369. -32768,     0,-32768,-32768,    32,-32768,-32768,   -91,-32768,-32768,
  370. -32768,-32768,    51
  371. };
  372.  
  373.  
  374. #define    YYLAST        860
  375.  
  376.  
  377. static const short yytable[] = {    37,
  378.     10,   141,   172,   112,   112,   112,   138,   139,    77,    78,
  379.     45,    79,    80,    81,    82,    83,    84,    85,    92,    86,
  380.     87,    88,    89,    93,   114,    92,    47,    10,    91,    62,
  381.     93,    64,   174,    48,   173,   113,   166,    90,    86,    87,
  382.     88,    89,    49,    64,    50,   164,    95,    96,    97,    98,
  383.     43,   123,   101,    51,   103,   104,   105,   106,   107,   108,
  384.    109,   135,   110,    52,    53,    54,    55,   115,   116,   117,
  385.    118,   119,   120,   121,   122,    56,   126,   127,   128,   129,
  386.    130,   131,   132,   133,   134,    67,    57,    58,    92,    59,
  387.     60,   140,   142,    93,    94,    61,   147,   -74,   148,   150,
  388.    182,    99,   100,    93,   102,   183,     0,   124,     0,     0,
  389.      0,   160,    78,   161,    79,    80,    81,    82,    83,    84,
  390.     85,     0,    86,    87,    88,    89,   125,     0,    79,    80,
  391.     81,    82,    83,    84,    85,   162,    86,    87,    88,    89,
  392.     82,    83,    84,    85,     0,    86,    87,    88,    89,   167,
  393.      0,     0,     0,   168,     0,   169,     0,   170,   171,     1,
  394.      0,     0,     2,     3,     4,     5,     6,     7,     8,     9,
  395.      0,   180,    10,    11,    12,    13,    14,    15,    16,    17,
  396.     18,    19,    20,    21,    22,    23,    24,    25,    26,     0,
  397.     27,    28,    29,    80,    81,    82,    83,    84,    85,     0,
  398.     86,    87,    88,    89,     0,     0,     0,     0,    30,    31,
  399.      0,     0,     0,     0,     0,     0,     0,     0,    32,    33,
  400.     34,     1,     0,    35,     2,     3,     4,     5,     6,     7,
  401.      8,     9,     0,     0,    10,    11,    12,    13,    14,    15,
  402.     16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
  403.     26,     0,    27,    28,    29,     0,     0,     0,     0,     0,
  404.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  405.     30,    31,     0,     0,     0,     0,     0,     0,     0,     0,
  406.     44,    33,    34,     0,   154,    35,    68,    69,    70,    71,
  407.     72,    73,    74,    75,    76,    77,    78,     0,    79,    80,
  408.     81,    82,    83,    84,    85,     0,    86,    87,    88,    89,
  409.      0,     0,   156,   155,    68,    69,    70,    71,    72,    73,
  410.     74,    75,    76,    77,    78,     0,    79,    80,    81,    82,
  411.     83,    84,    85,     0,    86,    87,    88,    89,     0,     0,
  412.      0,   157,    68,    69,    70,    71,    72,    73,    74,    75,
  413.     76,    77,    78,     0,    79,    80,    81,    82,    83,    84,
  414.     85,     0,    86,    87,    88,    89,     0,     0,     0,   111,
  415.     68,    69,    70,    71,    72,    73,    74,    75,    76,    77,
  416.     78,     0,    79,    80,    81,    82,    83,    84,    85,     0,
  417.     86,    87,    88,    89,     0,     0,     0,   143,    68,    69,
  418.     70,    71,    72,    73,    74,    75,    76,    77,    78,     0,
  419.     79,    80,    81,    82,    83,    84,    85,     0,    86,    87,
  420.     88,    89,     0,     0,     0,   144,    68,    69,    70,    71,
  421.     72,    73,    74,    75,    76,    77,    78,     0,    79,    80,
  422.     81,    82,    83,    84,    85,     0,    86,    87,    88,    89,
  423.      0,     0,     0,   145,    68,    69,    70,    71,    72,    73,
  424.     74,    75,    76,    77,    78,     0,    79,    80,    81,    82,
  425.     83,    84,    85,     0,    86,    87,    88,    89,     0,     0,
  426.      0,   146,    68,    69,    70,    71,    72,    73,    74,    75,
  427.     76,    77,    78,     0,    79,    80,    81,    82,    83,    84,
  428.     85,     0,    86,    87,    88,    89,     0,     0,     0,   149,
  429.     68,    69,    70,    71,    72,    73,    74,    75,    76,    77,
  430.     78,     0,    79,    80,    81,    82,    83,    84,    85,     0,
  431.     86,    87,    88,    89,     0,     0,     0,   151,    68,    69,
  432.     70,    71,    72,    73,    74,    75,    76,    77,    78,     0,
  433.     79,    80,    81,    82,    83,    84,    85,     0,    86,    87,
  434.     88,    89,     0,     0,     0,   152,    68,    69,    70,    71,
  435.     72,    73,    74,    75,    76,    77,    78,     0,    79,    80,
  436.     81,    82,    83,    84,    85,     0,    86,    87,    88,    89,
  437.      0,     0,     0,   153,    68,    69,    70,    71,    72,    73,
  438.     74,    75,    76,    77,    78,     0,    79,    80,    81,    82,
  439.     83,    84,    85,     0,    86,    87,    88,    89,     0,     0,
  440.      0,   165,    68,    69,    70,    71,    72,    73,    74,    75,
  441.     76,    77,    78,     0,    79,    80,    81,    82,    83,    84,
  442.     85,     0,    86,    87,    88,    89,     0,     0,     0,   175,
  443.     68,    69,    70,    71,    72,    73,    74,    75,    76,    77,
  444.     78,     0,    79,    80,    81,    82,    83,    84,    85,     0,
  445.     86,    87,    88,    89,     0,     0,     0,   176,    68,    69,
  446.     70,    71,    72,    73,    74,    75,    76,    77,    78,     0,
  447.     79,    80,    81,    82,    83,    84,    85,     0,    86,    87,
  448.     88,    89,     0,     0,     0,   177,    68,    69,    70,    71,
  449.     72,    73,    74,    75,    76,    77,    78,     0,    79,    80,
  450.     81,    82,    83,    84,    85,     0,    86,    87,    88,    89,
  451.      0,     0,     0,   178,    68,    69,    70,    71,    72,    73,
  452.     74,    75,    76,    77,    78,     0,    79,    80,    81,    82,
  453.     83,    84,    85,     0,    86,    87,    88,    89,     0,     0,
  454.    158,   179,    68,    69,    70,    71,    72,    73,    74,    75,
  455.     76,    77,    78,     0,    79,    80,    81,    82,    83,    84,
  456.     85,     0,    86,    87,    88,    89,   159,     0,    68,    69,
  457.     70,    71,    72,    73,    74,    75,    76,    77,    78,     0,
  458.     79,    80,    81,    82,    83,    84,    85,     0,    86,    87,
  459.     88,    89,    68,    69,    70,    71,    72,    73,    74,    75,
  460.     76,    77,    78,     0,    79,    80,    81,    82,    83,    84,
  461.     85,     0,    86,    87,    88,    89,-32768,    69,    70,    71,
  462.     72,    73,    74,    75,    76,    77,    78,     0,    79,    80,
  463.     81,    82,    83,    84,    85,     0,    86,    87,    88,    89
  464. };
  465.  
  466. static const short yycheck[] = {     0,
  467.     16,    93,    37,    37,    37,    37,    12,    13,    48,    49,
  468.     11,    51,    52,    53,    54,    55,    56,    57,    62,    59,
  469.     60,    61,    62,    67,    68,    62,    62,    16,    33,    30,
  470.     67,    32,    66,    62,    69,    68,    68,    38,    59,    60,
  471.     61,    62,    62,    44,    62,   137,    47,    48,    49,    50,
  472.      0,    67,    53,    62,    55,    56,    57,    58,    59,    60,
  473.     61,    12,    63,    62,    62,    62,    62,    68,    69,    70,
  474.     71,    72,    73,    74,    75,    62,    77,    78,    79,    80,
  475.     81,    82,    83,    84,    85,    35,    62,    62,    62,    62,
  476.     62,    92,    66,    67,    44,    62,    66,    33,    66,    37,
  477.      0,    51,    52,    67,    54,     0,    -1,    76,    -1,    -1,
  478.     -1,   112,    49,   114,    51,    52,    53,    54,    55,    56,
  479.     57,    -1,    59,    60,    61,    62,    76,    -1,    51,    52,
  480.     53,    54,    55,    56,    57,   136,    59,    60,    61,    62,
  481.     54,    55,    56,    57,    -1,    59,    60,    61,    62,   150,
  482.     -1,    -1,    -1,   154,    -1,   156,    -1,   158,   159,     3,
  483.     -1,    -1,     6,     7,     8,     9,    10,    11,    12,    13,
  484.     -1,   172,    16,    17,    18,    19,    20,    21,    22,    23,
  485.     24,    25,    26,    27,    28,    29,    30,    31,    32,    -1,
  486.     34,    35,    36,    52,    53,    54,    55,    56,    57,    -1,
  487.     59,    60,    61,    62,    -1,    -1,    -1,    -1,    52,    53,
  488.     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    62,    63,
  489.     64,     3,    -1,    67,     6,     7,     8,     9,    10,    11,
  490.     12,    13,    -1,    -1,    16,    17,    18,    19,    20,    21,
  491.     22,    23,    24,    25,    26,    27,    28,    29,    30,    31,
  492.     32,    -1,    34,    35,    36,    -1,    -1,    -1,    -1,    -1,
  493.     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
  494.     52,    53,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
  495.     62,    63,    64,    -1,    37,    67,    39,    40,    41,    42,
  496.     43,    44,    45,    46,    47,    48,    49,    -1,    51,    52,
  497.     53,    54,    55,    56,    57,    -1,    59,    60,    61,    62,
  498.     -1,    -1,    37,    66,    39,    40,    41,    42,    43,    44,
  499.     45,    46,    47,    48,    49,    -1,    51,    52,    53,    54,
  500.     55,    56,    57,    -1,    59,    60,    61,    62,    -1,    -1,
  501.     -1,    66,    39,    40,    41,    42,    43,    44,    45,    46,
  502.     47,    48,    49,    -1,    51,    52,    53,    54,    55,    56,
  503.     57,    -1,    59,    60,    61,    62,    -1,    -1,    -1,    66,
  504.     39,    40,    41,    42,    43,    44,    45,    46,    47,    48,
  505.     49,    -1,    51,    52,    53,    54,    55,    56,    57,    -1,
  506.     59,    60,    61,    62,    -1,    -1,    -1,    66,    39,    40,
  507.     41,    42,    43,    44,    45,    46,    47,    48,    49,    -1,
  508.     51,    52,    53,    54,    55,    56,    57,    -1,    59,    60,
  509.     61,    62,    -1,    -1,    -1,    66,    39,    40,    41,    42,
  510.     43,    44,    45,    46,    47,    48,    49,    -1,    51,    52,
  511.     53,    54,    55,    56,    57,    -1,    59,    60,    61,    62,
  512.     -1,    -1,    -1,    66,    39,    40,    41,    42,    43,    44,
  513.     45,    46,    47,    48,    49,    -1,    51,    52,    53,    54,
  514.     55,    56,    57,    -1,    59,    60,    61,    62,    -1,    -1,
  515.     -1,    66,    39,    40,    41,    42,    43,    44,    45,    46,
  516.     47,    48,    49,    -1,    51,    52,    53,    54,    55,    56,
  517.     57,    -1,    59,    60,    61,    62,    -1,    -1,    -1,    66,
  518.     39,    40,    41,    42,    43,    44,    45,    46,    47,    48,
  519.     49,    -1,    51,    52,    53,    54,    55,    56,    57,    -1,
  520.     59,    60,    61,    62,    -1,    -1,    -1,    66,    39,    40,
  521.     41,    42,    43,    44,    45,    46,    47,    48,    49,    -1,
  522.     51,    52,    53,    54,    55,    56,    57,    -1,    59,    60,
  523.     61,    62,    -1,    -1,    -1,    66,    39,    40,    41,    42,
  524.     43,    44,    45,    46,    47,    48,    49,    -1,    51,    52,
  525.     53,    54,    55,    56,    57,    -1,    59,    60,    61,    62,
  526.     -1,    -1,    -1,    66,    39,    40,    41,    42,    43,    44,
  527.     45,    46,    47,    48,    49,    -1,    51,    52,    53,    54,
  528.     55,    56,    57,    -1,    59,    60,    61,    62,    -1,    -1,
  529.     -1,    66,    39,    40,    41,    42,    43,    44,    45,    46,
  530.     47,    48,    49,    -1,    51,    52,    53,    54,    55,    56,
  531.     57,    -1,    59,    60,    61,    62,    -1,    -1,    -1,    66,
  532.     39,    40,    41,    42,    43,    44,    45,    46,    47,    48,
  533.     49,    -1,    51,    52,    53,    54,    55,    56,    57,    -1,
  534.     59,    60,    61,    62,    -1,    -1,    -1,    66,    39,    40,
  535.     41,    42,    43,    44,    45,    46,    47,    48,    49,    -1,
  536.     51,    52,    53,    54,    55,    56,    57,    -1,    59,    60,
  537.     61,    62,    -1,    -1,    -1,    66,    39,    40,    41,    42,
  538.     43,    44,    45,    46,    47,    48,    49,    -1,    51,    52,
  539.     53,    54,    55,    56,    57,    -1,    59,    60,    61,    62,
  540.     -1,    -1,    -1,    66,    39,    40,    41,    42,    43,    44,
  541.     45,    46,    47,    48,    49,    -1,    51,    52,    53,    54,
  542.     55,    56,    57,    -1,    59,    60,    61,    62,    -1,    -1,
  543.     37,    66,    39,    40,    41,    42,    43,    44,    45,    46,
  544.     47,    48,    49,    -1,    51,    52,    53,    54,    55,    56,
  545.     57,    -1,    59,    60,    61,    62,    37,    -1,    39,    40,
  546.     41,    42,    43,    44,    45,    46,    47,    48,    49,    -1,
  547.     51,    52,    53,    54,    55,    56,    57,    -1,    59,    60,
  548.     61,    62,    39,    40,    41,    42,    43,    44,    45,    46,
  549.     47,    48,    49,    -1,    51,    52,    53,    54,    55,    56,
  550.     57,    -1,    59,    60,    61,    62,    39,    40,    41,    42,
  551.     43,    44,    45,    46,    47,    48,    49,    -1,    51,    52,
  552.     53,    54,    55,    56,    57,    -1,    59,    60,    61,    62
  553. };
  554. /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
  555. #line 3 "/usr/unsupported/lib/bison.simple"
  556.  
  557. /* Skeleton output parser for bison,
  558.    Copyright (C) 1984, 1989, 1990 Bob Corbett and Richard Stallman
  559.  
  560.    This program is free software; you can redistribute it and/or modify
  561.    it under the terms of the GNU General Public License as published by
  562.    the Free Software Foundation; either version 1, or (at your option)
  563.    any later version.
  564.  
  565.    This program is distributed in the hope that it will be useful,
  566.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  567.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  568.    GNU General Public License for more details.
  569.  
  570.    You should have received a copy of the GNU General Public License
  571.    along with this program; if not, write to the Free Software
  572.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  573.  
  574.  
  575. #ifndef alloca
  576. #ifdef __GNUC__
  577. #define alloca __builtin_alloca
  578. #else /* not GNU C.  */
  579. #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
  580. #include <alloca.h>
  581. #else /* not sparc */
  582. #if defined (MSDOS) && !defined (__TURBOC__)
  583. #else /* not MSDOS, or __TURBOC__ */
  584. #if defined(_AIX)
  585.  #pragma alloca
  586. #else /* not MSDOS, __TURBOC__, or _AIX */
  587. #ifdef __hpux
  588. #ifdef __cplusplus
  589. extern "C" {
  590. void *alloca (unsigned int);
  591. };
  592. #else /* not __cplusplus */
  593. void *alloca ();
  594. #endif /* not __cplusplus */
  595. #endif /* __hpux */
  596. #endif /* not _AIX */
  597. #endif /* not MSDOS, or __TURBOC__ */
  598. #endif /* not sparc.  */
  599. #endif /* not GNU C.  */
  600. #endif /* alloca not defined.  */
  601.  
  602. /* This is the parser code that is written into each bison parser
  603.   when the %semantic_parser declaration is not specified in the grammar.
  604.   It was written by Richard Stallman by simplifying the hairy parser
  605.   used when %semantic_parser is specified.  */
  606.  
  607. /* Note: there must be only one dollar sign in this file.
  608.    It is replaced by the list of actions, each action
  609.    as one case of the switch.  */
  610.  
  611. #define yyerrok        (yyerrstatus = 0)
  612. #define yyclearin    (yychar = YYEMPTY)
  613. #define YYEMPTY        -2
  614. #define YYEOF        0
  615. #define YYACCEPT    return(0)
  616. #define YYABORT     return(1)
  617. #define YYERROR        goto yyerrlab1
  618. /* Like YYERROR except do call yyerror.
  619.    This remains here temporarily to ease the
  620.    transition to the new meaning of YYERROR, for GCC.
  621.    Once GCC version 2 has supplanted version 1, this can go.  */
  622. #define YYFAIL        goto yyerrlab
  623. #define YYRECOVERING()  (!!yyerrstatus)
  624. #define YYBACKUP(token, value) \
  625. do                                \
  626.   if (yychar == YYEMPTY && yylen == 1)                \
  627.     { yychar = (token), yylval = (value);            \
  628.       yychar1 = YYTRANSLATE (yychar);                \
  629.       YYPOPSTACK;                        \
  630.       goto yybackup;                        \
  631.     }                                \
  632.   else                                \
  633.     { yyerror ("syntax error: cannot back up"); YYERROR; }    \
  634. while (0)
  635.  
  636. #define YYTERROR    1
  637. #define YYERRCODE    256
  638.  
  639. #ifndef YYPURE
  640. #define YYLEX        yylex()
  641. #endif
  642.  
  643. #ifdef YYPURE
  644. #ifdef YYLSP_NEEDED
  645. #define YYLEX        yylex(&yylval, &yylloc)
  646. #else
  647. #define YYLEX        yylex(&yylval)
  648. #endif
  649. #endif
  650.  
  651. /* If nonreentrant, generate the variables here */
  652.  
  653. #ifndef YYPURE
  654.  
  655. int    yychar;            /*  the lookahead symbol        */
  656. YYSTYPE    yylval;            /*  the semantic value of the        */
  657.                 /*  lookahead symbol            */
  658.  
  659. #ifdef YYLSP_NEEDED
  660. YYLTYPE yylloc;            /*  location data for the lookahead    */
  661.                 /*  symbol                */
  662. #endif
  663.  
  664. int yynerrs;            /*  number of parse errors so far       */
  665. #endif  /* not YYPURE */
  666.  
  667. #if YYDEBUG != 0
  668. int yydebug;            /*  nonzero means print parse trace    */
  669. /* Since this is uninitialized, it does not stop multiple parsers
  670.    from coexisting.  */
  671. #endif
  672.  
  673. /*  YYINITDEPTH indicates the initial size of the parser's stacks    */
  674.  
  675. #ifndef    YYINITDEPTH
  676. #define YYINITDEPTH 200
  677. #endif
  678.  
  679. /*  YYMAXDEPTH is the maximum size the stacks can grow to
  680.     (effective only if the built-in stack extension method is used).  */
  681.  
  682. #if YYMAXDEPTH == 0
  683. #undef YYMAXDEPTH
  684. #endif
  685.  
  686. #ifndef YYMAXDEPTH
  687. #define YYMAXDEPTH 10000
  688. #endif
  689.  
  690. /* Prevent warning if -Wstrict-prototypes.  */
  691. #ifdef __GNUC__
  692. int yyparse (void);
  693. #endif
  694.  
  695. #if __GNUC__ > 1        /* GNU C and GNU C++ define this.  */
  696. #define __yy_bcopy(FROM,TO,COUNT)    __builtin_memcpy(TO,FROM,COUNT)
  697. #else                /* not GNU C or C++ */
  698. #ifndef __cplusplus
  699.  
  700. /* This is the most reliable way to avoid incompatibilities
  701.    in available built-in functions on various systems.  */
  702. static void
  703. __yy_bcopy (from, to, count)
  704.      char *from;
  705.      char *to;
  706.      int count;
  707. {
  708.   register char *f = from;
  709.   register char *t = to;
  710.   register int i = count;
  711.  
  712.   while (i-- > 0)
  713.     *t++ = *f++;
  714. }
  715.  
  716. #else /* __cplusplus */
  717.  
  718. /* This is the most reliable way to avoid incompatibilities
  719.    in available built-in functions on various systems.  */
  720. static void
  721. __yy_bcopy (char *from, char *to, int count)
  722. {
  723.   register char *f = from;
  724.   register char *t = to;
  725.   register int i = count;
  726.  
  727.   while (i-- > 0)
  728.     *t++ = *f++;
  729. }
  730.  
  731. #endif
  732. #endif
  733.  
  734. #line 184 "/usr/unsupported/lib/bison.simple"
  735. int
  736. yyparse()
  737. {
  738.   register int yystate;
  739.   register int yyn;
  740.   register short *yyssp;
  741.   register YYSTYPE *yyvsp;
  742.   int yyerrstatus;    /*  number of tokens to shift before error messages enabled */
  743.   int yychar1 = 0;        /*  lookahead token as an internal (translated) token number */
  744.  
  745.   short    yyssa[YYINITDEPTH];    /*  the state stack            */
  746.   YYSTYPE yyvsa[YYINITDEPTH];    /*  the semantic value stack        */
  747.  
  748.   short *yyss = yyssa;        /*  refer to the stacks thru separate pointers */
  749.   YYSTYPE *yyvs = yyvsa;    /*  to allow yyoverflow to xreallocate them elsewhere */
  750.  
  751. #ifdef YYLSP_NEEDED
  752.   YYLTYPE yylsa[YYINITDEPTH];    /*  the location stack            */
  753.   YYLTYPE *yyls = yylsa;
  754.   YYLTYPE *yylsp;
  755.  
  756. #define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
  757. #else
  758. #define YYPOPSTACK   (yyvsp--, yyssp--)
  759. #endif
  760.  
  761.   int yystacksize = YYINITDEPTH;
  762.  
  763. #ifdef YYPURE
  764.   int yychar;
  765.   YYSTYPE yylval;
  766.   int yynerrs;
  767. #ifdef YYLSP_NEEDED
  768.   YYLTYPE yylloc;
  769. #endif
  770. #endif
  771.  
  772.   YYSTYPE yyval;        /*  the variable used to return        */
  773.                 /*  semantic values from the action    */
  774.                 /*  routines                */
  775.  
  776.   int yylen;
  777.  
  778. #if YYDEBUG != 0
  779.   if (yydebug)
  780.     fprintf(stderr, "Starting parse\n");
  781. #endif
  782.  
  783.   yystate = 0;
  784.   yyerrstatus = 0;
  785.   yynerrs = 0;
  786.   yychar = YYEMPTY;        /* Cause a token to be read.  */
  787.  
  788.   /* Initialize stack pointers.
  789.      Waste one element of value and location stack
  790.      so that they stay on the same level as the state stack.
  791.      The wasted elements are never initialized.  */
  792.  
  793.   yyssp = yyss - 1;
  794.   yyvsp = yyvs;
  795. #ifdef YYLSP_NEEDED
  796.   yylsp = yyls;
  797. #endif
  798.  
  799. /* Push a new state, which is found in  yystate  .  */
  800. /* In all cases, when you get here, the value and location stacks
  801.    have just been pushed. so pushing a state here evens the stacks.  */
  802. yynewstate:
  803.  
  804.   *++yyssp = yystate;
  805.  
  806.   if (yyssp >= yyss + yystacksize - 1)
  807.     {
  808.       /* Give user a chance to xreallocate the stack */
  809.       /* Use copies of these so that the &'s don't force the real ones into memory. */
  810.       YYSTYPE *yyvs1 = yyvs;
  811.       short *yyss1 = yyss;
  812. #ifdef YYLSP_NEEDED
  813.       YYLTYPE *yyls1 = yyls;
  814. #endif
  815.  
  816.       /* Get the current used size of the three stacks, in elements.  */
  817.       int size = yyssp - yyss + 1;
  818.  
  819. #ifdef yyoverflow
  820.       /* Each stack pointer address is followed by the size of
  821.      the data in use in that stack, in bytes.  */
  822. #ifdef YYLSP_NEEDED
  823.       /* This used to be a conditional around just the two extra args,
  824.      but that might be undefined if yyoverflow is a macro.  */
  825.       yyoverflow("parser stack overflow",
  826.          &yyss1, size * sizeof (*yyssp),
  827.          &yyvs1, size * sizeof (*yyvsp),
  828.          &yyls1, size * sizeof (*yylsp),
  829.          &yystacksize);
  830. #else
  831.       yyoverflow("parser stack overflow",
  832.          &yyss1, size * sizeof (*yyssp),
  833.          &yyvs1, size * sizeof (*yyvsp),
  834.          &yystacksize);
  835. #endif
  836.  
  837.       yyss = yyss1; yyvs = yyvs1;
  838. #ifdef YYLSP_NEEDED
  839.       yyls = yyls1;
  840. #endif
  841. #else /* no yyoverflow */
  842.       /* Extend the stack our own way.  */
  843.       if (yystacksize >= YYMAXDEPTH)
  844.     {
  845.       yyerror("parser stack overflow");
  846.       return 2;
  847.     }
  848.       yystacksize *= 2;
  849.       if (yystacksize > YYMAXDEPTH)
  850.     yystacksize = YYMAXDEPTH;
  851.       yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
  852.       __yy_bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
  853.       yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
  854.       __yy_bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
  855. #ifdef YYLSP_NEEDED
  856.       yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
  857.       __yy_bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
  858. #endif
  859. #endif /* no yyoverflow */
  860.  
  861.       yyssp = yyss + size - 1;
  862.       yyvsp = yyvs + size - 1;
  863. #ifdef YYLSP_NEEDED
  864.       yylsp = yyls + size - 1;
  865. #endif
  866.  
  867. #if YYDEBUG != 0
  868.       if (yydebug)
  869.     fprintf(stderr, "Stack size increased to %d\n", yystacksize);
  870. #endif
  871.  
  872.       if (yyssp >= yyss + yystacksize - 1)
  873.     YYABORT;
  874.     }
  875.  
  876. #if YYDEBUG != 0
  877.   if (yydebug)
  878.     fprintf(stderr, "Entering state %d\n", yystate);
  879. #endif
  880.  
  881.   goto yybackup;
  882.  yybackup:
  883.  
  884. /* Do appropriate processing given the current state.  */
  885. /* Read a lookahead token if we need one and don't already have one.  */
  886. /* yyresume: */
  887.  
  888.   /* First try to decide what to do without reference to lookahead token.  */
  889.  
  890.   yyn = yypact[yystate];
  891.   if (yyn == YYFLAG)
  892.     goto yydefault;
  893.  
  894.   /* Not known => get a lookahead token if don't already have one.  */
  895.  
  896.   /* yychar is either YYEMPTY or YYEOF
  897.      or a valid token in external form.  */
  898.  
  899.   if (yychar == YYEMPTY)
  900.     {
  901. #if YYDEBUG != 0
  902.       if (yydebug)
  903.     fprintf(stderr, "Reading a token: ");
  904. #endif
  905.       yychar = YYLEX;
  906.     }
  907.  
  908.   /* Convert token to internal form (in yychar1) for indexing tables with */
  909.  
  910.   if (yychar <= 0)        /* This means end of input. */
  911.     {
  912.       yychar1 = 0;
  913.       yychar = YYEOF;        /* Don't call YYLEX any more */
  914.  
  915. #if YYDEBUG != 0
  916.       if (yydebug)
  917.     fprintf(stderr, "Now at end of input.\n");
  918. #endif
  919.     }
  920.   else
  921.     {
  922.       yychar1 = YYTRANSLATE(yychar);
  923.  
  924. #if YYDEBUG != 0
  925.       if (yydebug)
  926.     {
  927.       fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
  928.       /* Give the individual parser a way to print the precise meaning
  929.          of a token, for further debugging info.  */
  930. #ifdef YYPRINT
  931.       YYPRINT (stderr, yychar, yylval);
  932. #endif
  933.       fprintf (stderr, ")\n");
  934.     }
  935. #endif
  936.     }
  937.  
  938.   yyn += yychar1;
  939.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
  940.     goto yydefault;
  941.  
  942.   yyn = yytable[yyn];
  943.  
  944.   /* yyn is what to do for this token type in this state.
  945.      Negative => reduce, -yyn is rule number.
  946.      Positive => shift, yyn is new state.
  947.        New state is final state => don't bother to shift,
  948.        just return success.
  949.      0, or most negative number => error.  */
  950.  
  951.   if (yyn < 0)
  952.     {
  953.       if (yyn == YYFLAG)
  954.     goto yyerrlab;
  955.       yyn = -yyn;
  956.       goto yyreduce;
  957.     }
  958.   else if (yyn == 0)
  959.     goto yyerrlab;
  960.  
  961.   if (yyn == YYFINAL)
  962.     YYACCEPT;
  963.  
  964.   /* Shift the lookahead token.  */
  965.  
  966. #if YYDEBUG != 0
  967.   if (yydebug)
  968.     fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
  969. #endif
  970.  
  971.   /* Discard the token being shifted unless it is eof.  */
  972.   if (yychar != YYEOF)
  973.     yychar = YYEMPTY;
  974.  
  975.   *++yyvsp = yylval;
  976. #ifdef YYLSP_NEEDED
  977.   *++yylsp = yylloc;
  978. #endif
  979.  
  980.   /* count tokens shifted since error; after three, turn off error status.  */
  981.   if (yyerrstatus) yyerrstatus--;
  982.  
  983.   yystate = yyn;
  984.   goto yynewstate;
  985.  
  986. /* Do the default action for the current state.  */
  987. yydefault:
  988.  
  989.   yyn = yydefact[yystate];
  990.   if (yyn == 0)
  991.     goto yyerrlab;
  992.  
  993. /* Do a reduction.  yyn is the number of a rule to reduce with.  */
  994. yyreduce:
  995.   yylen = yyr2[yyn];
  996.   if (yylen > 0)
  997.     yyval = yyvsp[1-yylen]; /* implement default value of the action */
  998.  
  999. #if YYDEBUG != 0
  1000.   if (yydebug)
  1001.     {
  1002.       int i;
  1003.  
  1004.       fprintf (stderr, "Reducing via rule %d (line %d), ",
  1005.            yyn, yyrline[yyn]);
  1006.  
  1007.       /* Print the symbols being reduced, and their result.  */
  1008.       for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
  1009.     fprintf (stderr, "%s ", yytname[yyrhs[i]]);
  1010.       fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
  1011.     }
  1012. #endif
  1013.  
  1014.  
  1015.   switch (yyn) {
  1016.  
  1017. case 3:
  1018. #line 202 "./m2-exp.y"
  1019. { write_exp_elt_opcode(OP_TYPE);
  1020.           write_exp_elt_type(yyvsp[0].tval);
  1021.           write_exp_elt_opcode(OP_TYPE);
  1022.         ;
  1023.     break;}
  1024. case 4:
  1025. #line 211 "./m2-exp.y"
  1026. { write_exp_elt_opcode (UNOP_IND); ;
  1027.     break;}
  1028. case 5:
  1029. #line 214 "./m2-exp.y"
  1030. { number_sign = -1; ;
  1031.     break;}
  1032. case 6:
  1033. #line 216 "./m2-exp.y"
  1034. { number_sign = 1;
  1035.               write_exp_elt_opcode (UNOP_NEG); ;
  1036.     break;}
  1037. case 7:
  1038. #line 221 "./m2-exp.y"
  1039. { write_exp_elt_opcode(UNOP_PLUS); ;
  1040.     break;}
  1041. case 8:
  1042. #line 225 "./m2-exp.y"
  1043. { write_exp_elt_opcode (UNOP_LOGICAL_NOT); ;
  1044.     break;}
  1045. case 11:
  1046. #line 233 "./m2-exp.y"
  1047. { write_exp_elt_opcode (UNOP_CAP); ;
  1048.     break;}
  1049. case 12:
  1050. #line 237 "./m2-exp.y"
  1051. { write_exp_elt_opcode (UNOP_ORD); ;
  1052.     break;}
  1053. case 13:
  1054. #line 241 "./m2-exp.y"
  1055. { write_exp_elt_opcode (UNOP_ABS); ;
  1056.     break;}
  1057. case 14:
  1058. #line 245 "./m2-exp.y"
  1059. { write_exp_elt_opcode (UNOP_HIGH); ;
  1060.     break;}
  1061. case 15:
  1062. #line 249 "./m2-exp.y"
  1063. { write_exp_elt_opcode (UNOP_MIN);
  1064.               write_exp_elt_type (yyvsp[-1].tval);
  1065.               write_exp_elt_opcode (UNOP_MIN); ;
  1066.     break;}
  1067. case 16:
  1068. #line 255 "./m2-exp.y"
  1069. { write_exp_elt_opcode (UNOP_MAX);
  1070.               write_exp_elt_type (yyvsp[-1].tval);
  1071.               write_exp_elt_opcode (UNOP_MIN); ;
  1072.     break;}
  1073. case 17:
  1074. #line 261 "./m2-exp.y"
  1075. { write_exp_elt_opcode (UNOP_FLOAT); ;
  1076.     break;}
  1077. case 18:
  1078. #line 265 "./m2-exp.y"
  1079. { write_exp_elt_opcode (BINOP_VAL);
  1080.               write_exp_elt_type (yyvsp[-3].tval);
  1081.               write_exp_elt_opcode (BINOP_VAL); ;
  1082.     break;}
  1083. case 19:
  1084. #line 271 "./m2-exp.y"
  1085. { write_exp_elt_opcode (UNOP_CHR); ;
  1086.     break;}
  1087. case 20:
  1088. #line 275 "./m2-exp.y"
  1089. { write_exp_elt_opcode (UNOP_ODD); ;
  1090.     break;}
  1091. case 21:
  1092. #line 279 "./m2-exp.y"
  1093. { write_exp_elt_opcode (UNOP_TRUNC); ;
  1094.     break;}
  1095. case 22:
  1096. #line 283 "./m2-exp.y"
  1097. { write_exp_elt_opcode (UNOP_SIZEOF); ;
  1098.     break;}
  1099. case 23:
  1100. #line 288 "./m2-exp.y"
  1101. { write_exp_elt_opcode(UNOP_PREINCREMENT); ;
  1102.     break;}
  1103. case 24:
  1104. #line 292 "./m2-exp.y"
  1105. { write_exp_elt_opcode(BINOP_ASSIGN_MODIFY);
  1106.               write_exp_elt_opcode(BINOP_ADD);
  1107.               write_exp_elt_opcode(BINOP_ASSIGN_MODIFY); ;
  1108.     break;}
  1109. case 25:
  1110. #line 298 "./m2-exp.y"
  1111. { write_exp_elt_opcode(UNOP_PREDECREMENT);;
  1112.     break;}
  1113. case 26:
  1114. #line 302 "./m2-exp.y"
  1115. { write_exp_elt_opcode(BINOP_ASSIGN_MODIFY);
  1116.               write_exp_elt_opcode(BINOP_SUB);
  1117.               write_exp_elt_opcode(BINOP_ASSIGN_MODIFY); ;
  1118.     break;}
  1119. case 27:
  1120. #line 308 "./m2-exp.y"
  1121. { write_exp_elt_opcode (STRUCTOP_STRUCT);
  1122.               write_exp_string (yyvsp[0].sval);
  1123.               write_exp_elt_opcode (STRUCTOP_STRUCT); ;
  1124.     break;}
  1125. case 29:
  1126. #line 317 "./m2-exp.y"
  1127. { error("Sets are not implemented.");;
  1128.     break;}
  1129. case 30:
  1130. #line 321 "./m2-exp.y"
  1131. { error("Sets are not implemented.");;
  1132.     break;}
  1133. case 31:
  1134. #line 325 "./m2-exp.y"
  1135. { error("Sets are not implemented.");;
  1136.     break;}
  1137. case 32:
  1138. #line 328 "./m2-exp.y"
  1139. { error("Sets are not implemented.");;
  1140.     break;}
  1141. case 33:
  1142. #line 330 "./m2-exp.y"
  1143. { error("Sets are not implemented.");;
  1144.     break;}
  1145. case 34:
  1146. #line 339 "./m2-exp.y"
  1147. { start_arglist(); ;
  1148.     break;}
  1149. case 35:
  1150. #line 341 "./m2-exp.y"
  1151. { write_exp_elt_opcode (MULTI_SUBSCRIPT);
  1152.               write_exp_elt_longcst ((LONGEST) end_arglist());
  1153.               write_exp_elt_opcode (MULTI_SUBSCRIPT); ;
  1154.     break;}
  1155. case 36:
  1156. #line 349 "./m2-exp.y"
  1157. { start_arglist (); ;
  1158.     break;}
  1159. case 37:
  1160. #line 351 "./m2-exp.y"
  1161. { write_exp_elt_opcode (OP_FUNCALL);
  1162.               write_exp_elt_longcst ((LONGEST) end_arglist ());
  1163.               write_exp_elt_opcode (OP_FUNCALL); ;
  1164.     break;}
  1165. case 39:
  1166. #line 360 "./m2-exp.y"
  1167. { arglist_len = 1; ;
  1168.     break;}
  1169. case 40:
  1170. #line 364 "./m2-exp.y"
  1171. { arglist_len++; ;
  1172.     break;}
  1173. case 41:
  1174. #line 369 "./m2-exp.y"
  1175. { arglist_len = 1; ;
  1176.     break;}
  1177. case 42:
  1178. #line 374 "./m2-exp.y"
  1179. { arglist_len++; ;
  1180.     break;}
  1181. case 43:
  1182. #line 379 "./m2-exp.y"
  1183. { write_exp_elt_opcode (UNOP_MEMVAL);
  1184.               write_exp_elt_type (yyvsp[-2].tval);
  1185.               write_exp_elt_opcode (UNOP_MEMVAL); ;
  1186.     break;}
  1187. case 44:
  1188. #line 385 "./m2-exp.y"
  1189. { write_exp_elt_opcode (UNOP_CAST);
  1190.               write_exp_elt_type (yyvsp[-3].tval);
  1191.               write_exp_elt_opcode (UNOP_CAST); ;
  1192.     break;}
  1193. case 45:
  1194. #line 391 "./m2-exp.y"
  1195. { ;
  1196.     break;}
  1197. case 46:
  1198. #line 399 "./m2-exp.y"
  1199. { write_exp_elt_opcode (BINOP_REPEAT); ;
  1200.     break;}
  1201. case 47:
  1202. #line 403 "./m2-exp.y"
  1203. { write_exp_elt_opcode (BINOP_MUL); ;
  1204.     break;}
  1205. case 48:
  1206. #line 407 "./m2-exp.y"
  1207. { write_exp_elt_opcode (BINOP_DIV); ;
  1208.     break;}
  1209. case 49:
  1210. #line 411 "./m2-exp.y"
  1211. { write_exp_elt_opcode (BINOP_INTDIV); ;
  1212.     break;}
  1213. case 50:
  1214. #line 415 "./m2-exp.y"
  1215. { write_exp_elt_opcode (BINOP_REM); ;
  1216.     break;}
  1217. case 51:
  1218. #line 419 "./m2-exp.y"
  1219. { write_exp_elt_opcode (BINOP_ADD); ;
  1220.     break;}
  1221. case 52:
  1222. #line 423 "./m2-exp.y"
  1223. { write_exp_elt_opcode (BINOP_SUB); ;
  1224.     break;}
  1225. case 53:
  1226. #line 427 "./m2-exp.y"
  1227. { write_exp_elt_opcode (BINOP_EQUAL); ;
  1228.     break;}
  1229. case 54:
  1230. #line 431 "./m2-exp.y"
  1231. { write_exp_elt_opcode (BINOP_NOTEQUAL); ;
  1232.     break;}
  1233. case 55:
  1234. #line 433 "./m2-exp.y"
  1235. { write_exp_elt_opcode (BINOP_NOTEQUAL); ;
  1236.     break;}
  1237. case 56:
  1238. #line 437 "./m2-exp.y"
  1239. { write_exp_elt_opcode (BINOP_LEQ); ;
  1240.     break;}
  1241. case 57:
  1242. #line 441 "./m2-exp.y"
  1243. { write_exp_elt_opcode (BINOP_GEQ); ;
  1244.     break;}
  1245. case 58:
  1246. #line 445 "./m2-exp.y"
  1247. { write_exp_elt_opcode (BINOP_LESS); ;
  1248.     break;}
  1249. case 59:
  1250. #line 449 "./m2-exp.y"
  1251. { write_exp_elt_opcode (BINOP_GTR); ;
  1252.     break;}
  1253. case 60:
  1254. #line 453 "./m2-exp.y"
  1255. { write_exp_elt_opcode (BINOP_LOGICAL_AND); ;
  1256.     break;}
  1257. case 61:
  1258. #line 457 "./m2-exp.y"
  1259. { write_exp_elt_opcode (BINOP_LOGICAL_OR); ;
  1260.     break;}
  1261. case 62:
  1262. #line 461 "./m2-exp.y"
  1263. { write_exp_elt_opcode (BINOP_ASSIGN); ;
  1264.     break;}
  1265. case 63:
  1266. #line 468 "./m2-exp.y"
  1267. { write_exp_elt_opcode (OP_BOOL);
  1268.               write_exp_elt_longcst ((LONGEST) yyvsp[0].ulval);
  1269.               write_exp_elt_opcode (OP_BOOL); ;
  1270.     break;}
  1271. case 64:
  1272. #line 474 "./m2-exp.y"
  1273. { write_exp_elt_opcode (OP_BOOL);
  1274.               write_exp_elt_longcst ((LONGEST) yyvsp[0].ulval);
  1275.               write_exp_elt_opcode (OP_BOOL); ;
  1276.     break;}
  1277. case 65:
  1278. #line 480 "./m2-exp.y"
  1279. { write_exp_elt_opcode (OP_LONG);
  1280.               write_exp_elt_type (builtin_type_m2_int);
  1281.               write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
  1282.               write_exp_elt_opcode (OP_LONG); ;
  1283.     break;}
  1284. case 66:
  1285. #line 487 "./m2-exp.y"
  1286. {
  1287.               write_exp_elt_opcode (OP_LONG);
  1288.               write_exp_elt_type (builtin_type_m2_card);
  1289.               write_exp_elt_longcst ((LONGEST) yyvsp[0].ulval);
  1290.               write_exp_elt_opcode (OP_LONG);
  1291.             ;
  1292.     break;}
  1293. case 67:
  1294. #line 496 "./m2-exp.y"
  1295. { write_exp_elt_opcode (OP_LONG);
  1296.               write_exp_elt_type (builtin_type_m2_char);
  1297.               write_exp_elt_longcst ((LONGEST) yyvsp[0].ulval);
  1298.               write_exp_elt_opcode (OP_LONG); ;
  1299.     break;}
  1300. case 68:
  1301. #line 504 "./m2-exp.y"
  1302. { write_exp_elt_opcode (OP_DOUBLE);
  1303.               write_exp_elt_type (builtin_type_m2_real);
  1304.               write_exp_elt_dblcst (yyvsp[0].dval);
  1305.               write_exp_elt_opcode (OP_DOUBLE); ;
  1306.     break;}
  1307. case 70:
  1308. #line 515 "./m2-exp.y"
  1309. { write_exp_elt_opcode (OP_LAST);
  1310.               write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
  1311.               write_exp_elt_opcode (OP_LAST); ;
  1312.     break;}
  1313. case 71:
  1314. #line 521 "./m2-exp.y"
  1315. { write_exp_elt_opcode (OP_REGISTER);
  1316.               write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
  1317.               write_exp_elt_opcode (OP_REGISTER); ;
  1318.     break;}
  1319. case 72:
  1320. #line 527 "./m2-exp.y"
  1321. { write_exp_elt_opcode (OP_LONG);
  1322.               write_exp_elt_type (builtin_type_int);
  1323.               write_exp_elt_longcst ((LONGEST) TYPE_LENGTH (yyvsp[-1].tval));
  1324.               write_exp_elt_opcode (OP_LONG); ;
  1325.     break;}
  1326. case 73:
  1327. #line 534 "./m2-exp.y"
  1328. { write_exp_elt_opcode (OP_M2_STRING);
  1329.               write_exp_string (yyvsp[0].sval);
  1330.               write_exp_elt_opcode (OP_M2_STRING); ;
  1331.     break;}
  1332. case 74:
  1333. #line 541 "./m2-exp.y"
  1334. { yyval.bval = SYMBOL_BLOCK_VALUE(yyvsp[0].sym); ;
  1335.     break;}
  1336. case 75:
  1337. #line 545 "./m2-exp.y"
  1338. { struct symbol *sym
  1339.                 = lookup_symbol (copy_name (yyvsp[0].sval), expression_context_block,
  1340.                          VAR_NAMESPACE, 0, NULL);
  1341.               yyval.sym = sym;;
  1342.     break;}
  1343. case 76:
  1344. #line 554 "./m2-exp.y"
  1345. { struct symbol *tem
  1346.                 = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval,
  1347.                          VAR_NAMESPACE, 0, NULL);
  1348.               if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
  1349.                 error ("No function \"%s\" in specified context.",
  1350.                    copy_name (yyvsp[0].sval));
  1351.               yyval.sym = tem;
  1352.             ;
  1353.     break;}
  1354. case 77:
  1355. #line 566 "./m2-exp.y"
  1356. { write_exp_elt_opcode(OP_VAR_VALUE);
  1357.               write_exp_elt_block (NULL);
  1358.               write_exp_elt_sym (yyvsp[0].sym);
  1359.               write_exp_elt_opcode (OP_VAR_VALUE); ;
  1360.     break;}
  1361. case 78:
  1362. #line 574 "./m2-exp.y"
  1363. { write_exp_elt_opcode (OP_INTERNALVAR);
  1364.               write_exp_elt_intern (yyvsp[0].ivar);
  1365.               write_exp_elt_opcode (OP_INTERNALVAR); ;
  1366.     break;}
  1367. case 79:
  1368. #line 581 "./m2-exp.y"
  1369. { struct symbol *sym;
  1370.               sym = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval,
  1371.                            VAR_NAMESPACE, 0, NULL);
  1372.               if (sym == 0)
  1373.                 error ("No symbol \"%s\" in specified context.",
  1374.                    copy_name (yyvsp[0].sval));
  1375.  
  1376.               write_exp_elt_opcode (OP_VAR_VALUE);
  1377.               /* block_found is set by lookup_symbol.  */
  1378.               write_exp_elt_block (block_found);
  1379.               write_exp_elt_sym (sym);
  1380.               write_exp_elt_opcode (OP_VAR_VALUE); ;
  1381.     break;}
  1382. case 80:
  1383. #line 597 "./m2-exp.y"
  1384. { struct symbol *sym;
  1385.               int is_a_field_of_this;
  1386.  
  1387.                sym = lookup_symbol (copy_name (yyvsp[0].sval),
  1388.                            expression_context_block,
  1389.                            VAR_NAMESPACE,
  1390.                            &is_a_field_of_this,
  1391.                            NULL);
  1392.               if (sym)
  1393.                 {
  1394.                   if (symbol_read_needs_frame (sym))
  1395.                 {
  1396.                   if (innermost_block == 0 ||
  1397.                       contained_in (block_found, 
  1398.                             innermost_block))
  1399.                     innermost_block = block_found;
  1400.                 }
  1401.  
  1402.                   write_exp_elt_opcode (OP_VAR_VALUE);
  1403.                   /* We want to use the selected frame, not
  1404.                  another more inner frame which happens to
  1405.                  be in the same block.  */
  1406.                   write_exp_elt_block (NULL);
  1407.                   write_exp_elt_sym (sym);
  1408.                   write_exp_elt_opcode (OP_VAR_VALUE);
  1409.                 }
  1410.               else
  1411.                 {
  1412.                   struct minimal_symbol *msymbol;
  1413.                   register char *arg = copy_name (yyvsp[0].sval);
  1414.  
  1415.                   msymbol =
  1416.                 lookup_minimal_symbol (arg, NULL, NULL);
  1417.                   if (msymbol != NULL)
  1418.                 {
  1419.                   write_exp_msymbol
  1420.                     (msymbol,
  1421.                      lookup_function_type (builtin_type_int),
  1422.                      builtin_type_int);
  1423.                 }
  1424.                   else if (!have_full_symbols () && !have_partial_symbols ())
  1425.                 error ("No symbol table is loaded.  Use the \"symbol-file\" command.");
  1426.                   else
  1427.                 error ("No symbol \"%s\" in current context.",
  1428.                        copy_name (yyvsp[0].sval));
  1429.                 }
  1430.             ;
  1431.     break;}
  1432. case 81:
  1433. #line 648 "./m2-exp.y"
  1434. { yyval.tval = lookup_typename (copy_name (yyvsp[0].sval),
  1435.                         expression_context_block, 0); ;
  1436.     break;}
  1437. }
  1438.    /* the action file gets copied in in place of this dollarsign */
  1439. #line 465 "/usr/unsupported/lib/bison.simple"
  1440.  
  1441.   yyvsp -= yylen;
  1442.   yyssp -= yylen;
  1443. #ifdef YYLSP_NEEDED
  1444.   yylsp -= yylen;
  1445. #endif
  1446.  
  1447. #if YYDEBUG != 0
  1448.   if (yydebug)
  1449.     {
  1450.       short *ssp1 = yyss - 1;
  1451.       fprintf (stderr, "state stack now");
  1452.       while (ssp1 != yyssp)
  1453.     fprintf (stderr, " %d", *++ssp1);
  1454.       fprintf (stderr, "\n");
  1455.     }
  1456. #endif
  1457.  
  1458.   *++yyvsp = yyval;
  1459.  
  1460. #ifdef YYLSP_NEEDED
  1461.   yylsp++;
  1462.   if (yylen == 0)
  1463.     {
  1464.       yylsp->first_line = yylloc.first_line;
  1465.       yylsp->first_column = yylloc.first_column;
  1466.       yylsp->last_line = (yylsp-1)->last_line;
  1467.       yylsp->last_column = (yylsp-1)->last_column;
  1468.       yylsp->text = 0;
  1469.     }
  1470.   else
  1471.     {
  1472.       yylsp->last_line = (yylsp+yylen-1)->last_line;
  1473.       yylsp->last_column = (yylsp+yylen-1)->last_column;
  1474.     }
  1475. #endif
  1476.  
  1477.   /* Now "shift" the result of the reduction.
  1478.      Determine what state that goes to,
  1479.      based on the state we popped back to
  1480.      and the rule number reduced by.  */
  1481.  
  1482.   yyn = yyr1[yyn];
  1483.  
  1484.   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
  1485.   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
  1486.     yystate = yytable[yystate];
  1487.   else
  1488.     yystate = yydefgoto[yyn - YYNTBASE];
  1489.  
  1490.   goto yynewstate;
  1491.  
  1492. yyerrlab:   /* here on detecting error */
  1493.  
  1494.   if (! yyerrstatus)
  1495.     /* If not already recovering from an error, report this error.  */
  1496.     {
  1497.       ++yynerrs;
  1498.  
  1499. #ifdef YYERROR_VERBOSE
  1500.       yyn = yypact[yystate];
  1501.  
  1502.       if (yyn > YYFLAG && yyn < YYLAST)
  1503.     {
  1504.       int size = 0;
  1505.       char *msg;
  1506.       int x, count;
  1507.  
  1508.       count = 0;
  1509.       /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
  1510.       for (x = (yyn < 0 ? -yyn : 0);
  1511.            x < (sizeof(yytname) / sizeof(char *)); x++)
  1512.         if (yycheck[x + yyn] == x)
  1513.           size += strlen(yytname[x]) + 15, count++;
  1514.       msg = (char *) xmalloc(size + 15);
  1515.       if (msg != 0)
  1516.         {
  1517.           strcpy(msg, "parse error");
  1518.  
  1519.           if (count < 5)
  1520.         {
  1521.           count = 0;
  1522.           for (x = (yyn < 0 ? -yyn : 0);
  1523.                x < (sizeof(yytname) / sizeof(char *)); x++)
  1524.             if (yycheck[x + yyn] == x)
  1525.               {
  1526.             strcat(msg, count == 0 ? ", expecting `" : " or `");
  1527.             strcat(msg, yytname[x]);
  1528.             strcat(msg, "'");
  1529.             count++;
  1530.               }
  1531.         }
  1532.           yyerror(msg);
  1533.           free(msg);
  1534.         }
  1535.       else
  1536.         yyerror ("parse error; also virtual memory exceeded");
  1537.     }
  1538.       else
  1539. #endif /* YYERROR_VERBOSE */
  1540.     yyerror("parse error");
  1541.     }
  1542.  
  1543.   goto yyerrlab1;
  1544. yyerrlab1:   /* here on error raised explicitly by an action */
  1545.  
  1546.   if (yyerrstatus == 3)
  1547.     {
  1548.       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
  1549.  
  1550.       /* return failure if at end of input */
  1551.       if (yychar == YYEOF)
  1552.     YYABORT;
  1553.  
  1554. #if YYDEBUG != 0
  1555.       if (yydebug)
  1556.     fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
  1557. #endif
  1558.  
  1559.       yychar = YYEMPTY;
  1560.     }
  1561.  
  1562.   /* Else will try to reuse lookahead token
  1563.      after shifting the error token.  */
  1564.  
  1565.   yyerrstatus = 3;        /* Each real token shifted decrements this */
  1566.  
  1567.   goto yyerrhandle;
  1568.  
  1569. yyerrdefault:  /* current state does not do anything special for the error token. */
  1570.  
  1571. #if 0
  1572.   /* This is wrong; only states that explicitly want error tokens
  1573.      should shift them.  */
  1574.   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
  1575.   if (yyn) goto yydefault;
  1576. #endif
  1577.  
  1578. yyerrpop:   /* pop the current state because it cannot handle the error token */
  1579.  
  1580.   if (yyssp == yyss) YYABORT;
  1581.   yyvsp--;
  1582.   yystate = *--yyssp;
  1583. #ifdef YYLSP_NEEDED
  1584.   yylsp--;
  1585. #endif
  1586.  
  1587. #if YYDEBUG != 0
  1588.   if (yydebug)
  1589.     {
  1590.       short *ssp1 = yyss - 1;
  1591.       fprintf (stderr, "Error: state stack now");
  1592.       while (ssp1 != yyssp)
  1593.     fprintf (stderr, " %d", *++ssp1);
  1594.       fprintf (stderr, "\n");
  1595.     }
  1596. #endif
  1597.  
  1598. yyerrhandle:
  1599.  
  1600.   yyn = yypact[yystate];
  1601.   if (yyn == YYFLAG)
  1602.     goto yyerrdefault;
  1603.  
  1604.   yyn += YYTERROR;
  1605.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
  1606.     goto yyerrdefault;
  1607.  
  1608.   yyn = yytable[yyn];
  1609.   if (yyn < 0)
  1610.     {
  1611.       if (yyn == YYFLAG)
  1612.     goto yyerrpop;
  1613.       yyn = -yyn;
  1614.       goto yyreduce;
  1615.     }
  1616.   else if (yyn == 0)
  1617.     goto yyerrpop;
  1618.  
  1619.   if (yyn == YYFINAL)
  1620.     YYACCEPT;
  1621.  
  1622. #if YYDEBUG != 0
  1623.   if (yydebug)
  1624.     fprintf(stderr, "Shifting error token, ");
  1625. #endif
  1626.  
  1627.   *++yyvsp = yylval;
  1628. #ifdef YYLSP_NEEDED
  1629.   *++yylsp = yylloc;
  1630. #endif
  1631.  
  1632.   yystate = yyn;
  1633.   goto yynewstate;
  1634. }
  1635. #line 653 "./m2-exp.y"
  1636.  
  1637.  
  1638. #if 0  /* FIXME! */
  1639. int
  1640. overflow(a,b)
  1641.    long a,b;
  1642. {
  1643.    return (MAX_OF_TYPE(builtin_type_m2_int) - b) < a;
  1644. }
  1645.  
  1646. int
  1647. uoverflow(a,b)
  1648.    unsigned long a,b;
  1649. {
  1650.    return (MAX_OF_TYPE(builtin_type_m2_card) - b) < a;
  1651. }
  1652. #endif /* FIXME */
  1653.  
  1654. /* Take care of parsing a number (anything that starts with a digit).
  1655.    Set yylval and return the token type; update lexptr.
  1656.    LEN is the number of characters in it.  */
  1657.  
  1658. /*** Needs some error checking for the float case ***/
  1659.  
  1660. static int
  1661. parse_number (olen)
  1662.      int olen;
  1663. {
  1664.   register char *p = lexptr;
  1665.   register LONGEST n = 0;
  1666.   register LONGEST prevn = 0;
  1667.   register int c,i,ischar=0;
  1668.   register int base = input_radix;
  1669.   register int len = olen;
  1670.   int unsigned_p = number_sign == 1 ? 1 : 0;
  1671.  
  1672.   if(p[len-1] == 'H')
  1673.   {
  1674.      base = 16;
  1675.      len--;
  1676.   }
  1677.   else if(p[len-1] == 'C' || p[len-1] == 'B')
  1678.   {
  1679.      base = 8;
  1680.      ischar = p[len-1] == 'C';
  1681.      len--;
  1682.   }
  1683.  
  1684.   /* Scan the number */
  1685.   for (c = 0; c < len; c++)
  1686.   {
  1687.     if (p[c] == '.' && base == 10)
  1688.       {
  1689.     /* It's a float since it contains a point.  */
  1690.     yylval.dval = atof (p);
  1691.     lexptr += len;
  1692.     return FLOAT;
  1693.       }
  1694.     if (p[c] == '.' && base != 10)
  1695.        error("Floating point numbers must be base 10.");
  1696.     if (base == 10 && (p[c] < '0' || p[c] > '9'))
  1697.        error("Invalid digit \'%c\' in number.",p[c]);
  1698.  }
  1699.  
  1700.   while (len-- > 0)
  1701.     {
  1702.       c = *p++;
  1703.       n *= base;
  1704.       if( base == 8 && (c == '8' || c == '9'))
  1705.      error("Invalid digit \'%c\' in octal number.",c);
  1706.       if (c >= '0' && c <= '9')
  1707.     i = c - '0';
  1708.       else
  1709.     {
  1710.       if (base == 16 && c >= 'A' && c <= 'F')
  1711.         i = c - 'A' + 10;
  1712.       else
  1713.          return ERROR;
  1714.     }
  1715.       n+=i;
  1716.       if(i >= base)
  1717.      return ERROR;
  1718.       if(!unsigned_p && number_sign == 1 && (prevn >= n))
  1719.      unsigned_p=1;        /* Try something unsigned */
  1720.       /* Don't do the range check if n==i and i==0, since that special
  1721.      case will give an overflow error. */
  1722.       if(RANGE_CHECK && n!=i && i)
  1723.       {
  1724.      if((unsigned_p && (unsigned)prevn >= (unsigned)n) ||
  1725.         ((!unsigned_p && number_sign==-1) && -prevn <= -n))
  1726.         range_error("Overflow on numeric constant.");
  1727.       }
  1728.      prevn=n;
  1729.     }
  1730.  
  1731.   lexptr = p;
  1732.   if(*p == 'B' || *p == 'C' || *p == 'H')
  1733.      lexptr++;            /* Advance past B,C or H */
  1734.  
  1735.   if (ischar)
  1736.   {
  1737.      yylval.ulval = n;
  1738.      return CHAR;
  1739.   }
  1740.   else if ( unsigned_p && number_sign == 1)
  1741.   {
  1742.      yylval.ulval = n;
  1743.      return UINT;
  1744.   }
  1745.   else if((unsigned_p && (n<0))) {
  1746.      range_error("Overflow on numeric constant -- number too large.");
  1747.      /* But, this can return if range_check == range_warn.  */
  1748.   }
  1749.   yylval.lval = n;
  1750.   return INT;
  1751. }
  1752.  
  1753.  
  1754. /* Some tokens */
  1755.  
  1756. static struct
  1757. {
  1758.    char name[2];
  1759.    int token;
  1760. } tokentab2[] =
  1761. {
  1762.     { {'<', '>'},    NOTEQUAL     },
  1763.     { {':', '='},    ASSIGN    },
  1764.     { {'<', '='},    LEQ    },
  1765.     { {'>', '='},    GEQ    },
  1766.     { {':', ':'},    COLONCOLON },
  1767.  
  1768. };
  1769.  
  1770. /* Some specific keywords */
  1771.  
  1772. struct keyword {
  1773.    char keyw[10];
  1774.    int token;
  1775. };
  1776.  
  1777. static struct keyword keytab[] =
  1778. {
  1779.     {"OR" ,   OROR     },
  1780.     {"IN",    IN         },/* Note space after IN */
  1781.     {"AND",   LOGICAL_AND},
  1782.     {"ABS",   ABS     },
  1783.     {"CHR",   CHR     },
  1784.     {"DEC",   DEC     },
  1785.     {"NOT",   NOT     },
  1786.     {"DIV",   DIV         },
  1787.     {"INC",   INC     },
  1788.     {"MAX",   MAX_FUNC     },
  1789.     {"MIN",   MIN_FUNC     },
  1790.     {"MOD",   MOD     },
  1791.     {"ODD",   ODD     },
  1792.     {"CAP",   CAP     },
  1793.     {"ORD",   ORD     },
  1794.     {"VAL",   VAL     },
  1795.     {"EXCL",  EXCL     },
  1796.     {"HIGH",  HIGH       },
  1797.     {"INCL",  INCL     },
  1798.     {"SIZE",  SIZE       },
  1799.     {"FLOAT", FLOAT_FUNC },
  1800.     {"TRUNC", TRUNC     },
  1801. };
  1802.  
  1803.  
  1804. /* Read one token, getting characters through lexptr.  */
  1805.  
  1806. /* This is where we will check to make sure that the language and the operators used are
  1807.    compatible  */
  1808.  
  1809. static int
  1810. yylex ()
  1811. {
  1812.   register int c;
  1813.   register int namelen;
  1814.   register int i;
  1815.   register char *tokstart;
  1816.   register char quote;
  1817.  
  1818.  retry:
  1819.  
  1820.   tokstart = lexptr;
  1821.  
  1822.  
  1823.   /* See if it is a special token of length 2 */
  1824.   for( i = 0 ; i < sizeof tokentab2 / sizeof tokentab2[0] ; i++)
  1825.      if(STREQN(tokentab2[i].name, tokstart, 2))
  1826.      {
  1827.     lexptr += 2;
  1828.     return tokentab2[i].token;
  1829.      }
  1830.  
  1831.   switch (c = *tokstart)
  1832.     {
  1833.     case 0:
  1834.       return 0;
  1835.  
  1836.     case ' ':
  1837.     case '\t':
  1838.     case '\n':
  1839.       lexptr++;
  1840.       goto retry;
  1841.  
  1842.     case '(':
  1843.       paren_depth++;
  1844.       lexptr++;
  1845.       return c;
  1846.  
  1847.     case ')':
  1848.       if (paren_depth == 0)
  1849.     return 0;
  1850.       paren_depth--;
  1851.       lexptr++;
  1852.       return c;
  1853.  
  1854.     case ',':
  1855.       if (comma_terminates && paren_depth == 0)
  1856.     return 0;
  1857.       lexptr++;
  1858.       return c;
  1859.  
  1860.     case '.':
  1861.       /* Might be a floating point number.  */
  1862.       if (lexptr[1] >= '0' && lexptr[1] <= '9')
  1863.     break;            /* Falls into number code.  */
  1864.       else
  1865.       {
  1866.      lexptr++;
  1867.      return DOT;
  1868.       }
  1869.  
  1870. /* These are character tokens that appear as-is in the YACC grammar */
  1871.     case '+':
  1872.     case '-':
  1873.     case '*':
  1874.     case '/':
  1875.     case '^':
  1876.     case '<':
  1877.     case '>':
  1878.     case '[':
  1879.     case ']':
  1880.     case '=':
  1881.     case '{':
  1882.     case '}':
  1883.     case '#':
  1884.     case '@':
  1885.     case '~':
  1886.     case '&':
  1887.       lexptr++;
  1888.       return c;
  1889.  
  1890.     case '\'' :
  1891.     case '"':
  1892.       quote = c;
  1893.       for (namelen = 1; (c = tokstart[namelen]) != quote && c != '\0'; namelen++)
  1894.     if (c == '\\')
  1895.       {
  1896.         c = tokstart[++namelen];
  1897.         if (c >= '0' && c <= '9')
  1898.           {
  1899.         c = tokstart[++namelen];
  1900.         if (c >= '0' && c <= '9')
  1901.           c = tokstart[++namelen];
  1902.           }
  1903.       }
  1904.       if(c != quote)
  1905.      error("Unterminated string or character constant.");
  1906.       yylval.sval.ptr = tokstart + 1;
  1907.       yylval.sval.length = namelen - 1;
  1908.       lexptr += namelen + 1;
  1909.  
  1910.       if(namelen == 2)      /* Single character */
  1911.       {
  1912.        yylval.ulval = tokstart[1];
  1913.        return CHAR;
  1914.       }
  1915.       else
  1916.      return STRING;
  1917.     }
  1918.  
  1919.   /* Is it a number?  */
  1920.   /* Note:  We have already dealt with the case of the token '.'.
  1921.      See case '.' above.  */
  1922.   if ((c >= '0' && c <= '9'))
  1923.     {
  1924.       /* It's a number.  */
  1925.       int got_dot = 0, got_e = 0;
  1926.       register char *p = tokstart;
  1927.       int toktype;
  1928.  
  1929.       for (++p ;; ++p)
  1930.     {
  1931.       if (!got_e && (*p == 'e' || *p == 'E'))
  1932.         got_dot = got_e = 1;
  1933.       else if (!got_dot && *p == '.')
  1934.         got_dot = 1;
  1935.       else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
  1936.            && (*p == '-' || *p == '+'))
  1937.         /* This is the sign of the exponent, not the end of the
  1938.            number.  */
  1939.         continue;
  1940.       else if ((*p < '0' || *p > '9') &&
  1941.            (*p < 'A' || *p > 'F') &&
  1942.            (*p != 'H'))  /* Modula-2 hexadecimal number */
  1943.         break;
  1944.     }
  1945.     toktype = parse_number (p - tokstart);
  1946.         if (toktype == ERROR)
  1947.       {
  1948.         char *err_copy = (char *) alloca (p - tokstart + 1);
  1949.  
  1950.         memcpy (err_copy, tokstart, p - tokstart);
  1951.         err_copy[p - tokstart] = 0;
  1952.         error ("Invalid number \"%s\".", err_copy);
  1953.       }
  1954.     lexptr = p;
  1955.     return toktype;
  1956.     }
  1957.  
  1958.   if (!(c == '_' || c == '$'
  1959.     || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
  1960.     /* We must have come across a bad character (e.g. ';').  */
  1961.     error ("Invalid character '%c' in expression.", c);
  1962.  
  1963.   /* It's a name.  See how long it is.  */
  1964.   namelen = 0;
  1965.   for (c = tokstart[namelen];
  1966.        (c == '_' || c == '$' || (c >= '0' && c <= '9')
  1967.     || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
  1968.        c = tokstart[++namelen])
  1969.     ;
  1970.  
  1971.   /* The token "if" terminates the expression and is NOT
  1972.      removed from the input stream.  */
  1973.   if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f')
  1974.     {
  1975.       return 0;
  1976.     }
  1977.  
  1978.   lexptr += namelen;
  1979.  
  1980.   /* Handle the tokens $digits; also $ (short for $0) and $$ (short for $$1)
  1981.      and $$digits (equivalent to $<-digits> if you could type that).
  1982.      Make token type LAST, and put the number (the digits) in yylval.  */
  1983.  
  1984.   if (*tokstart == '$')
  1985.     {
  1986.       register int negate = 0;
  1987.       c = 1;
  1988.       /* Double dollar means negate the number and add -1 as well.
  1989.      Thus $$ alone means -1.  */
  1990.       if (namelen >= 2 && tokstart[1] == '$')
  1991.     {
  1992.       negate = 1;
  1993.       c = 2;
  1994.     }
  1995.       if (c == namelen)
  1996.     {
  1997.       /* Just dollars (one or two) */
  1998.       yylval.lval = - negate;
  1999.       return LAST;
  2000.     }
  2001.       /* Is the rest of the token digits?  */
  2002.       for (; c < namelen; c++)
  2003.     if (!(tokstart[c] >= '0' && tokstart[c] <= '9'))
  2004.       break;
  2005.       if (c == namelen)
  2006.     {
  2007.       yylval.lval = atoi (tokstart + 1 + negate);
  2008.       if (negate)
  2009.         yylval.lval = - yylval.lval;
  2010.       return LAST;
  2011.     }
  2012.     }
  2013.  
  2014.   /* Handle tokens that refer to machine registers:
  2015.      $ followed by a register name.  */
  2016.  
  2017.   if (*tokstart == '$') {
  2018.     for (c = 0; c < NUM_REGS; c++)
  2019.       if (namelen - 1 == strlen (reg_names[c])
  2020.       && STREQN (tokstart + 1, reg_names[c], namelen - 1))
  2021.     {
  2022.       yylval.lval = c;
  2023.       return REGNAME;
  2024.     }
  2025.     for (c = 0; c < num_std_regs; c++)
  2026.      if (namelen - 1 == strlen (std_regs[c].name)
  2027.      && STREQN (tokstart + 1, std_regs[c].name, namelen - 1))
  2028.        {
  2029.      yylval.lval = std_regs[c].regnum;
  2030.      return REGNAME;
  2031.        }
  2032.   }
  2033.  
  2034.  
  2035.   /*  Lookup special keywords */
  2036.   for(i = 0 ; i < sizeof(keytab) / sizeof(keytab[0]) ; i++)
  2037.      if(namelen == strlen(keytab[i].keyw) && STREQN(tokstart,keytab[i].keyw,namelen))
  2038.        return keytab[i].token;
  2039.  
  2040.   yylval.sval.ptr = tokstart;
  2041.   yylval.sval.length = namelen;
  2042.  
  2043.   /* Any other names starting in $ are debugger internal variables.  */
  2044.  
  2045.   if (*tokstart == '$')
  2046.     {
  2047.       yylval.ivar = (struct internalvar *) lookup_internalvar (copy_name (yylval.sval) + 1);
  2048.       return INTERNAL_VAR;
  2049.     }
  2050.  
  2051.  
  2052.   /* Use token-type BLOCKNAME for symbols that happen to be defined as
  2053.      functions.  If this is not so, then ...
  2054.      Use token-type TYPENAME for symbols that happen to be defined
  2055.      currently as names of types; NAME for other symbols.
  2056.      The caller is not constrained to care about the distinction.  */
  2057.  {
  2058.  
  2059.  
  2060.     char *tmp = copy_name (yylval.sval);
  2061.     struct symbol *sym;
  2062.  
  2063.     if (lookup_partial_symtab (tmp))
  2064.       return BLOCKNAME;
  2065.     sym = lookup_symbol (tmp, expression_context_block,
  2066.              VAR_NAMESPACE, 0, NULL);
  2067.     if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
  2068.       return BLOCKNAME;
  2069.     if (lookup_typename (copy_name (yylval.sval), expression_context_block, 1))
  2070.       return TYPENAME;
  2071.  
  2072.     if(sym)
  2073.     {
  2074.        switch(sym->aclass)
  2075.        {
  2076.        case LOC_STATIC:
  2077.        case LOC_REGISTER:
  2078.        case LOC_ARG:
  2079.        case LOC_REF_ARG:
  2080.        case LOC_REGPARM:
  2081.        case LOC_REGPARM_ADDR:
  2082.        case LOC_LOCAL:
  2083.        case LOC_LOCAL_ARG:
  2084.        case LOC_BASEREG:
  2085.        case LOC_BASEREG_ARG:
  2086.        case LOC_CONST:
  2087.        case LOC_CONST_BYTES:
  2088.        case LOC_OPTIMIZED_OUT:
  2089.       return NAME;
  2090.  
  2091.        case LOC_TYPEDEF:
  2092.       return TYPENAME;
  2093.  
  2094.        case LOC_BLOCK:
  2095.       return BLOCKNAME;
  2096.  
  2097.        case LOC_UNDEF:
  2098.       error("internal:  Undefined class in m2lex()");
  2099.  
  2100.        case LOC_LABEL:
  2101.       error("internal:  Unforseen case in m2lex()");
  2102.        }
  2103.     }
  2104.     else
  2105.     {
  2106.        /* Built-in BOOLEAN type.  This is sort of a hack. */
  2107.        if(STREQN(tokstart,"TRUE",4))
  2108.        {
  2109.       yylval.ulval = 1;
  2110.       return M2_TRUE;
  2111.        }
  2112.        else if(STREQN(tokstart,"FALSE",5))
  2113.        {
  2114.       yylval.ulval = 0;
  2115.       return M2_FALSE;
  2116.        }
  2117.     }
  2118.  
  2119.     /* Must be another type of name... */
  2120.     return NAME;
  2121.  }
  2122. }
  2123.  
  2124. #if 0        /* Unused */
  2125. static char *
  2126. make_qualname(mod,ident)
  2127.    char *mod, *ident;
  2128. {
  2129.    char *new = xmalloc(strlen(mod)+strlen(ident)+2);
  2130.  
  2131.    strcpy(new,mod);
  2132.    strcat(new,".");
  2133.    strcat(new,ident);
  2134.    return new;
  2135. }
  2136. #endif  /* 0 */
  2137.  
  2138. void
  2139. yyerror (msg)
  2140.      char *msg;
  2141. {
  2142.   error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr);
  2143. }
  2144.