home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / gdb-4.9 / gdb / c-exp.tab.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-05-12  |  65.8 KB  |  2,303 lines

  1.  
  2. # line 38 "./c-exp.y"
  3.  
  4. #include "defs.h"
  5. #include "expression.h"
  6. #include "parser-defs.h"
  7. #include "value.h"
  8. #include "language.h"
  9. #include "c-lang.h"
  10.  
  11. /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
  12.    as well as gratuitiously global symbol names, so we can have multiple
  13.    yacc generated parsers in gdb.  Note that these are only the variables
  14.    produced by yacc.  If other parser generators (bison, byacc, etc) produce
  15.    additional global names that conflict at link time, then those parser
  16.    generators need to be fixed instead of adding those names to this list. */
  17.  
  18. #define    yymaxdepth c_maxdepth
  19. #define    yyparse    c_parse
  20. #define    yylex    c_lex
  21. #define    yyerror    c_error
  22. #define    yylval    c_lval
  23. #define    yychar    c_char
  24. #define    yydebug    c_debug
  25. #define    yypact    c_pact    
  26. #define    yyr1    c_r1            
  27. #define    yyr2    c_r2            
  28. #define    yydef    c_def        
  29. #define    yychk    c_chk        
  30. #define    yypgo    c_pgo        
  31. #define    yyact    c_act        
  32. #define    yyexca    c_exca
  33. #define yyerrflag c_errflag
  34. #define yynerrs    c_nerrs
  35. #define    yyps    c_ps
  36. #define    yypv    c_pv
  37. #define    yys    c_s
  38. #define    yy_yys    c_yys
  39. #define    yystate    c_state
  40. #define    yytmp    c_tmp
  41. #define    yyv    c_v
  42. #define    yy_yyv    c_yyv
  43. #define    yyval    c_val
  44. #define    yylloc    c_lloc
  45. #define yyreds    c_reds        /* With YYDEBUG defined */
  46. #define yytoks    c_toks        /* With YYDEBUG defined */
  47.  
  48. #ifndef YYDEBUG
  49. #define    YYDEBUG    0        /* Default to no yydebug support */
  50. #endif
  51.  
  52. int
  53. yyparse PARAMS ((void));
  54.  
  55. static int
  56. yylex PARAMS ((void));
  57.  
  58. void
  59. yyerror PARAMS ((char *));
  60.  
  61.  
  62. # line 102 "./c-exp.y"
  63. typedef union 
  64.   {
  65.     LONGEST lval;
  66.     struct {
  67.       LONGEST val;
  68.       struct type *type;
  69.     } typed_val;
  70.     double dval;
  71.     struct symbol *sym;
  72.     struct type *tval;
  73.     struct stoken sval;
  74.     struct ttype tsym;
  75.     struct symtoken ssym;
  76.     int voidval;
  77.     struct block *bval;
  78.     enum exp_opcode opcode;
  79.     struct internalvar *ivar;
  80.  
  81.     struct type **tvec;
  82.     int *ivec;
  83.   } YYSTYPE;
  84.  
  85. # line 125 "./c-exp.y"
  86. /* YYSTYPE gets defined by %union */
  87. static int
  88. parse_number PARAMS ((char *, int, int, YYSTYPE *));
  89. # define INT 257
  90. # define FLOAT 258
  91. # define STRING 259
  92. # define NAME 260
  93. # define TYPENAME 261
  94. # define NAME_OR_INT 262
  95. # define STRUCT 263
  96. # define CLASS 264
  97. # define UNION 265
  98. # define ENUM 266
  99. # define SIZEOF 267
  100. # define UNSIGNED 268
  101. # define COLONCOLON 269
  102. # define TEMPLATE 270
  103. # define ERROR 271
  104. # define SIGNED_KEYWORD 272
  105. # define LONG 273
  106. # define SHORT 274
  107. # define INT_KEYWORD 275
  108. # define CONST_KEYWORD 276
  109. # define VOLATILE_KEYWORD 277
  110. # define LAST 278
  111. # define REGNAME 279
  112. # define VARIABLE 280
  113. # define ASSIGN_MODIFY 281
  114. # define THIS 282
  115. # define ABOVE_COMMA 283
  116. # define OROR 284
  117. # define ANDAND 285
  118. # define EQUAL 286
  119. # define NOTEQUAL 287
  120. # define LEQ 288
  121. # define GEQ 289
  122. # define LSH 290
  123. # define RSH 291
  124. # define UNARY 292
  125. # define INCREMENT 293
  126. # define DECREMENT 294
  127. # define ARROW 295
  128. # define BLOCKNAME 296
  129. #define yyclearin yychar = -1
  130. #define yyerrok yyerrflag = 0
  131. extern int yychar;
  132. extern int yyerrflag;
  133. #ifndef YYMAXDEPTH
  134. #define YYMAXDEPTH 150
  135. #endif
  136. YYSTYPE yylval, yyval;
  137. # define YYERRCODE 256
  138.  
  139. # line 943 "./c-exp.y"
  140.  
  141.  
  142. /* Take care of parsing a number (anything that starts with a digit).
  143.    Set yylval and return the token type; update lexptr.
  144.    LEN is the number of characters in it.  */
  145.  
  146. /*** Needs some error checking for the float case ***/
  147.  
  148. static int
  149. parse_number (p, len, parsed_float, putithere)
  150.      register char *p;
  151.      register int len;
  152.      int parsed_float;
  153.      YYSTYPE *putithere;
  154. {
  155.   register LONGEST n = 0;
  156.   register LONGEST prevn = 0;
  157.   register int i;
  158.   register int c;
  159.   register int base = input_radix;
  160.   int unsigned_p = 0;
  161.   int long_p = 0;
  162.   unsigned LONGEST high_bit;
  163.   struct type *signed_type;
  164.   struct type *unsigned_type;
  165.  
  166.   if (parsed_float)
  167.     {
  168.       /* It's a float since it contains a point or an exponent.  */
  169.       putithere->dval = atof (p);
  170.       return FLOAT;
  171.     }
  172.  
  173.   /* Handle base-switching prefixes 0x, 0t, 0d, 0 */
  174.   if (p[0] == '0')
  175.     switch (p[1])
  176.       {
  177.       case 'x':
  178.       case 'X':
  179.     if (len >= 3)
  180.       {
  181.         p += 2;
  182.         base = 16;
  183.         len -= 2;
  184.       }
  185.     break;
  186.  
  187.       case 't':
  188.       case 'T':
  189.       case 'd':
  190.       case 'D':
  191.     if (len >= 3)
  192.       {
  193.         p += 2;
  194.         base = 10;
  195.         len -= 2;
  196.       }
  197.     break;
  198.  
  199.       default:
  200.     base = 8;
  201.     break;
  202.       }
  203.  
  204.   while (len-- > 0)
  205.     {
  206.       c = *p++;
  207.       if (c >= 'A' && c <= 'Z')
  208.     c += 'a' - 'A';
  209.       if (c != 'l' && c != 'u')
  210.     n *= base;
  211.       if (c >= '0' && c <= '9')
  212.     n += i = c - '0';
  213.       else
  214.     {
  215.       if (base > 10 && c >= 'a' && c <= 'f')
  216.         n += i = c - 'a' + 10;
  217.       else if (len == 0 && c == 'l') 
  218.             long_p = 1;
  219.       else if (len == 0 && c == 'u')
  220.         unsigned_p = 1;
  221.       else
  222.         return ERROR;    /* Char not a digit */
  223.     }
  224.       if (i >= base)
  225.     return ERROR;        /* Invalid digit in this base */
  226.  
  227.       /* Portably test for overflow (only works for nonzero values, so make
  228.      a second check for zero).  */
  229.       if((prevn >= n) && n != 0)
  230.      unsigned_p=1;        /* Try something unsigned */
  231.       /* If range checking enabled, portably test for unsigned overflow.  */
  232.       if(RANGE_CHECK && n!=0)
  233.       {    
  234.      if((unsigned_p && (unsigned)prevn >= (unsigned)n))
  235.         range_error("Overflow on numeric constant.");     
  236.       }
  237.       prevn=n;
  238.     }
  239.  
  240.      /* If the number is too big to be an int, or it's got an l suffix
  241.     then it's a long.  Work out if this has to be a long by
  242.     shifting right and and seeing if anything remains, and the
  243.     target int size is different to the target long size.
  244.  
  245.     In the expression below, we could have tested
  246.             (n >> TARGET_INT_BIT)
  247.     to see if it was zero,
  248.     but too many compilers warn about that, when ints and longs
  249.     are the same size.  So we shift it twice, with fewer bits
  250.     each time, for the same result.  */
  251.  
  252.     if (   (TARGET_INT_BIT != TARGET_LONG_BIT 
  253.             && ((n >> 2) >> (TARGET_INT_BIT-2)))   /* Avoid shift warning */
  254.         || long_p)
  255.       {
  256.          high_bit = ((unsigned LONGEST)1) << (TARGET_LONG_BIT-1);
  257.      unsigned_type = builtin_type_unsigned_long;
  258.      signed_type = builtin_type_long;
  259.       }
  260.     else 
  261.       {
  262.      high_bit = ((unsigned LONGEST)1) << (TARGET_INT_BIT-1);
  263.      unsigned_type = builtin_type_unsigned_int;
  264.      signed_type = builtin_type_int;
  265.       }    
  266.  
  267.    putithere->typed_val.val = n;
  268.  
  269.    /* If the high bit of the worked out type is set then this number
  270.       has to be unsigned. */
  271.  
  272.    if (unsigned_p || (n & high_bit)) 
  273.      {
  274.         putithere->typed_val.type = unsigned_type;
  275.      }
  276.    else 
  277.      {
  278.         putithere->typed_val.type = signed_type;
  279.      }
  280.  
  281.    return INT;
  282. }
  283.  
  284. struct token
  285. {
  286.   char *operator;
  287.   int token;
  288.   enum exp_opcode opcode;
  289. };
  290.  
  291. static const struct token tokentab3[] =
  292.   {
  293.     {">>=", ASSIGN_MODIFY, BINOP_RSH},
  294.     {"<<=", ASSIGN_MODIFY, BINOP_LSH}
  295.   };
  296.  
  297. static const struct token tokentab2[] =
  298.   {
  299.     {"+=", ASSIGN_MODIFY, BINOP_ADD},
  300.     {"-=", ASSIGN_MODIFY, BINOP_SUB},
  301.     {"*=", ASSIGN_MODIFY, BINOP_MUL},
  302.     {"/=", ASSIGN_MODIFY, BINOP_DIV},
  303.     {"%=", ASSIGN_MODIFY, BINOP_REM},
  304.     {"|=", ASSIGN_MODIFY, BINOP_BITWISE_IOR},
  305.     {"&=", ASSIGN_MODIFY, BINOP_BITWISE_AND},
  306.     {"^=", ASSIGN_MODIFY, BINOP_BITWISE_XOR},
  307.     {"++", INCREMENT, BINOP_END},
  308.     {"--", DECREMENT, BINOP_END},
  309.     {"->", ARROW, BINOP_END},
  310.     {"&&", ANDAND, BINOP_END},
  311.     {"||", OROR, BINOP_END},
  312.     {"::", COLONCOLON, BINOP_END},
  313.     {"<<", LSH, BINOP_END},
  314.     {">>", RSH, BINOP_END},
  315.     {"==", EQUAL, BINOP_END},
  316.     {"!=", NOTEQUAL, BINOP_END},
  317.     {"<=", LEQ, BINOP_END},
  318.     {">=", GEQ, BINOP_END}
  319.   };
  320.  
  321. /* Read one token, getting characters through lexptr.  */
  322.  
  323. static int
  324. yylex ()
  325. {
  326.   int c;
  327.   int namelen;
  328.   unsigned int i;
  329.   char *tokstart;
  330.   char *tokptr;
  331.   int tempbufindex;
  332.   static char *tempbuf;
  333.   static int tempbufsize;
  334.   
  335.  retry:
  336.  
  337.   tokstart = lexptr;
  338.   /* See if it is a special token of length 3.  */
  339.   for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
  340.     if (STREQN (tokstart, tokentab3[i].operator, 3))
  341.       {
  342.     lexptr += 3;
  343.     yylval.opcode = tokentab3[i].opcode;
  344.     return tokentab3[i].token;
  345.       }
  346.  
  347.   /* See if it is a special token of length 2.  */
  348.   for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++)
  349.     if (STREQN (tokstart, tokentab2[i].operator, 2))
  350.       {
  351.     lexptr += 2;
  352.     yylval.opcode = tokentab2[i].opcode;
  353.     return tokentab2[i].token;
  354.       }
  355.  
  356.   switch (c = *tokstart)
  357.     {
  358.     case 0:
  359.       return 0;
  360.  
  361.     case ' ':
  362.     case '\t':
  363.     case '\n':
  364.       lexptr++;
  365.       goto retry;
  366.  
  367.     case '\'':
  368.       /* We either have a character constant ('0' or '\177' for example)
  369.      or we have a quoted symbol reference ('foo(int,int)' in C++
  370.      for example). */
  371.       lexptr++;
  372.       c = *lexptr++;
  373.       if (c == '\\')
  374.     c = parse_escape (&lexptr);
  375.  
  376.       yylval.typed_val.val = c;
  377.       yylval.typed_val.type = builtin_type_char;
  378.  
  379.       c = *lexptr++;
  380.       if (c != '\'')
  381.     {
  382.       namelen = skip_quoted (tokstart) - tokstart;
  383.       if (namelen > 2)
  384.         {
  385.           lexptr = tokstart + namelen;
  386.           namelen -= 2;
  387.           tokstart++;
  388.           goto tryname;
  389.         }
  390.       error ("Invalid character constant.");
  391.     }
  392.       return INT;
  393.  
  394.     case '(':
  395.       paren_depth++;
  396.       lexptr++;
  397.       return c;
  398.  
  399.     case ')':
  400.       if (paren_depth == 0)
  401.     return 0;
  402.       paren_depth--;
  403.       lexptr++;
  404.       return c;
  405.  
  406.     case ',':
  407.       if (comma_terminates && paren_depth == 0)
  408.     return 0;
  409.       lexptr++;
  410.       return c;
  411.  
  412.     case '.':
  413.       /* Might be a floating point number.  */
  414.       if (lexptr[1] < '0' || lexptr[1] > '9')
  415.     goto symbol;        /* Nope, must be a symbol. */
  416.       /* FALL THRU into number case.  */
  417.  
  418.     case '0':
  419.     case '1':
  420.     case '2':
  421.     case '3':
  422.     case '4':
  423.     case '5':
  424.     case '6':
  425.     case '7':
  426.     case '8':
  427.     case '9':
  428.       {
  429.     /* It's a number.  */
  430.     int got_dot = 0, got_e = 0, toktype;
  431.     register char *p = tokstart;
  432.     int hex = input_radix > 10;
  433.  
  434.     if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
  435.       {
  436.         p += 2;
  437.         hex = 1;
  438.       }
  439.     else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D'))
  440.       {
  441.         p += 2;
  442.         hex = 0;
  443.       }
  444.  
  445.     for (;; ++p)
  446.       {
  447.         if (!hex && !got_e && (*p == 'e' || *p == 'E'))
  448.           got_dot = got_e = 1;
  449.         else if (!hex && !got_dot && *p == '.')
  450.           got_dot = 1;
  451.         else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
  452.              && (*p == '-' || *p == '+'))
  453.           /* This is the sign of the exponent, not the end of the
  454.          number.  */
  455.           continue;
  456.         /* We will take any letters or digits.  parse_number will
  457.            complain if past the radix, or if L or U are not final.  */
  458.         else if ((*p < '0' || *p > '9')
  459.              && ((*p < 'a' || *p > 'z')
  460.                   && (*p < 'A' || *p > 'Z')))
  461.           break;
  462.       }
  463.     toktype = parse_number (tokstart, p - tokstart, got_dot|got_e, &yylval);
  464.         if (toktype == ERROR)
  465.       {
  466.         char *err_copy = (char *) alloca (p - tokstart + 1);
  467.  
  468.         memcpy (err_copy, tokstart, p - tokstart);
  469.         err_copy[p - tokstart] = 0;
  470.         error ("Invalid number \"%s\".", err_copy);
  471.       }
  472.     lexptr = p;
  473.     return toktype;
  474.       }
  475.  
  476.     case '+':
  477.     case '-':
  478.     case '*':
  479.     case '/':
  480.     case '%':
  481.     case '|':
  482.     case '&':
  483.     case '^':
  484.     case '~':
  485.     case '!':
  486.     case '@':
  487.     case '<':
  488.     case '>':
  489.     case '[':
  490.     case ']':
  491.     case '?':
  492.     case ':':
  493.     case '=':
  494.     case '{':
  495.     case '}':
  496.     symbol:
  497.       lexptr++;
  498.       return c;
  499.  
  500.     case '"':
  501.  
  502.       /* Build the gdb internal form of the input string in tempbuf,
  503.      translating any standard C escape forms seen.  Note that the
  504.      buffer is null byte terminated *only* for the convenience of
  505.      debugging gdb itself and printing the buffer contents when
  506.      the buffer contains no embedded nulls.  Gdb does not depend
  507.      upon the buffer being null byte terminated, it uses the length
  508.      string instead.  This allows gdb to handle C strings (as well
  509.      as strings in other languages) with embedded null bytes */
  510.  
  511.       tokptr = ++tokstart;
  512.       tempbufindex = 0;
  513.  
  514.       do {
  515.     /* Grow the static temp buffer if necessary, including allocating
  516.        the first one on demand. */
  517.     if (tempbufindex + 1 >= tempbufsize)
  518.       {
  519.         tempbuf = (char *) xrealloc (tempbuf, tempbufsize += 64);
  520.       }
  521.     switch (*tokptr)
  522.       {
  523.       case '\0':
  524.       case '"':
  525.         /* Do nothing, loop will terminate. */
  526.         break;
  527.       case '\\':
  528.         tokptr++;
  529.         c = parse_escape (&tokptr);
  530.         if (c == -1)
  531.           {
  532.         continue;
  533.           }
  534.         tempbuf[tempbufindex++] = c;
  535.         break;
  536.       default:
  537.         tempbuf[tempbufindex++] = *tokptr++;
  538.         break;
  539.       }
  540.       } while ((*tokptr != '"') && (*tokptr != '\0'));
  541.       if (*tokptr++ != '"')
  542.     {
  543.       error ("Unterminated string in expression.");
  544.     }
  545.       tempbuf[tempbufindex] = '\0';    /* See note above */
  546.       yylval.sval.ptr = tempbuf;
  547.       yylval.sval.length = tempbufindex;
  548.       lexptr = tokptr;
  549.       return (STRING);
  550.     }
  551.  
  552.   if (!(c == '_' || c == '$'
  553.     || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
  554.     /* We must have come across a bad character (e.g. ';').  */
  555.     error ("Invalid character '%c' in expression.", c);
  556.  
  557.   /* It's a name.  See how long it is.  */
  558.   namelen = 0;
  559.   for (c = tokstart[namelen];
  560.        (c == '_' || c == '$' || (c >= '0' && c <= '9')
  561.     || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
  562.        c = tokstart[++namelen])
  563.     ;
  564.  
  565.   /* The token "if" terminates the expression and is NOT 
  566.      removed from the input stream.  */
  567.   if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f')
  568.     {
  569.       return 0;
  570.     }
  571.  
  572.   lexptr += namelen;
  573.  
  574.   /* Handle the tokens $digits; also $ (short for $0) and $$ (short for $$1)
  575.      and $$digits (equivalent to $<-digits> if you could type that).
  576.      Make token type LAST, and put the number (the digits) in yylval.  */
  577.  
  578.   tryname:
  579.   if (*tokstart == '$')
  580.     {
  581.       register int negate = 0;
  582.       c = 1;
  583.       /* Double dollar means negate the number and add -1 as well.
  584.      Thus $$ alone means -1.  */
  585.       if (namelen >= 2 && tokstart[1] == '$')
  586.     {
  587.       negate = 1;
  588.       c = 2;
  589.     }
  590.       if (c == namelen)
  591.     {
  592.       /* Just dollars (one or two) */
  593.       yylval.lval = - negate;
  594.       return LAST;
  595.     }
  596.       /* Is the rest of the token digits?  */
  597.       for (; c < namelen; c++)
  598.     if (!(tokstart[c] >= '0' && tokstart[c] <= '9'))
  599.       break;
  600.       if (c == namelen)
  601.     {
  602.       yylval.lval = atoi (tokstart + 1 + negate);
  603.       if (negate)
  604.         yylval.lval = - yylval.lval;
  605.       return LAST;
  606.     }
  607.     }
  608.  
  609.   /* Handle tokens that refer to machine registers:
  610.      $ followed by a register name.  */
  611.  
  612.   if (*tokstart == '$') {
  613.     for (c = 0; c < NUM_REGS; c++)
  614.       if (namelen - 1 == strlen (reg_names[c])
  615.       && STREQN (tokstart + 1, reg_names[c], namelen - 1))
  616.     {
  617.       yylval.lval = c;
  618.       return REGNAME;
  619.     }
  620.     for (c = 0; c < num_std_regs; c++)
  621.      if (namelen - 1 == strlen (std_regs[c].name)
  622.      && STREQN (tokstart + 1, std_regs[c].name, namelen - 1))
  623.        {
  624.      yylval.lval = std_regs[c].regnum;
  625.      return REGNAME;
  626.        }
  627.   }
  628.   /* Catch specific keywords.  Should be done with a data structure.  */
  629.   switch (namelen)
  630.     {
  631.     case 8:
  632.       if (STREQN (tokstart, "unsigned", 8))
  633.     return UNSIGNED;
  634.       if (current_language->la_language == language_cplus
  635.       && STREQN (tokstart, "template", 8))
  636.     return TEMPLATE;
  637.       if (STREQN (tokstart, "volatile", 8))
  638.     return VOLATILE_KEYWORD;
  639.       break;
  640.     case 6:
  641.       if (STREQN (tokstart, "struct", 6))
  642.     return STRUCT;
  643.       if (STREQN (tokstart, "signed", 6))
  644.     return SIGNED_KEYWORD;
  645.       if (STREQN (tokstart, "sizeof", 6))      
  646.     return SIZEOF;
  647.       break;
  648.     case 5:
  649.       if (current_language->la_language == language_cplus
  650.       && STREQN (tokstart, "class", 5))
  651.     return CLASS;
  652.       if (STREQN (tokstart, "union", 5))
  653.     return UNION;
  654.       if (STREQN (tokstart, "short", 5))
  655.     return SHORT;
  656.       if (STREQN (tokstart, "const", 5))
  657.     return CONST_KEYWORD;
  658.       break;
  659.     case 4:
  660.       if (STREQN (tokstart, "enum", 4))
  661.     return ENUM;
  662.       if (STREQN (tokstart, "long", 4))
  663.     return LONG;
  664.       if (current_language->la_language == language_cplus
  665.       && STREQN (tokstart, "this", 4))
  666.     {
  667.       static const char this_name[] =
  668.                  { CPLUS_MARKER, 't', 'h', 'i', 's', '\0' };
  669.  
  670.       if (lookup_symbol (this_name, expression_context_block,
  671.                  VAR_NAMESPACE, 0, NULL))
  672.         return THIS;
  673.     }
  674.       break;
  675.     case 3:
  676.       if (STREQN (tokstart, "int", 3))
  677.     return INT_KEYWORD;
  678.       break;
  679.     default:
  680.       break;
  681.     }
  682.  
  683.   yylval.sval.ptr = tokstart;
  684.   yylval.sval.length = namelen;
  685.  
  686.   /* Any other names starting in $ are debugger internal variables.  */
  687.  
  688.   if (*tokstart == '$')
  689.     {
  690.       yylval.ivar =  lookup_internalvar (copy_name (yylval.sval) + 1);
  691.       return VARIABLE;
  692.     }
  693.  
  694.   /* Use token-type BLOCKNAME for symbols that happen to be defined as
  695.      functions or symtabs.  If this is not so, then ...
  696.      Use token-type TYPENAME for symbols that happen to be defined
  697.      currently as names of types; NAME for other symbols.
  698.      The caller is not constrained to care about the distinction.  */
  699.   {
  700.     char *tmp = copy_name (yylval.sval);
  701.     struct symbol *sym;
  702.     int is_a_field_of_this = 0;
  703.     int hextype;
  704.  
  705.     sym = lookup_symbol (tmp, expression_context_block,
  706.              VAR_NAMESPACE,
  707.              current_language->la_language == language_cplus
  708.              ? &is_a_field_of_this : NULL,
  709.              NULL);
  710.     if ((sym && SYMBOL_CLASS (sym) == LOC_BLOCK) ||
  711.         lookup_partial_symtab (tmp))
  712.       {
  713.     yylval.ssym.sym = sym;
  714.     yylval.ssym.is_a_field_of_this = is_a_field_of_this;
  715.     return BLOCKNAME;
  716.       }
  717.     if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
  718.         {
  719.       yylval.tsym.type = SYMBOL_TYPE (sym);
  720.       return TYPENAME;
  721.         }
  722.     if ((yylval.tsym.type = lookup_primitive_typename (tmp)) != 0)
  723.     return TYPENAME;
  724.  
  725.     /* Input names that aren't symbols but ARE valid hex numbers,
  726.        when the input radix permits them, can be names or numbers
  727.        depending on the parse.  Note we support radixes > 16 here.  */
  728.     if (!sym && 
  729.         ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10) ||
  730.          (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
  731.       {
  732.      YYSTYPE newlval;    /* Its value is ignored.  */
  733.     hextype = parse_number (tokstart, namelen, 0, &newlval);
  734.     if (hextype == INT)
  735.       {
  736.         yylval.ssym.sym = sym;
  737.         yylval.ssym.is_a_field_of_this = is_a_field_of_this;
  738.         return NAME_OR_INT;
  739.       }
  740.       }
  741.  
  742.     /* Any other kind of symbol */
  743.     yylval.ssym.sym = sym;
  744.     yylval.ssym.is_a_field_of_this = is_a_field_of_this;
  745.     return NAME;
  746.   }
  747. }
  748.  
  749. void
  750. yyerror (msg)
  751.      char *msg;
  752. {
  753.   error (msg ? msg : "Invalid syntax in expression.");
  754. }
  755. int yyexca[] ={
  756. -1, 1,
  757.     0, -1,
  758.     -2, 0,
  759. -1, 45,
  760.     269, 66,
  761.     -2, 129,
  762. -1, 129,
  763.     269, 95,
  764.     -2, 126,
  765. -1, 181,
  766.     269, 67,
  767.     -2, 68,
  768.     };
  769. # define YYNPROD 130
  770. # define YYLAST 1038
  771. int yyact[]={
  772.  
  773.      9,    57,   203,   185,    53,     7,    55,    15,   182,     6,
  774.     51,    56,     8,   167,   103,   105,   106,    32,   109,    37,
  775.     38,    39,    40,   184,    36,   183,    42,   192,    41,    34,
  776.     35,    33,    43,    44,   168,   158,   108,    53,   107,   101,
  777.      9,   179,    87,    51,   113,     7,    76,    86,   113,     6,
  778.    104,   202,     8,    98,    99,    52,   120,   121,   114,   173,
  779.    110,   111,   114,    95,    95,    97,    97,    94,    94,    93,
  780.     76,    47,   160,    95,   161,    97,   186,    94,    47,   214,
  781.      9,   176,   200,    91,     2,   168,   205,    15,    52,   160,
  782.     27,   207,   209,    10,    29,    76,   193,   199,    57,    68,
  783.    200,    53,   211,    55,    58,   210,    59,    51,    56,   165,
  784.    100,   198,    47,    76,   164,    76,   100,   100,   167,   191,
  785.    189,    66,    74,    67,    73,    54,   100,   134,    28,    31,
  786.     27,   162,    25,    10,    57,    68,   133,    53,   112,    55,
  787.     58,   132,    59,    51,    56,   127,   131,   103,   105,   106,
  788.    171,   172,    52,   162,    96,    69,    14,    66,    74,    67,
  789.     73,    54,    19,   163,   169,   170,    57,   174,     1,    53,
  790.     27,    55,    58,    10,    59,    51,    56,   190,     3,     0,
  791.    119,     0,     0,   104,     0,    70,     0,     0,    52,     0,
  792.      0,    69,     0,    54,     0,     0,     0,     0,     0,     0,
  793.      0,     0,     0,     0,     0,   180,     0,     0,     0,     0,
  794.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  795.     52,    70,     0,     0,    16,    18,    23,    46,    32,    17,
  796.     37,    38,    39,    40,    13,    36,    30,    42,     0,    41,
  797.     34,    35,    33,    43,    44,    20,    21,    22,     0,    24,
  798.      0,     0,   103,   105,   106,     0,     0,    48,    49,    50,
  799.     11,    12,     0,    45,    16,    18,    23,    46,    32,    17,
  800.     37,    38,    39,    40,    13,    36,    30,    42,     0,    41,
  801.     34,    35,    33,    43,    44,    20,    21,    22,   104,    24,
  802.     48,    49,    50,   213,   201,    92,     0,     0,     0,     0,
  803.     11,    12,     0,    45,    16,    18,    23,    46,    32,    17,
  804.     37,    38,    39,    40,    13,    36,    30,    42,     0,    41,
  805.     34,    35,    33,    43,    44,    20,    21,    22,     0,    24,
  806.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  807.     11,    12,    75,    45,   128,    72,    71,    62,    63,    64,
  808.     65,    60,    61,     0,    48,    49,    50,     0,     0,   103,
  809.    129,   106,    37,    38,    39,    40,     0,    36,     0,    42,
  810.      0,    41,    34,    35,    33,    43,    44,   212,    75,     0,
  811.      0,    72,    71,    62,    63,    64,    65,    60,    61,     0,
  812.     48,    49,    50,    57,    68,   104,    53,     0,    55,    58,
  813.      0,    59,    51,    56,    57,    68,     0,    53,     0,    55,
  814.     58,     0,    59,    51,    56,     0,    66,     0,    67,    73,
  815.     54,     0,    48,    49,    50,     0,     0,    66,     0,    67,
  816.      0,    54,    57,    68,     0,    53,     0,    55,    58,     0,
  817.     59,    51,    56,    57,    68,     0,    53,    52,    55,    58,
  818.     69,    59,    51,    56,     0,    66,     0,    67,    52,    54,
  819.      0,    69,     0,     0,     0,     0,    66,     0,    67,    57,
  820.     54,     0,    53,     0,    55,    58,     0,    59,    51,    56,
  821.     70,    95,     0,    97,   175,    94,    52,     0,     0,    69,
  822.      0,    70,     0,    57,    68,     0,    53,    52,    55,    58,
  823.     69,    59,    51,    56,    57,     0,     0,    53,     0,    55,
  824.     58,     0,    59,    51,    56,     0,    66,     0,    67,    70,
  825.     54,     0,     0,    52,     0,     0,     0,    66,     0,    67,
  826.     57,    54,     0,    53,   100,    55,    58,     0,    59,    51,
  827.     56,     0,     0,   175,     0,     0,     0,    52,     0,     0,
  828.      0,     0,     0,    66,     0,    67,     0,    54,    52,     0,
  829.      0,     0,   103,   129,   106,    37,    38,    39,    40,     0,
  830.     36,     0,    42,     0,    41,    34,    35,    33,    43,    44,
  831.     57,     0,     0,    53,    52,    55,    58,     0,    59,    51,
  832.     56,     0,     0,     0,     0,     0,     0,    32,   104,    37,
  833.     38,    39,    40,     0,    36,     0,    42,    54,    41,    34,
  834.     35,    33,    43,    44,     0,     0,     0,     0,     0,     0,
  835.      0,     0,     0,   177,     5,     0,     0,     0,   166,     0,
  836.      0,     0,     0,     0,    52,     0,     0,     0,    88,    90,
  837.     72,    71,    62,    63,    64,    65,    60,    61,     0,    48,
  838.     49,    50,    71,    62,    63,    64,    65,    60,    61,   102,
  839.     48,    49,    50,     0,     0,     0,   115,   116,   117,   118,
  840.      0,   122,     0,     0,     0,     0,     0,     0,     0,   126,
  841.    130,    62,    63,    64,    65,    60,    61,     0,    48,    49,
  842.     50,     0,    62,    63,    64,    65,    60,    61,     0,    48,
  843.     49,    50,     0,     0,    32,     0,    37,    38,    39,    40,
  844.    159,    36,     0,    42,     0,    41,    34,    35,    33,    43,
  845.     44,     0,     0,     0,     0,    48,    49,    50,     0,     0,
  846.    181,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  847.      0,     0,    62,    63,    64,    65,    60,    61,     0,    48,
  848.     49,    50,     0,    62,    63,    64,    65,    60,    61,     0,
  849.     48,    49,    50,    32,     0,    37,    38,    39,    40,     0,
  850.     36,     0,    42,     0,    41,    34,    35,    33,    43,    44,
  851.      0,    64,    65,    60,    61,     0,    48,    49,    50,     0,
  852.      0,     4,     0,     0,     0,     0,   197,     0,    77,    79,
  853.     80,    81,    82,    83,    84,    85,    89,     0,     0,     0,
  854.    204,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  855.      0,     0,     0,     0,   208,    78,    26,     0,     0,     0,
  856.      0,     0,     0,    60,    61,     0,    48,    49,    50,   125,
  857.     26,    26,     0,     0,     0,     0,   135,   136,   137,   138,
  858.    139,   140,   141,   142,   143,   144,   145,   146,   147,   148,
  859.    149,   150,   151,   152,   153,   154,   155,   156,     0,   123,
  860.    124,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  861.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  862.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  863.      0,     0,   157,     0,     0,     0,     0,     0,     0,     0,
  864.      0,     0,    26,     0,     0,     0,     0,     0,     0,     0,
  865.    187,     0,     0,   178,   188,     0,    89,     0,     0,     0,
  866.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  867.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  868.      0,     0,   194,     0,     0,   195,   196,     0,     0,     0,
  869.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  870.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  871.      0,     0,     0,   206,     0,   196,     0,     0,     0,     0,
  872.      0,     0,     0,     0,     0,     0,     0,     0,     0,   178,
  873.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  874.      0,     0,   178,     0,     0,     0,     0,     0,     0,     0,
  875.      0,     0,     0,     0,     0,     0,   178,     0,     0,     0,
  876.      0,     0,     0,     0,     0,     0,     0,   178 };
  877. int yypact[]={
  878.  
  879.    -33, -1000,    34, -1000,    97,    75,   -33,   -33,   -33,   -33,
  880.    -33,   -33,   -33,     7,   -33,   -33, -1000, -1000, -1000, -1000,
  881.  -1000, -1000, -1000, -1000, -1000, -1000,    26, -1000,  -230, -1000,
  882.   -246, -1000, -1000, -1000,  -237,  -257,  -213,  -246,  -246,  -246,
  883.   -246,  -217,  -246,  -244,  -244, -1000, -1000,   -33, -1000, -1000,
  884.    302,    99,   -33, -1000,   -33,   -33,   -33,   -33,   -33,   -33,
  885.    -33,   -33,   -33,   -33,   -33,   -33,   -33,   -33,   -33,   -33,
  886.    -33,   -33,   -33,   -33,   -33,   -33,  -244,    -3,  -234,    -3,
  887.     -3,    -3,    -3,    -3,    -3,    -3,   -33,    28,     6,    97,
  888.     73,    68,    -8, -1000,    35,    35,    19,   443, -1000, -1000,
  889.    -52,  -246, -1000, -1000, -1000, -1000, -1000, -1000,  -267, -1000,
  890.   -250,  -272, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
  891.  -1000, -1000,    16, -1000, -1000,    97, -1000, -1000,   -33, -1000,
  892.  -1000, -1000,   -33,    27,   -33,   432,    -3,    -3,    -3,   -36,
  893.    -36,   129,   129,   493,   493,   543,   543,   543,   543,   467,
  894.    456,   406,   395,   367,    61,    97,    97,  -242,  -113,    55,
  895.    -33, -1000, -1000,   -33,   -33, -1000, -1000,  -246, -1000, -1000,
  896.  -1000, -1000, -1000,   502,    70, -1000,    56,    75,    25, -1000,
  897.    -42, -1000, -1000, -1000,  -273, -1000,  -244,    -3,    -3, -1000,
  898.     45,   -33,    49,    47,    97,    -3,    -3, -1000, -1000, -1000,
  899.   -244,    43, -1000, -1000,    30, -1000,   356,    64,    75, -1000,
  900.     62,   336, -1000,    38, -1000 };
  901. int yypgo[]={
  902.  
  903.      0,   791,    83,   178,   168,   162,    94,   156,    74,   623,
  904.    825,    81,    54,   154,    69,   132,    53,   628,   129,   138,
  905.    128,   127,    42 };
  906. int yyr1[]={
  907.  
  908.      0,     4,     4,     3,     2,     2,     1,     1,     1,     1,
  909.      1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
  910.      1,     1,     1,    21,     1,     7,    22,    22,    22,     8,
  911.      1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
  912.      1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
  913.      1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
  914.      1,     1,     1,     1,     1,     1,    20,    20,     5,     6,
  915.      6,     5,     5,     5,    15,    15,    14,    14,    14,    14,
  916.     14,    13,    13,    13,    13,    13,    16,    16,    12,    12,
  917.      9,     9,     9,     9,     9,    10,    10,    10,    10,    10,
  918.     10,    10,    10,    10,    10,    10,    10,    10,    10,    10,
  919.     10,    10,    10,    10,    10,    10,    10,    10,    19,    19,
  920.     19,    19,    11,    11,    17,    17,    17,    17,    18,    18 };
  921. int yyr2[]={
  922.  
  923.      0,     2,     2,     3,     2,     7,     5,     5,     5,     5,
  924.      5,     5,     5,     5,     5,     5,     7,     7,     9,     7,
  925.      7,     9,     9,     1,    11,     3,     0,     3,     7,     3,
  926.      7,     9,     9,     7,     7,     7,     7,     7,     7,     7,
  927.      7,     7,     7,     7,     7,     7,     7,     7,     7,     7,
  928.      7,     7,     7,    11,     7,     7,     3,     3,     3,     2,
  929.      3,     3,     3,     9,     3,     3,     3,     7,     7,     7,
  930.      9,     2,     5,     3,     2,     5,     3,     5,     3,     5,
  931.      2,     7,     5,     3,     5,     3,     5,     7,     5,     7,
  932.      2,     7,    13,    17,    19,     3,     3,     3,     3,     5,
  933.      7,     5,     7,     7,     9,     5,     7,     5,     5,     5,
  934.      5,     5,     3,     5,     3,    11,     5,     5,     2,     3,
  935.      3,     3,     3,     7,     3,     3,     3,     3,     2,     2 };
  936. int yychk[]={
  937.  
  938.  -1000,    -4,    -2,    -3,    -1,    -9,    42,    38,    45,    33,
  939.    126,   293,   294,   267,    -7,    40,   257,   262,   258,    -5,
  940.    278,   279,   280,   259,   282,   -15,   -10,   123,   -20,    -6,
  941.    269,   -18,   261,   275,   273,   274,   268,   263,   264,   265,
  942.    266,   272,   270,   276,   277,   296,   260,    44,   293,   294,
  943.    295,    46,    91,    40,    64,    42,    47,    37,    43,    45,
  944.    290,   291,   286,   287,   288,   289,    60,    62,    38,    94,
  945.    124,   285,   284,    63,    61,   281,    40,    -1,   -10,    -1,
  946.     -1,    -1,    -1,    -1,    -1,    -1,    40,   -22,    -9,    -1,
  947.     -9,    -2,   269,   -14,    42,    38,   -13,    40,   -16,   -12,
  948.     91,   269,   -17,   260,   296,   261,   262,   275,   273,   275,
  949.    273,   274,   -19,   261,   275,   -17,   -17,   -17,   -17,   -19,
  950.    273,   274,   -17,   -10,   -10,    -1,   -17,    -6,    42,   261,
  951.    -17,    -6,    42,    -2,   -21,    -1,    -1,    -1,    -1,    -1,
  952.     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
  953.     -1,    -1,    -1,    -1,    -1,    -1,    -1,   -10,   269,    -9,
  954.     44,    -8,   125,    -8,    41,    41,   -17,   126,    42,   -14,
  955.    -14,   -16,   -12,    40,   -14,    41,   -11,    -9,   -10,    93,
  956.    257,   -17,   275,   275,   273,   275,    60,    -1,    -1,    93,
  957.    -22,    58,   269,    41,    -1,    -1,    -1,   -17,    41,    41,
  958.     44,   269,    93,   275,    -9,    41,    -1,    42,    -9,    62,
  959.     41,    40,    41,   -11,    41 };
  960. int yydef[]={
  961.  
  962.      0,    -2,     1,     2,     4,     3,     0,     0,     0,     0,
  963.      0,     0,     0,     0,    26,     0,    56,    57,    58,    59,
  964.     60,    61,    62,    64,    65,    90,    74,    25,     0,    71,
  965.      0,    73,    95,    96,    97,    98,   112,     0,     0,     0,
  966.      0,   114,     0,     0,     0,    -2,   128,     0,    13,    14,
  967.      0,     0,     0,    23,     0,     0,     0,     0,     0,     0,
  968.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  969.      0,     0,     0,     0,     0,     0,     0,     6,     0,     7,
  970.      8,     9,    10,    11,    12,    15,     0,     0,     0,    27,
  971.      0,     0,     0,    75,    76,    78,    80,     0,    83,    85,
  972.      0,     0,    72,   124,   125,   126,   127,    99,   101,   105,
  973.    120,   121,   111,   118,   119,   107,   108,   109,   110,   113,
  974.    120,   121,     0,   116,   117,     5,    16,    17,     0,    -2,
  975.     19,    20,     0,     0,    26,    34,    35,    36,    37,    38,
  976.     39,    40,    41,    42,    43,    44,    45,    46,    47,    48,
  977.     49,    50,    51,    52,     0,    54,    55,     0,     0,     0,
  978.      0,    30,    29,     0,     0,    33,    69,     0,    91,    77,
  979.     79,    82,    84,     0,     0,    88,     0,   122,    74,    86,
  980.      0,    -2,   102,   100,   103,   106,     0,    18,    21,    22,
  981.      0,     0,     0,    63,    28,    31,    32,    70,    81,    89,
  982.      0,     0,    87,   104,     0,    24,    53,     0,   123,   115,
  983.     92,     0,    93,     0,    94 };
  984. typedef struct { char *t_name; int t_val; } yytoktype;
  985. #ifndef YYDEBUG
  986. #    define YYDEBUG    0    /* don't allow debugging */
  987. #endif
  988.  
  989. #if YYDEBUG
  990.  
  991. yytoktype yytoks[] =
  992. {
  993.     "INT",    257,
  994.     "FLOAT",    258,
  995.     "STRING",    259,
  996.     "NAME",    260,
  997.     "TYPENAME",    261,
  998.     "NAME_OR_INT",    262,
  999.     "STRUCT",    263,
  1000.     "CLASS",    264,
  1001.     "UNION",    265,
  1002.     "ENUM",    266,
  1003.     "SIZEOF",    267,
  1004.     "UNSIGNED",    268,
  1005.     "COLONCOLON",    269,
  1006.     "TEMPLATE",    270,
  1007.     "ERROR",    271,
  1008.     "SIGNED_KEYWORD",    272,
  1009.     "LONG",    273,
  1010.     "SHORT",    274,
  1011.     "INT_KEYWORD",    275,
  1012.     "CONST_KEYWORD",    276,
  1013.     "VOLATILE_KEYWORD",    277,
  1014.     "LAST",    278,
  1015.     "REGNAME",    279,
  1016.     "VARIABLE",    280,
  1017.     "ASSIGN_MODIFY",    281,
  1018.     "THIS",    282,
  1019.     ",",    44,
  1020.     "ABOVE_COMMA",    283,
  1021.     "=",    61,
  1022.     "?",    63,
  1023.     "OROR",    284,
  1024.     "ANDAND",    285,
  1025.     "|",    124,
  1026.     "^",    94,
  1027.     "&",    38,
  1028.     "EQUAL",    286,
  1029.     "NOTEQUAL",    287,
  1030.     "<",    60,
  1031.     ">",    62,
  1032.     "LEQ",    288,
  1033.     "GEQ",    289,
  1034.     "LSH",    290,
  1035.     "RSH",    291,
  1036.     "@",    64,
  1037.     "+",    43,
  1038.     "-",    45,
  1039.     "*",    42,
  1040.     "/",    47,
  1041.     "%",    37,
  1042.     "UNARY",    292,
  1043.     "INCREMENT",    293,
  1044.     "DECREMENT",    294,
  1045.     "ARROW",    295,
  1046.     ".",    46,
  1047.     "[",    91,
  1048.     "(",    40,
  1049.     "BLOCKNAME",    296,
  1050.     "-unknown-",    -1    /* ends search */
  1051. };
  1052.  
  1053. char * yyreds[] =
  1054. {
  1055.     "-no such reduction-",
  1056.     "start : exp1",
  1057.     "start : type_exp",
  1058.     "type_exp : type",
  1059.     "exp1 : exp",
  1060.     "exp1 : exp1 ',' exp",
  1061.     "exp : '*' exp",
  1062.     "exp : '&' exp",
  1063.     "exp : '-' exp",
  1064.     "exp : '!' exp",
  1065.     "exp : '~' exp",
  1066.     "exp : INCREMENT exp",
  1067.     "exp : DECREMENT exp",
  1068.     "exp : exp INCREMENT",
  1069.     "exp : exp DECREMENT",
  1070.     "exp : SIZEOF exp",
  1071.     "exp : exp ARROW name",
  1072.     "exp : exp ARROW qualified_name",
  1073.     "exp : exp ARROW '*' exp",
  1074.     "exp : exp '.' name",
  1075.     "exp : exp '.' qualified_name",
  1076.     "exp : exp '.' '*' exp",
  1077.     "exp : exp '[' exp1 ']'",
  1078.     "exp : exp '('",
  1079.     "exp : exp '(' arglist ')'",
  1080.     "lcurly : '{'",
  1081.     "arglist : /* empty */",
  1082.     "arglist : exp",
  1083.     "arglist : arglist ',' exp",
  1084.     "rcurly : '}'",
  1085.     "exp : lcurly arglist rcurly",
  1086.     "exp : lcurly type rcurly exp",
  1087.     "exp : '(' type ')' exp",
  1088.     "exp : '(' exp1 ')'",
  1089.     "exp : exp '@' exp",
  1090.     "exp : exp '*' exp",
  1091.     "exp : exp '/' exp",
  1092.     "exp : exp '%' exp",
  1093.     "exp : exp '+' exp",
  1094.     "exp : exp '-' exp",
  1095.     "exp : exp LSH exp",
  1096.     "exp : exp RSH exp",
  1097.     "exp : exp EQUAL exp",
  1098.     "exp : exp NOTEQUAL exp",
  1099.     "exp : exp LEQ exp",
  1100.     "exp : exp GEQ exp",
  1101.     "exp : exp '<' exp",
  1102.     "exp : exp '>' exp",
  1103.     "exp : exp '&' exp",
  1104.     "exp : exp '^' exp",
  1105.     "exp : exp '|' exp",
  1106.     "exp : exp ANDAND exp",
  1107.     "exp : exp OROR exp",
  1108.     "exp : exp '?' exp ':' exp",
  1109.     "exp : exp '=' exp",
  1110.     "exp : exp ASSIGN_MODIFY exp",
  1111.     "exp : INT",
  1112.     "exp : NAME_OR_INT",
  1113.     "exp : FLOAT",
  1114.     "exp : variable",
  1115.     "exp : LAST",
  1116.     "exp : REGNAME",
  1117.     "exp : VARIABLE",
  1118.     "exp : SIZEOF '(' type ')'",
  1119.     "exp : STRING",
  1120.     "exp : THIS",
  1121.     "block : BLOCKNAME",
  1122.     "block : block COLONCOLON name",
  1123.     "variable : block COLONCOLON name",
  1124.     "qualified_name : typebase COLONCOLON name",
  1125.     "qualified_name : typebase COLONCOLON '~' name",
  1126.     "variable : qualified_name",
  1127.     "variable : COLONCOLON name",
  1128.     "variable : name_not_typename",
  1129.     "ptype : typebase",
  1130.     "ptype : typebase abs_decl",
  1131.     "abs_decl : '*'",
  1132.     "abs_decl : '*' abs_decl",
  1133.     "abs_decl : '&'",
  1134.     "abs_decl : '&' abs_decl",
  1135.     "abs_decl : direct_abs_decl",
  1136.     "direct_abs_decl : '(' abs_decl ')'",
  1137.     "direct_abs_decl : direct_abs_decl array_mod",
  1138.     "direct_abs_decl : array_mod",
  1139.     "direct_abs_decl : direct_abs_decl func_mod",
  1140.     "direct_abs_decl : func_mod",
  1141.     "array_mod : '[' ']'",
  1142.     "array_mod : '[' INT ']'",
  1143.     "func_mod : '(' ')'",
  1144.     "func_mod : '(' nonempty_typelist ')'",
  1145.     "type : ptype",
  1146.     "type : typebase COLONCOLON '*'",
  1147.     "type : type '(' typebase COLONCOLON '*' ')'",
  1148.     "type : type '(' typebase COLONCOLON '*' ')' '(' ')'",
  1149.     "type : type '(' typebase COLONCOLON '*' ')' '(' nonempty_typelist ')'",
  1150.     "typebase : TYPENAME",
  1151.     "typebase : INT_KEYWORD",
  1152.     "typebase : LONG",
  1153.     "typebase : SHORT",
  1154.     "typebase : LONG INT_KEYWORD",
  1155.     "typebase : UNSIGNED LONG INT_KEYWORD",
  1156.     "typebase : LONG LONG",
  1157.     "typebase : LONG LONG INT_KEYWORD",
  1158.     "typebase : UNSIGNED LONG LONG",
  1159.     "typebase : UNSIGNED LONG LONG INT_KEYWORD",
  1160.     "typebase : SHORT INT_KEYWORD",
  1161.     "typebase : UNSIGNED SHORT INT_KEYWORD",
  1162.     "typebase : STRUCT name",
  1163.     "typebase : CLASS name",
  1164.     "typebase : UNION name",
  1165.     "typebase : ENUM name",
  1166.     "typebase : UNSIGNED typename",
  1167.     "typebase : UNSIGNED",
  1168.     "typebase : SIGNED_KEYWORD typename",
  1169.     "typebase : SIGNED_KEYWORD",
  1170.     "typebase : TEMPLATE name '<' type '>'",
  1171.     "typebase : CONST_KEYWORD typebase",
  1172.     "typebase : VOLATILE_KEYWORD typebase",
  1173.     "typename : TYPENAME",
  1174.     "typename : INT_KEYWORD",
  1175.     "typename : LONG",
  1176.     "typename : SHORT",
  1177.     "nonempty_typelist : type",
  1178.     "nonempty_typelist : nonempty_typelist ',' type",
  1179.     "name : NAME",
  1180.     "name : BLOCKNAME",
  1181.     "name : TYPENAME",
  1182.     "name : NAME_OR_INT",
  1183.     "name_not_typename : NAME",
  1184.     "name_not_typename : BLOCKNAME",
  1185. };
  1186. #endif /* YYDEBUG */
  1187. #line 1 "/usr/lib/yaccpar"
  1188. /*    @(#)yaccpar 1.10 89/04/04 SMI; from S5R3 1.10    */
  1189.  
  1190. /*
  1191. ** Skeleton parser driver for yacc output
  1192. */
  1193.  
  1194. /*
  1195. ** yacc user known macros and defines
  1196. */
  1197. #define YYERROR        goto yyerrlab
  1198. #define YYACCEPT    { free(yys); free(yyv); return(0); }
  1199. #define YYABORT        { free(yys); free(yyv); return(1); }
  1200. #define YYBACKUP( newtoken, newvalue )\
  1201. {\
  1202.     if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\
  1203.     {\
  1204.         yyerror( "syntax error - cannot backup" );\
  1205.         goto yyerrlab;\
  1206.     }\
  1207.     yychar = newtoken;\
  1208.     yystate = *yyps;\
  1209.     yylval = newvalue;\
  1210.     goto yynewstate;\
  1211. }
  1212. #define YYRECOVERING()    (!!yyerrflag)
  1213. #ifndef YYDEBUG
  1214. #    define YYDEBUG    1    /* make debugging available */
  1215. #endif
  1216.  
  1217. /*
  1218. ** user known globals
  1219. */
  1220. int yydebug;            /* set to 1 to get debugging */
  1221.  
  1222. /*
  1223. ** driver internal defines
  1224. */
  1225. #define YYFLAG        (-1000)
  1226.  
  1227. /*
  1228. ** static variables used by the parser
  1229. */
  1230. static YYSTYPE *yyv;            /* value stack */
  1231. static int *yys;            /* state stack */
  1232.  
  1233. static YYSTYPE *yypv;            /* top of value stack */
  1234. static int *yyps;            /* top of state stack */
  1235.  
  1236. static int yystate;            /* current state */
  1237. static int yytmp;            /* extra var (lasts between blocks) */
  1238.  
  1239. int yynerrs;            /* number of errors */
  1240.  
  1241. int yyerrflag;            /* error recovery flag */
  1242. int yychar;            /* current input token number */
  1243.  
  1244.  
  1245. /*
  1246. ** yyparse - return 0 if worked, 1 if syntax error not recovered from
  1247. */
  1248. int
  1249. yyparse()
  1250. {
  1251.     register YYSTYPE *yypvt;    /* top of value stack for $vars */
  1252.     unsigned yymaxdepth = YYMAXDEPTH;
  1253.  
  1254.     /*
  1255.     ** Initialize externals - yyparse may be called more than once
  1256.     */
  1257.     yyv = (YYSTYPE*)xmalloc(yymaxdepth*sizeof(YYSTYPE));
  1258.     yys = (int*)xmalloc(yymaxdepth*sizeof(int));
  1259.     if (!yyv || !yys)
  1260.     {
  1261.         yyerror( "out of memory" );
  1262.         return(1);
  1263.     }
  1264.     yypv = &yyv[-1];
  1265.     yyps = &yys[-1];
  1266.     yystate = 0;
  1267.     yytmp = 0;
  1268.     yynerrs = 0;
  1269.     yyerrflag = 0;
  1270.     yychar = -1;
  1271.  
  1272.     goto yystack;
  1273.     {
  1274.         register YYSTYPE *yy_pv;    /* top of value stack */
  1275.         register int *yy_ps;        /* top of state stack */
  1276.         register int yy_state;        /* current state */
  1277.         register int  yy_n;        /* internal state number info */
  1278.  
  1279.         /*
  1280.         ** get globals into registers.
  1281.         ** branch to here only if YYBACKUP was called.
  1282.         */
  1283.     yynewstate:
  1284.         yy_pv = yypv;
  1285.         yy_ps = yyps;
  1286.         yy_state = yystate;
  1287.         goto yy_newstate;
  1288.  
  1289.         /*
  1290.         ** get globals into registers.
  1291.         ** either we just started, or we just finished a reduction
  1292.         */
  1293.     yystack:
  1294.         yy_pv = yypv;
  1295.         yy_ps = yyps;
  1296.         yy_state = yystate;
  1297.  
  1298.         /*
  1299.         ** top of for (;;) loop while no reductions done
  1300.         */
  1301.     yy_stack:
  1302.         /*
  1303.         ** put a state and value onto the stacks
  1304.         */
  1305. #if YYDEBUG
  1306.         /*
  1307.         ** if debugging, look up token value in list of value vs.
  1308.         ** name pairs.  0 and negative (-1) are special values.
  1309.         ** Note: linear search is used since time is not a real
  1310.         ** consideration while debugging.
  1311.         */
  1312.         if ( yydebug )
  1313.         {
  1314.             register int yy_i;
  1315.  
  1316.             (void)printf( "State %d, token ", yy_state );
  1317.             if ( yychar == 0 )
  1318.                 (void)printf( "end-of-file\n" );
  1319.             else if ( yychar < 0 )
  1320.                 (void)printf( "-none-\n" );
  1321.             else
  1322.             {
  1323.                 for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
  1324.                     yy_i++ )
  1325.                 {
  1326.                     if ( yytoks[yy_i].t_val == yychar )
  1327.                         break;
  1328.                 }
  1329.                 (void)printf( "%s\n", yytoks[yy_i].t_name );
  1330.             }
  1331.         }
  1332. #endif /* YYDEBUG */
  1333.         if ( ++yy_ps >= &yys[ yymaxdepth ] )    /* room on stack? */
  1334.         {
  1335.             /*
  1336.             ** xreallocate and recover.  Note that pointers
  1337.             ** have to be reset, or bad things will happen
  1338.             */
  1339.             int yyps_index = (yy_ps - yys);
  1340.             int yypv_index = (yy_pv - yyv);
  1341.             int yypvt_index = (yypvt - yyv);
  1342.             yymaxdepth += YYMAXDEPTH;
  1343.             yyv = (YYSTYPE*)xrealloc((char*)yyv,
  1344.                 yymaxdepth * sizeof(YYSTYPE));
  1345.             yys = (int*)xrealloc((char*)yys,
  1346.                 yymaxdepth * sizeof(int));
  1347.             if (!yyv || !yys)
  1348.             {
  1349.                 yyerror( "yacc stack overflow" );
  1350.                 return(1);
  1351.             }
  1352.             yy_ps = yys + yyps_index;
  1353.             yy_pv = yyv + yypv_index;
  1354.             yypvt = yyv + yypvt_index;
  1355.         }
  1356.         *yy_ps = yy_state;
  1357.         *++yy_pv = yyval;
  1358.  
  1359.         /*
  1360.         ** we have a new state - find out what to do
  1361.         */
  1362.     yy_newstate:
  1363.         if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG )
  1364.             goto yydefault;        /* simple state */
  1365. #if YYDEBUG
  1366.         /*
  1367.         ** if debugging, need to mark whether new token grabbed
  1368.         */
  1369.         yytmp = yychar < 0;
  1370. #endif
  1371.         if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
  1372.             yychar = 0;        /* reached EOF */
  1373. #if YYDEBUG
  1374.         if ( yydebug && yytmp )
  1375.         {
  1376.             register int yy_i;
  1377.  
  1378.             (void)printf( "Received token " );
  1379.             if ( yychar == 0 )
  1380.                 (void)printf( "end-of-file\n" );
  1381.             else if ( yychar < 0 )
  1382.                 (void)printf( "-none-\n" );
  1383.             else
  1384.             {
  1385.                 for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
  1386.                     yy_i++ )
  1387.                 {
  1388.                     if ( yytoks[yy_i].t_val == yychar )
  1389.                         break;
  1390.                 }
  1391.                 (void)printf( "%s\n", yytoks[yy_i].t_name );
  1392.             }
  1393.         }
  1394. #endif /* YYDEBUG */
  1395.         if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) )
  1396.             goto yydefault;
  1397.         if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar )    /*valid shift*/
  1398.         {
  1399.             yychar = -1;
  1400.             yyval = yylval;
  1401.             yy_state = yy_n;
  1402.             if ( yyerrflag > 0 )
  1403.                 yyerrflag--;
  1404.             goto yy_stack;
  1405.         }
  1406.  
  1407.     yydefault:
  1408.         if ( ( yy_n = yydef[ yy_state ] ) == -2 )
  1409.         {
  1410. #if YYDEBUG
  1411.             yytmp = yychar < 0;
  1412. #endif
  1413.             if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
  1414.                 yychar = 0;        /* reached EOF */
  1415. #if YYDEBUG
  1416.             if ( yydebug && yytmp )
  1417.             {
  1418.                 register int yy_i;
  1419.  
  1420.                 (void)printf( "Received token " );
  1421.                 if ( yychar == 0 )
  1422.                     (void)printf( "end-of-file\n" );
  1423.                 else if ( yychar < 0 )
  1424.                     (void)printf( "-none-\n" );
  1425.                 else
  1426.                 {
  1427.                     for ( yy_i = 0;
  1428.                         yytoks[yy_i].t_val >= 0;
  1429.                         yy_i++ )
  1430.                     {
  1431.                         if ( yytoks[yy_i].t_val
  1432.                             == yychar )
  1433.                         {
  1434.                             break;
  1435.                         }
  1436.                     }
  1437.                     (void)printf( "%s\n", yytoks[yy_i].t_name );
  1438.                 }
  1439.             }
  1440. #endif /* YYDEBUG */
  1441.             /*
  1442.             ** look through exception table
  1443.             */
  1444.             {
  1445.                 register int *yyxi = yyexca;
  1446.  
  1447.                 while ( ( *yyxi != -1 ) ||
  1448.                     ( yyxi[1] != yy_state ) )
  1449.                 {
  1450.                     yyxi += 2;
  1451.                 }
  1452.                 while ( ( *(yyxi += 2) >= 0 ) &&
  1453.                     ( *yyxi != yychar ) )
  1454.                     ;
  1455.                 if ( ( yy_n = yyxi[1] ) < 0 )
  1456.                     YYACCEPT;
  1457.             }
  1458.         }
  1459.  
  1460.         /*
  1461.         ** check for syntax error
  1462.         */
  1463.         if ( yy_n == 0 )    /* have an error */
  1464.         {
  1465.             /* no worry about speed here! */
  1466.             switch ( yyerrflag )
  1467.             {
  1468.             case 0:        /* new error */
  1469.                 yyerror( "syntax error" );
  1470.                 goto skip_init;
  1471.             yyerrlab:
  1472.                 /*
  1473.                 ** get globals into registers.
  1474.                 ** we have a user generated syntax type error
  1475.                 */
  1476.                 yy_pv = yypv;
  1477.                 yy_ps = yyps;
  1478.                 yy_state = yystate;
  1479.                 yynerrs++;
  1480.             skip_init:
  1481.             case 1:
  1482.             case 2:        /* incompletely recovered error */
  1483.                     /* try again... */
  1484.                 yyerrflag = 3;
  1485.                 /*
  1486.                 ** find state where "error" is a legal
  1487.                 ** shift action
  1488.                 */
  1489.                 while ( yy_ps >= yys )
  1490.                 {
  1491.                     yy_n = yypact[ *yy_ps ] + YYERRCODE;
  1492.                     if ( yy_n >= 0 && yy_n < YYLAST &&
  1493.                         yychk[yyact[yy_n]] == YYERRCODE)                    {
  1494.                         /*
  1495.                         ** simulate shift of "error"
  1496.                         */
  1497.                         yy_state = yyact[ yy_n ];
  1498.                         goto yy_stack;
  1499.                     }
  1500.                     /*
  1501.                     ** current state has no shift on
  1502.                     ** "error", pop stack
  1503.                     */
  1504. #if YYDEBUG
  1505. #    define _POP_ "Error recovery pops state %d, uncovers state %d\n"
  1506.                     if ( yydebug )
  1507.                         (void)printf( _POP_, *yy_ps,
  1508.                             yy_ps[-1] );
  1509. #    undef _POP_
  1510. #endif
  1511.                     yy_ps--;
  1512.                     yy_pv--;
  1513.                 }
  1514.                 /*
  1515.                 ** there is no state on stack with "error" as
  1516.                 ** a valid shift.  give up.
  1517.                 */
  1518.                 YYABORT;
  1519.             case 3:        /* no shift yet; eat a token */
  1520. #if YYDEBUG
  1521.                 /*
  1522.                 ** if debugging, look up token in list of
  1523.                 ** pairs.  0 and negative shouldn't occur,
  1524.                 ** but since timing doesn't matter when
  1525.                 ** debugging, it doesn't hurt to leave the
  1526.                 ** tests here.
  1527.                 */
  1528.                 if ( yydebug )
  1529.                 {
  1530.                     register int yy_i;
  1531.  
  1532.                     (void)printf( "Error recovery discards " );
  1533.                     if ( yychar == 0 )
  1534.                         (void)printf( "token end-of-file\n" );
  1535.                     else if ( yychar < 0 )
  1536.                         (void)printf( "token -none-\n" );
  1537.                     else
  1538.                     {
  1539.                         for ( yy_i = 0;
  1540.                             yytoks[yy_i].t_val >= 0;
  1541.                             yy_i++ )
  1542.                         {
  1543.                             if ( yytoks[yy_i].t_val
  1544.                                 == yychar )
  1545.                             {
  1546.                                 break;
  1547.                             }
  1548.                         }
  1549.                         (void)printf( "token %s\n",
  1550.                             yytoks[yy_i].t_name );
  1551.                     }
  1552.                 }
  1553. #endif /* YYDEBUG */
  1554.                 if ( yychar == 0 )    /* reached EOF. quit */
  1555.                     YYABORT;
  1556.                 yychar = -1;
  1557.                 goto yy_newstate;
  1558.             }
  1559.         }/* end if ( yy_n == 0 ) */
  1560.         /*
  1561.         ** reduction by production yy_n
  1562.         ** put stack tops, etc. so things right after switch
  1563.         */
  1564. #if YYDEBUG
  1565.         /*
  1566.         ** if debugging, print the string that is the user's
  1567.         ** specification of the reduction which is just about
  1568.         ** to be done.
  1569.         */
  1570.         if ( yydebug )
  1571.             (void)printf( "Reduce by (%d) \"%s\"\n",
  1572.                 yy_n, yyreds[ yy_n ] );
  1573. #endif
  1574.         yytmp = yy_n;            /* value to switch over */
  1575.         yypvt = yy_pv;            /* $vars top of value stack */
  1576.         /*
  1577.         ** Look in goto table for next state
  1578.         ** Sorry about using yy_state here as temporary
  1579.         ** register variable, but why not, if it works...
  1580.         ** If yyr2[ yy_n ] doesn't have the low order bit
  1581.         ** set, then there is no action to be done for
  1582.         ** this reduction.  So, no saving & unsaving of
  1583.         ** registers done.  The only difference between the
  1584.         ** code just after the if and the body of the if is
  1585.         ** the goto yy_stack in the body.  This way the test
  1586.         ** can be made before the choice of what to do is needed.
  1587.         */
  1588.         {
  1589.             /* length of production doubled with extra bit */
  1590.             register int yy_len = yyr2[ yy_n ];
  1591.  
  1592.             if ( !( yy_len & 01 ) )
  1593.             {
  1594.                 yy_len >>= 1;
  1595.                 yyval = ( yy_pv -= yy_len )[1];    /* $$ = $1 */
  1596.                 yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
  1597.                     *( yy_ps -= yy_len ) + 1;
  1598.                 if ( yy_state >= YYLAST ||
  1599.                     yychk[ yy_state =
  1600.                     yyact[ yy_state ] ] != -yy_n )
  1601.                 {
  1602.                     yy_state = yyact[ yypgo[ yy_n ] ];
  1603.                 }
  1604.                 goto yy_stack;
  1605.             }
  1606.             yy_len >>= 1;
  1607.             yyval = ( yy_pv -= yy_len )[1];    /* $$ = $1 */
  1608.             yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
  1609.                 *( yy_ps -= yy_len ) + 1;
  1610.             if ( yy_state >= YYLAST ||
  1611.                 yychk[ yy_state = yyact[ yy_state ] ] != -yy_n )
  1612.             {
  1613.                 yy_state = yyact[ yypgo[ yy_n ] ];
  1614.             }
  1615.         }
  1616.                     /* save until reenter driver code */
  1617.         yystate = yy_state;
  1618.         yyps = yy_ps;
  1619.         yypv = yy_pv;
  1620.     }
  1621.     /*
  1622.     ** code supplied by user is placed in this switch
  1623.     */
  1624.     switch( yytmp )
  1625.     {
  1626.         
  1627. case 3:
  1628. # line 211 "./c-exp.y"
  1629. { write_exp_elt_opcode(OP_TYPE);
  1630.               write_exp_elt_type(yypvt[-0].tval);
  1631.               write_exp_elt_opcode(OP_TYPE);} break;
  1632. case 5:
  1633. # line 219 "./c-exp.y"
  1634. { write_exp_elt_opcode (BINOP_COMMA); } break;
  1635. case 6:
  1636. # line 224 "./c-exp.y"
  1637. { write_exp_elt_opcode (UNOP_IND); } break;
  1638. case 7:
  1639. # line 227 "./c-exp.y"
  1640. { write_exp_elt_opcode (UNOP_ADDR); } break;
  1641. case 8:
  1642. # line 230 "./c-exp.y"
  1643. { write_exp_elt_opcode (UNOP_NEG); } break;
  1644. case 9:
  1645. # line 234 "./c-exp.y"
  1646. { write_exp_elt_opcode (UNOP_LOGICAL_NOT); } break;
  1647. case 10:
  1648. # line 238 "./c-exp.y"
  1649. { write_exp_elt_opcode (UNOP_COMPLEMENT); } break;
  1650. case 11:
  1651. # line 242 "./c-exp.y"
  1652. { write_exp_elt_opcode (UNOP_PREINCREMENT); } break;
  1653. case 12:
  1654. # line 246 "./c-exp.y"
  1655. { write_exp_elt_opcode (UNOP_PREDECREMENT); } break;
  1656. case 13:
  1657. # line 250 "./c-exp.y"
  1658. { write_exp_elt_opcode (UNOP_POSTINCREMENT); } break;
  1659. case 14:
  1660. # line 254 "./c-exp.y"
  1661. { write_exp_elt_opcode (UNOP_POSTDECREMENT); } break;
  1662. case 15:
  1663. # line 258 "./c-exp.y"
  1664. { write_exp_elt_opcode (UNOP_SIZEOF); } break;
  1665. case 16:
  1666. # line 262 "./c-exp.y"
  1667. { write_exp_elt_opcode (STRUCTOP_PTR);
  1668.               write_exp_string (yypvt[-0].sval);
  1669.               write_exp_elt_opcode (STRUCTOP_PTR); } break;
  1670. case 17:
  1671. # line 268 "./c-exp.y"
  1672. { /* exp->type::name becomes exp->*(&type::name) */
  1673.               /* Note: this doesn't work if name is a
  1674.                  static member!  FIXME */
  1675.               write_exp_elt_opcode (UNOP_ADDR);
  1676.               write_exp_elt_opcode (STRUCTOP_MPTR); } break;
  1677. case 18:
  1678. # line 275 "./c-exp.y"
  1679. { write_exp_elt_opcode (STRUCTOP_MPTR); } break;
  1680. case 19:
  1681. # line 279 "./c-exp.y"
  1682. { write_exp_elt_opcode (STRUCTOP_STRUCT);
  1683.               write_exp_string (yypvt[-0].sval);
  1684.               write_exp_elt_opcode (STRUCTOP_STRUCT); } break;
  1685. case 20:
  1686. # line 285 "./c-exp.y"
  1687. { /* exp.type::name becomes exp.*(&type::name) */
  1688.               /* Note: this doesn't work if name is a
  1689.                  static member!  FIXME */
  1690.               write_exp_elt_opcode (UNOP_ADDR);
  1691.               write_exp_elt_opcode (STRUCTOP_MEMBER); } break;
  1692. case 21:
  1693. # line 293 "./c-exp.y"
  1694. { write_exp_elt_opcode (STRUCTOP_MEMBER); } break;
  1695. case 22:
  1696. # line 297 "./c-exp.y"
  1697. { write_exp_elt_opcode (BINOP_SUBSCRIPT); } break;
  1698. case 23:
  1699. # line 303 "./c-exp.y"
  1700. { start_arglist (); } break;
  1701. case 24:
  1702. # line 305 "./c-exp.y"
  1703. { write_exp_elt_opcode (OP_FUNCALL);
  1704.               write_exp_elt_longcst ((LONGEST) end_arglist ());
  1705.               write_exp_elt_opcode (OP_FUNCALL); } break;
  1706. case 25:
  1707. # line 311 "./c-exp.y"
  1708. { start_arglist (); } break;
  1709. case 27:
  1710. # line 318 "./c-exp.y"
  1711. { arglist_len = 1; } break;
  1712. case 28:
  1713. # line 322 "./c-exp.y"
  1714. { arglist_len++; } break;
  1715. case 29:
  1716. # line 326 "./c-exp.y"
  1717. { yyval.lval = end_arglist () - 1; } break;
  1718. case 30:
  1719. # line 329 "./c-exp.y"
  1720. { write_exp_elt_opcode (OP_ARRAY);
  1721.               write_exp_elt_longcst ((LONGEST) 0);
  1722.               write_exp_elt_longcst ((LONGEST) yypvt[-0].lval);
  1723.               write_exp_elt_opcode (OP_ARRAY); } break;
  1724. case 31:
  1725. # line 336 "./c-exp.y"
  1726. { write_exp_elt_opcode (UNOP_MEMVAL);
  1727.               write_exp_elt_type (yypvt[-2].tval);
  1728.               write_exp_elt_opcode (UNOP_MEMVAL); } break;
  1729. case 32:
  1730. # line 342 "./c-exp.y"
  1731. { write_exp_elt_opcode (UNOP_CAST);
  1732.               write_exp_elt_type (yypvt[-2].tval);
  1733.               write_exp_elt_opcode (UNOP_CAST); } break;
  1734. case 33:
  1735. # line 348 "./c-exp.y"
  1736. { } break;
  1737. case 34:
  1738. # line 354 "./c-exp.y"
  1739. { write_exp_elt_opcode (BINOP_REPEAT); } break;
  1740. case 35:
  1741. # line 358 "./c-exp.y"
  1742. { write_exp_elt_opcode (BINOP_MUL); } break;
  1743. case 36:
  1744. # line 362 "./c-exp.y"
  1745. { write_exp_elt_opcode (BINOP_DIV); } break;
  1746. case 37:
  1747. # line 366 "./c-exp.y"
  1748. { write_exp_elt_opcode (BINOP_REM); } break;
  1749. case 38:
  1750. # line 370 "./c-exp.y"
  1751. { write_exp_elt_opcode (BINOP_ADD); } break;
  1752. case 39:
  1753. # line 374 "./c-exp.y"
  1754. { write_exp_elt_opcode (BINOP_SUB); } break;
  1755. case 40:
  1756. # line 378 "./c-exp.y"
  1757. { write_exp_elt_opcode (BINOP_LSH); } break;
  1758. case 41:
  1759. # line 382 "./c-exp.y"
  1760. { write_exp_elt_opcode (BINOP_RSH); } break;
  1761. case 42:
  1762. # line 386 "./c-exp.y"
  1763. { write_exp_elt_opcode (BINOP_EQUAL); } break;
  1764. case 43:
  1765. # line 390 "./c-exp.y"
  1766. { write_exp_elt_opcode (BINOP_NOTEQUAL); } break;
  1767. case 44:
  1768. # line 394 "./c-exp.y"
  1769. { write_exp_elt_opcode (BINOP_LEQ); } break;
  1770. case 45:
  1771. # line 398 "./c-exp.y"
  1772. { write_exp_elt_opcode (BINOP_GEQ); } break;
  1773. case 46:
  1774. # line 402 "./c-exp.y"
  1775. { write_exp_elt_opcode (BINOP_LESS); } break;
  1776. case 47:
  1777. # line 406 "./c-exp.y"
  1778. { write_exp_elt_opcode (BINOP_GTR); } break;
  1779. case 48:
  1780. # line 410 "./c-exp.y"
  1781. { write_exp_elt_opcode (BINOP_BITWISE_AND); } break;
  1782. case 49:
  1783. # line 414 "./c-exp.y"
  1784. { write_exp_elt_opcode (BINOP_BITWISE_XOR); } break;
  1785. case 50:
  1786. # line 418 "./c-exp.y"
  1787. { write_exp_elt_opcode (BINOP_BITWISE_IOR); } break;
  1788. case 51:
  1789. # line 422 "./c-exp.y"
  1790. { write_exp_elt_opcode (BINOP_LOGICAL_AND); } break;
  1791. case 52:
  1792. # line 426 "./c-exp.y"
  1793. { write_exp_elt_opcode (BINOP_LOGICAL_OR); } break;
  1794. case 53:
  1795. # line 430 "./c-exp.y"
  1796. { write_exp_elt_opcode (TERNOP_COND); } break;
  1797. case 54:
  1798. # line 434 "./c-exp.y"
  1799. { write_exp_elt_opcode (BINOP_ASSIGN); } break;
  1800. case 55:
  1801. # line 438 "./c-exp.y"
  1802. { write_exp_elt_opcode (BINOP_ASSIGN_MODIFY);
  1803.               write_exp_elt_opcode (yypvt[-1].opcode);
  1804.               write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); } break;
  1805. case 56:
  1806. # line 444 "./c-exp.y"
  1807. { write_exp_elt_opcode (OP_LONG);
  1808.               write_exp_elt_type (yypvt[-0].typed_val.type);
  1809.               write_exp_elt_longcst ((LONGEST)(yypvt[-0].typed_val.val));
  1810.               write_exp_elt_opcode (OP_LONG); } break;
  1811. case 57:
  1812. # line 451 "./c-exp.y"
  1813. { YYSTYPE val;
  1814.               parse_number (yypvt[-0].ssym.stoken.ptr, yypvt[-0].ssym.stoken.length, 0, &val);
  1815.               write_exp_elt_opcode (OP_LONG);
  1816.               write_exp_elt_type (val.typed_val.type);
  1817.               write_exp_elt_longcst ((LONGEST)val.typed_val.val);
  1818.               write_exp_elt_opcode (OP_LONG);
  1819.             } break;
  1820. case 58:
  1821. # line 462 "./c-exp.y"
  1822. { write_exp_elt_opcode (OP_DOUBLE);
  1823.               write_exp_elt_type (builtin_type_double);
  1824.               write_exp_elt_dblcst (yypvt[-0].dval);
  1825.               write_exp_elt_opcode (OP_DOUBLE); } break;
  1826. case 60:
  1827. # line 472 "./c-exp.y"
  1828. { write_exp_elt_opcode (OP_LAST);
  1829.               write_exp_elt_longcst ((LONGEST) yypvt[-0].lval);
  1830.               write_exp_elt_opcode (OP_LAST); } break;
  1831. case 61:
  1832. # line 478 "./c-exp.y"
  1833. { write_exp_elt_opcode (OP_REGISTER);
  1834.               write_exp_elt_longcst ((LONGEST) yypvt[-0].lval);
  1835.               write_exp_elt_opcode (OP_REGISTER); } break;
  1836. case 62:
  1837. # line 484 "./c-exp.y"
  1838. { write_exp_elt_opcode (OP_INTERNALVAR);
  1839.               write_exp_elt_intern (yypvt[-0].ivar);
  1840.               write_exp_elt_opcode (OP_INTERNALVAR); } break;
  1841. case 63:
  1842. # line 490 "./c-exp.y"
  1843. { write_exp_elt_opcode (OP_LONG);
  1844.               write_exp_elt_type (builtin_type_int);
  1845.               write_exp_elt_longcst ((LONGEST) TYPE_LENGTH (yypvt[-1].tval));
  1846.               write_exp_elt_opcode (OP_LONG); } break;
  1847. case 64:
  1848. # line 497 "./c-exp.y"
  1849. { /* C strings are converted into array constants with
  1850.                  an explicit null byte added at the end.  Thus
  1851.                  the array upper bound is the string length.
  1852.                  There is no such thing in C as a completely empty
  1853.                  string. */
  1854.               char *sp = yypvt[-0].sval.ptr; int count = yypvt[-0].sval.length;
  1855.               while (count-- > 0)
  1856.                 {
  1857.                   write_exp_elt_opcode (OP_LONG);
  1858.                   write_exp_elt_type (builtin_type_char);
  1859.                   write_exp_elt_longcst ((LONGEST)(*sp++));
  1860.                   write_exp_elt_opcode (OP_LONG);
  1861.                 }
  1862.               write_exp_elt_opcode (OP_LONG);
  1863.               write_exp_elt_type (builtin_type_char);
  1864.               write_exp_elt_longcst ((LONGEST)'\0');
  1865.               write_exp_elt_opcode (OP_LONG);
  1866.               write_exp_elt_opcode (OP_ARRAY);
  1867.               write_exp_elt_longcst ((LONGEST) 0);
  1868.               write_exp_elt_longcst ((LONGEST) (yypvt[-0].sval.length));
  1869.               write_exp_elt_opcode (OP_ARRAY); } break;
  1870. case 65:
  1871. # line 522 "./c-exp.y"
  1872. { write_exp_elt_opcode (OP_THIS);
  1873.               write_exp_elt_opcode (OP_THIS); } break;
  1874. case 66:
  1875. # line 529 "./c-exp.y"
  1876. {
  1877.               if (yypvt[-0].ssym.sym != 0)
  1878.                   yyval.bval = SYMBOL_BLOCK_VALUE (yypvt[-0].ssym.sym);
  1879.               else
  1880.                 {
  1881.                   struct symtab *tem =
  1882.                   lookup_symtab (copy_name (yypvt[-0].ssym.stoken));
  1883.                   if (tem)
  1884.                 yyval.bval = BLOCKVECTOR_BLOCK
  1885.                      (BLOCKVECTOR (tem), STATIC_BLOCK);
  1886.                   else
  1887.                 error ("No file or function \"%s\".",
  1888.                        copy_name (yypvt[-0].ssym.stoken));
  1889.                 }
  1890.             } break;
  1891. case 67:
  1892. # line 547 "./c-exp.y"
  1893. { struct symbol *tem
  1894.                 = lookup_symbol (copy_name (yypvt[-0].sval), yypvt[-2].bval,
  1895.                          VAR_NAMESPACE, 0, NULL);
  1896.               if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
  1897.                 error ("No function \"%s\" in specified context.",
  1898.                    copy_name (yypvt[-0].sval));
  1899.               yyval.bval = SYMBOL_BLOCK_VALUE (tem); } break;
  1900. case 68:
  1901. # line 557 "./c-exp.y"
  1902. { struct symbol *sym;
  1903.               sym = lookup_symbol (copy_name (yypvt[-0].sval), yypvt[-2].bval,
  1904.                            VAR_NAMESPACE, 0, NULL);
  1905.               if (sym == 0)
  1906.                 error ("No symbol \"%s\" in specified context.",
  1907.                    copy_name (yypvt[-0].sval));
  1908.  
  1909.               write_exp_elt_opcode (OP_VAR_VALUE);
  1910.               write_exp_elt_sym (sym);
  1911.               write_exp_elt_opcode (OP_VAR_VALUE); } break;
  1912. case 69:
  1913. # line 570 "./c-exp.y"
  1914. {
  1915.               struct type *type = yypvt[-2].tval;
  1916.               if (TYPE_CODE (type) != TYPE_CODE_STRUCT
  1917.                   && TYPE_CODE (type) != TYPE_CODE_UNION)
  1918.                 error ("`%s' is not defined as an aggregate type.",
  1919.                    TYPE_NAME (type));
  1920.  
  1921.               write_exp_elt_opcode (OP_SCOPE);
  1922.               write_exp_elt_type (type);
  1923.               write_exp_string (yypvt[-0].sval);
  1924.               write_exp_elt_opcode (OP_SCOPE);
  1925.             } break;
  1926. case 70:
  1927. # line 583 "./c-exp.y"
  1928. {
  1929.               struct type *type = yypvt[-3].tval;
  1930.               struct stoken tmp_token;
  1931.               if (TYPE_CODE (type) != TYPE_CODE_STRUCT
  1932.                   && TYPE_CODE (type) != TYPE_CODE_UNION)
  1933.                 error ("`%s' is not defined as an aggregate type.",
  1934.                    TYPE_NAME (type));
  1935.  
  1936.               if (!STREQ (type_name_no_tag (type), yypvt[-0].sval.ptr))
  1937.                 error ("invalid destructor `%s::~%s'",
  1938.                    type_name_no_tag (type), yypvt[-0].sval.ptr);
  1939.  
  1940.               tmp_token.ptr = (char*) alloca (yypvt[-0].sval.length + 2);
  1941.               tmp_token.length = yypvt[-0].sval.length + 1;
  1942.               tmp_token.ptr[0] = '~';
  1943.               memcpy (tmp_token.ptr+1, yypvt[-0].sval.ptr, yypvt[-0].sval.length);
  1944.               tmp_token.ptr[tmp_token.length] = 0;
  1945.               write_exp_elt_opcode (OP_SCOPE);
  1946.               write_exp_elt_type (type);
  1947.               write_exp_string (tmp_token);
  1948.               write_exp_elt_opcode (OP_SCOPE);
  1949.             } break;
  1950. case 72:
  1951. # line 609 "./c-exp.y"
  1952. {
  1953.               char *name = copy_name (yypvt[-0].sval);
  1954.               struct symbol *sym;
  1955.               struct minimal_symbol *msymbol;
  1956.  
  1957.               sym =
  1958.                 lookup_symbol (name, 0, VAR_NAMESPACE, 0, NULL);
  1959.               if (sym)
  1960.                 {
  1961.                   write_exp_elt_opcode (OP_VAR_VALUE);
  1962.                   write_exp_elt_sym (sym);
  1963.                   write_exp_elt_opcode (OP_VAR_VALUE);
  1964.                   break;
  1965.                 }
  1966.  
  1967.               msymbol = lookup_minimal_symbol (name,
  1968.                       (struct objfile *) NULL);
  1969.               if (msymbol != NULL)
  1970.                 {
  1971.                   write_exp_elt_opcode (OP_LONG);
  1972.                   write_exp_elt_type (builtin_type_int);
  1973.                   write_exp_elt_longcst ((LONGEST) SYMBOL_VALUE_ADDRESS (msymbol));
  1974.                   write_exp_elt_opcode (OP_LONG);
  1975.                   write_exp_elt_opcode (UNOP_MEMVAL);
  1976.                   if (msymbol -> type == mst_data ||
  1977.                   msymbol -> type == mst_bss)
  1978.                 write_exp_elt_type (builtin_type_int);
  1979.                   else if (msymbol -> type == mst_text)
  1980.                 write_exp_elt_type (lookup_function_type (builtin_type_int));
  1981.                   else
  1982.                 write_exp_elt_type (builtin_type_char);
  1983.                   write_exp_elt_opcode (UNOP_MEMVAL);
  1984.                 }
  1985.               else
  1986.                 if (!have_full_symbols () && !have_partial_symbols ())
  1987.                   error ("No symbol table is loaded.  Use the \"file\" command.");
  1988.                 else
  1989.                   error ("No symbol \"%s\" in current context.", name);
  1990.             } break;
  1991. case 73:
  1992. # line 651 "./c-exp.y"
  1993. { struct symbol *sym = yypvt[-0].ssym.sym;
  1994.  
  1995.               if (sym)
  1996.                 {
  1997.                   switch (SYMBOL_CLASS (sym))
  1998.                 {
  1999.                 case LOC_REGISTER:
  2000.                 case LOC_ARG:
  2001.                 case LOC_REF_ARG:
  2002.                 case LOC_REGPARM:
  2003.                 case LOC_LOCAL:
  2004.                 case LOC_LOCAL_ARG:
  2005.                   if (innermost_block == 0 ||
  2006.                       contained_in (block_found, 
  2007.                             innermost_block))
  2008.                     innermost_block = block_found;
  2009.                 case LOC_UNDEF:
  2010.                 case LOC_CONST:
  2011.                 case LOC_STATIC:
  2012.                 case LOC_TYPEDEF:
  2013.                 case LOC_LABEL:
  2014.                 case LOC_BLOCK:
  2015.                 case LOC_CONST_BYTES:
  2016.                 case LOC_OPTIMIZED_OUT:
  2017.  
  2018.                   /* In this case the expression can
  2019.                      be evaluated regardless of what
  2020.                      frame we are in, so there is no
  2021.                      need to check for the
  2022.                      innermost_block.  These cases are
  2023.                      listed so that gcc -Wall will
  2024.                      report types that may not have
  2025.                      been considered.  */
  2026.  
  2027.                   break;
  2028.                 }
  2029.                   write_exp_elt_opcode (OP_VAR_VALUE);
  2030.                   write_exp_elt_sym (sym);
  2031.                   write_exp_elt_opcode (OP_VAR_VALUE);
  2032.                 }
  2033.               else if (yypvt[-0].ssym.is_a_field_of_this)
  2034.                 {
  2035.                   /* C++: it hangs off of `this'.  Must
  2036.                      not inadvertently convert from a method call
  2037.                  to data ref.  */
  2038.                   if (innermost_block == 0 || 
  2039.                   contained_in (block_found, innermost_block))
  2040.                 innermost_block = block_found;
  2041.                   write_exp_elt_opcode (OP_THIS);
  2042.                   write_exp_elt_opcode (OP_THIS);
  2043.                   write_exp_elt_opcode (STRUCTOP_PTR);
  2044.                   write_exp_string (yypvt[-0].ssym.stoken);
  2045.                   write_exp_elt_opcode (STRUCTOP_PTR);
  2046.                 }
  2047.               else
  2048.                 {
  2049.                   struct minimal_symbol *msymbol;
  2050.                   register char *arg = copy_name (yypvt[-0].ssym.stoken);
  2051.  
  2052.                   msymbol = lookup_minimal_symbol (arg,
  2053.                       (struct objfile *) NULL);
  2054.                   if (msymbol != NULL)
  2055.                 {
  2056.                   write_exp_elt_opcode (OP_LONG);
  2057.                   write_exp_elt_type (builtin_type_int);
  2058.                   write_exp_elt_longcst ((LONGEST) SYMBOL_VALUE_ADDRESS (msymbol));
  2059.                   write_exp_elt_opcode (OP_LONG);
  2060.                   write_exp_elt_opcode (UNOP_MEMVAL);
  2061.                   if (msymbol -> type == mst_data ||
  2062.                       msymbol -> type == mst_bss)
  2063.                     write_exp_elt_type (builtin_type_int);
  2064.                   else if (msymbol -> type == mst_text)
  2065.                     write_exp_elt_type (lookup_function_type (builtin_type_int));
  2066.                   else
  2067.                     write_exp_elt_type (builtin_type_char);
  2068.                   write_exp_elt_opcode (UNOP_MEMVAL);
  2069.                 }
  2070.                   else if (!have_full_symbols () && !have_partial_symbols ())
  2071.                 error ("No symbol table is loaded.  Use the \"file\" command.");
  2072.                   else
  2073.                 error ("No symbol \"%s\" in current context.",
  2074.                        copy_name (yypvt[-0].ssym.stoken));
  2075.                 }
  2076.             } break;
  2077. case 75:
  2078. # line 740 "./c-exp.y"
  2079. {
  2080.           /* This is where the interesting stuff happens.  */
  2081.           int done = 0;
  2082.           int array_size;
  2083.           struct type *follow_type = yypvt[-1].tval;
  2084.           struct type *range_type;
  2085.           
  2086.           while (!done)
  2087.             switch (pop_type ())
  2088.               {
  2089.               case tp_end:
  2090.             done = 1;
  2091.             break;
  2092.               case tp_pointer:
  2093.             follow_type = lookup_pointer_type (follow_type);
  2094.             break;
  2095.               case tp_reference:
  2096.             follow_type = lookup_reference_type (follow_type);
  2097.             break;
  2098.               case tp_array:
  2099.             array_size = pop_type_int ();
  2100.             if (array_size != -1)
  2101.               {
  2102.                 range_type =
  2103.                   create_range_type ((struct type *) NULL,
  2104.                          builtin_type_int, 0,
  2105.                          array_size - 1);
  2106.                 follow_type =
  2107.                   create_array_type ((struct type *) NULL,
  2108.                          follow_type, range_type);
  2109.               }
  2110.             else
  2111.               follow_type = lookup_pointer_type (follow_type);
  2112.             break;
  2113.               case tp_function:
  2114.             follow_type = lookup_function_type (follow_type);
  2115.             break;
  2116.               }
  2117.           yyval.tval = follow_type;
  2118.         } break;
  2119. case 76:
  2120. # line 783 "./c-exp.y"
  2121. { push_type (tp_pointer); yyval.voidval = 0; } break;
  2122. case 77:
  2123. # line 785 "./c-exp.y"
  2124. { push_type (tp_pointer); yyval.voidval = yypvt[-0].voidval; } break;
  2125. case 78:
  2126. # line 787 "./c-exp.y"
  2127. { push_type (tp_reference); yyval.voidval = 0; } break;
  2128. case 79:
  2129. # line 789 "./c-exp.y"
  2130. { push_type (tp_reference); yyval.voidval = yypvt[-0].voidval; } break;
  2131. case 81:
  2132. # line 794 "./c-exp.y"
  2133. { yyval.voidval = yypvt[-1].voidval; } break;
  2134. case 82:
  2135. # line 796 "./c-exp.y"
  2136. {
  2137.               push_type_int (yypvt[-0].lval);
  2138.               push_type (tp_array);
  2139.             } break;
  2140. case 83:
  2141. # line 801 "./c-exp.y"
  2142. {
  2143.               push_type_int (yypvt[-0].lval);
  2144.               push_type (tp_array);
  2145.               yyval.voidval = 0;
  2146.             } break;
  2147. case 84:
  2148. # line 807 "./c-exp.y"
  2149. { push_type (tp_function); } break;
  2150. case 85:
  2151. # line 809 "./c-exp.y"
  2152. { push_type (tp_function); } break;
  2153. case 86:
  2154. # line 813 "./c-exp.y"
  2155. { yyval.lval = -1; } break;
  2156. case 87:
  2157. # line 815 "./c-exp.y"
  2158. { yyval.lval = yypvt[-1].typed_val.val; } break;
  2159. case 88:
  2160. # line 819 "./c-exp.y"
  2161. { yyval.voidval = 0; } break;
  2162. case 89:
  2163. # line 821 "./c-exp.y"
  2164. { free ((PTR)yypvt[-1].tvec); yyval.voidval = 0; } break;
  2165. case 91:
  2166. # line 826 "./c-exp.y"
  2167. { yyval.tval = lookup_member_type (builtin_type_int, yypvt[-2].tval); } break;
  2168. case 92:
  2169. # line 828 "./c-exp.y"
  2170. { yyval.tval = lookup_member_type (yypvt[-5].tval, yypvt[-3].tval); } break;
  2171. case 93:
  2172. # line 830 "./c-exp.y"
  2173. { yyval.tval = lookup_member_type
  2174.                 (lookup_function_type (yypvt[-7].tval), yypvt[-5].tval); } break;
  2175. case 94:
  2176. # line 833 "./c-exp.y"
  2177. { yyval.tval = lookup_member_type
  2178.                 (lookup_function_type (yypvt[-8].tval), yypvt[-6].tval);
  2179.               free ((PTR)yypvt[-1].tvec); } break;
  2180. case 95:
  2181. # line 840 "./c-exp.y"
  2182. { yyval.tval = yypvt[-0].tsym.type; } break;
  2183. case 96:
  2184. # line 842 "./c-exp.y"
  2185. { yyval.tval = builtin_type_int; } break;
  2186. case 97:
  2187. # line 844 "./c-exp.y"
  2188. { yyval.tval = builtin_type_long; } break;
  2189. case 98:
  2190. # line 846 "./c-exp.y"
  2191. { yyval.tval = builtin_type_short; } break;
  2192. case 99:
  2193. # line 848 "./c-exp.y"
  2194. { yyval.tval = builtin_type_long; } break;
  2195. case 100:
  2196. # line 850 "./c-exp.y"
  2197. { yyval.tval = builtin_type_unsigned_long; } break;
  2198. case 101:
  2199. # line 852 "./c-exp.y"
  2200. { yyval.tval = builtin_type_long_long; } break;
  2201. case 102:
  2202. # line 854 "./c-exp.y"
  2203. { yyval.tval = builtin_type_long_long; } break;
  2204. case 103:
  2205. # line 856 "./c-exp.y"
  2206. { yyval.tval = builtin_type_unsigned_long_long; } break;
  2207. case 104:
  2208. # line 858 "./c-exp.y"
  2209. { yyval.tval = builtin_type_unsigned_long_long; } break;
  2210. case 105:
  2211. # line 860 "./c-exp.y"
  2212. { yyval.tval = builtin_type_short; } break;
  2213. case 106:
  2214. # line 862 "./c-exp.y"
  2215. { yyval.tval = builtin_type_unsigned_short; } break;
  2216. case 107:
  2217. # line 864 "./c-exp.y"
  2218. { yyval.tval = lookup_struct (copy_name (yypvt[-0].sval),
  2219.                           expression_context_block); } break;
  2220. case 108:
  2221. # line 867 "./c-exp.y"
  2222. { yyval.tval = lookup_struct (copy_name (yypvt[-0].sval),
  2223.                           expression_context_block); } break;
  2224. case 109:
  2225. # line 870 "./c-exp.y"
  2226. { yyval.tval = lookup_union (copy_name (yypvt[-0].sval),
  2227.                          expression_context_block); } break;
  2228. case 110:
  2229. # line 873 "./c-exp.y"
  2230. { yyval.tval = lookup_enum (copy_name (yypvt[-0].sval),
  2231.                         expression_context_block); } break;
  2232. case 111:
  2233. # line 876 "./c-exp.y"
  2234. { yyval.tval = lookup_unsigned_typename (TYPE_NAME(yypvt[-0].tsym.type)); } break;
  2235. case 112:
  2236. # line 878 "./c-exp.y"
  2237. { yyval.tval = builtin_type_unsigned_int; } break;
  2238. case 113:
  2239. # line 880 "./c-exp.y"
  2240. { yyval.tval = lookup_signed_typename (TYPE_NAME(yypvt[-0].tsym.type)); } break;
  2241. case 114:
  2242. # line 882 "./c-exp.y"
  2243. { yyval.tval = builtin_type_int; } break;
  2244. case 115:
  2245. # line 884 "./c-exp.y"
  2246. { yyval.tval = lookup_template_type(copy_name(yypvt[-3].sval), yypvt[-1].tval,
  2247.                             expression_context_block);
  2248.             } break;
  2249. case 116:
  2250. # line 888 "./c-exp.y"
  2251. { yyval.tval = yypvt[-0].tval; } break;
  2252. case 117:
  2253. # line 889 "./c-exp.y"
  2254. { yyval.tval = yypvt[-0].tval; } break;
  2255. case 119:
  2256. # line 894 "./c-exp.y"
  2257. {
  2258.           yyval.tsym.stoken.ptr = "int";
  2259.           yyval.tsym.stoken.length = 3;
  2260.           yyval.tsym.type = builtin_type_int;
  2261.         } break;
  2262. case 120:
  2263. # line 900 "./c-exp.y"
  2264. {
  2265.           yyval.tsym.stoken.ptr = "long";
  2266.           yyval.tsym.stoken.length = 4;
  2267.           yyval.tsym.type = builtin_type_long;
  2268.         } break;
  2269. case 121:
  2270. # line 906 "./c-exp.y"
  2271. {
  2272.           yyval.tsym.stoken.ptr = "short";
  2273.           yyval.tsym.stoken.length = 5;
  2274.           yyval.tsym.type = builtin_type_short;
  2275.         } break;
  2276. case 122:
  2277. # line 915 "./c-exp.y"
  2278. { yyval.tvec = (struct type **) xmalloc (sizeof (struct type *) * 2);
  2279.           yyval.ivec[0] = 1;    /* Number of types in vector */
  2280.           yyval.tvec[1] = yypvt[-0].tval;
  2281.         } break;
  2282. case 123:
  2283. # line 920 "./c-exp.y"
  2284. { int len = sizeof (struct type *) * (++(yypvt[-2].ivec[0]) + 1);
  2285.           yyval.tvec = (struct type **) xrealloc ((char *) yypvt[-2].tvec, len);
  2286.           yyval.tvec[yyval.ivec[0]] = yypvt[-0].tval;
  2287.         } break;
  2288. case 124:
  2289. # line 926 "./c-exp.y"
  2290. { yyval.sval = yypvt[-0].ssym.stoken; } break;
  2291. case 125:
  2292. # line 927 "./c-exp.y"
  2293. { yyval.sval = yypvt[-0].ssym.stoken; } break;
  2294. case 126:
  2295. # line 928 "./c-exp.y"
  2296. { yyval.sval = yypvt[-0].tsym.stoken; } break;
  2297. case 127:
  2298. # line 929 "./c-exp.y"
  2299. { yyval.sval = yypvt[-0].ssym.stoken; } break;
  2300.     }
  2301.     goto yystack;        /* reset registers in driver code */
  2302. }
  2303.