home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 7 / FreshFishVol7.bin / bbs / gnu / gcc-2.3.3-src.lha / GNU / src / amiga / gcc-2.3.3 / cexp.c < prev    next >
C/C++ Source or Header  |  1994-02-06  |  50KB  |  1,865 lines

  1.  
  2. /*  A Bison parser, made from cexp.y  */
  3.  
  4. #define YYBISON 1  /* Identify Bison output.  */
  5.  
  6. #define    INT    258
  7. #define    CHAR    259
  8. #define    NAME    260
  9. #define    ERROR    261
  10. #define    OR    262
  11. #define    AND    263
  12. #define    EQUAL    264
  13. #define    NOTEQUAL    265
  14. #define    LEQ    266
  15. #define    GEQ    267
  16. #define    LSH    268
  17. #define    RSH    269
  18. #define    UNARY    270
  19.  
  20. #line 26 "cexp.y"
  21.  
  22. #include "config.h"
  23. #include <setjmp.h>
  24. /* #define YYDEBUG 1 */
  25.  
  26. #ifdef MULTIBYTE_CHARS
  27. #include <stdlib.h>
  28. #include <locale.h>
  29. #endif
  30.  
  31. #include <stdio.h>
  32.  
  33. typedef unsigned char U_CHAR;
  34.  
  35. /* This is used for communicating lists of keywords with cccp.c.  */
  36. struct arglist {
  37.   struct arglist *next;
  38.   U_CHAR *name;
  39.   int length;
  40.   int argno;
  41. };
  42.  
  43. /* Define a generic NULL if one hasn't already been defined.  */
  44.  
  45. #ifndef NULL
  46. #define NULL 0
  47. #endif
  48.  
  49. #ifndef GENERIC_PTR
  50. #if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
  51. #define GENERIC_PTR void *
  52. #else
  53. #define GENERIC_PTR char *
  54. #endif
  55. #endif
  56.  
  57. #ifndef NULL_PTR
  58. #define NULL_PTR ((GENERIC_PTR)0)
  59. #endif
  60.  
  61. int yylex ();
  62. void yyerror ();
  63. int expression_value;
  64.  
  65. static jmp_buf parse_return_error;
  66.  
  67. /* Nonzero means count most punctuation as part of a name.  */
  68. static int keyword_parsing = 0;
  69.  
  70. /* some external tables of character types */
  71. extern unsigned char is_idstart[], is_idchar[], is_hor_space[];
  72.  
  73. extern char *xmalloc ();
  74.  
  75. /* Flag for -pedantic.  */
  76. extern int pedantic;
  77.  
  78. /* Flag for -traditional.  */
  79. extern int traditional;
  80.  
  81. #ifndef CHAR_TYPE_SIZE
  82. #define CHAR_TYPE_SIZE BITS_PER_UNIT
  83. #endif
  84.  
  85. #ifndef INT_TYPE_SIZE
  86. #define INT_TYPE_SIZE BITS_PER_WORD
  87. #endif
  88.  
  89. #ifndef LONG_TYPE_SIZE
  90. #define LONG_TYPE_SIZE BITS_PER_WORD
  91. #endif
  92.  
  93. #ifndef WCHAR_TYPE_SIZE
  94. #define WCHAR_TYPE_SIZE INT_TYPE_SIZE
  95. #endif
  96.  
  97. /* Yield nonzero if adding two numbers with A's and B's signs can yield a
  98.    number with SUM's sign, where A, B, and SUM are all C integers.  */
  99. #define possible_sum_sign(a, b, sum) ((((a) ^ (b)) | ~ ((a) ^ (sum))) < 0)
  100.  
  101. static void integer_overflow ();
  102. static long left_shift ();
  103. static long right_shift ();
  104.  
  105. #line 111 "cexp.y"
  106. typedef union {
  107.   struct constant {long value; int unsignedp;} integer;
  108.   struct name {U_CHAR *address; int length;} name;
  109.   struct arglist *keywords;
  110.   int voidval;
  111.   char *sval;
  112. } YYSTYPE;
  113.  
  114. #ifndef YYLTYPE
  115. typedef
  116.   struct yyltype
  117.     {
  118.       int timestamp;
  119.       int first_line;
  120.       int first_column;
  121.       int last_line;
  122.       int last_column;
  123.       char *text;
  124.    }
  125.   yyltype;
  126.  
  127. #define YYLTYPE yyltype
  128. #endif
  129.  
  130. #include <stdio.h>
  131.  
  132. #ifndef __STDC__
  133. #define const
  134. #endif
  135.  
  136.  
  137.  
  138. #define    YYFINAL        73
  139. #define    YYFLAG        -32768
  140. #define    YYNTBASE    34
  141.  
  142. #define YYTRANSLATE(x) ((unsigned)(x) <= 270 ? yytranslate[x] : 39)
  143.  
  144. static const char yytranslate[] = {     0,
  145.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  146.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  147.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  148.      2,     2,    29,     2,    31,     2,    27,    14,     2,    32,
  149.     33,    25,    23,     9,    24,     2,    26,     2,     2,     2,
  150.      2,     2,     2,     2,     2,     2,     2,     8,     2,    17,
  151.      2,    18,     7,     2,     2,     2,     2,     2,     2,     2,
  152.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  153.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  154.      2,     2,     2,    13,     2,     2,     2,     2,     2,     2,
  155.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  156.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  157.      2,     2,     2,    12,     2,    30,     2,     2,     2,     2,
  158.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  159.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  160.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  161.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  162.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  163.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  164.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  165.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  166.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  167.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  168.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  169.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  170.      2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
  171.      6,    10,    11,    15,    16,    19,    20,    21,    22,    28
  172. };
  173.  
  174. static const short yyprhs[] = {     0,
  175.      0,     2,     4,     8,    11,    14,    17,    20,    23,    24,
  176.     31,    35,    39,    43,    47,    51,    55,    59,    63,    67,
  177.     71,    75,    79,    83,    87,    91,    95,    99,   103,   107,
  178.    113,   115,   117,   119,   120,   125
  179. };
  180.  
  181. static const short yyrhs[] = {    35,
  182.      0,    36,     0,    35,     9,    36,     0,    24,    36,     0,
  183.     29,    36,     0,    23,    36,     0,    30,    36,     0,    31,
  184.      5,     0,     0,    31,     5,    37,    32,    38,    33,     0,
  185.     32,    35,    33,     0,    36,    25,    36,     0,    36,    26,
  186.     36,     0,    36,    27,    36,     0,    36,    23,    36,     0,
  187.     36,    24,    36,     0,    36,    21,    36,     0,    36,    22,
  188.     36,     0,    36,    15,    36,     0,    36,    16,    36,     0,
  189.     36,    19,    36,     0,    36,    20,    36,     0,    36,    17,
  190.     36,     0,    36,    18,    36,     0,    36,    14,    36,     0,
  191.     36,    13,    36,     0,    36,    12,    36,     0,    36,    11,
  192.     36,     0,    36,    10,    36,     0,    36,     7,    36,     8,
  193.     36,     0,     3,     0,     4,     0,     5,     0,     0,    32,
  194.     38,    33,    38,     0,     5,    38,     0
  195. };
  196.  
  197. #if YYDEBUG != 0
  198. static const short yyrline[] = { 0,
  199.    143,   148,   149,   156,   161,   164,   166,   169,   173,   175,
  200.    180,   185,   197,   212,   223,   230,   237,   243,   249,   252,
  201.    255,   261,   267,   273,   279,   282,   285,   288,   291,   294,
  202.    297,   299,   301,   306,   308,   321
  203. };
  204.  
  205. static const char * const yytname[] = {   "$","error","$illegal.","INT","CHAR",
  206. "NAME","ERROR","'?'","':'","','","OR","AND","'|'","'^'","'&'","EQUAL","NOTEQUAL",
  207. "'<'","'>'","LEQ","GEQ","LSH","RSH","'+'","'-'","'*'","'/'","'%'","UNARY","'!'",
  208. "'~'","'#'","'('","')'","start","exp1","exp","@1","keywords",""
  209. };
  210. #endif
  211.  
  212. static const short yyr1[] = {     0,
  213.     34,    35,    35,    36,    36,    36,    36,    36,    37,    36,
  214.     36,    36,    36,    36,    36,    36,    36,    36,    36,    36,
  215.     36,    36,    36,    36,    36,    36,    36,    36,    36,    36,
  216.     36,    36,    36,    38,    38,    38
  217. };
  218.  
  219. static const short yyr2[] = {     0,
  220.      1,     1,     3,     2,     2,     2,     2,     2,     0,     6,
  221.      3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
  222.      3,     3,     3,     3,     3,     3,     3,     3,     3,     5,
  223.      1,     1,     1,     0,     4,     2
  224. };
  225.  
  226. static const short yydefact[] = {     0,
  227.     31,    32,    33,     0,     0,     0,     0,     0,     0,     1,
  228.      2,     6,     4,     5,     7,     8,     0,     0,     0,     0,
  229.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  230.      0,     0,     0,     0,     0,     0,     0,     0,    11,     3,
  231.      0,    29,    28,    27,    26,    25,    19,    20,    23,    24,
  232.     21,    22,    17,    18,    15,    16,    12,    13,    14,    34,
  233.      0,    34,    34,     0,    30,    36,     0,    10,    34,    35,
  234.      0,     0,     0
  235. };
  236.  
  237. static const short yydefgoto[] = {    71,
  238.     10,    11,    38,    64
  239. };
  240.  
  241. static const short yypact[] = {    31,
  242. -32768,-32768,-32768,    31,    31,    31,    31,     4,    31,     3,
  243.     80,-32768,-32768,-32768,-32768,     6,    32,    31,    31,    31,
  244.     31,    31,    31,    31,    31,    31,    31,    31,    31,    31,
  245.     31,    31,    31,    31,    31,    31,    31,     7,-32768,    80,
  246.     59,    97,   113,   128,   142,   155,    25,    25,   162,   162,
  247.    162,   162,   167,   167,   -19,   -19,-32768,-32768,-32768,     5,
  248.     31,     5,     5,   -