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 >
Wrap
C/C++ Source or Header
|
1994-02-06
|
50KB
|
1,865 lines
/* A Bison parser, made from cexp.y */
#define YYBISON 1 /* Identify Bison output. */
#define INT 258
#define CHAR 259
#define NAME 260
#define ERROR 261
#define OR 262
#define AND 263
#define EQUAL 264
#define NOTEQUAL 265
#define LEQ 266
#define GEQ 267
#define LSH 268
#define RSH 269
#define UNARY 270
#line 26 "cexp.y"
#include "config.h"
#include <setjmp.h>
/* #define YYDEBUG 1 */
#ifdef MULTIBYTE_CHARS
#include <stdlib.h>
#include <locale.h>
#endif
#include <stdio.h>
typedef unsigned char U_CHAR;
/* This is used for communicating lists of keywords with cccp.c. */
struct arglist {
struct arglist *next;
U_CHAR *name;
int length;
int argno;
};
/* Define a generic NULL if one hasn't already been defined. */
#ifndef NULL
#define NULL 0
#endif
#ifndef GENERIC_PTR
#if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
#define GENERIC_PTR void *
#else
#define GENERIC_PTR char *
#endif
#endif
#ifndef NULL_PTR
#define NULL_PTR ((GENERIC_PTR)0)
#endif
int yylex ();
void yyerror ();
int expression_value;
static jmp_buf parse_return_error;
/* Nonzero means count most punctuation as part of a name. */
static int keyword_parsing = 0;
/* some external tables of character types */
extern unsigned char is_idstart[], is_idchar[], is_hor_space[];
extern char *xmalloc ();
/* Flag for -pedantic. */
extern int pedantic;
/* Flag for -traditional. */
extern int traditional;
#ifndef CHAR_TYPE_SIZE
#define CHAR_TYPE_SIZE BITS_PER_UNIT
#endif
#ifndef INT_TYPE_SIZE
#define INT_TYPE_SIZE BITS_PER_WORD
#endif
#ifndef LONG_TYPE_SIZE
#define LONG_TYPE_SIZE BITS_PER_WORD
#endif
#ifndef WCHAR_TYPE_SIZE
#define WCHAR_TYPE_SIZE INT_TYPE_SIZE
#endif
/* Yield nonzero if adding two numbers with A's and B's signs can yield a
number with SUM's sign, where A, B, and SUM are all C integers. */
#define possible_sum_sign(a, b, sum) ((((a) ^ (b)) | ~ ((a) ^ (sum))) < 0)
static void integer_overflow ();
static long left_shift ();
static long right_shift ();
#line 111 "cexp.y"
typedef union {
struct constant {long value; int unsignedp;} integer;
struct name {U_CHAR *address; int length;} name;
struct arglist *keywords;
int voidval;
char *sval;
} YYSTYPE;
#ifndef YYLTYPE
typedef
struct yyltype
{
int timestamp;
int first_line;
int first_column;
int last_line;
int last_column;
char *text;
}
yyltype;
#define YYLTYPE yyltype
#endif
#include <stdio.h>
#ifndef __STDC__
#define const
#endif
#define YYFINAL 73
#define YYFLAG -32768
#define YYNTBASE 34
#define YYTRANSLATE(x) ((unsigned)(x) <= 270 ? yytranslate[x] : 39)
static const char yytranslate[] = { 0,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 29, 2, 31, 2, 27, 14, 2, 32,
33, 25, 23, 9, 24, 2, 26, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 8, 2, 17,
2, 18, 7, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 13, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 12, 2, 30, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 1, 2, 3, 4, 5,
6, 10, 11, 15, 16, 19, 20, 21, 22, 28
};
static const short yyprhs[] = { 0,
0, 2, 4, 8, 11, 14, 17, 20, 23, 24,
31, 35, 39, 43, 47, 51, 55, 59, 63, 67,
71, 75, 79, 83, 87, 91, 95, 99, 103, 107,
113, 115, 117, 119, 120, 125
};
static const short yyrhs[] = { 35,
0, 36, 0, 35, 9, 36, 0, 24, 36, 0,
29, 36, 0, 23, 36, 0, 30, 36, 0, 31,
5, 0, 0, 31, 5, 37, 32, 38, 33, 0,
32, 35, 33, 0, 36, 25, 36, 0, 36, 26,
36, 0, 36, 27, 36, 0, 36, 23, 36, 0,
36, 24, 36, 0, 36, 21, 36, 0, 36, 22,
36, 0, 36, 15, 36, 0, 36, 16, 36, 0,
36, 19, 36, 0, 36, 20, 36, 0, 36, 17,
36, 0, 36, 18, 36, 0, 36, 14, 36, 0,
36, 13, 36, 0, 36, 12, 36, 0, 36, 11,
36, 0, 36, 10, 36, 0, 36, 7, 36, 8,
36, 0, 3, 0, 4, 0, 5, 0, 0, 32,
38, 33, 38, 0, 5, 38, 0
};
#if YYDEBUG != 0
static const short yyrline[] = { 0,
143, 148, 149, 156, 161, 164, 166, 169, 173, 175,
180, 185, 197, 212, 223, 230, 237, 243, 249, 252,
255, 261, 267, 273, 279, 282, 285, 288, 291, 294,
297, 299, 301, 306, 308, 321
};
static const char * const yytname[] = { "$","error","$illegal.","INT","CHAR",
"NAME","ERROR","'?'","':'","','","OR","AND","'|'","'^'","'&'","EQUAL","NOTEQUAL",
"'<'","'>'","LEQ","GEQ","LSH","RSH","'+'","'-'","'*'","'/'","'%'","UNARY","'!'",
"'~'","'#'","'('","')'","start","exp1","exp","@1","keywords",""
};
#endif
static const short yyr1[] = { 0,
34, 35, 35, 36, 36, 36, 36, 36, 37, 36,
36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
36, 36, 36, 38, 38, 38
};
static const short yyr2[] = { 0,
1, 1, 3, 2, 2, 2, 2, 2, 0, 6,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 5,
1, 1, 1, 0, 4, 2
};
static const short yydefact[] = { 0,
31, 32, 33, 0, 0, 0, 0, 0, 0, 1,
2, 6, 4, 5, 7, 8, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 11, 3,
0, 29, 28, 27, 26, 25, 19, 20, 23, 24,
21, 22, 17, 18, 15, 16, 12, 13, 14, 34,
0, 34, 34, 0, 30, 36, 0, 10, 34, 35,
0, 0, 0
};
static const short yydefgoto[] = { 71,
10, 11, 38, 64
};
static const short yypact[] = { 31,
-32768,-32768,-32768, 31, 31, 31, 31, 4, 31, 3,
80,-32768,-32768,-32768,-32768, 6, 32, 31, 31, 31,
31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
31, 31, 31, 31, 31, 31, 31, 7,-32768, 80,
59, 97, 113, 128, 142, 155, 25, 25, 162, 162,
162, 162, 167, 167, -19, -19,-32768,-32768,-32768, 5,
31, 5, 5, -