reactos/reactos/tools/wpp/lex.yy.c

4121 lines
116 KiB
C
Raw Normal View History

#define yy_create_buffer pp_create_buffer
#define yy_delete_buffer pp_delete_buffer
#define yy_scan_buffer pp_scan_buffer
#define yy_scan_string pp_scan_string
#define yy_scan_bytes pp_scan_bytes
#define yy_flex_debug pp_flex_debug
#define yy_init_buffer pp_init_buffer
#define yy_flush_buffer pp_flush_buffer
#define yy_load_buffer_state pp_load_buffer_state
#define yy_switch_to_buffer pp_switch_to_buffer
#define yyin ppin
#define yyleng ppleng
#define yylex pplex
#define yyout ppout
#define yyrestart pprestart
#define yytext pptext
#define yywrap ppwrap
#line 20 "tools/wpp/lex.yy.c"
/* A lexical scanner generated by flex */
/* Scanner skeleton version:
* $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $
*/
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
#include <stdio.h>
#include <unistd.h>
/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
#ifdef c_plusplus
#ifndef __cplusplus
#define __cplusplus
#endif
#endif
#ifdef __cplusplus
#include <stdlib.h>
/* Use prototypes in function declarations. */
#define YY_USE_PROTOS
/* The "const" storage-class-modifier is valid. */
#define YY_USE_CONST
#else /* ! __cplusplus */
#if __STDC__
#define YY_USE_PROTOS
#define YY_USE_CONST
#endif /* __STDC__ */
#endif /* ! __cplusplus */
#ifdef __TURBOC__
#pragma warn -rch
#pragma warn -use
#include <io.h>
#include <stdlib.h>
#define YY_USE_CONST
#define YY_USE_PROTOS
#endif
#ifdef YY_USE_CONST
#define yyconst const
#else
#define yyconst
#endif
#ifdef YY_USE_PROTOS
#define YY_PROTO(proto) proto
#else
#define YY_PROTO(proto) ()
#endif
/* Returned upon end-of-file. */
#define YY_NULL 0
/* Promotes a possibly negative, possibly signed char to an unsigned
* integer for use as an array index. If the signed char is negative,
* we want to instead treat it as an 8-bit unsigned char, hence the
* double cast.
*/
#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
/* Enter a start condition. This macro really ought to take a parameter,
* but we do it the disgusting crufty way forced on us by the ()-less
* definition of BEGIN.
*/
#define BEGIN yy_start = 1 + 2 *
/* Translate the current start state into a value that can be later handed
* to BEGIN to return to the state. The YYSTATE alias is for lex
* compatibility.
*/
#define YY_START ((yy_start - 1) / 2)
#define YYSTATE YY_START
/* Action number for EOF rule of a given start state. */
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
/* Special action meaning "start processing a new file". */
#define YY_NEW_FILE yyrestart( yyin )
#define YY_END_OF_BUFFER_CHAR 0
/* Size of default input buffer. */
#define YY_BUF_SIZE 16384
typedef struct yy_buffer_state *YY_BUFFER_STATE;
extern int yyleng;
extern FILE *yyin, *yyout;
#define EOB_ACT_CONTINUE_SCAN 0
#define EOB_ACT_END_OF_FILE 1
#define EOB_ACT_LAST_MATCH 2
/* The funky do-while in the following #define is used to turn the definition
* int a single C statement (which needs a semi-colon terminator). This
* avoids problems with code like:
*
* if ( condition_holds )
* yyless( 5 );
* else
* do_something_else();
*
* Prior to using the do-while the compiler would get upset at the
* "else" because it interpreted the "if" statement as being all
* done when it reached the ';' after the yyless() call.
*/
/* Return all but the first 'n' matched characters back to the input stream. */
#define yyless(n) \
do \
{ \
/* Undo effects of setting up yytext. */ \
*yy_cp = yy_hold_char; \
YY_RESTORE_YY_MORE_OFFSET \
yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
YY_DO_BEFORE_ACTION; /* set up yytext again */ \
} \
while ( 0 )
#define unput(c) yyunput( c, yytext_ptr )
/* The following is because we cannot portably get our hands on size_t
* (without autoconf's help, which isn't available because we want
* flex-generated scanners to compile on their own).
*/
typedef unsigned int yy_size_t;
struct yy_buffer_state
{
FILE *yy_input_file;
char *yy_ch_buf; /* input buffer */
char *yy_buf_pos; /* current position in input buffer */
/* Size of input buffer in bytes, not including room for EOB
* characters.
*/
yy_size_t yy_buf_size;
/* Number of characters read into yy_ch_buf, not including EOB
* characters.
*/
int yy_n_chars;
/* Whether we "own" the buffer - i.e., we know we created it,
* and can realloc() it to grow it, and should free() it to
* delete it.
*/
int yy_is_our_buffer;
/* Whether this is an "interactive" input source; if so, and
* if we're using stdio for input, then we want to use getc()
* instead of fread(), to make sure we stop fetching input after
* each newline.
*/
int yy_is_interactive;
/* Whether we're considered to be at the beginning of a line.
* If so, '^' rules will be active on the next match, otherwise
* not.
*/
int yy_at_bol;
/* Whether to try to fill the input buffer when we reach the
* end of it.
*/
int yy_fill_buffer;
int yy_buffer_status;
#define YY_BUFFER_NEW 0
#define YY_BUFFER_NORMAL 1
/* When an EOF's been seen but there's still some text to process
* then we mark the buffer as YY_EOF_PENDING, to indicate that we
* shouldn't try reading from the input source any more. We might
* still have a bunch of tokens to match, though, because of
* possible backing-up.
*
* When we actually see the EOF, we change the status to "new"
* (via yyrestart()), so that the user can continue scanning by
* just pointing yyin at a new input file.
*/
#define YY_BUFFER_EOF_PENDING 2
};
static YY_BUFFER_STATE yy_current_buffer = 0;
/* We provide macros for accessing buffer states in case in the
* future we want to put the buffer states in a more general
* "scanner state".
*/
#define YY_CURRENT_BUFFER yy_current_buffer
/* yy_hold_char holds the character lost when yytext is formed. */
static char yy_hold_char;
static int yy_n_chars; /* number of characters read into yy_ch_buf */
int yyleng;
/* Points to current character in buffer. */
static char *yy_c_buf_p = (char *) 0;
static int yy_init = 1; /* whether we need to initialize */
static int yy_start = 0; /* start state number */
/* Flag which is used to allow yywrap()'s to do buffer switches
* instead of setting up a fresh yyin. A bit of a hack ...
*/
static int yy_did_buffer_switch_on_eof;
void yyrestart YY_PROTO(( FILE *input_file ));
void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
void yy_load_buffer_state YY_PROTO(( void ));
YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
static void yy_flex_free YY_PROTO(( void * ));
#define yy_new_buffer yy_create_buffer
#define yy_set_interactive(is_interactive) \
{ \
if ( ! yy_current_buffer ) \
yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
yy_current_buffer->yy_is_interactive = is_interactive; \
}
#define yy_set_bol(at_bol) \
{ \
if ( ! yy_current_buffer ) \
yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
yy_current_buffer->yy_at_bol = at_bol; \
}
#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
typedef unsigned char YY_CHAR;
FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
typedef int yy_state_type;
extern char *yytext;
#define yytext_ptr yytext
static yy_state_type yy_get_previous_state YY_PROTO(( void ));
static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
static int yy_get_next_buffer YY_PROTO(( void ));
static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
/* Done after the current pattern has been matched and before the
* corresponding action - sets up yytext.
*/
#define YY_DO_BEFORE_ACTION \
yytext_ptr = yy_bp; \
yyleng = (int) (yy_cp - yy_bp); \
yy_hold_char = *yy_cp; \
*yy_cp = '\0'; \
yy_c_buf_p = yy_cp;
#define YY_NUM_RULES 144
#define YY_END_OF_BUFFER 145
static yyconst short int yy_accept[421] =
{ 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 118, 118, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 145, 134, 135, 136, 122, 143,
123, 134, 133, 134, 135, 1, 22, 17, 19, 17,
22, 21, 18, 18, 18, 18, 18, 18, 18, 18,
69, 72, 70, 71, 29, 26, 27, 25, 29, 24,
29, 29, 124, 132, 125, 143, 126, 127, 143, 128,
129, 118, 119, 118, 78, 76, 78, 78, 75, 78,
79, 83, 85, 84, 143, 80, 91, 87, 91, 86,
89, 91, 91, 88, 91, 93, 101, 103, 96, 102,
98, 97, 94, 98, 93, 107, 107, 105, 104, 107,
115, 114, 111, 112, 108, 109, 110, 115, 115, 134,
135, 139, 122, 139, 123, 134, 133, 134, 54, 51,
48, 54, 53, 54, 52, 54, 34, 36, 54, 54,
54, 54, 50, 54, 54, 59, 56, 57, 59, 55,
59, 63, 60, 61, 63, 63, 23, 68, 65, 68,
66, 68, 64, 68, 30, 31, 33, 33, 33, 30,
1, 141, 144, 142, 140, 140, 134, 135, 134, 117,
121, 133, 137, 138, 135, 1, 17, 18, 18, 18,
18, 18, 18, 18, 18, 19, 20, 21, 18, 18,
18, 18, 18, 12, 18, 18, 18, 18, 18, 69,
70, 71, 73, 71, 26, 28, 29, 124, 131, 130,
131, 126, 128, 118, 118, 118, 120, 76, 74, 75,
77, 78, 79, 80, 82, 80, 87, 86, 91, 88,
92, 91, 93, 95, 98, 97, 94, 100, 98, 93,
107, 105, 104, 107, 106, 107, 115, 115, 113, 116,
115, 134, 139, 139, 51, 45, 42, 34, 35, 34,
34, 38, 36, 36, 36, 40, 46, 44, 47, 41,
49, 50, 133, 43, 56, 55, 58, 59, 60, 62,
0, 23, 65, 64, 68, 67, 68, 30, 32, 33,
30, 141, 140, 121, 121, 18, 18, 18, 18, 18,
18, 12, 18, 18, 18, 18, 18, 18, 18, 70,
81, 90, 99, 35, 35, 34, 34, 34, 37, 36,
36, 36, 133, 121, 18, 13, 14, 18, 18, 18,
18, 18, 18, 16, 18, 18, 18, 35, 35, 35,
34, 37, 37, 36, 133, 18, 13, 14, 15, 5,
8, 10, 18, 18, 16, 18, 9, 18, 35, 37,
37, 37, 133, 4, 15, 5, 8, 10, 11, 18,
7, 9, 18, 37, 133, 4, 11, 2, 7, 6,
39, 2, 0, 6, 0, 0, 0, 3, 3, 0
} ;
static yyconst int yy_ec[256] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
2, 2, 4, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 2, 5, 6, 7, 1, 1, 8, 9, 10,
11, 12, 1, 13, 1, 14, 15, 16, 17, 17,
17, 17, 17, 17, 17, 18, 18, 1, 1, 19,
20, 21, 1, 1, 22, 22, 22, 22, 22, 22,
23, 23, 23, 23, 23, 24, 23, 23, 23, 23,
23, 23, 23, 23, 25, 23, 23, 26, 23, 23,
1, 27, 1, 1, 28, 1, 29, 30, 31, 32,
33, 34, 35, 36, 37, 36, 36, 38, 39, 40,
41, 42, 36, 43, 44, 45, 46, 36, 47, 48,
36, 36, 1, 49, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1
} ;
static yyconst int yy_meta[50] =
{ 0,
1, 2, 3, 2, 1, 4, 5, 1, 6, 7,
8, 9, 8, 10, 11, 12, 12, 12, 1, 1,
13, 14, 15, 15, 15, 15, 16, 17, 14, 14,
14, 14, 14, 14, 15, 15, 15, 15, 15, 15,
15, 15, 15, 15, 15, 15, 15, 15, 1
} ;
static yyconst short int yy_base[464] =
{ 0,
0, 48, 55, 0, 102, 103, 130, 0, 177, 178,
179, 182, 186, 187, 104, 107, 214, 0, 261, 262,
289, 0, 338, 0, 386, 389, 414, 439, 466, 0,
515, 0, 564, 0, 399, 403, 612, 638, 665, 0,
428, 618, 714, 763, 1354, 0, 49, 1771, 1771, 1771,
1771, 96, 0, 109, 118, 1771, 1771, 811, 1771, 1350,
111, 111, 858, 1316, 154, 161, 1307, 1300, 1302, 1312,
0, 1771, 184, 124, 1771, 196, 1771, 1771, 254, 1771,
0, 199, 0, 1771, 1771, 269, 0, 1771, 1337, 0,
1771, 0, 1771, 263, 1771, 208, 1771, 267, 1123, 277,
0, 1771, 1771, 1771, 271, 281, 1771, 393, 1771, 396,
1771, 1118, 396, 0, 406, 0, 1771, 1771, 1124, 1771,
400, 0, 0, 418, 905, 1771, 430, 1771, 1771, 433,
0, 1771, 1771, 1771, 1771, 1771, 1771, 432, 435, 0,
449, 1771, 1771, 1771, 1771, 444, 0, 954, 1771, 456,
1771, 1110, 1771, 1121, 1771, 449, 988, 714, 443, 1108,
603, 0, 623, 1094, 1077, 1771, 615, 1771, 619, 0,
632, 1771, 644, 1771, 635, 634, 635, 1771, 655, 1771,
1771, 646, 0, 659, 0, 1771, 1771, 725, 738, 741,
1771, 742, 1771, 1771, 0, 735, 0, 747, 741, 1771,
0, 0, 1771, 1122, 755, 1771, 0, 0, 1091, 747,
754, 1086, 1079, 1081, 1091, 1771, 1771, 1116, 1084, 717,
1085, 1073, 1082, 777, 1083, 1073, 1083, 1079, 1067, 0,
0, 1771, 1771, 1106, 787, 1771, 1105, 0, 1771, 1771,
1104, 0, 0, 0, 743, 765, 1771, 791, 1771, 1093,
1771, 1099, 0, 1771, 794, 1098, 795, 798, 1086, 0,
1771, 1096, 0, 1771, 789, 0, 0, 801, 1081, 0,
804, 1771, 1771, 807, 1771, 1080, 0, 804, 1771, 1771,
1079, 806, 1771, 0, 818, 1771, 1771, 847, 843, 874,
799, 0, 905, 903, 800, 1771, 1771, 1771, 1771, 1771,
1771, 1078, 1046, 1771, 823, 0, 1771, 1076, 824, 1771,
1075, 816, 871, 0, 1771, 1771, 1051, 0, 1771, 1036,
872, 876, 0, 1036, 0, 995, 990, 988, 979, 970,
942, 880, 917, 915, 906, 881, 873, 870, 862, 0,
884, 1771, 890, 907, 845, 618, 863, 873, 910, 911,
914, 922, 840, 1085, 830, 935, 938, 832, 796, 791,
801, 797, 783, 974, 753, 702, 691, 938, 942, 945,
1771, 961, 953, 1771, 620, 616, 977, 985, 986, 990,
991, 994, 598, 433, 998, 417, 1006, 388, 1771, 972,
977, 985, 386, 1015, 1018, 1023, 1026, 1027, 1031, 371,
1048, 1049, 359, 1771, 255, 1056, 1057, 1060, 1061, 1064,
0, 1065, 234, 1068, 153, 61, 9, 1069, 1072, 1771,
1134, 1151, 1168, 1185, 1202, 1219, 1236, 1253, 1270, 1287,
1304, 1321, 1338, 1351, 1353, 1370, 1387, 1404, 1421, 1438,
1455, 1472, 1489, 1500, 1517, 1534, 1540, 1557, 1574, 1591,
1597, 1614, 1631, 1648, 1654, 1660, 1677, 1694, 1702, 1719,
1736, 1063, 1753
} ;
static yyconst short int yy_def[464] =
{ 0,
420, 1, 420, 3, 421, 421, 420, 7, 422, 422,
423, 423, 424, 424, 425, 425, 420, 17, 426, 426,
420, 21, 420, 23, 427, 427, 428, 428, 420, 29,
420, 31, 420, 33, 429, 429, 430, 430, 420, 39,
431, 431, 432, 432, 420, 433, 420, 420, 420, 420,
420, 434, 435, 434, 420, 420, 420, 420, 420, 58,
420, 420, 58, 63, 63, 63, 63, 63, 63, 63,
436, 420, 437, 420, 420, 420, 420, 420, 420, 420,
435, 420, 438, 420, 420, 439, 440, 420, 439, 441,
420, 442, 420, 443, 420, 420, 420, 420, 444, 420,
445, 420, 420, 420, 446, 420, 420, 420, 420, 420,
420, 420, 420, 447, 420, 448, 420, 420, 420, 420,
449, 450, 451, 420, 451, 420, 420, 420, 420, 420,
452, 420, 420, 420, 420, 420, 420, 453, 420, 433,
420, 420, 420, 420, 420, 434, 435, 454, 420, 420,
420, 420, 420, 420, 420, 420, 420, 420, 420, 420,
420, 435, 420, 435, 420, 420, 420, 420, 420, 455,
420, 420, 420, 420, 420, 420, 420, 420, 420, 420,
420, 420, 456, 457, 458, 420, 420, 420, 420, 458,
420, 420, 420, 420, 459, 459, 433, 420, 434, 420,
460, 435, 420, 420, 420, 420, 58, 63, 63, 63,
63, 63, 63, 63, 63, 420, 420, 420, 63, 63,
63, 63, 63, 63, 63, 63, 63, 63, 63, 436,
461, 420, 420, 420, 420, 420, 420, 438, 420, 420,
420, 440, 441, 442, 443, 443, 420, 420, 420, 444,
420, 420, 445, 420, 420, 420, 420, 420, 420, 447,
420, 420, 448, 420, 449, 450, 451, 420, 420, 125,
420, 420, 420, 420, 420, 420, 452, 453, 420, 420,
420, 434, 420, 454, 420, 420, 420, 420, 420, 420,
420, 462, 420, 420, 420, 420, 420, 420, 420, 420,
420, 420, 435, 420, 420, 455, 420, 420, 420, 420,
420, 420, 420, 456, 420, 420, 420, 458, 420, 420,
458, 420, 459, 463, 460, 63, 63, 63, 63, 63,
63, 420, 63, 63, 63, 63, 63, 63, 63, 461,
420, 420, 420, 420, 420, 420, 420, 420, 462, 420,
420, 420, 435, 463, 63, 63, 63, 63, 63, 63,
63, 63, 63, 63, 63, 63, 63, 420, 420, 420,
420, 420, 420, 420, 435, 63, 420, 420, 63, 63,
63, 63, 63, 63, 420, 63, 63, 63, 420, 420,
420, 420, 435, 63, 420, 420, 420, 420, 63, 63,
63, 420, 63, 420, 435, 420, 420, 63, 420, 63,
435, 420, 420, 420, 420, 420, 420, 420, 420, 0,
420, 420, 420, 420, 420, 420, 420, 420, 420, 420,
420, 420, 420, 420, 420, 420, 420, 420, 420, 420,
420, 420, 420, 420, 420, 420, 420, 420, 420, 420,
420, 420, 420, 420, 420, 420, 420, 420, 420, 420,
420, 420, 420
} ;
static yyconst short int yy_nxt[1821] =
{ 0,
46, 47, 48, 47, 46, 49, 50, 46, 51, 46,
46, 46, 46, 46, 52, 46, 46, 46, 46, 46,
46, 53, 53, 53, 53, 53, 54, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 46, 55,
198, 55, 198, 418, 56, 57, 58, 59, 60, 57,
57, 57, 57, 57, 57, 57, 57, 57, 57, 61,
57, 57, 57, 57, 57, 57, 57, 57, 57, 57,
57, 62, 57, 63, 63, 63, 64, 65, 63, 63,
63, 66, 67, 63, 63, 63, 68, 63, 63, 63,
69, 70, 63, 57, 72, 72, 93, 200, 417, 93,
201, 203, 204, 217, 218, 94, 73, 73, 94, 205,
420, 205, 200, 420, 206, 201, 233, 234, 74, 74,
75, 76, 77, 76, 75, 78, 75, 75, 75, 75,
75, 75, 75, 75, 79, 75, 75, 75, 80, 75,
75, 81, 81, 81, 81, 81, 82, 81, 81, 81,
81, 81, 81, 81, 81, 81, 81, 81, 81, 81,
81, 81, 81, 81, 81, 81, 81, 81, 75, 84,
84, 84, 85, 85, 84, 416, 232, 88, 84, 84,
88, 220, 223, 221, 224, 200, 222, 235, 201, 235,
225, 236, 237, 86, 86, 89, 91, 91, 89, 248,
232, 248, 89, 89, 95, 96, 97, 96, 95, 95,
95, 95, 95, 95, 95, 95, 95, 95, 98, 95,
95, 95, 95, 95, 95, 99, 99, 99, 99, 99,
100, 99, 99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 95, 102, 102, 200, 103, 103, 201, 104,
104, 240, 241, 415, 246, 105, 105, 247, 200, 251,
252, 201, 200, 255, 256, 201, 411, 106, 106, 107,
108, 109, 108, 107, 107, 107, 107, 107, 107, 110,
107, 111, 112, 113, 107, 107, 107, 107, 107, 107,
114, 114, 114, 114, 114, 115, 114, 114, 114, 114,
114, 114, 114, 114, 114, 114, 114, 114, 114, 114,
114, 114, 114, 114, 114, 114, 114, 107, 116, 116,
117, 116, 116, 118, 119, 116, 120, 116, 116, 116,
116, 116, 121, 122, 122, 122, 116, 116, 116, 123,
123, 123, 123, 123, 124, 125, 123, 123, 123, 123,
123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
123, 123, 123, 123, 123, 123, 116, 127, 128, 127,
127, 128, 127, 410, 257, 129, 257, 258, 129, 258,
173, 174, 173, 408, 173, 174, 173, 200, 261, 262,
201, 200, 130, 175, 201, 130, 132, 175, 405, 133,
268, 269, 134, 135, 136, 176, 137, 403, 138, 176,
186, 271, 272, 271, 187, 275, 276, 280, 281, 273,
139, 132, 188, 279, 133, 401, 201, 134, 135, 136,
198, 137, 198, 138, 189, 420, 274, 285, 420, 285,
200, 296, 297, 201, 400, 139, 140, 141, 142, 141,
140, 143, 144, 140, 145, 140, 140, 140, 140, 140,
146, 140, 140, 140, 140, 140, 140, 147, 147, 147,
147, 147, 148, 147, 147, 147, 147, 147, 147, 147,
147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
147, 147, 147, 147, 140, 149, 150, 151, 150, 152,
153, 149, 154, 155, 149, 149, 149, 149, 149, 156,
157, 158, 158, 159, 160, 161, 162, 162, 162, 162,
162, 163, 162, 162, 162, 162, 164, 162, 162, 162,
162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
162, 162, 162, 165, 166, 167, 168, 167, 166, 166,
166, 166, 166, 166, 166, 166, 166, 166, 169, 166,
166, 166, 166, 166, 166, 170, 170, 170, 170, 170,
171, 170, 170, 170, 170, 170, 170, 170, 170, 170,
170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
170, 170, 166, 76, 77, 76, 305, 78, 305, 190,
186, 190, 299, 300, 191, 301, 302, 177, 177, 177,
200, 399, 188, 201, 307, 308, 310, 311, 82, 76,
77, 76, 371, 78, 189, 309, 200, 309, 394, 201,
312, 312, 312, 177, 177, 177, 313, 200, 313, 393,
201, 316, 317, 371, 82, 178, 179, 180, 179, 178,
178, 178, 178, 178, 181, 181, 178, 178, 178, 182,
178, 178, 178, 178, 178, 178, 183, 183, 183, 183,
183, 184, 183, 183, 183, 183, 183, 183, 183, 183,
183, 183, 183, 183, 183, 183, 183, 183, 183, 183,
183, 183, 183, 178, 50, 192, 193, 192, 50, 194,
50, 50, 50, 50, 50, 50, 50, 388, 196, 293,
293, 293, 50, 50, 50, 387, 200, 294, 295, 201,
319, 320, 321, 322, 321, 322, 200, 206, 198, 324,
198, 294, 420, 327, 420, 420, 205, 420, 205, 295,
328, 206, 50, 50, 192, 193, 192, 50, 194, 50,
50, 50, 50, 50, 50, 50, 246, 196, 332, 247,
332, 50, 50, 50, 220, 223, 221, 224, 235, 222,
235, 386, 248, 225, 248, 341, 257, 341, 257, 258,
420, 258, 343, 420, 343, 271, 272, 271, 333, 275,
276, 50, 207, 273, 207, 420, 334, 420, 420, 285,
420, 285, 348, 352, 305, 309, 305, 309, 384, 383,
274, 312, 312, 312, 382, 381, 348, 352, 380, 208,
208, 208, 209, 210, 208, 208, 208, 211, 212, 208,
208, 208, 213, 208, 208, 208, 214, 215, 208, 420,
289, 420, 288, 288, 289, 379, 344, 345, 370, 376,
290, 291, 313, 321, 313, 321, 375, 322, 206, 322,
344, 332, 370, 332, 290, 341, 371, 341, 345, 208,
208, 343, 291, 343, 208, 208, 371, 346, 347, 208,
371, 367, 366, 208, 208, 263, 263, 365, 263, 263,
371, 346, 263, 364, 263, 263, 263, 263, 263, 347,
293, 293, 293, 263, 263, 263, 350, 351, 294, 295,
368, 369, 270, 372, 373, 374, 377, 374, 377, 378,
350, 378, 294, 363, 368, 374, 362, 372, 351, 361,
295, 374, 369, 263, 282, 373, 374, 284, 282, 374,
282, 282, 389, 282, 282, 389, 282, 282, 389, 282,
282, 282, 282, 282, 282, 385, 392, 385, 377, 389,
377, 360, 389, 389, 390, 391, 378, 395, 378, 395,
392, 396, 397, 396, 397, 398, 404, 398, 390, 385,
404, 385, 282, 288, 288, 289, 391, 402, 404, 402,
359, 290, 291, 292, 404, 358, 406, 404, 406, 395,
357, 395, 404, 356, 396, 290, 396, 397, 398, 397,
398, 355, 407, 291, 407, 292, 325, 325, 319, 325,
325, 325, 325, 325, 325, 325, 325, 325, 325, 409,
402, 409, 402, 316, 325, 325, 325, 406, 407, 406,
407, 412, 409, 412, 409, 414, 412, 414, 412, 414,
419, 414, 419, 419, 349, 419, 349, 310, 307, 353,
301, 280, 275, 268, 325, 325, 325, 413, 325, 325,
325, 325, 325, 325, 325, 325, 325, 325, 261, 342,
255, 251, 249, 325, 325, 325, 240, 236, 233, 339,
338, 337, 336, 335, 331, 330, 329, 326, 217, 229,
228, 227, 226, 219, 203, 304, 303, 298, 287, 286,
264, 259, 249, 325, 71, 71, 71, 71, 71, 71,
71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
71, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 87, 87,
87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
87, 87, 87, 87, 87, 90, 90, 90, 90, 90,
90, 90, 90, 90, 90, 90, 90, 90, 90, 90,
90, 90, 92, 92, 92, 92, 92, 92, 92, 92,
92, 92, 92, 92, 92, 92, 92, 92, 92, 101,
101, 101, 101, 101, 101, 101, 101, 101, 101, 101,
101, 101, 101, 101, 101, 101, 126, 126, 126, 126,
126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
126, 126, 126, 131, 131, 131, 131, 131, 131, 131,
131, 131, 131, 131, 131, 131, 131, 131, 131, 131,
172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
172, 172, 172, 172, 172, 172, 172, 75, 75, 75,
75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
75, 75, 75, 75, 185, 185, 185, 185, 185, 185,
185, 185, 185, 185, 185, 185, 185, 185, 185, 185,
185, 195, 195, 195, 195, 195, 195, 195, 195, 195,
195, 195, 195, 195, 195, 195, 195, 195, 197, 420,
229, 228, 227, 226, 197, 197, 197, 197, 219, 197,
197, 199, 216, 420, 420, 199, 420, 199, 199, 199,
199, 199, 199, 199, 202, 420, 202, 202, 420, 202,
230, 230, 420, 230, 230, 230, 230, 230, 230, 230,
420, 230, 230, 230, 230, 420, 230, 231, 231, 231,
231, 231, 231, 231, 231, 231, 231, 231, 231, 231,
231, 231, 231, 231, 238, 238, 420, 420, 238, 238,
238, 238, 238, 238, 238, 238, 238, 238, 238, 420,
238, 239, 239, 239, 239, 239, 239, 239, 239, 239,
239, 239, 239, 239, 239, 239, 239, 239, 242, 242,
420, 242, 242, 420, 242, 242, 242, 242, 242, 242,
242, 242, 242, 420, 242, 243, 243, 420, 243, 243,
243, 243, 243, 243, 243, 243, 243, 420, 243, 243,
420, 243, 244, 244, 420, 244, 244, 244, 244, 244,
420, 244, 244, 244, 244, 244, 244, 244, 244, 245,
245, 420, 245, 245, 245, 245, 245, 245, 245, 245,
245, 245, 245, 245, 245, 245, 250, 420, 420, 420,
420, 250, 420, 250, 250, 420, 250, 253, 253, 420,
420, 253, 420, 253, 253, 253, 253, 420, 253, 253,
253, 253, 420, 253, 254, 254, 254, 254, 254, 254,
254, 254, 254, 254, 254, 254, 254, 254, 254, 254,
254, 260, 420, 260, 260, 420, 260, 263, 263, 420,
420, 420, 420, 263, 263, 263, 263, 420, 420, 263,
420, 420, 420, 263, 265, 265, 420, 420, 420, 420,
265, 265, 265, 265, 265, 265, 265, 265, 265, 420,
265, 266, 266, 420, 420, 420, 420, 266, 266, 266,
266, 420, 266, 266, 266, 266, 420, 266, 267, 420,
267, 267, 420, 267, 277, 277, 420, 420, 277, 420,
420, 420, 277, 277, 420, 277, 277, 277, 277, 420,
277, 278, 278, 420, 420, 278, 420, 420, 420, 278,
278, 278, 278, 278, 278, 278, 420, 278, 283, 283,
283, 283, 283, 283, 283, 283, 283, 283, 283, 283,
283, 283, 283, 283, 283, 306, 420, 306, 306, 420,
306, 314, 420, 314, 314, 420, 314, 315, 315, 315,
315, 315, 315, 315, 315, 315, 315, 315, 315, 315,
315, 315, 315, 315, 318, 318, 420, 318, 420, 318,
318, 318, 318, 318, 420, 318, 318, 318, 318, 420,
318, 323, 323, 323, 420, 323, 323, 323, 323, 325,
325, 420, 325, 325, 325, 325, 325, 325, 325, 325,
325, 325, 325, 325, 325, 325, 340, 340, 420, 340,
340, 340, 340, 340, 420, 340, 420, 340, 340, 340,
340, 420, 340, 354, 354, 420, 354, 354, 354, 354,
354, 354, 354, 354, 354, 354, 354, 354, 354, 354,
45, 420, 420, 420, 420, 420, 420, 420, 420, 420,
420, 420, 420, 420, 420, 420, 420, 420, 420, 420,
420, 420, 420, 420, 420, 420, 420, 420, 420, 420,
420, 420, 420, 420, 420, 420, 420, 420, 420, 420,
420, 420, 420, 420, 420, 420, 420, 420, 420, 420
} ;
static yyconst short int yy_chk[1821] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
47, 2, 47, 417, 2, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 5, 6, 15, 52, 416, 16,
52, 54, 54, 62, 62, 15, 5, 6, 16, 55,
54, 55, 61, 54, 55, 61, 74, 74, 5, 6,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 9,
10, 11, 9, 10, 12, 415, 73, 11, 13, 14,
12, 65, 66, 65, 66, 73, 65, 76, 73, 76,
66, 82, 82, 9, 10, 11, 13, 14, 12, 96,
73, 96, 13, 14, 17, 17, 17, 17, 17, 17,
17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
17, 17, 17, 19, 20, 79, 19, 20, 79, 19,
20, 86, 86, 413, 94, 19, 20, 94, 98, 100,
100, 98, 105, 106, 106, 105, 405, 19, 20, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 23, 23,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23, 23, 23, 23, 25, 25, 25,
26, 26, 26, 403, 108, 25, 108, 110, 26, 110,
35, 35, 35, 400, 36, 36, 36, 113, 115, 115,
113, 121, 25, 35, 121, 26, 27, 36, 393, 27,
124, 124, 27, 27, 27, 35, 27, 388, 27, 36,
41, 127, 127, 127, 41, 130, 130, 139, 139, 127,
27, 28, 41, 138, 28, 386, 138, 28, 28, 28,
141, 28, 141, 28, 41, 146, 127, 150, 146, 150,
156, 159, 159, 156, 384, 28, 29, 29, 29, 29,
29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
29, 29, 29, 29, 29, 31, 31, 31, 31, 31,
31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
31, 31, 31, 31, 33, 33, 33, 33, 33, 33,
33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
33, 33, 33, 37, 37, 37, 167, 37, 167, 42,
42, 42, 161, 161, 42, 163, 163, 37, 37, 37,
169, 383, 42, 169, 171, 171, 176, 176, 37, 38,
38, 38, 346, 38, 42, 173, 175, 173, 376, 175,
177, 177, 177, 38, 38, 38, 179, 182, 179, 375,
182, 184, 184, 346, 38, 39, 39, 39, 39, 39,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
39, 39, 39, 39, 43, 43, 43, 43, 43, 43,
43, 43, 43, 43, 43, 43, 43, 367, 43, 158,
158, 158, 43, 43, 43, 366, 188, 158, 158, 188,
189, 189, 190, 192, 190, 192, 196, 190, 198, 196,
198, 158, 199, 220, 245, 199, 205, 245, 205, 158,
220, 205, 43, 44, 44, 44, 44, 44, 44, 44,
44, 44, 44, 44, 44, 44, 246, 44, 224, 246,
224, 44, 44, 44, 210, 211, 210, 211, 235, 210,
235, 365, 248, 211, 248, 255, 257, 255, 257, 258,
265, 258, 268, 265, 268, 271, 271, 271, 224, 274,
274, 44, 58, 271, 58, 278, 224, 282, 278, 285,
282, 285, 291, 295, 305, 309, 305, 309, 363, 362,
271, 312, 312, 312, 361, 360, 291, 295, 359, 58,
58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
58, 58, 58, 58, 58, 58, 58, 58, 58, 63,
289, 63, 288, 288, 288, 358, 289, 289, 345, 355,
288, 288, 313, 321, 313, 321, 353, 322, 321, 322,
289, 332, 345, 332, 288, 341, 347, 341, 289, 63,
63, 343, 288, 343, 63, 63, 348, 290, 290, 63,
347, 339, 338, 63, 63, 125, 125, 337, 125, 125,
348, 290, 125, 336, 125, 125, 125, 125, 125, 290,
293, 293, 293, 125, 125, 125, 294, 294, 293, 293,
344, 344, 125, 349, 349, 350, 356, 351, 356, 357,
294, 357, 293, 335, 344, 352, 334, 349, 294, 333,
293, 351, 344, 125, 148, 349, 350, 148, 148, 352,
148, 148, 368, 148, 148, 369, 148, 148, 370, 148,
148, 148, 148, 148, 148, 364, 373, 364, 377, 369,
377, 331, 370, 368, 372, 372, 378, 379, 378, 379,
373, 380, 381, 380, 381, 382, 390, 382, 372, 385,
391, 385, 148, 157, 157, 157, 372, 387, 392, 387,
330, 157, 157, 157, 391, 329, 394, 390, 394, 395,
328, 395, 392, 327, 396, 157, 396, 397, 398, 397,
398, 326, 399, 157, 399, 157, 324, 324, 320, 324,
324, 324, 324, 324, 324, 324, 324, 324, 324, 401,
402, 401, 402, 317, 324, 324, 324, 406, 407, 406,
407, 408, 409, 408, 409, 410, 412, 410, 412, 414,
418, 414, 418, 419, 462, 419, 462, 311, 308, 303,
302, 281, 276, 269, 324, 354, 354, 408, 354, 354,
354, 354, 354, 354, 354, 354, 354, 354, 262, 259,
256, 252, 250, 354, 354, 354, 241, 237, 234, 229,
228, 227, 226, 225, 223, 222, 221, 219, 218, 215,
214, 213, 212, 209, 204, 165, 164, 160, 154, 152,
119, 112, 99, 354, 421, 421, 421, 421, 421, 421,
421, 421, 421, 421, 421, 421, 421, 421, 421, 421,
421, 422, 422, 422, 422, 422, 422, 422, 422, 422,
422, 422, 422, 422, 422, 422, 422, 422, 423, 423,
423, 423, 423, 423, 423, 423, 423, 423, 423, 423,
423, 423, 423, 423, 423, 424, 424, 424, 424, 424,
424, 424, 424, 424, 424, 424, 424, 424, 424, 424,
424, 424, 425, 425, 425, 425, 425, 425, 425, 425,
425, 425, 425, 425, 425, 425, 425, 425, 425, 426,
426, 426, 426, 426, 426, 426, 426, 426, 426, 426,
426, 426, 426, 426, 426, 426, 427, 427, 427, 427,
427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
427, 427, 427, 428, 428, 428, 428, 428, 428, 428,
428, 428, 428, 428, 428, 428, 428, 428, 428, 428,
429, 429, 429, 429, 429, 429, 429, 429, 429, 429,
429, 429, 429, 429, 429, 429, 429, 430, 430, 430,
430, 430, 430, 430, 430, 430, 430, 430, 430, 430,
430, 430, 430, 430, 431, 431, 431, 431, 431, 431,
431, 431, 431, 431, 431, 431, 431, 431, 431, 431,
431, 432, 432, 432, 432, 432, 432, 432, 432, 432,
432, 432, 432, 432, 432, 432, 432, 432, 433, 89,
70, 69, 68, 67, 433, 433, 433, 433, 64, 433,
433, 434, 60, 45, 0, 434, 0, 434, 434, 434,
434, 434, 434, 434, 435, 0, 435, 435, 0, 435,
436, 436, 0, 436, 436, 436, 436, 436, 436, 436,
0, 436, 436, 436, 436, 0, 436, 437, 437, 437,
437, 437, 437, 437, 437, 437, 437, 437, 437, 437,
437, 437, 437, 437, 438, 438, 0, 0, 438, 438,
438, 438, 438, 438, 438, 438, 438, 438, 438, 0,
438, 439, 439, 439, 439, 439, 439, 439, 439, 439,
439, 439, 439, 439, 439, 439, 439, 439, 440, 440,
0, 440, 440, 0, 440, 440, 440, 440, 440, 440,
440, 440, 440, 0, 440, 441, 441, 0, 441, 441,
441, 441, 441, 441, 441, 441, 441, 0, 441, 441,
0, 441, 442, 442, 0, 442, 442, 442, 442, 442,
0, 442, 442, 442, 442, 442, 442, 442, 442, 443,
443, 0, 443, 443, 443, 443, 443, 443, 443, 443,
443, 443, 443, 443, 443, 443, 444, 0, 0, 0,
0, 444, 0, 444, 444, 0, 444, 445, 445, 0,
0, 445, 0, 445, 445, 445, 445, 0, 445, 445,
445, 445, 0, 445, 446, 446, 446, 446, 446, 446,
446, 446, 446, 446, 446, 446, 446, 446, 446, 446,
446, 447, 0, 447, 447, 0, 447, 448, 448, 0,
0, 0, 0, 448, 448, 448, 448, 0, 0, 448,
0, 0, 0, 448, 449, 449, 0, 0, 0, 0,
449, 449, 449, 449, 449, 449, 449, 449, 449, 0,
449, 450, 450, 0, 0, 0, 0, 450, 450, 450,
450, 0, 450, 450, 450, 450, 0, 450, 451, 0,
451, 451, 0, 451, 452, 452, 0, 0, 452, 0,
0, 0, 452, 452, 0, 452, 452, 452, 452, 0,
452, 453, 453, 0, 0, 453, 0, 0, 0, 453,
453, 453, 453, 453, 453, 453, 0, 453, 454, 454,
454, 454, 454, 454, 454, 454, 454, 454, 454, 454,
454, 454, 454, 454, 454, 455, 0, 455, 455, 0,
455, 456, 0, 456, 456, 0, 456, 457, 457, 457,
457, 457, 457, 457, 457, 457, 457, 457, 457, 457,
457, 457, 457, 457, 458, 458, 0, 458, 0, 458,
458, 458, 458, 458, 0, 458, 458, 458, 458, 0,
458, 459, 459, 459, 0, 459, 459, 459, 459, 460,
460, 0, 460, 460, 460, 460, 460, 460, 460, 460,
460, 460, 460, 460, 460, 460, 461, 461, 0, 461,
461, 461, 461, 461, 0, 461, 0, 461, 461, 461,
461, 0, 461, 463, 463, 0, 463, 463, 463, 463,
463, 463, 463, 463, 463, 463, 463, 463, 463, 463,
420, 420, 420, 420, 420, 420, 420, 420, 420, 420,
420, 420, 420, 420, 420, 420, 420, 420, 420, 420,
420, 420, 420, 420, 420, 420, 420, 420, 420, 420,
420, 420, 420, 420, 420, 420, 420, 420, 420, 420,
420, 420, 420, 420, 420, 420, 420, 420, 420, 420
} ;
static yy_state_type yy_last_accepting_state;
static char *yy_last_accepting_cpos;
/* The intent behind this definition is that it'll catch
* any uses of REJECT which flex missed.
*/
#define REJECT reject_used_but_not_detected
#define yymore() yymore_used_but_not_detected
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
char *yytext;
#line 1 "tools/wpp/ppl.l"
#define INITIAL 0
/* -*-C-*-
* Wrc preprocessor lexical analysis
*
* Copyright 1999-2000 Bertho A. Stultiens (BS)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* History:
* 24-Apr-2000 BS - Started from scratch to restructure everything
* and reintegrate the source into the wine-tree.
* 04-Jan-2000 BS - Added comments about the lexicographical
* grammar to give some insight in the complexity.
* 28-Dec-1999 BS - Eliminated backing-up of the flexer by running
* `flex -b' on the source. This results in some
* weirdo extra rules, but a much faster scanner.
* 23-Dec-1999 BS - Started this file
*
*-------------------------------------------------------------------------
* The preprocessor's lexographical grammar (approximately):
*
* pp := {ws} # {ws} if {ws} {expr} {ws} \n
* | {ws} # {ws} ifdef {ws} {id} {ws} \n
* | {ws} # {ws} ifndef {ws} {id} {ws} \n
* | {ws} # {ws} elif {ws} {expr} {ws} \n
* | {ws} # {ws} else {ws} \n
* | {ws} # {ws} endif {ws} \n
* | {ws} # {ws} include {ws} < {anytext} > \n
* | {ws} # {ws} include {ws} " {anytext} " \n
* | {ws} # {ws} include_next {ws} < {anytext} > \n
* | {ws} # {ws} include_next {ws} " {anytext} " \n
* | {ws} # {ws} define {ws} {anytext} \n
* | {ws} # {ws} define( {arglist} ) {ws} {expansion} \n
* | {ws} # {ws} pragma {ws} {anytext} \n
* | {ws} # {ws} ident {ws} {anytext} \n
* | {ws} # {ws} error {ws} {anytext} \n
* | {ws} # {ws} warning {ws} {anytext} \n
* | {ws} # {ws} line {ws} " {anytext} " {number} \n
* | {ws} # {ws} {number} " {anytext} " {number} [ {number} [{number}] ] \n
* | {ws} # {ws} \n
*
* ws := [ \t\r\f\v]*
*
* expr := {expr} [+-*%^/|&] {expr}
* | {expr} {logor|logand} {expr}
* | [!~+-] {expr}
* | {expr} ? {expr} : {expr}
*
* logor := ||
*
* logand := &&
*
* id := [a-zA-Z_][a-zA-Z0-9_]*
*
* anytext := [^\n]* (see note)
*
* arglist :=
* | {id}
* | {arglist} , {id}
* | {arglist} , {id} ...
*
* expansion := {id}
* | # {id}
* | {anytext}
* | {anytext} ## {anytext}
*
* number := [0-9]+
*
* Note: "anytext" is not always "[^\n]*". This is because the
* trailing context must be considered as well.
*
* The only certain assumption for the preprocessor to make is that
* directives start at the beginning of the line, followed by a '#'
* and end with a newline.
* Any directive may be suffixed with a line-continuation. Also
* classical comment / *...* / (note: no comments within comments,
* therefore spaces) is considered to be a line-continuation
* (according to gcc and egcs AFAIK, ANSI is a bit vague).
* Comments have not been added to the above grammar for simplicity
* reasons. However, it is allowed to enter comment anywhere within
* the directives as long as they do not interfere with the context.
* All comments are considered to be deletable whitespace (both
* classical form "/ *...* /" and C++ form "//...\n").
*
* All recursive scans, except for macro-expansion, are done by the
* parser, whereas the simple state transitions of non-recursive
* directives are done in the scanner. This results in the many
* exclusive start-conditions of the scanner.
*
* Macro expansions are slightly more difficult because they have to
* prescan the arguments. Parameter substitution is literal if the
* substitution is # or ## (either side). This enables new identifiers
* to be created (see 'info cpp' node Macro|Pitfalls|Prescan for more
* information).
*
* FIXME: Variable macro parameters is recognized, but not yet
* expanded. I have to reread the ANSI standard on the subject (yes,
* ANSI defines it).
*
* The following special defines are supported:
* __FILE__ -> "thissource.c"
* __LINE__ -> 123
* __DATE__ -> "May 1 2000"
* __TIME__ -> "23:59:59"
* These macros expand, as expected, into their ANSI defined values.
*
* The same include prevention is implemented as gcc and egcs does.
* This results in faster processing because we do not read the text
* at all. Some wine-sources attempt to include the same file 4 or 5
* times. This strategy also saves a lot blank output-lines, which in
* its turn improves the real resource scanner/parser.
*
*/
/*
* Special flex options and exclusive scanner start-conditions
*/
#define YY_STACK_USED 1
#define YY_NEVER_INTERACTIVE 1
#define YY_NO_UNPUT 1
#define pp_pp 1
#define pp_eol 2
#define pp_inc 3
#define pp_dqs 4
#define pp_sqs 5
#define pp_iqs 6
#define pp_comment 7
#define pp_def 8
#define pp_define 9
#define pp_macro 10
#define pp_mbody 11
#define pp_macign 12
#define pp_macscan 13
#define pp_macexp 14
#define pp_if 15
#define pp_ifd 16
#define pp_endif 17
#define pp_line 18
#define pp_defined 19
#define pp_ignore 20
#define RCINCL 21
#line 161 "tools/wpp/ppl.l"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <assert.h>
#include "wpp_private.h"
#include "ppy.tab.h"
/*
* Make sure that we are running an appropriate version of flex.
*/
#if !defined(YY_FLEX_MAJOR_VERSION) || (1000 * YY_FLEX_MAJOR_VERSION + YY_FLEX_MINOR_VERSION < 2005)
#error Must use flex version 2.5.1 or higher (yy_scan_* routines are required).
#endif
#define YY_READ_BUF_SIZE 65536 /* So we read most of a file at once */
#define yy_current_state() YY_START
#define yy_pp_state(x) yy_pop_state(); yy_push_state(x)
/*
* Always update the current character position within a line
*/
#define YY_USER_ACTION pp_status.char_number+=ppleng;
/*
* Buffer management for includes and expansions
*/
#define MAXBUFFERSTACK 128 /* Nesting more than 128 includes or macro expansion textss is insane */
typedef struct bufferstackentry {
YY_BUFFER_STATE bufferstate; /* Buffer to switch back to */
pp_entry_t *define; /* Points to expanding define or NULL if handling includes */
int line_number; /* Line that we were handling */
int char_number; /* The current position on that line */
const char *filename; /* Filename that we were handling */
int if_depth; /* How many #if:s deep to check matching #endif:s */
int ncontinuations; /* Remember the continuation state */
int should_pop; /* Set if we must pop the start-state on EOF */
/* Include management */
include_state_t incl;
char *include_filename;
int pass_data;
} bufferstackentry_t;
#define ALLOCBLOCKSIZE (1 << 10) /* Allocate these chunks at a time for string-buffers */
/*
* Macro expansion nesting
* We need the stack to handle expansions while scanning
* a macro's arguments. The TOS must always be the macro
* that receives the current expansion from the scanner.
*/
#define MAXMACEXPSTACK 128 /* Nesting more than 128 macro expansions is insane */
typedef struct macexpstackentry {
pp_entry_t *ppp; /* This macro we are scanning */
char **args; /* With these arguments */
char **ppargs; /* Resulting in these preprocessed arguments */
int *nnls; /* Number of newlines per argument */
int nargs; /* And this many arguments scanned */
int parentheses; /* Nesting level of () */
int curargsize; /* Current scanning argument's size */
int curargalloc; /* Current scanning argument's block allocated */
char *curarg; /* Current scanning argument's content */
} macexpstackentry_t;
#define MACROPARENTHESES() (top_macro()->parentheses)
/*
* Prototypes
*/
static void newline(int);
static int make_number(int radix, YYSTYPE *val, const char *str, int len);
static void put_buffer(const char *s, int len);
static int is_c_h_include(char *fname, int quoted);
/* Buffer management */
static void push_buffer(pp_entry_t *ppp, char *filename, char *incname, int pop);
static bufferstackentry_t *pop_buffer(void);
/* String functions */
static void new_string(void);
static void add_string(const char *str, int len);
static char *get_string(void);
static void put_string(void);
static int string_start(void);
/* Macro functions */
static void push_macro(pp_entry_t *ppp);
static macexpstackentry_t *top_macro(void);
static macexpstackentry_t *pop_macro(void);
static void free_macro(macexpstackentry_t *mep);
static void add_text_to_macro(const char *text, int len);
static void macro_add_arg(int last);
static void macro_add_expansion(void);
/* Expansion */
static void expand_special(pp_entry_t *ppp);
static void expand_define(pp_entry_t *ppp);
static void expand_macro(macexpstackentry_t *mep);
/*
* Local variables
*/
static int ncontinuations;
static int strbuf_idx = 0;
static int strbuf_alloc = 0;
static char *strbuffer = NULL;
static int str_startline;
static macexpstackentry_t *macexpstack[MAXMACEXPSTACK];
static int macexpstackidx = 0;
static bufferstackentry_t bufferstack[MAXBUFFERSTACK];
static int bufferstackidx = 0;
static int pass_data=1;
/*
* Global variables
*/
include_state_t pp_incl_state =
{
-1, /* state */
NULL, /* ppp */
0, /* ifdepth */
0 /* seen_junk */
};
includelogicentry_t *pp_includelogiclist = NULL;
/*
**************************************************************************
* The scanner starts here
**************************************************************************
*/
#line 1237 "tools/wpp/lex.yy.c"
/* Macros after this point can all be overridden by user definitions in
* section 1.
*/
#ifndef YY_SKIP_YYWRAP
#ifdef __cplusplus
extern "C" int yywrap YY_PROTO(( void ));
#else
extern int yywrap YY_PROTO(( void ));
#endif
#endif
#ifndef YY_NO_UNPUT
static void yyunput YY_PROTO(( int c, char *buf_ptr ));
#endif
#ifndef yytext_ptr
static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
#endif
#ifdef YY_NEED_STRLEN
static int yy_flex_strlen YY_PROTO(( yyconst char * ));
#endif
#ifndef YY_NO_INPUT
#ifdef __cplusplus
static int yyinput YY_PROTO(( void ));
#else
static int input YY_PROTO(( void ));
#endif
#endif
#if YY_STACK_USED
static int yy_start_stack_ptr = 0;
static int yy_start_stack_depth = 0;
static int *yy_start_stack = 0;
#ifndef YY_NO_PUSH_STATE
static void yy_push_state YY_PROTO(( int new_state ));
#endif
#ifndef YY_NO_POP_STATE
static void yy_pop_state YY_PROTO(( void ));
#endif
#ifndef YY_NO_TOP_STATE
static int yy_top_state YY_PROTO(( void ));
#endif
#else
#define YY_NO_PUSH_STATE 1
#define YY_NO_POP_STATE 1
#define YY_NO_TOP_STATE 1
#endif
#ifdef YY_MALLOC_DECL
YY_MALLOC_DECL
#else
#if __STDC__
#ifndef __cplusplus
#include <stdlib.h>
#endif
#else
/* Just try to get by without declaring the routines. This will fail
* miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
* or sizeof(void*) != sizeof(int).
*/
#endif
#endif
/* Amount of stuff to slurp up with each read. */
#ifndef YY_READ_BUF_SIZE
#define YY_READ_BUF_SIZE 8192
#endif
/* Copy whatever the last rule matched to the standard output. */
#ifndef ECHO
/* This used to be an fputs(), but since the string might contain NUL's,
* we now use fwrite().
*/
#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
#endif
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
* is returned in "result".
*/
#ifndef YY_INPUT
#define YY_INPUT(buf,result,max_size) \
if ( yy_current_buffer->yy_is_interactive ) \
{ \
int c = '*', n; \
for ( n = 0; n < max_size && \
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \
buf[n] = (char) c; \
if ( c == '\n' ) \
buf[n++] = (char) c; \
if ( c == EOF && ferror( yyin ) ) \
YY_FATAL_ERROR( "input in flex scanner failed" ); \
result = n; \
} \
else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
&& ferror( yyin ) ) \
YY_FATAL_ERROR( "input in flex scanner failed" );
#endif
/* No semi-colon after return; correct usage is to write "yyterminate();" -
* we don't want an extra ';' after the "return" because that will cause
* some compilers to complain about unreachable statements.
*/
#ifndef yyterminate
#define yyterminate() return YY_NULL
#endif
/* Number of entries by which start-condition stack grows. */
#ifndef YY_START_STACK_INCR
#define YY_START_STACK_INCR 25
#endif
/* Report a fatal error. */
#ifndef YY_FATAL_ERROR
#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
#endif
/* Default declaration of generated scanner - a define so the user can
* easily add parameters.
*/
#ifndef YY_DECL
#define YY_DECL int yylex YY_PROTO(( void ))
#endif
/* Code executed at the beginning of each rule, after yytext and yyleng
* have been set up.
*/
#ifndef YY_USER_ACTION
#define YY_USER_ACTION
#endif
/* Code executed at the end of each rule. */
#ifndef YY_BREAK
#define YY_BREAK break;
#endif
#define YY_RULE_SETUP \
if ( yyleng > 0 ) \
yy_current_buffer->yy_at_bol = \
(yytext[yyleng - 1] == '\n'); \
YY_USER_ACTION
YY_DECL
{
register yy_state_type yy_current_state;
register char *yy_cp = NULL, *yy_bp = NULL;
register int yy_act;
#line 299 "tools/wpp/ppl.l"
/*
* Catch line-continuations.
* Note: Gcc keeps the line-continuations in, for example, strings
* intact. However, I prefer to remove them all so that the next
* scanner will not need to reduce the continuation state.
*
* <*>\\\n newline(0);
*/
/*
* Detect the leading # of a preprocessor directive.
*/
#line 1405 "tools/wpp/lex.yy.c"
if ( yy_init )
{
yy_init = 0;
#ifdef YY_USER_INIT
YY_USER_INIT;
#endif
if ( ! yy_start )
yy_start = 1; /* first start state */
if ( ! yyin )
yyin = stdin;
if ( ! yyout )
yyout = stdout;
if ( ! yy_current_buffer )
yy_current_buffer =
yy_create_buffer( yyin, YY_BUF_SIZE );
yy_load_buffer_state();
}
while ( 1 ) /* loops until end-of-file is reached */
{
yy_cp = yy_c_buf_p;
/* Support of yytext. */
*yy_cp = yy_hold_char;
/* yy_bp points to the position in yy_ch_buf of the start of
* the current run.
*/
yy_bp = yy_cp;
yy_current_state = yy_start;
yy_current_state += YY_AT_BOL();
yy_match:
do
{
register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
if ( yy_accept[yy_current_state] )
{
yy_last_accepting_state = yy_current_state;
yy_last_accepting_cpos = yy_cp;
}
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 421 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
++yy_cp;
}
while ( yy_base[yy_current_state] != 1771 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
if ( yy_act == 0 )
{ /* have to back up */
yy_cp = yy_last_accepting_cpos;
yy_current_state = yy_last_accepting_state;
yy_act = yy_accept[yy_current_state];
}
YY_DO_BEFORE_ACTION;
do_action: /* This label is used only to access EOF actions. */
switch ( yy_act )
{ /* beginning of action switch */
case 0: /* must back up */
/* undo the effects of YY_DO_BEFORE_ACTION */
*yy_cp = yy_hold_char;
yy_cp = yy_last_accepting_cpos;
yy_current_state = yy_last_accepting_state;
goto yy_find_action;
case 1:
YY_RULE_SETUP
#line 312 "tools/wpp/ppl.l"
pp_incl_state.seen_junk++; yy_push_state(pp_pp);
YY_BREAK
/*
* Scan for the preprocessor directives
*/
case 2:
YY_RULE_SETUP
#line 317 "tools/wpp/ppl.l"
if(yy_top_state() != pp_ignore) {yy_pp_state(pp_inc); return tINCLUDE;} else {yy_pp_state(pp_eol);}
YY_BREAK
case 3:
YY_RULE_SETUP
#line 318 "tools/wpp/ppl.l"
if(yy_top_state() != pp_ignore) {yy_pp_state(pp_inc); return tINCLUDE_NEXT;} else {yy_pp_state(pp_eol);}
YY_BREAK
case 4:
YY_RULE_SETUP
#line 319 "tools/wpp/ppl.l"
yy_pp_state(yy_current_state() != pp_ignore ? pp_def : pp_eol);
YY_BREAK
case 5:
YY_RULE_SETUP
#line 320 "tools/wpp/ppl.l"
yy_pp_state(pp_eol); if(yy_top_state() != pp_ignore) return tERROR;
YY_BREAK
case 6:
YY_RULE_SETUP
#line 321 "tools/wpp/ppl.l"
yy_pp_state(pp_eol); if(yy_top_state() != pp_ignore) return tWARNING;
YY_BREAK
case 7:
YY_RULE_SETUP
#line 322 "tools/wpp/ppl.l"
yy_pp_state(pp_eol); if(yy_top_state() != pp_ignore) return tPRAGMA;
YY_BREAK
case 8:
YY_RULE_SETUP
#line 323 "tools/wpp/ppl.l"
yy_pp_state(pp_eol); if(yy_top_state() != pp_ignore) return tPPIDENT;
YY_BREAK
case 9:
YY_RULE_SETUP
#line 324 "tools/wpp/ppl.l"
if(yy_top_state() != pp_ignore) {yy_pp_state(pp_ifd); return tUNDEF;} else {yy_pp_state(pp_eol);}
YY_BREAK
case 10:
YY_RULE_SETUP
#line 325 "tools/wpp/ppl.l"
yy_pp_state(pp_ifd); return tIFDEF;
YY_BREAK
case 11:
YY_RULE_SETUP
#line 326 "tools/wpp/ppl.l"
pp_incl_state.seen_junk--; yy_pp_state(pp_ifd); return tIFNDEF;
YY_BREAK
case 12:
YY_RULE_SETUP
#line 327 "tools/wpp/ppl.l"
yy_pp_state(pp_if); return tIF;
YY_BREAK
case 13:
YY_RULE_SETUP
#line 328 "tools/wpp/ppl.l"
yy_pp_state(pp_if); return tELIF;
YY_BREAK
case 14:
YY_RULE_SETUP
#line 329 "tools/wpp/ppl.l"
yy_pp_state(pp_endif); return tELSE;
YY_BREAK
case 15:
YY_RULE_SETUP
#line 330 "tools/wpp/ppl.l"
yy_pp_state(pp_endif); return tENDIF;
YY_BREAK
case 16:
YY_RULE_SETUP
#line 331 "tools/wpp/ppl.l"
if(yy_top_state() != pp_ignore) {yy_pp_state(pp_line); return tLINE;} else {yy_pp_state(pp_eol);}
YY_BREAK
case 17:
YY_RULE_SETUP
#line 332 "tools/wpp/ppl.l"
if(yy_top_state() != pp_ignore) {yy_pp_state(pp_line); return tGCCLINE;} else {yy_pp_state(pp_eol);}
YY_BREAK
case 18:
YY_RULE_SETUP
#line 333 "tools/wpp/ppl.l"
pperror("Invalid preprocessor token '%s'", pptext);
YY_BREAK
case 19:
YY_RULE_SETUP
#line 334 "tools/wpp/ppl.l"
newline(1); yy_pop_state(); return tNL; /* This could be the null-token */
YY_BREAK
case 20:
YY_RULE_SETUP
#line 335 "tools/wpp/ppl.l"
newline(0);
YY_BREAK
case 21:
YY_RULE_SETUP
#line 336 "tools/wpp/ppl.l"
pperror("Preprocessor junk '%s'", pptext);
YY_BREAK
case 22:
YY_RULE_SETUP
#line 337 "tools/wpp/ppl.l"
return *pptext;
YY_BREAK
/*
* Handle #include and #line
*/
case 23:
YY_RULE_SETUP
#line 342 "tools/wpp/ppl.l"
return make_number(10, &pplval, pptext, ppleng);
YY_BREAK
case 24:
YY_RULE_SETUP
#line 343 "tools/wpp/ppl.l"
new_string(); add_string(pptext, ppleng); yy_push_state(pp_iqs);
YY_BREAK
case 25:
YY_RULE_SETUP
#line 344 "tools/wpp/ppl.l"
new_string(); add_string(pptext, ppleng); yy_push_state(pp_dqs);
YY_BREAK
case 26:
YY_RULE_SETUP
#line 345 "tools/wpp/ppl.l"
;
YY_BREAK
case 27:
YY_RULE_SETUP
#line 346 "tools/wpp/ppl.l"
newline(1); yy_pop_state(); return tNL;
YY_BREAK
case 28:
YY_RULE_SETUP
#line 347 "tools/wpp/ppl.l"
newline(0);
YY_BREAK
case 29:
YY_RULE_SETUP
#line 348 "tools/wpp/ppl.l"
pperror(yy_current_state() == pp_inc ? "Trailing junk in #include" : "Trailing junk in #line");
YY_BREAK
/*
* Ignore all input when a false clause is parsed
*/
case 30:
YY_RULE_SETUP
#line 353 "tools/wpp/ppl.l"
;
YY_BREAK
case 31:
YY_RULE_SETUP
#line 354 "tools/wpp/ppl.l"
newline(1);
YY_BREAK
case 32:
YY_RULE_SETUP
#line 355 "tools/wpp/ppl.l"
newline(0);
YY_BREAK
case 33:
YY_RULE_SETUP
#line 356 "tools/wpp/ppl.l"
;
YY_BREAK
/*
* Handle #if and #elif.
* These require conditionals to be evaluated, but we do not
* want to jam the scanner normally when we see these tokens.
* Note: tIDENT is handled below.
*/
case 34:
YY_RULE_SETUP
#line 365 "tools/wpp/ppl.l"
return make_number(8, &pplval, pptext, ppleng);
YY_BREAK
case 35:
YY_RULE_SETUP
#line 366 "tools/wpp/ppl.l"
pperror("Invalid octal digit");
YY_BREAK
case 36:
YY_RULE_SETUP
#line 367 "tools/wpp/ppl.l"
return make_number(10, &pplval, pptext, ppleng);
YY_BREAK
case 37:
YY_RULE_SETUP
#line 368 "tools/wpp/ppl.l"
return make_number(16, &pplval, pptext, ppleng);
YY_BREAK
case 38:
YY_RULE_SETUP
#line 369 "tools/wpp/ppl.l"
pperror("Invalid hex number");
YY_BREAK
case 39:
YY_RULE_SETUP
#line 370 "tools/wpp/ppl.l"
yy_push_state(pp_defined); return tDEFINED;
YY_BREAK
case 40:
YY_RULE_SETUP
#line 371 "tools/wpp/ppl.l"
return tLSHIFT;
YY_BREAK
case 41:
YY_RULE_SETUP
#line 372 "tools/wpp/ppl.l"
return tRSHIFT;
YY_BREAK
case 42:
YY_RULE_SETUP
#line 373 "tools/wpp/ppl.l"
return tLOGAND;
YY_BREAK
case 43:
YY_RULE_SETUP
#line 374 "tools/wpp/ppl.l"
return tLOGOR;
YY_BREAK
case 44:
YY_RULE_SETUP
#line 375 "tools/wpp/ppl.l"
return tEQ;
YY_BREAK
case 45:
YY_RULE_SETUP
#line 376 "tools/wpp/ppl.l"
return tNE;
YY_BREAK
case 46:
YY_RULE_SETUP
#line 377 "tools/wpp/ppl.l"
return tLTE;
YY_BREAK
case 47:
YY_RULE_SETUP
#line 378 "tools/wpp/ppl.l"
return tGTE;
YY_BREAK
case 48:
YY_RULE_SETUP
#line 379 "tools/wpp/ppl.l"
newline(1); yy_pop_state(); return tNL;
YY_BREAK
case 49:
YY_RULE_SETUP
#line 380 "tools/wpp/ppl.l"
newline(0);
YY_BREAK
case 50:
YY_RULE_SETUP
#line 381 "tools/wpp/ppl.l"
pperror("Junk in conditional expression");
YY_BREAK
case 51:
YY_RULE_SETUP
#line 382 "tools/wpp/ppl.l"
;
YY_BREAK
case 52:
YY_RULE_SETUP
#line 383 "tools/wpp/ppl.l"
new_string(); add_string(pptext, ppleng); yy_push_state(pp_sqs);
YY_BREAK
case 53:
YY_RULE_SETUP
#line 384 "tools/wpp/ppl.l"
pperror("String constants not allowed in conditionals");
YY_BREAK
case 54:
YY_RULE_SETUP
#line 385 "tools/wpp/ppl.l"
return *pptext;
YY_BREAK
/*
* Handle #ifdef, #ifndef and #undef
* to get only an untranslated/unexpanded identifier
*/
case 55:
YY_RULE_SETUP
#line 391 "tools/wpp/ppl.l"
pplval.cptr = pp_xstrdup(pptext); return tIDENT;
YY_BREAK
case 56:
YY_RULE_SETUP
#line 392 "tools/wpp/ppl.l"
;
YY_BREAK
case 57:
YY_RULE_SETUP
#line 393 "tools/wpp/ppl.l"
newline(1); yy_pop_state(); return tNL;
YY_BREAK
case 58:
YY_RULE_SETUP
#line 394 "tools/wpp/ppl.l"
newline(0);
YY_BREAK
case 59:
YY_RULE_SETUP
#line 395 "tools/wpp/ppl.l"
pperror("Identifier expected");
YY_BREAK
/*
* Handle #else and #endif.
*/
case 60:
YY_RULE_SETUP
#line 400 "tools/wpp/ppl.l"
;
YY_BREAK
case 61:
YY_RULE_SETUP
#line 401 "tools/wpp/ppl.l"
newline(1); yy_pop_state(); return tNL;
YY_BREAK
case 62:
YY_RULE_SETUP
#line 402 "tools/wpp/ppl.l"
newline(0);
YY_BREAK
case 63:
YY_RULE_SETUP
#line 403 "tools/wpp/ppl.l"
pperror("Garbage after #else or #endif.");
YY_BREAK
/*
* Handle the special 'defined' keyword.
* This is necessary to get the identifier prior to any
* substitutions.
*/
case 64:
YY_RULE_SETUP
#line 410 "tools/wpp/ppl.l"
yy_pop_state(); pplval.cptr = pp_xstrdup(pptext); return tIDENT;
YY_BREAK
case 65:
YY_RULE_SETUP
#line 411 "tools/wpp/ppl.l"
;
YY_BREAK
case 66:
YY_RULE_SETUP
#line 412 "tools/wpp/ppl.l"
return *pptext;
YY_BREAK
case 67:
YY_RULE_SETUP
#line 413 "tools/wpp/ppl.l"
newline(0);
YY_BREAK
case 68:
YY_RULE_SETUP
#line 414 "tools/wpp/ppl.l"
pperror("Identifier expected");
YY_BREAK
/*
* Handle #error, #warning, #pragma and #ident.
* Pass everything literally to the parser, which
* will act appropriately.
* Comments are stripped from the literal text.
*/
case 69:
YY_RULE_SETUP
#line 422 "tools/wpp/ppl.l"
if(yy_top_state() != pp_ignore) { pplval.cptr = pp_xstrdup(pptext); return tLITERAL; }
YY_BREAK
case 70:
YY_RULE_SETUP
#line 423 "tools/wpp/ppl.l"
if(yy_top_state() != pp_ignore) { pplval.cptr = pp_xstrdup(pptext); return tLITERAL; }
YY_BREAK
case 71:
YY_RULE_SETUP
#line 424 "tools/wpp/ppl.l"
if(yy_top_state() != pp_ignore) { pplval.cptr = pp_xstrdup(pptext); return tLITERAL; }
YY_BREAK
case 72:
YY_RULE_SETUP
#line 425 "tools/wpp/ppl.l"
newline(1); yy_pop_state(); if(yy_current_state() != pp_ignore) { return tNL; }
YY_BREAK
case 73:
YY_RULE_SETUP
#line 426 "tools/wpp/ppl.l"
newline(0);
YY_BREAK
/*
* Handle left side of #define
*/
case 74:
YY_RULE_SETUP
#line 431 "tools/wpp/ppl.l"
pplval.cptr = pp_xstrdup(pptext); pplval.cptr[ppleng-1] = '\0'; yy_pp_state(pp_macro); return tMACRO;
YY_BREAK
case 75:
YY_RULE_SETUP
#line 432 "tools/wpp/ppl.l"
pplval.cptr = pp_xstrdup(pptext); yy_pp_state(pp_define); return tDEFINE;
YY_BREAK
case 76:
YY_RULE_SETUP
#line 433 "tools/wpp/ppl.l"
;
YY_BREAK
case 77:
YY_RULE_SETUP
#line 434 "tools/wpp/ppl.l"
newline(0);
YY_BREAK
case 78:
YY_RULE_SETUP
#line 435 "tools/wpp/ppl.l"
perror("Identifier expected");
YY_BREAK
/*
* Scan the substitution of a define
*/
case 79:
YY_RULE_SETUP
#line 440 "tools/wpp/ppl.l"
pplval.cptr = pp_xstrdup(pptext); return tLITERAL;
YY_BREAK
case 80:
YY_RULE_SETUP
#line 441 "tools/wpp/ppl.l"
pplval.cptr = pp_xstrdup(pptext); return tLITERAL;
YY_BREAK
case 81:
YY_RULE_SETUP
#line 442 "tools/wpp/ppl.l"
newline(0); pplval.cptr = pp_xstrdup(" "); return tLITERAL;
YY_BREAK
case 82:
YY_RULE_SETUP
#line 443 "tools/wpp/ppl.l"
newline(0);
YY_BREAK
case 83:
YY_RULE_SETUP
#line 444 "tools/wpp/ppl.l"
newline(1); yy_pop_state(); return tNL;
YY_BREAK
case 84:
YY_RULE_SETUP
#line 445 "tools/wpp/ppl.l"
new_string(); add_string(pptext, ppleng); yy_push_state(pp_sqs);
YY_BREAK
case 85:
YY_RULE_SETUP
#line 446 "tools/wpp/ppl.l"
new_string(); add_string(pptext, ppleng); yy_push_state(pp_dqs);
YY_BREAK
/*
* Scan the definition macro arguments
*/
case 86:
YY_RULE_SETUP
#line 451 "tools/wpp/ppl.l"
yy_pp_state(pp_mbody); return tMACROEND;
YY_BREAK
case 87:
YY_RULE_SETUP
#line 452 "tools/wpp/ppl.l"
;
YY_BREAK
case 88:
YY_RULE_SETUP
#line 453 "tools/wpp/ppl.l"
pplval.cptr = pp_xstrdup(pptext); return tIDENT;
YY_BREAK
case 89:
YY_RULE_SETUP
#line 454 "tools/wpp/ppl.l"
return ',';
YY_BREAK
case 90:
YY_RULE_SETUP
#line 455 "tools/wpp/ppl.l"
return tELIPSIS;
YY_BREAK
case 91:
YY_RULE_SETUP
#line 456 "tools/wpp/ppl.l"
pperror("Argument identifier expected");
YY_BREAK
case 92:
YY_RULE_SETUP
#line 457 "tools/wpp/ppl.l"
newline(0);
YY_BREAK
/*
* Scan the substitution of a macro
*/
case 93:
YY_RULE_SETUP
#line 462 "tools/wpp/ppl.l"
pplval.cptr = pp_xstrdup(pptext); return tLITERAL;
YY_BREAK
case 94:
YY_RULE_SETUP
#line 463 "tools/wpp/ppl.l"
pplval.cptr = pp_xstrdup(pptext); return tIDENT;
YY_BREAK
case 95:
YY_RULE_SETUP
#line 464 "tools/wpp/ppl.l"
return tCONCAT;
YY_BREAK
case 96:
YY_RULE_SETUP
#line 465 "tools/wpp/ppl.l"
return tSTRINGIZE;
YY_BREAK
case 97:
YY_RULE_SETUP
#line 466 "tools/wpp/ppl.l"
pplval.cptr = pp_xstrdup(pptext); return tLITERAL;
YY_BREAK
case 98:
YY_RULE_SETUP
#line 467 "tools/wpp/ppl.l"
pplval.cptr = pp_xstrdup(pptext); return tLITERAL;
YY_BREAK
case 99:
YY_RULE_SETUP
#line 468 "tools/wpp/ppl.l"
newline(0); pplval.cptr = pp_xstrdup(" "); return tLITERAL;
YY_BREAK
case 100:
YY_RULE_SETUP
#line 469 "tools/wpp/ppl.l"
newline(0);
YY_BREAK
case 101:
YY_RULE_SETUP
#line 470 "tools/wpp/ppl.l"
newline(1); yy_pop_state(); return tNL;
YY_BREAK
case 102:
YY_RULE_SETUP
#line 471 "tools/wpp/ppl.l"
new_string(); add_string(pptext, ppleng); yy_push_state(pp_sqs);
YY_BREAK
case 103:
YY_RULE_SETUP
#line 472 "tools/wpp/ppl.l"
new_string(); add_string(pptext, ppleng); yy_push_state(pp_dqs);
YY_BREAK
/*
* Macro expansion text scanning.
* This state is active just after the identifier is scanned
* that triggers an expansion. We *must* delete the leading
* whitespace before we can start scanning for arguments.
*
* If we do not see a '(' as next trailing token, then we have
* a false alarm. We just continue with a nose-bleed...
*/
case 104:
*yy_cp = yy_hold_char; /* undo effects of setting up yytext */
yy_c_buf_p = yy_cp -= 1;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
#line 483 "tools/wpp/ppl.l"
yy_pp_state(pp_macscan);
YY_BREAK
case 105:
YY_RULE_SETUP
#line 484 "tools/wpp/ppl.l"
{
if(yy_top_state() != pp_macscan)
newline(0);
}
YY_BREAK
case 106:
YY_RULE_SETUP
#line 488 "tools/wpp/ppl.l"
newline(0);
YY_BREAK
case 107:
YY_RULE_SETUP
#line 489 "tools/wpp/ppl.l"
{
macexpstackentry_t *mac = pop_macro();
yy_pop_state();
put_buffer(mac->ppp->ident, strlen(mac->ppp->ident));
put_buffer(pptext, ppleng);
free_macro(mac);
}
YY_BREAK
/*
* Macro expansion argument text scanning.
* This state is active when a macro's arguments are being read for expansion.
*/
case 108:
YY_RULE_SETUP
#line 501 "tools/wpp/ppl.l"
{
if(++MACROPARENTHESES() > 1)
add_text_to_macro(pptext, ppleng);
}
YY_BREAK
case 109:
YY_RULE_SETUP
#line 505 "tools/wpp/ppl.l"
{
if(--MACROPARENTHESES() == 0)
{
yy_pop_state();
macro_add_arg(1);
}
else
add_text_to_macro(pptext, ppleng);
}
YY_BREAK
case 110:
YY_RULE_SETUP
#line 514 "tools/wpp/ppl.l"
{
if(MACROPARENTHESES() > 1)
add_text_to_macro(pptext, ppleng);
else
macro_add_arg(0);
}
YY_BREAK
case 111:
YY_RULE_SETUP
#line 520 "tools/wpp/ppl.l"
new_string(); add_string(pptext, ppleng); yy_push_state(pp_dqs);
YY_BREAK
case 112:
YY_RULE_SETUP
#line 521 "tools/wpp/ppl.l"
new_string(); add_string(pptext, ppleng); yy_push_state(pp_sqs);
YY_BREAK
case 113:
YY_RULE_SETUP
#line 522 "tools/wpp/ppl.l"
yy_push_state(pp_comment); add_text_to_macro(" ", 1);
YY_BREAK
case 114:
YY_RULE_SETUP
#line 523 "tools/wpp/ppl.l"
pp_status.line_number++; pp_status.char_number = 1; add_text_to_macro(pptext, ppleng);
YY_BREAK
case 115:
YY_RULE_SETUP
#line 524 "tools/wpp/ppl.l"
add_text_to_macro(pptext, ppleng);
YY_BREAK
case 116:
YY_RULE_SETUP
#line 525 "tools/wpp/ppl.l"
newline(0);
YY_BREAK
/*
* Comment handling (almost all start-conditions)
*/
case 117:
YY_RULE_SETUP
#line 530 "tools/wpp/ppl.l"
yy_push_state(pp_comment);
YY_BREAK
case 118:
YY_RULE_SETUP
#line 531 "tools/wpp/ppl.l"
;
YY_BREAK
case 119:
YY_RULE_SETUP
#line 532 "tools/wpp/ppl.l"
newline(0);
YY_BREAK
case 120:
YY_RULE_SETUP
#line 533 "tools/wpp/ppl.l"
yy_pop_state();
YY_BREAK
/*
* Remove C++ style comment (almost all start-conditions)
*/
case 121:
YY_RULE_SETUP
#line 538 "tools/wpp/ppl.l"
{
if(pptext[ppleng-1] == '\\')
ppwarning("C++ style comment ends with an escaped newline (escape ignored)");
}
YY_BREAK
/*
* Single, double and <> quoted constants
*/
case 122:
YY_RULE_SETUP
#line 546 "tools/wpp/ppl.l"
pp_incl_state.seen_junk++; new_string(); add_string(pptext, ppleng); yy_push_state(pp_dqs);
YY_BREAK
case 123:
YY_RULE_SETUP
#line 547 "tools/wpp/ppl.l"
pp_incl_state.seen_junk++; new_string(); add_string(pptext, ppleng); yy_push_state(pp_sqs);
YY_BREAK
case 124:
YY_RULE_SETUP
#line 548 "tools/wpp/ppl.l"
add_string(pptext, ppleng);
YY_BREAK
case 125:
YY_RULE_SETUP
#line 549 "tools/wpp/ppl.l"
{
add_string(pptext, ppleng);
yy_pop_state();
switch(yy_current_state())
{
case pp_pp:
case pp_define:
case pp_mbody:
case pp_inc:
case RCINCL:
if (yy_current_state()==RCINCL) yy_pop_state();
pplval.cptr = get_string();
return tDQSTRING;
case pp_line:
pplval.cptr = get_string();
if (is_c_h_include(pplval.cptr, 1)) pass_data=0;
else pass_data=1;
return tDQSTRING;
default:
put_string();
}
}
YY_BREAK
case 126:
YY_RULE_SETUP
#line 571 "tools/wpp/ppl.l"
add_string(pptext, ppleng);
YY_BREAK
case 127:
YY_RULE_SETUP
#line 572 "tools/wpp/ppl.l"
{
add_string(pptext, ppleng);
yy_pop_state();
switch(yy_current_state())
{
case pp_if:
case pp_define:
case pp_mbody:
pplval.cptr = get_string();
return tSQSTRING;
default:
put_string();
}
}
YY_BREAK
case 128:
YY_RULE_SETUP
#line 586 "tools/wpp/ppl.l"
add_string(pptext, ppleng);
YY_BREAK
case 129:
YY_RULE_SETUP
#line 587 "tools/wpp/ppl.l"
{
add_string(pptext, ppleng);
yy_pop_state();
pplval.cptr = get_string();
return tIQSTRING;
}
YY_BREAK
case 130:
YY_RULE_SETUP
#line 593 "tools/wpp/ppl.l"
{
/*
* This is tricky; we need to remove the line-continuation
* from preprocessor strings, but OTOH retain them in all
* other strings. This is because the resource grammar is
* even more braindead than initially analysed and line-
* continuations in strings introduce, sigh, newlines in
* the output. There goes the concept of non-breaking, non-
* spacing whitespace.
*/
switch(yy_top_state())
{
case pp_pp:
case pp_define:
case pp_mbody:
case pp_inc:
case pp_line:
newline(0);
break;
default:
add_string(pptext, ppleng);
newline(-1);
}
}
YY_BREAK
case 131:
YY_RULE_SETUP
#line 617 "tools/wpp/ppl.l"
add_string(pptext, ppleng);
YY_BREAK
case 132:
YY_RULE_SETUP
#line 618 "tools/wpp/ppl.l"
{
newline(1);
add_string(pptext, ppleng);
ppwarning("Newline in string constant encounterd (started line %d)", string_start());
}
YY_BREAK
/*
* Identifier scanning
*/
case 133:
YY_RULE_SETUP
#line 627 "tools/wpp/ppl.l"
{
pp_entry_t *ppp;
pp_incl_state.seen_junk++;
if(!(ppp = pplookup(pptext)))
{
if(yy_current_state() == pp_inc)
pperror("Expected include filename");
if(yy_current_state() == pp_if)
{
pplval.cptr = pp_xstrdup(pptext);
return tIDENT;
}
else {
if((yy_current_state()==INITIAL) && (strcasecmp(pptext,"RCINCLUDE")==0)){
yy_push_state(RCINCL);
return tRCINCLUDE;
}
else put_buffer(pptext, ppleng);
}
}
else if(!ppp->expanding)
{
switch(ppp->type)
{
case def_special:
expand_special(ppp);
break;
case def_define:
expand_define(ppp);
break;
case def_macro:
yy_push_state(pp_macign);
push_macro(ppp);
break;
default:
pp_internal_error(__FILE__, __LINE__, "Invalid define type %d\n", ppp->type);
}
}
}
YY_BREAK
/*
* Everything else that needs to be passed and
* newline and continuation handling
*/
case 134:
YY_RULE_SETUP
#line 672 "tools/wpp/ppl.l"
pp_incl_state.seen_junk++; put_buffer(pptext, ppleng);
YY_BREAK
case 135:
YY_RULE_SETUP
#line 673 "tools/wpp/ppl.l"
put_buffer(pptext, ppleng);
YY_BREAK
case 136:
YY_RULE_SETUP
#line 674 "tools/wpp/ppl.l"
newline(1);
YY_BREAK
case 137:
YY_RULE_SETUP
#line 675 "tools/wpp/ppl.l"
newline(0);
YY_BREAK
case 138:
YY_RULE_SETUP
#line 676 "tools/wpp/ppl.l"
pp_incl_state.seen_junk++; put_buffer(pptext, ppleng);
YY_BREAK
/*
* Special catcher for macro argmument expansion to prevent
* newlines to propagate to the output or admin.
*/
case 139:
YY_RULE_SETUP
#line 682 "tools/wpp/ppl.l"
put_buffer(pptext, ppleng);
YY_BREAK
case 140:
YY_RULE_SETUP
#line 684 "tools/wpp/ppl.l"
{
pplval.cptr=pp_xstrdup(pptext);
yy_pop_state();
return tRCINCLUDEPATH;
}
YY_BREAK
case 141:
YY_RULE_SETUP
#line 690 "tools/wpp/ppl.l"
;
YY_BREAK
case 142:
YY_RULE_SETUP
#line 692 "tools/wpp/ppl.l"
{
new_string(); add_string(pptext,ppleng);yy_push_state(pp_dqs);
}
YY_BREAK
/*
* This is a 'catch-all' rule to discover errors in the scanner
* in an orderly manner.
*/
case 143:
YY_RULE_SETUP
#line 700 "tools/wpp/ppl.l"
pp_incl_state.seen_junk++; ppwarning("Unmatched text '%c' (0x%02x); please report\n", isprint(*pptext & 0xff) ? *pptext : ' ', *pptext);
YY_BREAK
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(pp_pp):
case YY_STATE_EOF(pp_eol):
case YY_STATE_EOF(pp_inc):
case YY_STATE_EOF(pp_dqs):
case YY_STATE_EOF(pp_sqs):
case YY_STATE_EOF(pp_iqs):
case YY_STATE_EOF(pp_comment):
case YY_STATE_EOF(pp_def):
case YY_STATE_EOF(pp_define):
case YY_STATE_EOF(pp_macro):
case YY_STATE_EOF(pp_mbody):
case YY_STATE_EOF(pp_macign):
case YY_STATE_EOF(pp_macscan):
case YY_STATE_EOF(pp_macexp):
case YY_STATE_EOF(pp_if):
case YY_STATE_EOF(pp_ifd):
case YY_STATE_EOF(pp_endif):
case YY_STATE_EOF(pp_line):
case YY_STATE_EOF(pp_defined):
case YY_STATE_EOF(pp_ignore):
case YY_STATE_EOF(RCINCL):
#line 702 "tools/wpp/ppl.l"
{
YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
bufferstackentry_t *bep = pop_buffer();
if((!bep && pp_get_if_depth()) || (bep && pp_get_if_depth() != bep->if_depth))
ppwarning("Unmatched #if/#endif at end of file");
if(!bep)
{
if(YY_START != INITIAL)
pperror("Unexpected end of file during preprocessing");
yyterminate();
}
else if(bep->should_pop == 2)
{
macexpstackentry_t *mac;
mac = pop_macro();
expand_macro(mac);
}
pp_delete_buffer(b);
}
YY_BREAK
case 144:
YY_RULE_SETUP
#line 724 "tools/wpp/ppl.l"
ECHO;
YY_BREAK
#line 2478 "tools/wpp/lex.yy.c"
case YY_END_OF_BUFFER:
{
/* Amount of text matched not including the EOB char. */
int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
/* Undo the effects of YY_DO_BEFORE_ACTION. */
*yy_cp = yy_hold_char;
YY_RESTORE_YY_MORE_OFFSET
if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
{
/* We're scanning a new file or input source. It's
* possible that this happened because the user
* just pointed yyin at a new source and called
* yylex(). If so, then we have to assure
* consistency between yy_current_buffer and our
* globals. Here is the right place to do so, because
* this is the first action (other than possibly a
* back-up) that will match for the new input source.
*/
yy_n_chars = yy_current_buffer->yy_n_chars;
yy_current_buffer->yy_input_file = yyin;
yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
}
/* Note that here we test for yy_c_buf_p "<=" to the position
* of the first EOB in the buffer, since yy_c_buf_p will
* already have been incremented past the NUL character
* (since all states make transitions on EOB to the
* end-of-buffer state). Contrast this with the test
* in input().
*/
if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
{ /* This was really a NUL. */
yy_state_type yy_next_state;
yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
yy_current_state = yy_get_previous_state();
/* Okay, we're now positioned to make the NUL
* transition. We couldn't have
* yy_get_previous_state() go ahead and do it
* for us because it doesn't know how to deal
* with the possibility of jamming (and we don't
* want to build jamming into it because then it
* will run more slowly).
*/
yy_next_state = yy_try_NUL_trans( yy_current_state );
yy_bp = yytext_ptr + YY_MORE_ADJ;
if ( yy_next_state )
{
/* Consume the NUL. */
yy_cp = ++yy_c_buf_p;
yy_current_state = yy_next_state;
goto yy_match;
}
else
{
yy_cp = yy_c_buf_p;
goto yy_find_action;
}
}
else switch ( yy_get_next_buffer() )
{
case EOB_ACT_END_OF_FILE:
{
yy_did_buffer_switch_on_eof = 0;
if ( yywrap() )
{
/* Note: because we've taken care in
* yy_get_next_buffer() to have set up
* yytext, we can now set up
* yy_c_buf_p so that if some total
* hoser (like flex itself) wants to
* call the scanner after we return the
* YY_NULL, it'll still work - another
* YY_NULL will get returned.
*/
yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
yy_act = YY_STATE_EOF(YY_START);
goto do_action;
}
else
{
if ( ! yy_did_buffer_switch_on_eof )
YY_NEW_FILE;
}
break;
}
case EOB_ACT_CONTINUE_SCAN:
yy_c_buf_p =
yytext_ptr + yy_amount_of_matched_text;
yy_current_state = yy_get_previous_state();
yy_cp = yy_c_buf_p;
yy_bp = yytext_ptr + YY_MORE_ADJ;
goto yy_match;
case EOB_ACT_LAST_MATCH:
yy_c_buf_p =
&yy_current_buffer->yy_ch_buf[yy_n_chars];
yy_current_state = yy_get_previous_state();
yy_cp = yy_c_buf_p;
yy_bp = yytext_ptr + YY_MORE_ADJ;
goto yy_find_action;
}
break;
}
default:
YY_FATAL_ERROR(
"fatal flex scanner internal error--no action found" );
} /* end of action switch */
} /* end of scanning one token */
} /* end of yylex */
/* yy_get_next_buffer - try to read in a new buffer
*
* Returns a code representing an action:
* EOB_ACT_LAST_MATCH -
* EOB_ACT_CONTINUE_SCAN - continue scanning from current position
* EOB_ACT_END_OF_FILE - end of file
*/
static int yy_get_next_buffer()
{
register char *dest = yy_current_buffer->yy_ch_buf;
register char *source = yytext_ptr;
register int number_to_move, i;
int ret_val;
if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
YY_FATAL_ERROR(
"fatal flex scanner internal error--end of buffer missed" );
if ( yy_current_buffer->yy_fill_buffer == 0 )
{ /* Don't try to fill the buffer, so this is an EOF. */
if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
{
/* We matched a single character, the EOB, so
* treat this as a final EOF.
*/
return EOB_ACT_END_OF_FILE;
}
else
{
/* We matched some text prior to the EOB, first
* process it.
*/
return EOB_ACT_LAST_MATCH;
}
}
/* Try to read more data. */
/* First move last chars to start of buffer. */
number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
for ( i = 0; i < number_to_move; ++i )
*(dest++) = *(source++);
if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
/* don't do the read, it's not guaranteed to return an EOF,
* just force an EOF
*/
yy_current_buffer->yy_n_chars = yy_n_chars = 0;
else
{
int num_to_read =
yy_current_buffer->yy_buf_size - number_to_move - 1;
while ( num_to_read <= 0 )
{ /* Not enough room in the buffer - grow it. */
#ifdef YY_USES_REJECT
YY_FATAL_ERROR(
"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
#else
/* just a shorter name for the current buffer */
YY_BUFFER_STATE b = yy_current_buffer;
int yy_c_buf_p_offset =
(int) (yy_c_buf_p - b->yy_ch_buf);
if ( b->yy_is_our_buffer )
{
int new_size = b->yy_buf_size * 2;
if ( new_size <= 0 )
b->yy_buf_size += b->yy_buf_size / 8;
else
b->yy_buf_size *= 2;
b->yy_ch_buf = (char *)
/* Include room in for 2 EOB chars. */
yy_flex_realloc( (void *) b->yy_ch_buf,
b->yy_buf_size + 2 );
}
else
/* Can't grow it, we don't own it. */
b->yy_ch_buf = 0;
if ( ! b->yy_ch_buf )
YY_FATAL_ERROR(
"fatal error - scanner input buffer overflow" );
yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
num_to_read = yy_current_buffer->yy_buf_size -
number_to_move - 1;
#endif
}
if ( num_to_read > YY_READ_BUF_SIZE )
num_to_read = YY_READ_BUF_SIZE;
/* Read in more data. */
YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
yy_n_chars, num_to_read );
yy_current_buffer->yy_n_chars = yy_n_chars;
}
if ( yy_n_chars == 0 )
{
if ( number_to_move == YY_MORE_ADJ )
{
ret_val = EOB_ACT_END_OF_FILE;
yyrestart( yyin );
}
else
{
ret_val = EOB_ACT_LAST_MATCH;
yy_current_buffer->yy_buffer_status =
YY_BUFFER_EOF_PENDING;
}
}
else
ret_val = EOB_ACT_CONTINUE_SCAN;
yy_n_chars += number_to_move;
yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
return ret_val;
}
/* yy_get_previous_state - get the state just before the EOB char was reached */
static yy_state_type yy_get_previous_state()
{
register yy_state_type yy_current_state;
register char *yy_cp;
yy_current_state = yy_start;
yy_current_state += YY_AT_BOL();
for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
{
register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
if ( yy_accept[yy_current_state] )
{
yy_last_accepting_state = yy_current_state;
yy_last_accepting_cpos = yy_cp;
}
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 421 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
}
return yy_current_state;
}
/* yy_try_NUL_trans - try to make a transition on the NUL character
*
* synopsis
* next_state = yy_try_NUL_trans( current_state );
*/
#ifdef YY_USE_PROTOS
static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
#else
static yy_state_type yy_try_NUL_trans( yy_current_state )
yy_state_type yy_current_state;
#endif
{
register int yy_is_jam;
register char *yy_cp = yy_c_buf_p;
register YY_CHAR yy_c = 1;
if ( yy_accept[yy_current_state] )
{
yy_last_accepting_state = yy_current_state;
yy_last_accepting_cpos = yy_cp;
}
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 421 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
yy_is_jam = (yy_current_state == 420);
return yy_is_jam ? 0 : yy_current_state;
}
#ifndef YY_NO_UNPUT
#ifdef YY_USE_PROTOS
static void yyunput( int c, register char *yy_bp )
#else
static void yyunput( c, yy_bp )
int c;
register char *yy_bp;
#endif
{
register char *yy_cp = yy_c_buf_p;
/* undo effects of setting up yytext */
*yy_cp = yy_hold_char;
if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
{ /* need to shift things up to make room */
/* +2 for EOB chars. */
register int number_to_move = yy_n_chars + 2;
register char *dest = &yy_current_buffer->yy_ch_buf[
yy_current_buffer->yy_buf_size + 2];
register char *source =
&yy_current_buffer->yy_ch_buf[number_to_move];
while ( source > yy_current_buffer->yy_ch_buf )
*--dest = *--source;
yy_cp += (int) (dest - source);
yy_bp += (int) (dest - source);
yy_current_buffer->yy_n_chars =
yy_n_chars = yy_current_buffer->yy_buf_size;
if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
YY_FATAL_ERROR( "flex scanner push-back overflow" );
}
*--yy_cp = (char) c;
yytext_ptr = yy_bp;
yy_hold_char = *yy_cp;
yy_c_buf_p = yy_cp;
}
#endif /* ifndef YY_NO_UNPUT */
#ifndef YY_NO_INPUT
#ifdef __cplusplus
static int yyinput()
#else
static int input()
#endif
{
int c;
*yy_c_buf_p = yy_hold_char;
if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
{
/* yy_c_buf_p now points to the character we want to return.
* If this occurs *before* the EOB characters, then it's a
* valid NUL; if not, then we've hit the end of the buffer.
*/
if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
/* This was really a NUL. */
*yy_c_buf_p = '\0';
else
{ /* need more input */
int offset = yy_c_buf_p - yytext_ptr;
++yy_c_buf_p;
switch ( yy_get_next_buffer() )
{
case EOB_ACT_LAST_MATCH:
/* This happens because yy_g_n_b()
* sees that we've accumulated a
* token and flags that we need to
* try matching the token before
* proceeding. But for input(),
* there's no matching to consider.
* So convert the EOB_ACT_LAST_MATCH
* to EOB_ACT_END_OF_FILE.
*/
/* Reset buffer status. */
yyrestart( yyin );
/* fall through */
case EOB_ACT_END_OF_FILE:
{
if ( yywrap() )
return EOF;
if ( ! yy_did_buffer_switch_on_eof )
YY_NEW_FILE;
#ifdef __cplusplus
return yyinput();
#else
return input();
#endif
}
case EOB_ACT_CONTINUE_SCAN:
yy_c_buf_p = yytext_ptr + offset;
break;
}
}
}
c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
*yy_c_buf_p = '\0'; /* preserve yytext */
yy_hold_char = *++yy_c_buf_p;
yy_current_buffer->yy_at_bol = (c == '\n');
return c;
}
#endif /* YY_NO_INPUT */
#ifdef YY_USE_PROTOS
void yyrestart( FILE *input_file )
#else
void yyrestart( input_file )
FILE *input_file;
#endif
{
if ( ! yy_current_buffer )
yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
yy_init_buffer( yy_current_buffer, input_file );
yy_load_buffer_state();
}
#ifdef YY_USE_PROTOS
void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
#else
void yy_switch_to_buffer( new_buffer )
YY_BUFFER_STATE new_buffer;
#endif
{
if ( yy_current_buffer == new_buffer )
return;
if ( yy_current_buffer )
{
/* Flush out information for old buffer. */
*yy_c_buf_p = yy_hold_char;
yy_current_buffer->yy_buf_pos = yy_c_buf_p;
yy_current_buffer->yy_n_chars = yy_n_chars;
}
yy_current_buffer = new_buffer;
yy_load_buffer_state();
/* We don't actually know whether we did this switch during
* EOF (yywrap()) processing, but the only time this flag
* is looked at is after yywrap() is called, so it's safe
* to go ahead and always set it.
*/
yy_did_buffer_switch_on_eof = 1;
}
#ifdef YY_USE_PROTOS
void yy_load_buffer_state( void )
#else
void yy_load_buffer_state()
#endif
{
yy_n_chars = yy_current_buffer->yy_n_chars;
yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
yyin = yy_current_buffer->yy_input_file;
yy_hold_char = *yy_c_buf_p;
}
#ifdef YY_USE_PROTOS
YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
#else
YY_BUFFER_STATE yy_create_buffer( file, size )
FILE *file;
int size;
#endif
{
YY_BUFFER_STATE b;
b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
b->yy_buf_size = size;
/* yy_ch_buf has to be 2 characters longer than the size given because
* we need to put in 2 end-of-buffer characters.
*/
b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
if ( ! b->yy_ch_buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
b->yy_is_our_buffer = 1;
yy_init_buffer( b, file );
return b;
}
#ifdef YY_USE_PROTOS
void yy_delete_buffer( YY_BUFFER_STATE b )
#else
void yy_delete_buffer( b )
YY_BUFFER_STATE b;
#endif
{
if ( ! b )
return;
if ( b == yy_current_buffer )
yy_current_buffer = (YY_BUFFER_STATE) 0;
if ( b->yy_is_our_buffer )
yy_flex_free( (void *) b->yy_ch_buf );
yy_flex_free( (void *) b );
}
#ifdef YY_USE_PROTOS
void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
#else
void yy_init_buffer( b, file )
YY_BUFFER_STATE b;
FILE *file;
#endif
{
yy_flush_buffer( b );
b->yy_input_file = file;
b->yy_fill_buffer = 1;
#if YY_ALWAYS_INTERACTIVE
b->yy_is_interactive = 1;
#else
#if YY_NEVER_INTERACTIVE
b->yy_is_interactive = 0;
#else
b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
#endif
#endif
}
#ifdef YY_USE_PROTOS
void yy_flush_buffer( YY_BUFFER_STATE b )
#else
void yy_flush_buffer( b )
YY_BUFFER_STATE b;
#endif
{
if ( ! b )
return;
b->yy_n_chars = 0;
/* We always need two end-of-buffer characters. The first causes
* a transition to the end-of-buffer state. The second causes
* a jam in that state.
*/
b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
b->yy_buf_pos = &b->yy_ch_buf[0];
b->yy_at_bol = 1;
b->yy_buffer_status = YY_BUFFER_NEW;
if ( b == yy_current_buffer )
yy_load_buffer_state();
}
#ifndef YY_NO_SCAN_BUFFER
#ifdef YY_USE_PROTOS
YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
#else
YY_BUFFER_STATE yy_scan_buffer( base, size )
char *base;
yy_size_t size;
#endif
{
YY_BUFFER_STATE b;
if ( size < 2 ||
base[size-2] != YY_END_OF_BUFFER_CHAR ||
base[size-1] != YY_END_OF_BUFFER_CHAR )
/* They forgot to leave room for the EOB's. */
return 0;
b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
b->yy_buf_pos = b->yy_ch_buf = base;
b->yy_is_our_buffer = 0;
b->yy_input_file = 0;
b->yy_n_chars = b->yy_buf_size;
b->yy_is_interactive = 0;
b->yy_at_bol = 1;
b->yy_fill_buffer = 0;
b->yy_buffer_status = YY_BUFFER_NEW;
yy_switch_to_buffer( b );
return b;
}
#endif
#ifndef YY_NO_SCAN_STRING
#ifdef YY_USE_PROTOS
YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
#else
YY_BUFFER_STATE yy_scan_string( yy_str )
yyconst char *yy_str;
#endif
{
int len;
for ( len = 0; yy_str[len]; ++len )
;
return yy_scan_bytes( yy_str, len );
}
#endif
#ifndef YY_NO_SCAN_BYTES
#ifdef YY_USE_PROTOS
YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
#else
YY_BUFFER_STATE yy_scan_bytes( bytes, len )
yyconst char *bytes;
int len;
#endif
{
YY_BUFFER_STATE b;
char *buf;
yy_size_t n;
int i;
/* Get memory for full buffer, including space for trailing EOB's. */
n = len + 2;
buf = (char *) yy_flex_alloc( n );
if ( ! buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
for ( i = 0; i < len; ++i )
buf[i] = bytes[i];
buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
b = yy_scan_buffer( buf, n );
if ( ! b )
YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
/* It's okay to grow etc. this buffer, and we should throw it
* away when we're done.
*/
b->yy_is_our_buffer = 1;
return b;
}
#endif
#ifndef YY_NO_PUSH_STATE
#ifdef YY_USE_PROTOS
static void yy_push_state( int new_state )
#else
static void yy_push_state( new_state )
int new_state;
#endif
{
if ( yy_start_stack_ptr >= yy_start_stack_depth )
{
yy_size_t new_size;
yy_start_stack_depth += YY_START_STACK_INCR;
new_size = yy_start_stack_depth * sizeof( int );
if ( ! yy_start_stack )
yy_start_stack = (int *) yy_flex_alloc( new_size );
else
yy_start_stack = (int *) yy_flex_realloc(
(void *) yy_start_stack, new_size );
if ( ! yy_start_stack )
YY_FATAL_ERROR(
"out of memory expanding start-condition stack" );
}
yy_start_stack[yy_start_stack_ptr++] = YY_START;
BEGIN(new_state);
}
#endif
#ifndef YY_NO_POP_STATE
static void yy_pop_state()
{
if ( --yy_start_stack_ptr < 0 )
YY_FATAL_ERROR( "start-condition stack underflow" );
BEGIN(yy_start_stack[yy_start_stack_ptr]);
}
#endif
#ifndef YY_NO_TOP_STATE
static int yy_top_state()
{
return yy_start_stack[yy_start_stack_ptr - 1];
}
#endif
#ifndef YY_EXIT_FAILURE
#define YY_EXIT_FAILURE 2
#endif
#ifdef YY_USE_PROTOS
static void yy_fatal_error( yyconst char msg[] )
#else
static void yy_fatal_error( msg )
char msg[];
#endif
{
(void) fprintf( stderr, "%s\n", msg );
exit( YY_EXIT_FAILURE );
}
/* Redefine yyless() so it works in section 3 code. */
#undef yyless
#define yyless(n) \
do \
{ \
/* Undo effects of setting up yytext. */ \
yytext[yyleng] = yy_hold_char; \
yy_c_buf_p = yytext + n; \
yy_hold_char = *yy_c_buf_p; \
*yy_c_buf_p = '\0'; \
yyleng = n; \
} \
while ( 0 )
/* Internal utility routines. */
#ifndef yytext_ptr
#ifdef YY_USE_PROTOS
static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
#else
static void yy_flex_strncpy( s1, s2, n )
char *s1;
yyconst char *s2;
int n;
#endif
{
register int i;
for ( i = 0; i < n; ++i )
s1[i] = s2[i];
}
#endif
#ifdef YY_NEED_STRLEN
#ifdef YY_USE_PROTOS
static int yy_flex_strlen( yyconst char *s )
#else
static int yy_flex_strlen( s )
yyconst char *s;
#endif
{
register int n;
for ( n = 0; s[n]; ++n )
;
return n;
}
#endif
#ifdef YY_USE_PROTOS
static void *yy_flex_alloc( yy_size_t size )
#else
static void *yy_flex_alloc( size )
yy_size_t size;
#endif
{
return (void *) malloc( size );
}
#ifdef YY_USE_PROTOS
static void *yy_flex_realloc( void *ptr, yy_size_t size )
#else
static void *yy_flex_realloc( ptr, size )
void *ptr;
yy_size_t size;
#endif
{
/* The cast to (char *) in the following accommodates both
* implementations that use char* generic pointers, and those
* that use void* generic pointers. It works with the latter
* because both ANSI C and C++ allow castless assignment from
* any pointer type to void*, and deal with argument conversions
* as though doing an assignment.
*/
return (void *) realloc( (char *) ptr, size );
}
#ifdef YY_USE_PROTOS
static void yy_flex_free( void *ptr )
#else
static void yy_flex_free( ptr )
void *ptr;
#endif
{
free( ptr );
}
#if YY_MAIN
int main()
{
yylex();
return 0;
}
#endif
#line 724 "tools/wpp/ppl.l"
/*
**************************************************************************
* Support functions
**************************************************************************
*/
#ifndef ppwrap
int ppwrap(void)
{
return 1;
}
#endif
/*
*-------------------------------------------------------------------------
* Output newlines or set them as continuations
*
* Input: -1 - Don't count this one, but update local position (see pp_dqs)
* 0 - Line-continuation seen and cache output
* 1 - Newline seen and flush output
*-------------------------------------------------------------------------
*/
static void newline(int dowrite)
{
pp_status.line_number++;
pp_status.char_number = 1;
if(dowrite == -1)
return;
ncontinuations++;
if(dowrite)
{
for(;ncontinuations; ncontinuations--)
put_buffer("\n", 1);
}
}
/*
*-------------------------------------------------------------------------
* Make a number out of an any-base and suffixed string
*
* Possible number extensions:
* - "" int
* - "L" long int
* - "LL" long long int
* - "U" unsigned int
* - "UL" unsigned long int
* - "ULL" unsigned long long int
* - "LU" unsigned long int
* - "LLU" unsigned long long int
* - "LUL" invalid
*
* FIXME:
* The sizes of resulting 'int' and 'long' are compiler specific.
* I depend on sizeof(int) > 2 here (although a relatively safe
* assumption).
* Long longs are not yet implemented because this is very compiler
* specific and I don't want to think too much about the problems.
*
*-------------------------------------------------------------------------
*/
static int make_number(int radix, YYSTYPE *val, const char *str, int len)
{
int is_l = 0;
int is_ll = 0;
int is_u = 0;
char ext[4];
ext[3] = '\0';
ext[2] = toupper(str[len-1]);
ext[1] = len > 1 ? toupper(str[len-2]) : ' ';
ext[0] = len > 2 ? toupper(str[len-3]) : ' ';
if(!strcmp(ext, "LUL"))
pperror("Invalid constant suffix");
else if(!strcmp(ext, "LLU") || !strcmp(ext, "ULL"))
{
is_ll++;
is_u++;
}
else if(!strcmp(ext+1, "LU") || !strcmp(ext+1, "UL"))
{
is_l++;
is_u++;
}
else if(!strcmp(ext+1, "LL"))
{
is_ll++;
}
else if(!strcmp(ext+2, "L"))
{
is_l++;
}
else if(!strcmp(ext+2, "U"))
{
is_u++;
}
if(is_ll)
pp_internal_error(__FILE__, __LINE__, "long long constants not implemented yet");
if(is_u && is_l)
{
val->ulong = strtoul(str, NULL, radix);
return tULONG;
}
else if(!is_u && is_l)
{
val->slong = strtol(str, NULL, radix);
return tSLONG;
}
else if(is_u && !is_l)
{
val->uint = (unsigned int)strtoul(str, NULL, radix);
return tUINT;
}
/* Else it must be an int... */
val->sint = (int)strtol(str, NULL, radix);
return tSINT;
}
/*
*-------------------------------------------------------------------------
* Macro and define expansion support
*
* FIXME: Variable macro arguments.
*-------------------------------------------------------------------------
*/
static void expand_special(pp_entry_t *ppp)
{
const char *dbgtext = "?";
static char *buf = NULL;
assert(ppp->type == def_special);
if(!strcmp(ppp->ident, "__LINE__"))
{
dbgtext = "def_special(__LINE__)";
buf = pp_xrealloc(buf, 32);
sprintf(buf, "%d", pp_status.line_number);
}
else if(!strcmp(ppp->ident, "__FILE__"))
{
dbgtext = "def_special(__FILE__)";
buf = pp_xrealloc(buf, strlen(pp_status.input) + 3);
sprintf(buf, "\"%s\"", pp_status.input);
}
else
pp_internal_error(__FILE__, __LINE__, "Special macro '%s' not found...\n", ppp->ident);
if(pp_flex_debug)
fprintf(stderr, "expand_special(%d): %s:%d: '%s' -> '%s'\n",
macexpstackidx,
pp_status.input,
pp_status.line_number,
ppp->ident,
buf ? buf : "");
if(buf && buf[0])
{
push_buffer(ppp, NULL, NULL, 0);
yy_scan_string(buf);
}
}
static void expand_define(pp_entry_t *ppp)
{
assert(ppp->type == def_define);
if(pp_flex_debug)
fprintf(stderr, "expand_define(%d): %s:%d: '%s' -> '%s'\n",
macexpstackidx,
pp_status.input,
pp_status.line_number,
ppp->ident,
ppp->subst.text);
if(ppp->subst.text && ppp->subst.text[0])
{
push_buffer(ppp, NULL, NULL, 0);
yy_scan_string(ppp->subst.text);
}
}
static int curdef_idx = 0;
static int curdef_alloc = 0;
static char *curdef_text = NULL;
static void add_text(const char *str, int len)
{
if(len == 0)
return;
if(curdef_idx >= curdef_alloc || curdef_alloc - curdef_idx < len)
{
curdef_alloc += (len + ALLOCBLOCKSIZE-1) & ~(ALLOCBLOCKSIZE-1);
curdef_text = pp_xrealloc(curdef_text, curdef_alloc * sizeof(curdef_text[0]));
if(curdef_alloc > 65536)
ppwarning("Reallocating macro-expansion buffer larger than 64kB");
}
memcpy(&curdef_text[curdef_idx], str, len);
curdef_idx += len;
}
static mtext_t *add_expand_text(mtext_t *mtp, macexpstackentry_t *mep, int *nnl)
{
char *cptr;
char *exp;
int tag;
int n;
if(mtp == NULL)
return NULL;
switch(mtp->type)
{
case exp_text:
if(pp_flex_debug)
fprintf(stderr, "add_expand_text: exp_text: '%s'\n", mtp->subst.text);
add_text(mtp->subst.text, strlen(mtp->subst.text));
break;
case exp_stringize:
if(pp_flex_debug)
fprintf(stderr, "add_expand_text: exp_stringize(%d): '%s'\n",
mtp->subst.argidx,
mep->args[mtp->subst.argidx]);
cptr = mep->args[mtp->subst.argidx];
add_text("\"", 1);
while(*cptr)
{
if(*cptr == '"' || *cptr == '\\')
add_text("\\", 1);
add_text(cptr, 1);
cptr++;
}
add_text("\"", 1);
break;
case exp_concat:
if(pp_flex_debug)
fprintf(stderr, "add_expand_text: exp_concat\n");
/* Remove trailing whitespace from current expansion text */
while(curdef_idx)
{
if(isspace(curdef_text[curdef_idx-1] & 0xff))
curdef_idx--;
else
break;
}
/* tag current position and recursively expand the next part */
tag = curdef_idx;
mtp = add_expand_text(mtp->next, mep, nnl);
/* Now get rid of the leading space of the expansion */
cptr = &curdef_text[tag];
n = curdef_idx - tag;
while(n)
{
if(isspace(*cptr & 0xff))
{
cptr++;
n--;
}
else
break;
}
if(cptr != &curdef_text[tag])
{
memmove(&curdef_text[tag], cptr, n);
curdef_idx -= (curdef_idx - tag) - n;
}
break;
case exp_subst:
if((mtp->next && mtp->next->type == exp_concat) || (mtp->prev && mtp->prev->type == exp_concat))
exp = mep->args[mtp->subst.argidx];
else
exp = mep->ppargs[mtp->subst.argidx];
if(exp)
{
add_text(exp, strlen(exp));
*nnl -= mep->nnls[mtp->subst.argidx];
cptr = strchr(exp, '\n');
while(cptr)
{
*cptr = ' ';
cptr = strchr(cptr+1, '\n');
}
mep->nnls[mtp->subst.argidx] = 0;
}
if(pp_flex_debug)
fprintf(stderr, "add_expand_text: exp_subst(%d): '%s'\n", mtp->subst.argidx, exp);
break;
default:
pp_internal_error(__FILE__, __LINE__, "Invalid expansion type (%d) in macro expansion\n", mtp->type);
}
return mtp;
}
static void expand_macro(macexpstackentry_t *mep)
{
mtext_t *mtp;
int n, k;
char *cptr;
int nnl = 0;
pp_entry_t *ppp = mep->ppp;
int nargs = mep->nargs;
assert(ppp->type == def_macro);
assert(ppp->expanding == 0);
if((ppp->nargs >= 0 && nargs != ppp->nargs) || (ppp->nargs < 0 && nargs < -ppp->nargs))
pperror("Too %s macro arguments (%d)", nargs < abs(ppp->nargs) ? "few" : "many", nargs);
for(n = 0; n < nargs; n++)
nnl += mep->nnls[n];
if(pp_flex_debug)
fprintf(stderr, "expand_macro(%d): %s:%d: '%s'(%d,%d) -> ...\n",
macexpstackidx,
pp_status.input,
pp_status.line_number,
ppp->ident,
mep->nargs,
nnl);
curdef_idx = 0;
for(mtp = ppp->subst.mtext; mtp; mtp = mtp->next)
{
if(!(mtp = add_expand_text(mtp, mep, &nnl)))
break;
}
for(n = 0; n < nnl; n++)
add_text("\n", 1);
/* To make sure there is room and termination (see below) */
add_text(" \0", 2);
/* Strip trailing whitespace from expansion */
for(k = curdef_idx, cptr = &curdef_text[curdef_idx-1]; k > 0; k--, cptr--)
{
if(!isspace(*cptr & 0xff))
break;
}
/*
* We must add *one* whitespace to make sure that there
* is a token-separation after the expansion.
*/
*(++cptr) = ' ';
*(++cptr) = '\0';
k++;
/* Strip leading whitespace from expansion */
for(n = 0, cptr = curdef_text; n < k; n++, cptr++)
{
if(!isspace(*cptr & 0xff))
break;
}
if(k - n > 0)
{
if(pp_flex_debug)
fprintf(stderr, "expand_text: '%s'\n", curdef_text + n);
push_buffer(ppp, NULL, NULL, 0);
/*yy_scan_bytes(curdef_text + n, k - n);*/
yy_scan_string(curdef_text + n);
}
}
/*
*-------------------------------------------------------------------------
* String collection routines
*-------------------------------------------------------------------------
*/
static void new_string(void)
{
#ifdef DEBUG
if(strbuf_idx)
ppwarning("new_string: strbuf_idx != 0");
#endif
strbuf_idx = 0;
str_startline = pp_status.line_number;
}
static void add_string(const char *str, int len)
{
if(len == 0)
return;
if(strbuf_idx >= strbuf_alloc || strbuf_alloc - strbuf_idx < len)
{
strbuf_alloc += (len + ALLOCBLOCKSIZE-1) & ~(ALLOCBLOCKSIZE-1);
strbuffer = pp_xrealloc(strbuffer, strbuf_alloc * sizeof(strbuffer[0]));
if(strbuf_alloc > 65536)
ppwarning("Reallocating string buffer larger than 64kB");
}
memcpy(&strbuffer[strbuf_idx], str, len);
strbuf_idx += len;
}
static char *get_string(void)
{
char *str = pp_xmalloc(strbuf_idx + 1);
memcpy(str, strbuffer, strbuf_idx);
str[strbuf_idx] = '\0';
#ifdef DEBUG
strbuf_idx = 0;
#endif
return str;
}
static void put_string(void)
{
put_buffer(strbuffer, strbuf_idx);
#ifdef DEBUG
strbuf_idx = 0;
#endif
}
static int string_start(void)
{
return str_startline;
}
/*
*-------------------------------------------------------------------------
* Buffer management
*-------------------------------------------------------------------------
*/
static void push_buffer(pp_entry_t *ppp, char *filename, char *incname, int pop)
{
if(ppdebug)
printf("push_buffer(%d): %p %p %p %d\n", bufferstackidx, ppp, filename, incname, pop);
if(bufferstackidx >= MAXBUFFERSTACK)
pp_internal_error(__FILE__, __LINE__, "Buffer stack overflow");
memset(&bufferstack[bufferstackidx], 0, sizeof(bufferstack[0]));
bufferstack[bufferstackidx].bufferstate = YY_CURRENT_BUFFER;
bufferstack[bufferstackidx].define = ppp;
bufferstack[bufferstackidx].line_number = pp_status.line_number;
bufferstack[bufferstackidx].char_number = pp_status.char_number;
bufferstack[bufferstackidx].if_depth = pp_get_if_depth();
bufferstack[bufferstackidx].should_pop = pop;
bufferstack[bufferstackidx].filename = pp_status.input;
bufferstack[bufferstackidx].ncontinuations = ncontinuations;
bufferstack[bufferstackidx].incl = pp_incl_state;
bufferstack[bufferstackidx].include_filename = incname;
bufferstack[bufferstackidx].pass_data = pass_data;
if(ppp)
ppp->expanding = 1;
else if(filename)
{
/* These will track the pperror to the correct file and line */
pp_status.line_number = 1;
pp_status.char_number = 1;
pp_status.input = filename;
ncontinuations = 0;
}
else if(!pop)
pp_internal_error(__FILE__, __LINE__, "Pushing buffer without knowing where to go to");
bufferstackidx++;
}
static bufferstackentry_t *pop_buffer(void)
{
if(bufferstackidx < 0)
pp_internal_error(__FILE__, __LINE__, "Bufferstack underflow?");
if(bufferstackidx == 0)
return NULL;
bufferstackidx--;
if(bufferstack[bufferstackidx].define)
bufferstack[bufferstackidx].define->expanding = 0;
else
{
pp_status.line_number = bufferstack[bufferstackidx].line_number;
pp_status.char_number = bufferstack[bufferstackidx].char_number;
pp_status.input = bufferstack[bufferstackidx].filename;
ncontinuations = bufferstack[bufferstackidx].ncontinuations;
if(!bufferstack[bufferstackidx].should_pop)
{
fclose(ppin);
fprintf(ppout, "# %d \"%s\" 2\n", pp_status.line_number, pp_status.input);
/* We have EOF, check the include logic */
if(pp_incl_state.state == 2 && !pp_incl_state.seen_junk && pp_incl_state.ppp)
{
pp_entry_t *ppp = pplookup(pp_incl_state.ppp);
if(ppp)
{
includelogicentry_t *iep = pp_xmalloc(sizeof(includelogicentry_t));
iep->ppp = ppp;
ppp->iep = iep;
iep->filename = bufferstack[bufferstackidx].include_filename;
iep->prev = NULL;
iep->next = pp_includelogiclist;
if(iep->next)
iep->next->prev = iep;
pp_includelogiclist = iep;
if(pp_status.debug)
fprintf(stderr, "pop_buffer: %s:%d: includelogic added, include_ppp='%s', file='%s'\n", pp_status.input, pp_status.line_number, pp_incl_state.ppp, iep->filename);
}
else if(bufferstack[bufferstackidx].include_filename)
free(bufferstack[bufferstackidx].include_filename);
}
if(pp_incl_state.ppp)
free(pp_incl_state.ppp);
pp_incl_state = bufferstack[bufferstackidx].incl;
pass_data = bufferstack[bufferstackidx].pass_data;
}
}
if(ppdebug)
printf("pop_buffer(%d): %p %p (%d, %d, %d) %p %d\n",
bufferstackidx,
bufferstack[bufferstackidx].bufferstate,
bufferstack[bufferstackidx].define,
bufferstack[bufferstackidx].line_number,
bufferstack[bufferstackidx].char_number,
bufferstack[bufferstackidx].if_depth,
bufferstack[bufferstackidx].filename,
bufferstack[bufferstackidx].should_pop);
pp_switch_to_buffer(bufferstack[bufferstackidx].bufferstate);
if(bufferstack[bufferstackidx].should_pop)
{
if(yy_current_state() == pp_macexp)
macro_add_expansion();
else
pp_internal_error(__FILE__, __LINE__, "Pop buffer and state without macro expansion state");
yy_pop_state();
}
return &bufferstack[bufferstackidx];
}
/*
*-------------------------------------------------------------------------
* Macro nestng support
*-------------------------------------------------------------------------
*/
static void push_macro(pp_entry_t *ppp)
{
if(macexpstackidx >= MAXMACEXPSTACK)
pperror("Too many nested macros");
macexpstack[macexpstackidx] = pp_xmalloc(sizeof(macexpstack[0][0]));
memset( macexpstack[macexpstackidx], 0, sizeof(macexpstack[0][0]));
macexpstack[macexpstackidx]->ppp = ppp;
macexpstackidx++;
}
static macexpstackentry_t *top_macro(void)
{
return macexpstackidx > 0 ? macexpstack[macexpstackidx-1] : NULL;
}
static macexpstackentry_t *pop_macro(void)
{
if(macexpstackidx <= 0)
pp_internal_error(__FILE__, __LINE__, "Macro expansion stack underflow\n");
return macexpstack[--macexpstackidx];
}
static void free_macro(macexpstackentry_t *mep)
{
int i;
for(i = 0; i < mep->nargs; i++)
free(mep->args[i]);
if(mep->args)
free(mep->args);
if(mep->nnls)
free(mep->nnls);
if(mep->curarg)
free(mep->curarg);
free(mep);
}
static void add_text_to_macro(const char *text, int len)
{
macexpstackentry_t *mep = top_macro();
assert(mep->ppp->expanding == 0);
if(mep->curargalloc - mep->curargsize <= len+1) /* +1 for '\0' */
{
mep->curargalloc += (ALLOCBLOCKSIZE > len+1) ? ALLOCBLOCKSIZE : len+1;
mep->curarg = pp_xrealloc(mep->curarg, mep->curargalloc * sizeof(mep->curarg[0]));
}
memcpy(mep->curarg + mep->curargsize, text, len);
mep->curargsize += len;
mep->curarg[mep->curargsize] = '\0';
}
static void macro_add_arg(int last)
{
int nnl = 0;
char *cptr;
macexpstackentry_t *mep = top_macro();
assert(mep->ppp->expanding == 0);
mep->args = pp_xrealloc(mep->args, (mep->nargs+1) * sizeof(mep->args[0]));
mep->ppargs = pp_xrealloc(mep->ppargs, (mep->nargs+1) * sizeof(mep->ppargs[0]));
mep->nnls = pp_xrealloc(mep->nnls, (mep->nargs+1) * sizeof(mep->nnls[0]));
mep->args[mep->nargs] = pp_xstrdup(mep->curarg ? mep->curarg : "");
cptr = mep->args[mep->nargs]-1;
while((cptr = strchr(cptr+1, '\n')))
{
nnl++;
}
mep->nnls[mep->nargs] = nnl;
mep->nargs++;
free(mep->curarg);
mep->curargalloc = mep->curargsize = 0;
mep->curarg = NULL;
if(pp_flex_debug)
fprintf(stderr, "macro_add_arg: %s:%d: %d -> '%s'\n",
pp_status.input,
pp_status.line_number,
mep->nargs-1,
mep->args[mep->nargs-1]);
/* Each macro argument must be expanded to cope with stingize */
if(last || mep->args[mep->nargs-1][0])
{
yy_push_state(pp_macexp);
push_buffer(NULL, NULL, NULL, last ? 2 : 1);
yy_scan_string(mep->args[mep->nargs-1]);
/*mep->bufferstackidx = bufferstackidx; But not nested! */
}
}
static void macro_add_expansion(void)
{
macexpstackentry_t *mep = top_macro();
assert(mep->ppp->expanding == 0);
mep->ppargs[mep->nargs-1] = pp_xstrdup(mep->curarg ? mep->curarg : "");
free(mep->curarg);
mep->curargalloc = mep->curargsize = 0;
mep->curarg = NULL;
if(pp_flex_debug)
fprintf(stderr, "macro_add_expansion: %s:%d: %d -> '%s'\n",
pp_status.input,
pp_status.line_number,
mep->nargs-1,
mep->ppargs[mep->nargs-1]);
}
/*
*-------------------------------------------------------------------------
* Output management
*-------------------------------------------------------------------------
*/
static void put_buffer(const char *s, int len)
{
if(top_macro())
add_text_to_macro(s, len);
else {
if(pass_data)
fwrite(s, 1, len, ppout);
}
}
/*
*-------------------------------------------------------------------------
* Include management
*-------------------------------------------------------------------------
*/
static int is_c_h_include(char *fname, int quoted)
{
int sl=strlen(fname);
if (sl < 2 + 2 * quoted) return 0;
if ((toupper(fname[sl-1-quoted])!='H') && (toupper(fname[sl-1-quoted])!='C')) return 0;
if (fname[sl-2-quoted]!='.') return 0;
return 1;
}
void pp_do_include(char *fname, int type)
{
char *newpath;
int n;
includelogicentry_t *iep;
for(iep = pp_includelogiclist; iep; iep = iep->next)
{
if(!strcmp(iep->filename, fname))
{
/*
* We are done. The file was included before.
* If the define was deleted, then this entry would have
* been deleted too.
*/
return;
}
}
n = strlen(fname);
if(n <= 2)
pperror("Empty include filename");
/* Undo the effect of the quotation */
fname[n-1] = '\0';
if((ppin = pp_open_include(fname+1, type ? pp_status.input : NULL, &newpath, type)) == NULL)
pperror("Unable to open include file %s", fname+1);
fname[n-1] = *fname; /* Redo the quotes */
push_buffer(NULL, newpath, fname, 0);
pp_incl_state.seen_junk = 0;
pp_incl_state.state = 0;
pp_incl_state.ppp = NULL;
if (is_c_h_include(newpath, 0)) pass_data=0;
else pass_data=1;
if(pp_status.debug)
fprintf(stderr, "pp_do_include: %s:%d: include_state=%d, include_ppp='%s', include_ifdepth=%d ,pass_data=%d\n",
pp_status.input, pp_status.line_number, pp_incl_state.state, pp_incl_state.ppp, pp_incl_state.ifdepth, pass_data);
pp_switch_to_buffer(pp_create_buffer(ppin, YY_BUF_SIZE));
fprintf(ppout, "# 1 \"%s\" 1%s\n", newpath, type ? "" : " 3");
}
/*
*-------------------------------------------------------------------------
* Push/pop preprocessor ignore state when processing conditionals
* which are false.
*-------------------------------------------------------------------------
*/
void pp_push_ignore_state(void)
{
yy_push_state(pp_ignore);
}
void pp_pop_ignore_state(void)
{
yy_pop_state();
}