mirror of
https://github.com/reactos/reactos.git
synced 2024-08-18 01:18:56 +00:00
4603 lines
129 KiB
C
4603 lines
129 KiB
C
#line 2 "ppl.yy.c"
|
|
#line 125 "ppl.l"
|
|
#include "config.h"
|
|
#include "wine/port.h"
|
|
|
|
|
|
|
|
#line 9 "ppl.yy.c"
|
|
|
|
#define YY_INT_ALIGNED short int
|
|
|
|
/* A lexical scanner generated by flex */
|
|
|
|
#define yy_create_buffer ppy__create_buffer
|
|
#define yy_delete_buffer ppy__delete_buffer
|
|
#define yy_flex_debug ppy__flex_debug
|
|
#define yy_init_buffer ppy__init_buffer
|
|
#define yy_flush_buffer ppy__flush_buffer
|
|
#define yy_load_buffer_state ppy__load_buffer_state
|
|
#define yy_switch_to_buffer ppy__switch_to_buffer
|
|
#define yyin ppy_in
|
|
#define yyleng ppy_leng
|
|
#define yylex ppy_lex
|
|
#define yylineno ppy_lineno
|
|
#define yyout ppy_out
|
|
#define yyrestart ppy_restart
|
|
#define yytext ppy_text
|
|
#define yywrap ppy_wrap
|
|
#define yyalloc ppy_alloc
|
|
#define yyrealloc ppy_realloc
|
|
#define yyfree ppy_free
|
|
|
|
#define FLEX_SCANNER
|
|
#define YY_FLEX_MAJOR_VERSION 2
|
|
#define YY_FLEX_MINOR_VERSION 5
|
|
#define YY_FLEX_SUBMINOR_VERSION 35
|
|
#if YY_FLEX_SUBMINOR_VERSION > 0
|
|
#define FLEX_BETA
|
|
#endif
|
|
|
|
/* First, we deal with platform-specific or compiler-specific issues. */
|
|
|
|
/* begin standard C headers. */
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <errno.h>
|
|
#include <stdlib.h>
|
|
|
|
/* end standard C headers. */
|
|
|
|
/* flex integer type definitions */
|
|
|
|
#ifndef FLEXINT_H
|
|
#define FLEXINT_H
|
|
|
|
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
|
|
|
|
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
|
|
|
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
|
|
* if you want the limit (max/min) macros for int types.
|
|
*/
|
|
#ifndef __STDC_LIMIT_MACROS
|
|
#define __STDC_LIMIT_MACROS 1
|
|
#endif
|
|
|
|
#include <inttypes.h>
|
|
typedef int8_t flex_int8_t;
|
|
typedef uint8_t flex_uint8_t;
|
|
typedef int16_t flex_int16_t;
|
|
typedef uint16_t flex_uint16_t;
|
|
typedef int32_t flex_int32_t;
|
|
typedef uint32_t flex_uint32_t;
|
|
#else
|
|
typedef signed char flex_int8_t;
|
|
typedef short int flex_int16_t;
|
|
typedef int flex_int32_t;
|
|
typedef unsigned char flex_uint8_t;
|
|
typedef unsigned short int flex_uint16_t;
|
|
typedef unsigned int flex_uint32_t;
|
|
|
|
/* Limits of integral types. */
|
|
#ifndef INT8_MIN
|
|
#define INT8_MIN (-128)
|
|
#endif
|
|
#ifndef INT16_MIN
|
|
#define INT16_MIN (-32767-1)
|
|
#endif
|
|
#ifndef INT32_MIN
|
|
#define INT32_MIN (-2147483647-1)
|
|
#endif
|
|
#ifndef INT8_MAX
|
|
#define INT8_MAX (127)
|
|
#endif
|
|
#ifndef INT16_MAX
|
|
#define INT16_MAX (32767)
|
|
#endif
|
|
#ifndef INT32_MAX
|
|
#define INT32_MAX (2147483647)
|
|
#endif
|
|
#ifndef UINT8_MAX
|
|
#define UINT8_MAX (255U)
|
|
#endif
|
|
#ifndef UINT16_MAX
|
|
#define UINT16_MAX (65535U)
|
|
#endif
|
|
#ifndef UINT32_MAX
|
|
#define UINT32_MAX (4294967295U)
|
|
#endif
|
|
|
|
#endif /* ! C99 */
|
|
|
|
#endif /* ! FLEXINT_H */
|
|
|
|
#ifdef __cplusplus
|
|
|
|
/* The "const" storage-class-modifier is valid. */
|
|
#define YY_USE_CONST
|
|
|
|
#else /* ! __cplusplus */
|
|
|
|
/* C99 requires __STDC__ to be defined as 1. */
|
|
#if defined (__STDC__)
|
|
|
|
#define YY_USE_CONST
|
|
|
|
#endif /* defined (__STDC__) */
|
|
#endif /* ! __cplusplus */
|
|
|
|
#ifdef YY_USE_CONST
|
|
#define yyconst const
|
|
#else
|
|
#define yyconst
|
|
#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 ppy_restart(ppy_in )
|
|
|
|
#define YY_END_OF_BUFFER_CHAR 0
|
|
|
|
/* Size of default input buffer. */
|
|
#ifndef YY_BUF_SIZE
|
|
#ifdef __ia64__
|
|
/* On IA-64, the buffer size is 16k, not 8k.
|
|
* Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
|
|
* Ditto for the __ia64__ case accordingly.
|
|
*/
|
|
#define YY_BUF_SIZE 32768
|
|
#else
|
|
#define YY_BUF_SIZE 16384
|
|
#endif /* __ia64__ */
|
|
#endif
|
|
|
|
/* The state buf must be large enough to hold one state per character in the main buffer.
|
|
*/
|
|
#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
|
|
|
|
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
|
|
#define YY_TYPEDEF_YY_BUFFER_STATE
|
|
typedef struct yy_buffer_state *YY_BUFFER_STATE;
|
|
#endif
|
|
|
|
extern int ppy_leng;
|
|
|
|
extern FILE *ppy_in, *ppy_out;
|
|
|
|
#define EOB_ACT_CONTINUE_SCAN 0
|
|
#define EOB_ACT_END_OF_FILE 1
|
|
#define EOB_ACT_LAST_MATCH 2
|
|
|
|
#define YY_LESS_LINENO(n)
|
|
|
|
/* Return all but the first "n" matched characters back to the input stream. */
|
|
#define yyless(n) \
|
|
do \
|
|
{ \
|
|
/* Undo effects of setting up ppy_text. */ \
|
|
int yyless_macro_arg = (n); \
|
|
YY_LESS_LINENO(yyless_macro_arg);\
|
|
*yy_cp = (yy_hold_char); \
|
|
YY_RESTORE_YY_MORE_OFFSET \
|
|
(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
|
|
YY_DO_BEFORE_ACTION; /* set up ppy_text again */ \
|
|
} \
|
|
while ( 0 )
|
|
|
|
#define unput(c) yyunput( c, (yytext_ptr) )
|
|
|
|
#ifndef YY_TYPEDEF_YY_SIZE_T
|
|
#define YY_TYPEDEF_YY_SIZE_T
|
|
typedef size_t yy_size_t;
|
|
#endif
|
|
|
|
#ifndef YY_STRUCT_YY_BUFFER_STATE
|
|
#define YY_STRUCT_YY_BUFFER_STATE
|
|
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;
|
|
|
|
int yy_bs_lineno; /**< The line count. */
|
|
int yy_bs_column; /**< The column count. */
|
|
|
|
/* 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 ppy_restart()), so that the user can continue scanning by
|
|
* just pointing ppy_in at a new input file.
|
|
*/
|
|
#define YY_BUFFER_EOF_PENDING 2
|
|
|
|
};
|
|
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
|
|
|
|
/* Stack of input buffers. */
|
|
static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
|
|
static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
|
|
static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
|
|
|
|
/* 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".
|
|
*
|
|
* Returns the top of the stack, or NULL.
|
|
*/
|
|
#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
|
|
? (yy_buffer_stack)[(yy_buffer_stack_top)] \
|
|
: NULL)
|
|
|
|
/* Same as previous macro, but useful when we know that the buffer stack is not
|
|
* NULL or when we need an lvalue. For internal use only.
|
|
*/
|
|
#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
|
|
|
|
/* yy_hold_char holds the character lost when ppy_text is formed. */
|
|
static char yy_hold_char;
|
|
static int yy_n_chars; /* number of characters read into yy_ch_buf */
|
|
int ppy_leng;
|
|
|
|
/* Points to current character in buffer. */
|
|
static char *yy_c_buf_p = (char *) 0;
|
|
static int yy_init = 0; /* whether we need to initialize */
|
|
static int yy_start = 0; /* start state number */
|
|
|
|
/* Flag which is used to allow ppy_wrap()'s to do buffer switches
|
|
* instead of setting up a fresh ppy_in. A bit of a hack ...
|
|
*/
|
|
static int yy_did_buffer_switch_on_eof;
|
|
|
|
void ppy_restart (FILE *input_file );
|
|
void ppy__switch_to_buffer (YY_BUFFER_STATE new_buffer );
|
|
YY_BUFFER_STATE ppy__create_buffer (FILE *file,int size );
|
|
void ppy__delete_buffer (YY_BUFFER_STATE b );
|
|
void ppy__flush_buffer (YY_BUFFER_STATE b );
|
|
void ppy_push_buffer_state (YY_BUFFER_STATE new_buffer );
|
|
void ppy_pop_buffer_state (void );
|
|
|
|
static void ppy_ensure_buffer_stack (void );
|
|
static void ppy__load_buffer_state (void );
|
|
static void ppy__init_buffer (YY_BUFFER_STATE b,FILE *file );
|
|
|
|
#define YY_FLUSH_BUFFER ppy__flush_buffer(YY_CURRENT_BUFFER )
|
|
|
|
YY_BUFFER_STATE ppy__scan_buffer (char *base,yy_size_t size );
|
|
YY_BUFFER_STATE ppy__scan_string (yyconst char *yy_str );
|
|
YY_BUFFER_STATE ppy__scan_bytes (yyconst char *bytes,int len );
|
|
|
|
void *ppy_alloc (yy_size_t );
|
|
void *ppy_realloc (void *,yy_size_t );
|
|
void ppy_free (void * );
|
|
|
|
#define yy_new_buffer ppy__create_buffer
|
|
|
|
#define yy_set_interactive(is_interactive) \
|
|
{ \
|
|
if ( ! YY_CURRENT_BUFFER ){ \
|
|
ppy_ensure_buffer_stack (); \
|
|
YY_CURRENT_BUFFER_LVALUE = \
|
|
ppy__create_buffer(ppy_in,YY_BUF_SIZE ); \
|
|
} \
|
|
YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
|
|
}
|
|
|
|
#define yy_set_bol(at_bol) \
|
|
{ \
|
|
if ( ! YY_CURRENT_BUFFER ){\
|
|
ppy_ensure_buffer_stack (); \
|
|
YY_CURRENT_BUFFER_LVALUE = \
|
|
ppy__create_buffer(ppy_in,YY_BUF_SIZE ); \
|
|
} \
|
|
YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
|
|
}
|
|
|
|
#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
|
|
|
|
/* Begin user sect3 */
|
|
|
|
typedef unsigned char YY_CHAR;
|
|
|
|
FILE *ppy_in = (FILE *) 0, *ppy_out = (FILE *) 0;
|
|
|
|
typedef int yy_state_type;
|
|
|
|
extern int ppy_lineno;
|
|
|
|
int ppy_lineno = 1;
|
|
|
|
extern char *ppy_text;
|
|
#define yytext_ptr ppy_text
|
|
|
|
static yy_state_type yy_get_previous_state (void );
|
|
static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
|
|
static int yy_get_next_buffer (void );
|
|
static void yy_fatal_error (yyconst char msg[] );
|
|
|
|
/* Done after the current pattern has been matched and before the
|
|
* corresponding action - sets up ppy_text.
|
|
*/
|
|
#define YY_DO_BEFORE_ACTION \
|
|
(yytext_ptr) = yy_bp; \
|
|
ppy_leng = (size_t) (yy_cp - yy_bp); \
|
|
(yy_hold_char) = *yy_cp; \
|
|
*yy_cp = '\0'; \
|
|
(yy_c_buf_p) = yy_cp;
|
|
|
|
#define YY_NUM_RULES 143
|
|
#define YY_END_OF_BUFFER 144
|
|
/* This struct is not used in this scanner,
|
|
but its presence is necessary. */
|
|
struct yy_trans_info
|
|
{
|
|
flex_int32_t yy_verify;
|
|
flex_int32_t yy_nxt;
|
|
};
|
|
static yyconst flex_int16_t yy_accept[416] =
|
|
{ 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 117, 117, 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, 144, 133, 134, 135, 121, 142,
|
|
122, 133, 132, 133, 134, 1, 21, 16, 18, 16,
|
|
21, 20, 17, 17, 17, 17, 17, 17, 17, 17,
|
|
68, 71, 69, 70, 28, 25, 26, 24, 28, 23,
|
|
28, 28, 123, 131, 124, 142, 125, 126, 142, 127,
|
|
128, 117, 118, 117, 77, 75, 77, 77, 74, 77,
|
|
|
|
78, 82, 84, 83, 142, 79, 90, 86, 90, 85,
|
|
88, 90, 90, 87, 90, 92, 100, 102, 95, 101,
|
|
97, 96, 93, 97, 92, 106, 106, 104, 103, 106,
|
|
114, 113, 110, 111, 107, 108, 109, 114, 114, 133,
|
|
134, 138, 121, 138, 122, 133, 132, 133, 53, 50,
|
|
47, 53, 52, 53, 51, 53, 33, 35, 53, 53,
|
|
53, 53, 49, 53, 53, 58, 55, 56, 58, 54,
|
|
58, 62, 59, 60, 62, 62, 22, 67, 64, 67,
|
|
65, 67, 63, 67, 29, 30, 32, 32, 32, 29,
|
|
1, 140, 143, 141, 139, 139, 133, 134, 133, 116,
|
|
|
|
120, 132, 136, 137, 134, 1, 16, 17, 17, 17,
|
|
17, 17, 17, 17, 17, 18, 19, 20, 17, 17,
|
|
17, 17, 17, 11, 17, 17, 17, 17, 17, 68,
|
|
69, 70, 72, 70, 25, 27, 28, 123, 130, 129,
|
|
130, 125, 127, 117, 117, 117, 119, 75, 73, 74,
|
|
76, 77, 78, 79, 81, 79, 86, 85, 90, 87,
|
|
91, 90, 92, 94, 97, 96, 96, 93, 99, 97,
|
|
92, 106, 104, 103, 106, 105, 106, 114, 114, 112,
|
|
115, 114, 133, 138, 138, 50, 44, 41, 33, 34,
|
|
33, 33, 37, 35, 35, 35, 39, 45, 43, 46,
|
|
|
|
40, 48, 49, 132, 42, 55, 54, 57, 58, 59,
|
|
61, 0, 22, 64, 63, 67, 66, 67, 29, 31,
|
|
32, 29, 140, 139, 120, 120, 17, 17, 17, 17,
|
|
17, 17, 11, 17, 17, 17, 17, 17, 17, 17,
|
|
69, 80, 89, 98, 34, 34, 33, 33, 33, 36,
|
|
35, 35, 35, 132, 120, 17, 12, 13, 17, 17,
|
|
17, 17, 17, 17, 15, 17, 17, 17, 34, 34,
|
|
34, 33, 36, 36, 35, 132, 17, 12, 13, 14,
|
|
4, 7, 9, 17, 17, 15, 17, 8, 17, 34,
|
|
36, 36, 36, 132, 3, 14, 4, 7, 9, 10,
|
|
|
|
17, 6, 8, 17, 36, 132, 3, 10, 2, 6,
|
|
5, 38, 2, 5, 0
|
|
} ;
|
|
|
|
static yyconst flex_int32_t 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 flex_int32_t 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 flex_int16_t yy_base[460] =
|
|
{ 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, 1130, 0, 49, 1886, 1886, 1886,
|
|
1886, 96, 0, 109, 118, 1886, 1886, 811, 1886, 1126,
|
|
111, 111, 858, 1095, 154, 161, 1090, 1083, 1085, 1095,
|
|
0, 1886, 184, 124, 1886, 196, 1886, 1886, 254, 1886,
|
|
0, 199, 0, 1886, 1886, 269, 0, 1886, 1120, 0,
|
|
1886, 0, 1886, 263, 1886, 208, 1886, 267, 1112, 277,
|
|
|
|
0, 1886, 1886, 1886, 271, 281, 1886, 393, 1886, 396,
|
|
1886, 1107, 396, 0, 406, 0, 1886, 1886, 1113, 1886,
|
|
400, 905, 0, 418, 954, 1886, 430, 1886, 1886, 433,
|
|
0, 1886, 1886, 1886, 1886, 1886, 1886, 432, 435, 0,
|
|
449, 1886, 1886, 1886, 1886, 444, 0, 1003, 1886, 456,
|
|
1886, 1099, 1886, 1110, 1886, 449, 1037, 714, 443, 1097,
|
|
603, 0, 623, 1083, 1066, 1886, 615, 1886, 619, 0,
|
|
632, 1886, 644, 1886, 635, 634, 635, 1886, 655, 1886,
|
|
1886, 646, 0, 659, 0, 1886, 1886, 725, 738, 741,
|
|
1886, 742, 1886, 1886, 0, 735, 0, 747, 741, 1886,
|
|
|
|
0, 0, 1886, 1111, 755, 1886, 0, 0, 1079, 747,
|
|
754, 1074, 1067, 1069, 1079, 1886, 1886, 1104, 1069, 717,
|
|
1070, 1058, 1067, 777, 1063, 1052, 1062, 1056, 1041, 0,
|
|
0, 1886, 1886, 1079, 787, 1886, 1078, 0, 1886, 1886,
|
|
1077, 0, 0, 0, 743, 765, 1886, 791, 1886, 1069,
|
|
1886, 1075, 0, 1886, 794, 1074, 795, 798, 1062, 0,
|
|
1886, 1071, 0, 1886, 789, 0, 1085, 0, 801, 1070,
|
|
0, 804, 1886, 1886, 807, 1886, 1069, 0, 804, 1886,
|
|
1886, 1068, 806, 1886, 0, 818, 1886, 1886, 847, 843,
|
|
874, 799, 0, 905, 903, 800, 1886, 1886, 1886, 1886,
|
|
|
|
1886, 1886, 1066, 1026, 1886, 823, 0, 1886, 1048, 824,
|
|
1886, 1047, 816, 871, 0, 1886, 1886, 1027, 0, 1886,
|
|
1006, 872, 876, 0, 1134, 0, 969, 971, 948, 943,
|
|
906, 897, 880, 875, 871, 864, 844, 835, 833, 799,
|
|
0, 884, 1886, 890, 907, 845, 618, 863, 873, 914,
|
|
889, 910, 912, 799, 1183, 795, 938, 942, 796, 786,
|
|
747, 702, 695, 614, 959, 610, 598, 428, 932, 945,
|
|
946, 1886, 947, 952, 1886, 406, 395, 975, 984, 985,
|
|
990, 993, 994, 385, 372, 997, 365, 998, 247, 1886,
|
|
966, 991, 994, 241, 1023, 1024, 1029, 1032, 1033, 1036,
|
|
|
|
153, 1037, 1040, 74, 1886, 22, 1041, 1044, 1045, 1054,
|
|
1055, 0, 1062, 1063, 1886, 1232, 1249, 1266, 1283, 1300,
|
|
1317, 1334, 1351, 1368, 1385, 1402, 1419, 1436, 1449, 1451,
|
|
1468, 1485, 1502, 1519, 1536, 1553, 1570, 1587, 1598, 1615,
|
|
1632, 1638, 1655, 1672, 1689, 1695, 1712, 1729, 1746, 1752,
|
|
1758, 1775, 1792, 1800, 1817, 1834, 1851, 1056, 1868
|
|
} ;
|
|
|
|
static yyconst flex_int16_t yy_def[460] =
|
|
{ 0,
|
|
415, 1, 415, 3, 416, 416, 415, 7, 417, 417,
|
|
418, 418, 419, 419, 420, 420, 415, 17, 421, 421,
|
|
415, 21, 415, 23, 422, 422, 423, 423, 415, 29,
|
|
415, 31, 415, 33, 424, 424, 425, 425, 415, 39,
|
|
426, 426, 427, 427, 415, 428, 415, 415, 415, 415,
|
|
415, 429, 430, 429, 415, 415, 415, 415, 415, 58,
|
|
415, 415, 58, 63, 63, 63, 63, 63, 63, 63,
|
|
431, 415, 432, 415, 415, 415, 415, 415, 415, 415,
|
|
430, 415, 433, 415, 415, 434, 435, 415, 434, 436,
|
|
415, 437, 415, 438, 415, 415, 415, 415, 439, 415,
|
|
|
|
440, 415, 415, 415, 441, 415, 415, 415, 415, 415,
|
|
415, 415, 415, 442, 415, 443, 415, 415, 415, 415,
|
|
444, 445, 446, 415, 446, 415, 415, 415, 415, 415,
|
|
447, 415, 415, 415, 415, 415, 415, 448, 415, 428,
|
|
415, 415, 415, 415, 415, 429, 430, 449, 415, 415,
|
|
415, 415, 415, 415, 415, 415, 415, 415, 415, 415,
|
|
415, 430, 415, 430, 415, 415, 415, 415, 415, 450,
|
|
415, 415, 415, 415, 415, 415, 415, 415, 415, 415,
|
|
415, 415, 451, 452, 453, 415, 415, 415, 415, 453,
|
|
415, 415, 415, 415, 454, 454, 428, 415, 429, 415,
|
|
|
|
455, 430, 415, 415, 415, 415, 58, 63, 63, 63,
|
|
63, 63, 63, 63, 63, 415, 415, 415, 63, 63,
|
|
63, 63, 63, 63, 63, 63, 63, 63, 63, 431,
|
|
456, 415, 415, 415, 415, 415, 415, 433, 415, 415,
|
|
415, 435, 436, 437, 438, 438, 415, 415, 415, 439,
|
|
415, 415, 440, 415, 415, 415, 415, 415, 415, 442,
|
|
415, 415, 443, 415, 444, 457, 445, 446, 415, 415,
|
|
125, 415, 415, 415, 415, 415, 415, 447, 448, 415,
|
|
415, 415, 429, 415, 449, 415, 415, 415, 415, 415,
|
|
415, 415, 458, 415, 415, 415, 415, 415, 415, 415,
|
|
|
|
415, 415, 415, 430, 415, 415, 450, 415, 415, 415,
|
|
415, 415, 415, 415, 451, 415, 415, 415, 453, 415,
|
|
415, 453, 415, 454, 459, 455, 63, 63, 63, 63,
|
|
63, 63, 415, 63, 63, 63, 63, 63, 63, 63,
|
|
456, 415, 415, 415, 415, 415, 415, 415, 415, 458,
|
|
415, 415, 415, 430, 459, 63, 63, 63, 63, 63,
|
|
63, 63, 63, 63, 63, 63, 63, 63, 415, 415,
|
|
415, 415, 415, 415, 415, 430, 63, 415, 415, 63,
|
|
63, 63, 63, 63, 63, 415, 63, 63, 63, 415,
|
|
415, 415, 415, 430, 63, 415, 415, 415, 415, 63,
|
|
|
|
63, 63, 415, 63, 415, 430, 415, 415, 63, 415,
|
|
63, 430, 415, 415, 0, 415, 415, 415, 415, 415,
|
|
415, 415, 415, 415, 415, 415, 415, 415, 415, 415,
|
|
415, 415, 415, 415, 415, 415, 415, 415, 415, 415,
|
|
415, 415, 415, 415, 415, 415, 415, 415, 415, 415,
|
|
415, 415, 415, 415, 415, 415, 415, 415, 415
|
|
} ;
|
|
|
|
static yyconst flex_int16_t yy_nxt[1936] =
|
|
{ 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, 412, 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, 411, 93,
|
|
201, 203, 204, 217, 218, 94, 73, 73, 94, 205,
|
|
415, 205, 200, 415, 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, 409, 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, 406, 246, 105, 105, 247, 200, 251,
|
|
252, 201, 200, 255, 256, 201, 404, 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, 402, 257, 129, 257, 258, 129, 258,
|
|
|
|
173, 174, 173, 401, 173, 174, 173, 200, 261, 262,
|
|
201, 200, 130, 175, 201, 130, 132, 175, 400, 133,
|
|
269, 270, 134, 135, 136, 176, 137, 395, 138, 176,
|
|
186, 272, 273, 272, 187, 276, 277, 281, 282, 274,
|
|
139, 132, 188, 280, 133, 394, 201, 134, 135, 136,
|
|
198, 137, 198, 138, 189, 415, 275, 286, 415, 286,
|
|
200, 297, 298, 201, 389, 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, 306, 78, 306, 190,
|
|
186, 190, 300, 301, 191, 302, 303, 177, 177, 177,
|
|
200, 388, 188, 201, 308, 309, 311, 312, 82, 76,
|
|
77, 76, 372, 78, 189, 310, 200, 310, 387, 201,
|
|
313, 313, 313, 177, 177, 177, 314, 200, 314, 385,
|
|
201, 317, 318, 372, 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, 384, 196, 294,
|
|
294, 294, 50, 50, 50, 383, 200, 295, 296, 201,
|
|
320, 321, 322, 323, 322, 323, 200, 206, 198, 325,
|
|
198, 295, 415, 328, 415, 415, 205, 415, 205, 296,
|
|
329, 206, 50, 50, 192, 193, 192, 50, 194, 50,
|
|
50, 50, 50, 50, 50, 50, 246, 196, 333, 247,
|
|
333, 50, 50, 50, 220, 223, 221, 224, 235, 222,
|
|
235, 382, 248, 225, 248, 342, 257, 342, 257, 258,
|
|
|
|
415, 258, 344, 415, 344, 272, 273, 272, 334, 276,
|
|
277, 50, 207, 274, 207, 415, 335, 415, 415, 286,
|
|
415, 286, 349, 353, 306, 310, 306, 310, 381, 380,
|
|
275, 313, 313, 313, 377, 376, 349, 353, 368, 208,
|
|
208, 208, 209, 210, 208, 208, 208, 211, 212, 208,
|
|
208, 208, 213, 208, 208, 208, 214, 215, 208, 415,
|
|
290, 415, 289, 289, 290, 367, 345, 346, 371, 366,
|
|
291, 292, 314, 322, 314, 322, 365, 323, 206, 323,
|
|
345, 333, 371, 333, 291, 342, 372, 342, 346, 208,
|
|
208, 344, 292, 344, 208, 208, 372, 347, 348, 208,
|
|
|
|
372, 364, 363, 208, 208, 266, 266, 362, 266, 266,
|
|
372, 347, 266, 375, 266, 266, 266, 266, 266, 348,
|
|
294, 294, 294, 266, 266, 266, 351, 352, 295, 296,
|
|
369, 370, 266, 375, 375, 375, 361, 373, 374, 378,
|
|
351, 378, 295, 379, 369, 379, 360, 375, 352, 375,
|
|
296, 373, 370, 266, 263, 263, 390, 263, 263, 374,
|
|
386, 263, 386, 263, 263, 263, 263, 263, 390, 390,
|
|
391, 392, 263, 263, 263, 393, 378, 390, 378, 359,
|
|
358, 271, 390, 390, 391, 379, 396, 379, 396, 393,
|
|
405, 397, 392, 397, 398, 399, 398, 399, 386, 403,
|
|
|
|
386, 403, 263, 283, 357, 356, 285, 283, 320, 283,
|
|
283, 405, 283, 283, 405, 283, 283, 405, 283, 283,
|
|
283, 283, 283, 283, 407, 396, 407, 396, 405, 317,
|
|
397, 405, 397, 398, 399, 398, 399, 408, 410, 408,
|
|
410, 403, 407, 403, 407, 408, 413, 408, 413, 311,
|
|
308, 283, 289, 289, 290, 410, 414, 410, 414, 354,
|
|
291, 292, 293, 413, 414, 413, 414, 350, 302, 350,
|
|
281, 276, 269, 261, 291, 343, 255, 251, 249, 240,
|
|
236, 233, 292, 340, 293, 266, 266, 339, 266, 266,
|
|
338, 337, 266, 336, 266, 266, 266, 266, 266, 332,
|
|
|
|
331, 330, 327, 266, 266, 266, 217, 229, 228, 227,
|
|
226, 219, 266, 203, 305, 304, 299, 288, 287, 264,
|
|
259, 249, 415, 229, 228, 227, 226, 219, 216, 415,
|
|
415, 415, 415, 266, 326, 326, 415, 326, 326, 326,
|
|
326, 326, 326, 326, 326, 326, 326, 415, 415, 415,
|
|
415, 415, 326, 326, 326, 415, 415, 415, 415, 415,
|
|
415, 415, 415, 415, 415, 415, 415, 415, 415, 415,
|
|
415, 415, 415, 415, 415, 415, 415, 415, 415, 415,
|
|
415, 415, 326, 326, 326, 415, 326, 326, 326, 326,
|
|
326, 326, 326, 326, 326, 326, 415, 415, 415, 415,
|
|
|
|
415, 326, 326, 326, 415, 415, 415, 415, 415, 415,
|
|
415, 415, 415, 415, 415, 415, 415, 415, 415, 415,
|
|
415, 415, 415, 415, 415, 415, 415, 415, 415, 415,
|
|
415, 326, 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, 415, 415, 415,
|
|
415, 415, 197, 197, 197, 197, 415, 197, 197, 199,
|
|
415, 415, 415, 199, 415, 199, 199, 199, 199, 199,
|
|
199, 199, 202, 415, 202, 202, 415, 202, 230, 230,
|
|
415, 230, 230, 230, 230, 230, 230, 230, 415, 230,
|
|
230, 230, 230, 415, 230, 231, 231, 231, 231, 231,
|
|
231, 231, 231, 231, 231, 231, 231, 231, 231, 231,
|
|
|
|
231, 231, 238, 238, 415, 415, 238, 238, 238, 238,
|
|
238, 238, 238, 238, 238, 238, 238, 415, 238, 239,
|
|
239, 239, 239, 239, 239, 239, 239, 239, 239, 239,
|
|
239, 239, 239, 239, 239, 239, 242, 242, 415, 242,
|
|
242, 415, 242, 242, 242, 242, 242, 242, 242, 242,
|
|
242, 415, 242, 243, 243, 415, 243, 243, 243, 243,
|
|
243, 243, 243, 243, 243, 415, 243, 243, 415, 243,
|
|
244, 244, 415, 244, 244, 244, 244, 244, 415, 244,
|
|
244, 244, 244, 244, 244, 244, 244, 245, 245, 415,
|
|
245, 245, 245, 245, 245, 245, 245, 245, 245, 245,
|
|
|
|
245, 245, 245, 245, 250, 415, 415, 415, 415, 250,
|
|
415, 250, 250, 415, 250, 253, 253, 415, 415, 253,
|
|
415, 253, 253, 253, 253, 415, 253, 253, 253, 253,
|
|
415, 253, 254, 254, 254, 254, 254, 254, 254, 254,
|
|
254, 254, 254, 254, 254, 254, 254, 254, 254, 260,
|
|
415, 260, 260, 415, 260, 263, 263, 415, 415, 415,
|
|
415, 263, 263, 263, 263, 415, 415, 263, 415, 415,
|
|
415, 263, 265, 265, 415, 415, 415, 415, 265, 265,
|
|
265, 265, 265, 265, 265, 265, 265, 415, 265, 267,
|
|
267, 415, 415, 415, 415, 267, 267, 267, 267, 415,
|
|
|
|
267, 267, 267, 267, 415, 267, 268, 415, 268, 268,
|
|
415, 268, 278, 278, 415, 415, 278, 415, 415, 415,
|
|
278, 278, 415, 278, 278, 278, 278, 415, 278, 279,
|
|
279, 415, 415, 279, 415, 415, 415, 279, 279, 279,
|
|
279, 279, 279, 279, 415, 279, 284, 284, 284, 284,
|
|
284, 284, 284, 284, 284, 284, 284, 284, 284, 284,
|
|
284, 284, 284, 307, 415, 307, 307, 415, 307, 315,
|
|
415, 315, 315, 415, 315, 316, 316, 316, 316, 316,
|
|
316, 316, 316, 316, 316, 316, 316, 316, 316, 316,
|
|
316, 316, 319, 319, 415, 319, 415, 319, 319, 319,
|
|
|
|
319, 319, 415, 319, 319, 319, 319, 415, 319, 324,
|
|
324, 324, 415, 324, 324, 324, 324, 326, 326, 415,
|
|
326, 326, 326, 326, 326, 326, 326, 326, 326, 326,
|
|
326, 326, 326, 326, 341, 341, 415, 341, 341, 341,
|
|
341, 341, 415, 341, 415, 341, 341, 341, 341, 415,
|
|
341, 266, 266, 415, 415, 415, 415, 266, 266, 266,
|
|
266, 415, 415, 266, 415, 415, 415, 266, 355, 355,
|
|
415, 355, 355, 355, 355, 355, 355, 355, 355, 355,
|
|
355, 355, 355, 355, 355, 45, 415, 415, 415, 415,
|
|
415, 415, 415, 415, 415, 415, 415, 415, 415, 415,
|
|
|
|
415, 415, 415, 415, 415, 415, 415, 415, 415, 415,
|
|
415, 415, 415, 415, 415, 415, 415, 415, 415, 415,
|
|
415, 415, 415, 415, 415, 415, 415, 415, 415, 415,
|
|
415, 415, 415, 415, 415
|
|
} ;
|
|
|
|
static yyconst flex_int16_t yy_chk[1936] =
|
|
{ 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, 406, 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, 404, 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, 401, 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, 394, 94, 19, 20, 94, 98, 100,
|
|
100, 98, 105, 106, 106, 105, 389, 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, 387, 108, 25, 108, 110, 26, 110,
|
|
|
|
35, 35, 35, 385, 36, 36, 36, 113, 115, 115,
|
|
113, 121, 25, 35, 121, 26, 27, 36, 384, 27,
|
|
124, 124, 27, 27, 27, 35, 27, 377, 27, 36,
|
|
41, 127, 127, 127, 41, 130, 130, 139, 139, 127,
|
|
27, 28, 41, 138, 28, 376, 138, 28, 28, 28,
|
|
141, 28, 141, 28, 41, 146, 127, 150, 146, 150,
|
|
156, 159, 159, 156, 368, 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, 367, 42, 169, 171, 171, 176, 176, 37, 38,
|
|
38, 38, 347, 38, 42, 173, 175, 173, 366, 175,
|
|
177, 177, 177, 38, 38, 38, 179, 182, 179, 364,
|
|
182, 184, 184, 347, 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, 363, 43, 158,
|
|
158, 158, 43, 43, 43, 362, 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, 361, 248, 211, 248, 255, 257, 255, 257, 258,
|
|
|
|
265, 258, 269, 265, 269, 272, 272, 272, 224, 275,
|
|
275, 44, 58, 272, 58, 279, 224, 283, 279, 286,
|
|
283, 286, 292, 296, 306, 310, 306, 310, 360, 359,
|
|
272, 313, 313, 313, 356, 354, 292, 296, 340, 58,
|
|
58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
|
|
58, 58, 58, 58, 58, 58, 58, 58, 58, 63,
|
|
290, 63, 289, 289, 289, 339, 290, 290, 346, 338,
|
|
289, 289, 314, 322, 314, 322, 337, 323, 322, 323,
|
|
290, 333, 346, 333, 289, 342, 348, 342, 290, 63,
|
|
63, 344, 289, 344, 63, 63, 349, 291, 291, 63,
|
|
|
|
348, 336, 335, 63, 63, 122, 122, 334, 122, 122,
|
|
349, 291, 122, 351, 122, 122, 122, 122, 122, 291,
|
|
294, 294, 294, 122, 122, 122, 295, 295, 294, 294,
|
|
345, 345, 122, 352, 351, 353, 332, 350, 350, 357,
|
|
295, 357, 294, 358, 345, 358, 331, 352, 295, 353,
|
|
294, 350, 345, 122, 125, 125, 369, 125, 125, 350,
|
|
365, 125, 365, 125, 125, 125, 125, 125, 370, 371,
|
|
373, 373, 125, 125, 125, 374, 378, 369, 378, 330,
|
|
329, 125, 370, 371, 373, 379, 380, 379, 380, 374,
|
|
391, 381, 373, 381, 382, 383, 382, 383, 386, 388,
|
|
|
|
386, 388, 125, 148, 328, 327, 148, 148, 321, 148,
|
|
148, 391, 148, 148, 392, 148, 148, 393, 148, 148,
|
|
148, 148, 148, 148, 395, 396, 395, 396, 392, 318,
|
|
397, 393, 397, 398, 399, 398, 399, 400, 402, 400,
|
|
402, 403, 407, 403, 407, 408, 409, 408, 409, 312,
|
|
309, 148, 157, 157, 157, 410, 411, 410, 411, 304,
|
|
157, 157, 157, 413, 414, 413, 414, 458, 303, 458,
|
|
282, 277, 270, 262, 157, 259, 256, 252, 250, 241,
|
|
237, 234, 157, 229, 157, 267, 267, 228, 267, 267,
|
|
227, 226, 267, 225, 267, 267, 267, 267, 267, 223,
|
|
|
|
222, 221, 219, 267, 267, 267, 218, 215, 214, 213,
|
|
212, 209, 267, 204, 165, 164, 160, 154, 152, 119,
|
|
112, 99, 89, 70, 69, 68, 67, 64, 60, 45,
|
|
0, 0, 0, 267, 325, 325, 0, 325, 325, 325,
|
|
325, 325, 325, 325, 325, 325, 325, 0, 0, 0,
|
|
0, 0, 325, 325, 325, 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, 325, 355, 355, 0, 355, 355, 355, 355,
|
|
355, 355, 355, 355, 355, 355, 0, 0, 0, 0,
|
|
|
|
0, 355, 355, 355, 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, 355, 416, 416, 416, 416, 416, 416, 416, 416,
|
|
416, 416, 416, 416, 416, 416, 416, 416, 416, 417,
|
|
417, 417, 417, 417, 417, 417, 417, 417, 417, 417,
|
|
417, 417, 417, 417, 417, 417, 418, 418, 418, 418,
|
|
418, 418, 418, 418, 418, 418, 418, 418, 418, 418,
|
|
418, 418, 418, 419, 419, 419, 419, 419, 419, 419,
|
|
419, 419, 419, 419, 419, 419, 419, 419, 419, 419,
|
|
|
|
420, 420, 420, 420, 420, 420, 420, 420, 420, 420,
|
|
420, 420, 420, 420, 420, 420, 420, 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, 0, 0, 0,
|
|
0, 0, 428, 428, 428, 428, 0, 428, 428, 429,
|
|
0, 0, 0, 429, 0, 429, 429, 429, 429, 429,
|
|
429, 429, 430, 0, 430, 430, 0, 430, 431, 431,
|
|
0, 431, 431, 431, 431, 431, 431, 431, 0, 431,
|
|
431, 431, 431, 0, 431, 432, 432, 432, 432, 432,
|
|
432, 432, 432, 432, 432, 432, 432, 432, 432, 432,
|
|
|
|
432, 432, 433, 433, 0, 0, 433, 433, 433, 433,
|
|
433, 433, 433, 433, 433, 433, 433, 0, 433, 434,
|
|
434, 434, 434, 434, 434, 434, 434, 434, 434, 434,
|
|
434, 434, 434, 434, 434, 434, 435, 435, 0, 435,
|
|
435, 0, 435, 435, 435, 435, 435, 435, 435, 435,
|
|
435, 0, 435, 436, 436, 0, 436, 436, 436, 436,
|
|
436, 436, 436, 436, 436, 0, 436, 436, 0, 436,
|
|
437, 437, 0, 437, 437, 437, 437, 437, 0, 437,
|
|
437, 437, 437, 437, 437, 437, 437, 438, 438, 0,
|
|
438, 438, 438, 438, 438, 438, 438, 438, 438, 438,
|
|
|
|
438, 438, 438, 438, 439, 0, 0, 0, 0, 439,
|
|
0, 439, 439, 0, 439, 440, 440, 0, 0, 440,
|
|
0, 440, 440, 440, 440, 0, 440, 440, 440, 440,
|
|
0, 440, 441, 441, 441, 441, 441, 441, 441, 441,
|
|
441, 441, 441, 441, 441, 441, 441, 441, 441, 442,
|
|
0, 442, 442, 0, 442, 443, 443, 0, 0, 0,
|
|
0, 443, 443, 443, 443, 0, 0, 443, 0, 0,
|
|
0, 443, 444, 444, 0, 0, 0, 0, 444, 444,
|
|
444, 444, 444, 444, 444, 444, 444, 0, 444, 445,
|
|
445, 0, 0, 0, 0, 445, 445, 445, 445, 0,
|
|
|
|
445, 445, 445, 445, 0, 445, 446, 0, 446, 446,
|
|
0, 446, 447, 447, 0, 0, 447, 0, 0, 0,
|
|
447, 447, 0, 447, 447, 447, 447, 0, 447, 448,
|
|
448, 0, 0, 448, 0, 0, 0, 448, 448, 448,
|
|
448, 448, 448, 448, 0, 448, 449, 449, 449, 449,
|
|
449, 449, 449, 449, 449, 449, 449, 449, 449, 449,
|
|
449, 449, 449, 450, 0, 450, 450, 0, 450, 451,
|
|
0, 451, 451, 0, 451, 452, 452, 452, 452, 452,
|
|
452, 452, 452, 452, 452, 452, 452, 452, 452, 452,
|
|
452, 452, 453, 453, 0, 453, 0, 453, 453, 453,
|
|
|
|
453, 453, 0, 453, 453, 453, 453, 0, 453, 454,
|
|
454, 454, 0, 454, 454, 454, 454, 455, 455, 0,
|
|
455, 455, 455, 455, 455, 455, 455, 455, 455, 455,
|
|
455, 455, 455, 455, 456, 456, 0, 456, 456, 456,
|
|
456, 456, 0, 456, 0, 456, 456, 456, 456, 0,
|
|
456, 457, 457, 0, 0, 0, 0, 457, 457, 457,
|
|
457, 0, 0, 457, 0, 0, 0, 457, 459, 459,
|
|
0, 459, 459, 459, 459, 459, 459, 459, 459, 459,
|
|
459, 459, 459, 459, 459, 415, 415, 415, 415, 415,
|
|
415, 415, 415, 415, 415, 415, 415, 415, 415, 415,
|
|
|
|
415, 415, 415, 415, 415, 415, 415, 415, 415, 415,
|
|
415, 415, 415, 415, 415, 415, 415, 415, 415, 415,
|
|
415, 415, 415, 415, 415, 415, 415, 415, 415, 415,
|
|
415, 415, 415, 415, 415
|
|
} ;
|
|
|
|
static yy_state_type yy_last_accepting_state;
|
|
static char *yy_last_accepting_cpos;
|
|
|
|
extern int ppy__flex_debug;
|
|
int ppy__flex_debug = 0;
|
|
|
|
/* 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 *ppy_text;
|
|
#line 1 "ppl.l"
|
|
/* -*-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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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} 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_NO_INPUT 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#line 164 "ppl.l"
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <ctype.h>
|
|
#include <assert.h>
|
|
#include <errno.h>
|
|
#include <limits.h>
|
|
|
|
#ifndef LLONG_MAX
|
|
# define LLONG_MAX ((long long)0x7fffffff << 32 | 0xffffffff)
|
|
# define LLONG_MIN (-LLONG_MAX - 1)
|
|
#endif
|
|
#ifndef ULLONG_MAX
|
|
# define ULLONG_MAX ((long long)0xffffffff << 32 | 0xffffffff)
|
|
#endif
|
|
|
|
#ifndef HAVE_UNISTD_H
|
|
#define YY_NO_UNISTD_H
|
|
#endif
|
|
|
|
#include "wine/wpp.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+=ppy_leng;
|
|
|
|
/*
|
|
* 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 */
|
|
void *filehandle; /* Handle to be used with wpp_callbacks->read */
|
|
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 */
|
|
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;
|
|
} 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);
|
|
/* 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;
|
|
|
|
/*
|
|
* Global variables
|
|
*/
|
|
include_state_t pp_incl_state =
|
|
{
|
|
-1, /* state */
|
|
NULL, /* ppp */
|
|
0, /* ifdepth */
|
|
0 /* seen_junk */
|
|
};
|
|
|
|
includelogicentry_t *pp_includelogiclist = NULL;
|
|
|
|
#define YY_INPUT(buf,result,max_size) \
|
|
{ \
|
|
result = wpp_callbacks->read(pp_status.file, buf, max_size); \
|
|
}
|
|
|
|
#define BUFFERINITIALCAPACITY 256
|
|
|
|
void pp_writestring(const char *format, ...)
|
|
{
|
|
va_list valist;
|
|
int len;
|
|
static char *buffer;
|
|
static int buffercapacity;
|
|
char *new_buffer;
|
|
|
|
if(buffercapacity == 0)
|
|
{
|
|
buffer = pp_xmalloc(BUFFERINITIALCAPACITY);
|
|
if(buffer == NULL)
|
|
return;
|
|
buffercapacity = BUFFERINITIALCAPACITY;
|
|
}
|
|
|
|
va_start(valist, format);
|
|
len = vsnprintf(buffer, buffercapacity,
|
|
format, valist);
|
|
va_end(valist);
|
|
/* If the string is longer than buffersize, vsnprintf returns
|
|
* the string length with glibc >= 2.1, -1 with glibc < 2.1 */
|
|
while(len > buffercapacity || len < 0)
|
|
{
|
|
do
|
|
{
|
|
buffercapacity *= 2;
|
|
} while(len > buffercapacity);
|
|
|
|
new_buffer = pp_xrealloc(buffer, buffercapacity);
|
|
if(new_buffer == NULL)
|
|
{
|
|
va_end(valist);
|
|
return;
|
|
}
|
|
buffer = new_buffer;
|
|
va_start(valist, format);
|
|
len = vsnprintf(buffer, buffercapacity,
|
|
format, valist);
|
|
va_end(valist);
|
|
}
|
|
|
|
wpp_callbacks->write(buffer, len);
|
|
}
|
|
|
|
/*
|
|
**************************************************************************
|
|
* The scanner starts here
|
|
**************************************************************************
|
|
*/
|
|
#line 1402 "ppl.yy.c"
|
|
|
|
#define INITIAL 0
|
|
#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
|
|
|
|
#ifndef YY_NO_UNISTD_H
|
|
/* Special case for "unistd.h", since it is non-ANSI. We include it way
|
|
* down here because we want the user's section 1 to have been scanned first.
|
|
* The user has a chance to override it with an option.
|
|
*/
|
|
#include <unistd.h>
|
|
#endif
|
|
|
|
#ifndef YY_EXTRA_TYPE
|
|
#define YY_EXTRA_TYPE void *
|
|
#endif
|
|
|
|
static int yy_init_globals (void );
|
|
|
|
/* Accessor methods to globals.
|
|
These are made visible to non-reentrant scanners for convenience. */
|
|
|
|
int ppy_lex_destroy (void );
|
|
|
|
int ppy_get_debug (void );
|
|
|
|
void ppy_set_debug (int debug_flag );
|
|
|
|
YY_EXTRA_TYPE ppy_get_extra (void );
|
|
|
|
void ppy_set_extra (YY_EXTRA_TYPE user_defined );
|
|
|
|
FILE *ppy_get_in (void );
|
|
|
|
void ppy_set_in (FILE * in_str );
|
|
|
|
FILE *ppy_get_out (void );
|
|
|
|
void ppy_set_out (FILE * out_str );
|
|
|
|
int ppy_get_leng (void );
|
|
|
|
char *ppy_get_text (void );
|
|
|
|
int ppy_get_lineno (void );
|
|
|
|
void ppy_set_lineno (int line_number );
|
|
|
|
/* Macros after this point can all be overridden by user definitions in
|
|
* section 1.
|
|
*/
|
|
|
|
#ifndef YY_SKIP_YYWRAP
|
|
#ifdef __cplusplus
|
|
extern "C" int ppy_wrap (void );
|
|
#else
|
|
extern int ppy_wrap (void );
|
|
#endif
|
|
#endif
|
|
|
|
#ifndef yytext_ptr
|
|
static void yy_flex_strncpy (char *,yyconst char *,int );
|
|
#endif
|
|
|
|
#ifdef YY_NEED_STRLEN
|
|
static int yy_flex_strlen (yyconst char * );
|
|
#endif
|
|
|
|
#ifndef YY_NO_INPUT
|
|
|
|
#ifdef __cplusplus
|
|
static int yyinput (void );
|
|
#else
|
|
static int input (void );
|
|
#endif
|
|
|
|
#endif
|
|
|
|
static int yy_start_stack_ptr = 0;
|
|
static int yy_start_stack_depth = 0;
|
|
static int *yy_start_stack = NULL;
|
|
|
|
static void yy_push_state (int new_state );
|
|
|
|
static void yy_pop_state (void );
|
|
|
|
static int yy_top_state (void );
|
|
|
|
/* Amount of stuff to slurp up with each read. */
|
|
#ifndef YY_READ_BUF_SIZE
|
|
#ifdef __ia64__
|
|
/* On IA-64, the buffer size is 16k, not 8k */
|
|
#define YY_READ_BUF_SIZE 16384
|
|
#else
|
|
#define YY_READ_BUF_SIZE 8192
|
|
#endif /* __ia64__ */
|
|
#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 do { if (fwrite( ppy_text, ppy_leng, 1, ppy_out )) {} } while (0)
|
|
#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_LVALUE->yy_is_interactive ) \
|
|
{ \
|
|
int c = '*'; \
|
|
size_t n; \
|
|
for ( n = 0; n < max_size && \
|
|
(c = getc( ppy_in )) != EOF && c != '\n'; ++n ) \
|
|
buf[n] = (char) c; \
|
|
if ( c == '\n' ) \
|
|
buf[n++] = (char) c; \
|
|
if ( c == EOF && ferror( ppy_in ) ) \
|
|
YY_FATAL_ERROR( "input in flex scanner failed" ); \
|
|
result = n; \
|
|
} \
|
|
else \
|
|
{ \
|
|
errno=0; \
|
|
while ( (result = fread(buf, 1, max_size, ppy_in))==0 && ferror(ppy_in)) \
|
|
{ \
|
|
if( errno != EINTR) \
|
|
{ \
|
|
YY_FATAL_ERROR( "input in flex scanner failed" ); \
|
|
break; \
|
|
} \
|
|
errno=0; \
|
|
clearerr(ppy_in); \
|
|
} \
|
|
}\
|
|
\
|
|
|
|
#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
|
|
|
|
/* end tables serialization structures and prototypes */
|
|
|
|
/* Default declaration of generated scanner - a define so the user can
|
|
* easily add parameters.
|
|
*/
|
|
#ifndef YY_DECL
|
|
#define YY_DECL_IS_OURS 1
|
|
|
|
extern int ppy_lex (void);
|
|
|
|
#define YY_DECL int ppy_lex (void)
|
|
#endif /* !YY_DECL */
|
|
|
|
/* Code executed at the beginning of each rule, after ppy_text and ppy_leng
|
|
* 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 ( ppy_leng > 0 ) \
|
|
YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
|
|
(ppy_text[ppy_leng - 1] == '\n'); \
|
|
YY_USER_ACTION
|
|
|
|
/** The main scanner function which does all the work.
|
|
*/
|
|
YY_DECL
|
|
{
|
|
register yy_state_type yy_current_state;
|
|
register char *yy_cp, *yy_bp;
|
|
register int yy_act;
|
|
|
|
#line 366 "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 1635 "ppl.yy.c"
|
|
|
|
if ( !(yy_init) )
|
|
{
|
|
(yy_init) = 1;
|
|
|
|
#ifdef YY_USER_INIT
|
|
YY_USER_INIT;
|
|
#endif
|
|
|
|
if ( ! (yy_start) )
|
|
(yy_start) = 1; /* first start state */
|
|
|
|
if ( ! ppy_in )
|
|
ppy_in = stdin;
|
|
|
|
if ( ! ppy_out )
|
|
ppy_out = stdout;
|
|
|
|
if ( ! YY_CURRENT_BUFFER ) {
|
|
ppy_ensure_buffer_stack ();
|
|
YY_CURRENT_BUFFER_LVALUE =
|
|
ppy__create_buffer(ppy_in,YY_BUF_SIZE );
|
|
}
|
|
|
|
ppy__load_buffer_state( );
|
|
}
|
|
|
|
while ( 1 ) /* loops until end-of-file is reached */
|
|
{
|
|
yy_cp = (yy_c_buf_p);
|
|
|
|
/* Support of ppy_text. */
|
|
*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 >= 416 )
|
|
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_current_state != 415 );
|
|
yy_cp = (yy_last_accepting_cpos);
|
|
yy_current_state = (yy_last_accepting_state);
|
|
|
|
yy_find_action:
|
|
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 379 "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 384 "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 385 "ppl.l"
|
|
yy_pp_state(yy_current_state() != pp_ignore ? pp_def : pp_eol);
|
|
YY_BREAK
|
|
case 4:
|
|
YY_RULE_SETUP
|
|
#line 386 "ppl.l"
|
|
yy_pp_state(pp_eol); if(yy_top_state() != pp_ignore) return tERROR;
|
|
YY_BREAK
|
|
case 5:
|
|
YY_RULE_SETUP
|
|
#line 387 "ppl.l"
|
|
yy_pp_state(pp_eol); if(yy_top_state() != pp_ignore) return tWARNING;
|
|
YY_BREAK
|
|
case 6:
|
|
YY_RULE_SETUP
|
|
#line 388 "ppl.l"
|
|
yy_pp_state(pp_eol); if(yy_top_state() != pp_ignore) return tPRAGMA;
|
|
YY_BREAK
|
|
case 7:
|
|
YY_RULE_SETUP
|
|
#line 389 "ppl.l"
|
|
yy_pp_state(pp_eol); if(yy_top_state() != pp_ignore) return tPPIDENT;
|
|
YY_BREAK
|
|
case 8:
|
|
YY_RULE_SETUP
|
|
#line 390 "ppl.l"
|
|
if(yy_top_state() != pp_ignore) {yy_pp_state(pp_ifd); return tUNDEF;} else {yy_pp_state(pp_eol);}
|
|
YY_BREAK
|
|
case 9:
|
|
YY_RULE_SETUP
|
|
#line 391 "ppl.l"
|
|
yy_pp_state(pp_ifd); return tIFDEF;
|
|
YY_BREAK
|
|
case 10:
|
|
YY_RULE_SETUP
|
|
#line 392 "ppl.l"
|
|
pp_incl_state.seen_junk--; yy_pp_state(pp_ifd); return tIFNDEF;
|
|
YY_BREAK
|
|
case 11:
|
|
YY_RULE_SETUP
|
|
#line 393 "ppl.l"
|
|
yy_pp_state(pp_if); return tIF;
|
|
YY_BREAK
|
|
case 12:
|
|
YY_RULE_SETUP
|
|
#line 394 "ppl.l"
|
|
yy_pp_state(pp_if); return tELIF;
|
|
YY_BREAK
|
|
case 13:
|
|
YY_RULE_SETUP
|
|
#line 395 "ppl.l"
|
|
yy_pp_state(pp_endif); return tELSE;
|
|
YY_BREAK
|
|
case 14:
|
|
YY_RULE_SETUP
|
|
#line 396 "ppl.l"
|
|
yy_pp_state(pp_endif); return tENDIF;
|
|
YY_BREAK
|
|
case 15:
|
|
YY_RULE_SETUP
|
|
#line 397 "ppl.l"
|
|
if(yy_top_state() != pp_ignore) {yy_pp_state(pp_line); return tLINE;} else {yy_pp_state(pp_eol);}
|
|
YY_BREAK
|
|
case 16:
|
|
YY_RULE_SETUP
|
|
#line 398 "ppl.l"
|
|
if(yy_top_state() != pp_ignore) {yy_pp_state(pp_line); return tGCCLINE;} else {yy_pp_state(pp_eol);}
|
|
YY_BREAK
|
|
case 17:
|
|
YY_RULE_SETUP
|
|
#line 399 "ppl.l"
|
|
ppy_error("Invalid preprocessor token '%s'", ppy_text);
|
|
YY_BREAK
|
|
case 18:
|
|
/* rule 18 can match eol */
|
|
YY_RULE_SETUP
|
|
#line 400 "ppl.l"
|
|
newline(1); yy_pop_state(); return tNL; /* This could be the null-token */
|
|
YY_BREAK
|
|
case 19:
|
|
/* rule 19 can match eol */
|
|
YY_RULE_SETUP
|
|
#line 401 "ppl.l"
|
|
newline(0);
|
|
YY_BREAK
|
|
case 20:
|
|
YY_RULE_SETUP
|
|
#line 402 "ppl.l"
|
|
ppy_error("Preprocessor junk '%s'", ppy_text);
|
|
YY_BREAK
|
|
case 21:
|
|
YY_RULE_SETUP
|
|
#line 403 "ppl.l"
|
|
return *ppy_text;
|
|
YY_BREAK
|
|
/*
|
|
* Handle #include and #line
|
|
*/
|
|
case 22:
|
|
YY_RULE_SETUP
|
|
#line 408 "ppl.l"
|
|
return make_number(10, &ppy_lval, ppy_text, ppy_leng);
|
|
YY_BREAK
|
|
case 23:
|
|
YY_RULE_SETUP
|
|
#line 409 "ppl.l"
|
|
new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_iqs);
|
|
YY_BREAK
|
|
case 24:
|
|
YY_RULE_SETUP
|
|
#line 410 "ppl.l"
|
|
new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_dqs);
|
|
YY_BREAK
|
|
case 25:
|
|
YY_RULE_SETUP
|
|
#line 411 "ppl.l"
|
|
;
|
|
YY_BREAK
|
|
case 26:
|
|
/* rule 26 can match eol */
|
|
YY_RULE_SETUP
|
|
#line 412 "ppl.l"
|
|
newline(1); yy_pop_state(); return tNL;
|
|
YY_BREAK
|
|
case 27:
|
|
/* rule 27 can match eol */
|
|
YY_RULE_SETUP
|
|
#line 413 "ppl.l"
|
|
newline(0);
|
|
YY_BREAK
|
|
case 28:
|
|
YY_RULE_SETUP
|
|
#line 414 "ppl.l"
|
|
ppy_error(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 29:
|
|
YY_RULE_SETUP
|
|
#line 419 "ppl.l"
|
|
;
|
|
YY_BREAK
|
|
case 30:
|
|
/* rule 30 can match eol */
|
|
YY_RULE_SETUP
|
|
#line 420 "ppl.l"
|
|
newline(1);
|
|
YY_BREAK
|
|
case 31:
|
|
/* rule 31 can match eol */
|
|
YY_RULE_SETUP
|
|
#line 421 "ppl.l"
|
|
newline(0);
|
|
YY_BREAK
|
|
case 32:
|
|
YY_RULE_SETUP
|
|
#line 422 "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 33:
|
|
YY_RULE_SETUP
|
|
#line 431 "ppl.l"
|
|
return make_number(8, &ppy_lval, ppy_text, ppy_leng);
|
|
YY_BREAK
|
|
case 34:
|
|
YY_RULE_SETUP
|
|
#line 432 "ppl.l"
|
|
ppy_error("Invalid octal digit");
|
|
YY_BREAK
|
|
case 35:
|
|
YY_RULE_SETUP
|
|
#line 433 "ppl.l"
|
|
return make_number(10, &ppy_lval, ppy_text, ppy_leng);
|
|
YY_BREAK
|
|
case 36:
|
|
YY_RULE_SETUP
|
|
#line 434 "ppl.l"
|
|
return make_number(16, &ppy_lval, ppy_text, ppy_leng);
|
|
YY_BREAK
|
|
case 37:
|
|
YY_RULE_SETUP
|
|
#line 435 "ppl.l"
|
|
ppy_error("Invalid hex number");
|
|
YY_BREAK
|
|
case 38:
|
|
YY_RULE_SETUP
|
|
#line 436 "ppl.l"
|
|
yy_push_state(pp_defined); return tDEFINED;
|
|
YY_BREAK
|
|
case 39:
|
|
YY_RULE_SETUP
|
|
#line 437 "ppl.l"
|
|
return tLSHIFT;
|
|
YY_BREAK
|
|
case 40:
|
|
YY_RULE_SETUP
|
|
#line 438 "ppl.l"
|
|
return tRSHIFT;
|
|
YY_BREAK
|
|
case 41:
|
|
YY_RULE_SETUP
|
|
#line 439 "ppl.l"
|
|
return tLOGAND;
|
|
YY_BREAK
|
|
case 42:
|
|
YY_RULE_SETUP
|
|
#line 440 "ppl.l"
|
|
return tLOGOR;
|
|
YY_BREAK
|
|
case 43:
|
|
YY_RULE_SETUP
|
|
#line 441 "ppl.l"
|
|
return tEQ;
|
|
YY_BREAK
|
|
case 44:
|
|
YY_RULE_SETUP
|
|
#line 442 "ppl.l"
|
|
return tNE;
|
|
YY_BREAK
|
|
case 45:
|
|
YY_RULE_SETUP
|
|
#line 443 "ppl.l"
|
|
return tLTE;
|
|
YY_BREAK
|
|
case 46:
|
|
YY_RULE_SETUP
|
|
#line 444 "ppl.l"
|
|
return tGTE;
|
|
YY_BREAK
|
|
case 47:
|
|
/* rule 47 can match eol */
|
|
YY_RULE_SETUP
|
|
#line 445 "ppl.l"
|
|
newline(1); yy_pop_state(); return tNL;
|
|
YY_BREAK
|
|
case 48:
|
|
/* rule 48 can match eol */
|
|
YY_RULE_SETUP
|
|
#line 446 "ppl.l"
|
|
newline(0);
|
|
YY_BREAK
|
|
case 49:
|
|
YY_RULE_SETUP
|
|
#line 447 "ppl.l"
|
|
ppy_error("Junk in conditional expression");
|
|
YY_BREAK
|
|
case 50:
|
|
YY_RULE_SETUP
|
|
#line 448 "ppl.l"
|
|
;
|
|
YY_BREAK
|
|
case 51:
|
|
YY_RULE_SETUP
|
|
#line 449 "ppl.l"
|
|
new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_sqs);
|
|
YY_BREAK
|
|
case 52:
|
|
YY_RULE_SETUP
|
|
#line 450 "ppl.l"
|
|
ppy_error("String constants not allowed in conditionals");
|
|
YY_BREAK
|
|
case 53:
|
|
YY_RULE_SETUP
|
|
#line 451 "ppl.l"
|
|
return *ppy_text;
|
|
YY_BREAK
|
|
/*
|
|
* Handle #ifdef, #ifndef and #undef
|
|
* to get only an untranslated/unexpanded identifier
|
|
*/
|
|
case 54:
|
|
YY_RULE_SETUP
|
|
#line 457 "ppl.l"
|
|
ppy_lval.cptr = pp_xstrdup(ppy_text); return tIDENT;
|
|
YY_BREAK
|
|
case 55:
|
|
YY_RULE_SETUP
|
|
#line 458 "ppl.l"
|
|
;
|
|
YY_BREAK
|
|
case 56:
|
|
/* rule 56 can match eol */
|
|
YY_RULE_SETUP
|
|
#line 459 "ppl.l"
|
|
newline(1); yy_pop_state(); return tNL;
|
|
YY_BREAK
|
|
case 57:
|
|
/* rule 57 can match eol */
|
|
YY_RULE_SETUP
|
|
#line 460 "ppl.l"
|
|
newline(0);
|
|
YY_BREAK
|
|
case 58:
|
|
YY_RULE_SETUP
|
|
#line 461 "ppl.l"
|
|
ppy_error("Identifier expected");
|
|
YY_BREAK
|
|
/*
|
|
* Handle #else and #endif.
|
|
*/
|
|
case 59:
|
|
YY_RULE_SETUP
|
|
#line 466 "ppl.l"
|
|
;
|
|
YY_BREAK
|
|
case 60:
|
|
/* rule 60 can match eol */
|
|
YY_RULE_SETUP
|
|
#line 467 "ppl.l"
|
|
newline(1); yy_pop_state(); return tNL;
|
|
YY_BREAK
|
|
case 61:
|
|
/* rule 61 can match eol */
|
|
YY_RULE_SETUP
|
|
#line 468 "ppl.l"
|
|
newline(0);
|
|
YY_BREAK
|
|
case 62:
|
|
YY_RULE_SETUP
|
|
#line 469 "ppl.l"
|
|
ppy_error("Garbage after #else or #endif.");
|
|
YY_BREAK
|
|
/*
|
|
* Handle the special 'defined' keyword.
|
|
* This is necessary to get the identifier prior to any
|
|
* substitutions.
|
|
*/
|
|
case 63:
|
|
YY_RULE_SETUP
|
|
#line 476 "ppl.l"
|
|
yy_pop_state(); ppy_lval.cptr = pp_xstrdup(ppy_text); return tIDENT;
|
|
YY_BREAK
|
|
case 64:
|
|
YY_RULE_SETUP
|
|
#line 477 "ppl.l"
|
|
;
|
|
YY_BREAK
|
|
case 65:
|
|
YY_RULE_SETUP
|
|
#line 478 "ppl.l"
|
|
return *ppy_text;
|
|
YY_BREAK
|
|
case 66:
|
|
/* rule 66 can match eol */
|
|
YY_RULE_SETUP
|
|
#line 479 "ppl.l"
|
|
newline(0);
|
|
YY_BREAK
|
|
case 67:
|
|
/* rule 67 can match eol */
|
|
YY_RULE_SETUP
|
|
#line 480 "ppl.l"
|
|
ppy_error("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 68:
|
|
YY_RULE_SETUP
|
|
#line 488 "ppl.l"
|
|
if(yy_top_state() != pp_ignore) { ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; }
|
|
YY_BREAK
|
|
case 69:
|
|
YY_RULE_SETUP
|
|
#line 489 "ppl.l"
|
|
if(yy_top_state() != pp_ignore) { ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; }
|
|
YY_BREAK
|
|
case 70:
|
|
/* rule 70 can match eol */
|
|
YY_RULE_SETUP
|
|
#line 490 "ppl.l"
|
|
if(yy_top_state() != pp_ignore) { ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL; }
|
|
YY_BREAK
|
|
case 71:
|
|
/* rule 71 can match eol */
|
|
YY_RULE_SETUP
|
|
#line 491 "ppl.l"
|
|
newline(1); yy_pop_state(); if(yy_current_state() != pp_ignore) { return tNL; }
|
|
YY_BREAK
|
|
case 72:
|
|
/* rule 72 can match eol */
|
|
YY_RULE_SETUP
|
|
#line 492 "ppl.l"
|
|
newline(0);
|
|
YY_BREAK
|
|
/*
|
|
* Handle left side of #define
|
|
*/
|
|
case 73:
|
|
YY_RULE_SETUP
|
|
#line 497 "ppl.l"
|
|
ppy_lval.cptr = pp_xstrdup(ppy_text); if(ppy_lval.cptr) ppy_lval.cptr[ppy_leng-1] = '\0'; yy_pp_state(pp_macro); return tMACRO;
|
|
YY_BREAK
|
|
case 74:
|
|
YY_RULE_SETUP
|
|
#line 498 "ppl.l"
|
|
ppy_lval.cptr = pp_xstrdup(ppy_text); yy_pp_state(pp_define); return tDEFINE;
|
|
YY_BREAK
|
|
case 75:
|
|
YY_RULE_SETUP
|
|
#line 499 "ppl.l"
|
|
;
|
|
YY_BREAK
|
|
case 76:
|
|
/* rule 76 can match eol */
|
|
YY_RULE_SETUP
|
|
#line 500 "ppl.l"
|
|
newline(0);
|
|
YY_BREAK
|
|
case 77:
|
|
/* rule 77 can match eol */
|
|
YY_RULE_SETUP
|
|
#line 501 "ppl.l"
|
|
perror("Identifier expected");
|
|
YY_BREAK
|
|
/*
|
|
* Scan the substitution of a define
|
|
*/
|
|
case 78:
|
|
YY_RULE_SETUP
|
|
#line 506 "ppl.l"
|
|
ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL;
|
|
YY_BREAK
|
|
case 79:
|
|
/* rule 79 can match eol */
|
|
YY_RULE_SETUP
|
|
#line 507 "ppl.l"
|
|
ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL;
|
|
YY_BREAK
|
|
case 80:
|
|
/* rule 80 can match eol */
|
|
YY_RULE_SETUP
|
|
#line 508 "ppl.l"
|
|
newline(0); ppy_lval.cptr = pp_xstrdup(" "); return tLITERAL;
|
|
YY_BREAK
|
|
case 81:
|
|
/* rule 81 can match eol */
|
|
YY_RULE_SETUP
|
|
#line 509 "ppl.l"
|
|
newline(0);
|
|
YY_BREAK
|
|
case 82:
|
|
/* rule 82 can match eol */
|
|
YY_RULE_SETUP
|
|
#line 510 "ppl.l"
|
|
newline(1); yy_pop_state(); return tNL;
|
|
YY_BREAK
|
|
case 83:
|
|
YY_RULE_SETUP
|
|
#line 511 "ppl.l"
|
|
new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_sqs);
|
|
YY_BREAK
|
|
case 84:
|
|
YY_RULE_SETUP
|
|
#line 512 "ppl.l"
|
|
new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_dqs);
|
|
YY_BREAK
|
|
/*
|
|
* Scan the definition macro arguments
|
|
*/
|
|
case 85:
|
|
YY_RULE_SETUP
|
|
#line 517 "ppl.l"
|
|
yy_pp_state(pp_mbody); return tMACROEND;
|
|
YY_BREAK
|
|
case 86:
|
|
YY_RULE_SETUP
|
|
#line 518 "ppl.l"
|
|
;
|
|
YY_BREAK
|
|
case 87:
|
|
YY_RULE_SETUP
|
|
#line 519 "ppl.l"
|
|
ppy_lval.cptr = pp_xstrdup(ppy_text); return tIDENT;
|
|
YY_BREAK
|
|
case 88:
|
|
YY_RULE_SETUP
|
|
#line 520 "ppl.l"
|
|
return ',';
|
|
YY_BREAK
|
|
case 89:
|
|
YY_RULE_SETUP
|
|
#line 521 "ppl.l"
|
|
return tELIPSIS;
|
|
YY_BREAK
|
|
case 90:
|
|
/* rule 90 can match eol */
|
|
YY_RULE_SETUP
|
|
#line 522 "ppl.l"
|
|
ppy_error("Argument identifier expected");
|
|
YY_BREAK
|
|
case 91:
|
|
/* rule 91 can match eol */
|
|
YY_RULE_SETUP
|
|
#line 523 "ppl.l"
|
|
newline(0);
|
|
YY_BREAK
|
|
/*
|
|
* Scan the substitution of a macro
|
|
*/
|
|
case 92:
|
|
YY_RULE_SETUP
|
|
#line 528 "ppl.l"
|
|
ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL;
|
|
YY_BREAK
|
|
case 93:
|
|
YY_RULE_SETUP
|
|
#line 529 "ppl.l"
|
|
ppy_lval.cptr = pp_xstrdup(ppy_text); return tIDENT;
|
|
YY_BREAK
|
|
case 94:
|
|
YY_RULE_SETUP
|
|
#line 530 "ppl.l"
|
|
return tCONCAT;
|
|
YY_BREAK
|
|
case 95:
|
|
YY_RULE_SETUP
|
|
#line 531 "ppl.l"
|
|
return tSTRINGIZE;
|
|
YY_BREAK
|
|
case 96:
|
|
YY_RULE_SETUP
|
|
#line 532 "ppl.l"
|
|
ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL;
|
|
YY_BREAK
|
|
case 97:
|
|
YY_RULE_SETUP
|
|
#line 533 "ppl.l"
|
|
ppy_lval.cptr = pp_xstrdup(ppy_text); return tLITERAL;
|
|
YY_BREAK
|
|
case 98:
|
|
/* rule 98 can match eol */
|
|
YY_RULE_SETUP
|
|
#line 534 "ppl.l"
|
|
newline(0); ppy_lval.cptr = pp_xstrdup(" "); return tLITERAL;
|
|
YY_BREAK
|
|
case 99:
|
|
/* rule 99 can match eol */
|
|
YY_RULE_SETUP
|
|
#line 535 "ppl.l"
|
|
newline(0);
|
|
YY_BREAK
|
|
case 100:
|
|
/* rule 100 can match eol */
|
|
YY_RULE_SETUP
|
|
#line 536 "ppl.l"
|
|
newline(1); yy_pop_state(); return tNL;
|
|
YY_BREAK
|
|
case 101:
|
|
YY_RULE_SETUP
|
|
#line 537 "ppl.l"
|
|
new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_sqs);
|
|
YY_BREAK
|
|
case 102:
|
|
YY_RULE_SETUP
|
|
#line 538 "ppl.l"
|
|
new_string(); add_string(ppy_text, ppy_leng); 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 103:
|
|
*yy_cp = (yy_hold_char); /* undo effects of setting up ppy_text */
|
|
(yy_c_buf_p) = yy_cp -= 1;
|
|
YY_DO_BEFORE_ACTION; /* set up ppy_text again */
|
|
YY_RULE_SETUP
|
|
#line 549 "ppl.l"
|
|
yy_pp_state(pp_macscan);
|
|
YY_BREAK
|
|
case 104:
|
|
/* rule 104 can match eol */
|
|
YY_RULE_SETUP
|
|
#line 550 "ppl.l"
|
|
{
|
|
if(yy_top_state() != pp_macscan)
|
|
newline(0);
|
|
}
|
|
YY_BREAK
|
|
case 105:
|
|
/* rule 105 can match eol */
|
|
YY_RULE_SETUP
|
|
#line 554 "ppl.l"
|
|
newline(0);
|
|
YY_BREAK
|
|
case 106:
|
|
YY_RULE_SETUP
|
|
#line 555 "ppl.l"
|
|
{
|
|
macexpstackentry_t *mac = pop_macro();
|
|
yy_pop_state();
|
|
put_buffer(mac->ppp->ident, strlen(mac->ppp->ident));
|
|
put_buffer(ppy_text, ppy_leng);
|
|
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 107:
|
|
YY_RULE_SETUP
|
|
#line 567 "ppl.l"
|
|
{
|
|
if(++MACROPARENTHESES() > 1)
|
|
add_text_to_macro(ppy_text, ppy_leng);
|
|
}
|
|
YY_BREAK
|
|
case 108:
|
|
YY_RULE_SETUP
|
|
#line 571 "ppl.l"
|
|
{
|
|
if(--MACROPARENTHESES() == 0)
|
|
{
|
|
yy_pop_state();
|
|
macro_add_arg(1);
|
|
}
|
|
else
|
|
add_text_to_macro(ppy_text, ppy_leng);
|
|
}
|
|
YY_BREAK
|
|
case 109:
|
|
YY_RULE_SETUP
|
|
#line 580 "ppl.l"
|
|
{
|
|
if(MACROPARENTHESES() > 1)
|
|
add_text_to_macro(ppy_text, ppy_leng);
|
|
else
|
|
macro_add_arg(0);
|
|
}
|
|
YY_BREAK
|
|
case 110:
|
|
YY_RULE_SETUP
|
|
#line 586 "ppl.l"
|
|
new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_dqs);
|
|
YY_BREAK
|
|
case 111:
|
|
YY_RULE_SETUP
|
|
#line 587 "ppl.l"
|
|
new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_sqs);
|
|
YY_BREAK
|
|
case 112:
|
|
YY_RULE_SETUP
|
|
#line 588 "ppl.l"
|
|
yy_push_state(pp_comment); add_text_to_macro(" ", 1);
|
|
YY_BREAK
|
|
case 113:
|
|
/* rule 113 can match eol */
|
|
YY_RULE_SETUP
|
|
#line 589 "ppl.l"
|
|
pp_status.line_number++; pp_status.char_number = 1; add_text_to_macro(ppy_text, ppy_leng);
|
|
YY_BREAK
|
|
case 114:
|
|
YY_RULE_SETUP
|
|
#line 590 "ppl.l"
|
|
add_text_to_macro(ppy_text, ppy_leng);
|
|
YY_BREAK
|
|
case 115:
|
|
/* rule 115 can match eol */
|
|
YY_RULE_SETUP
|
|
#line 591 "ppl.l"
|
|
newline(0);
|
|
YY_BREAK
|
|
/*
|
|
* Comment handling (almost all start-conditions)
|
|
*/
|
|
case 116:
|
|
YY_RULE_SETUP
|
|
#line 596 "ppl.l"
|
|
yy_push_state(pp_comment);
|
|
YY_BREAK
|
|
case 117:
|
|
YY_RULE_SETUP
|
|
#line 597 "ppl.l"
|
|
;
|
|
YY_BREAK
|
|
case 118:
|
|
/* rule 118 can match eol */
|
|
YY_RULE_SETUP
|
|
#line 598 "ppl.l"
|
|
newline(0);
|
|
YY_BREAK
|
|
case 119:
|
|
YY_RULE_SETUP
|
|
#line 599 "ppl.l"
|
|
yy_pop_state();
|
|
YY_BREAK
|
|
/*
|
|
* Remove C++ style comment (almost all start-conditions)
|
|
*/
|
|
case 120:
|
|
YY_RULE_SETUP
|
|
#line 604 "ppl.l"
|
|
{
|
|
if(ppy_text[ppy_leng-1] == '\\')
|
|
ppy_warning("C++ style comment ends with an escaped newline (escape ignored)");
|
|
}
|
|
YY_BREAK
|
|
/*
|
|
* Single, double and <> quoted constants
|
|
*/
|
|
case 121:
|
|
YY_RULE_SETUP
|
|
#line 612 "ppl.l"
|
|
pp_incl_state.seen_junk++; new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_dqs);
|
|
YY_BREAK
|
|
case 122:
|
|
YY_RULE_SETUP
|
|
#line 613 "ppl.l"
|
|
pp_incl_state.seen_junk++; new_string(); add_string(ppy_text, ppy_leng); yy_push_state(pp_sqs);
|
|
YY_BREAK
|
|
case 123:
|
|
YY_RULE_SETUP
|
|
#line 614 "ppl.l"
|
|
add_string(ppy_text, ppy_leng);
|
|
YY_BREAK
|
|
case 124:
|
|
YY_RULE_SETUP
|
|
#line 615 "ppl.l"
|
|
{
|
|
add_string(ppy_text, ppy_leng);
|
|
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();
|
|
ppy_lval.cptr = get_string();
|
|
return tDQSTRING;
|
|
case pp_line:
|
|
ppy_lval.cptr = get_string();
|
|
return tDQSTRING;
|
|
default:
|
|
put_string();
|
|
}
|
|
}
|
|
YY_BREAK
|
|
case 125:
|
|
YY_RULE_SETUP
|
|
#line 635 "ppl.l"
|
|
add_string(ppy_text, ppy_leng);
|
|
YY_BREAK
|
|
case 126:
|
|
YY_RULE_SETUP
|
|
#line 636 "ppl.l"
|
|
{
|
|
add_string(ppy_text, ppy_leng);
|
|
yy_pop_state();
|
|
switch(yy_current_state())
|
|
{
|
|
case pp_if:
|
|
case pp_define:
|
|
case pp_mbody:
|
|
ppy_lval.cptr = get_string();
|
|
return tSQSTRING;
|
|
default:
|
|
put_string();
|
|
}
|
|
}
|
|
YY_BREAK
|
|
case 127:
|
|
YY_RULE_SETUP
|
|
#line 650 "ppl.l"
|
|
add_string(ppy_text, ppy_leng);
|
|
YY_BREAK
|
|
case 128:
|
|
YY_RULE_SETUP
|
|
#line 651 "ppl.l"
|
|
{
|
|
add_string(ppy_text, ppy_leng);
|
|
yy_pop_state();
|
|
ppy_lval.cptr = get_string();
|
|
return tIQSTRING;
|
|
}
|
|
YY_BREAK
|
|
case 129:
|
|
/* rule 129 can match eol */
|
|
YY_RULE_SETUP
|
|
#line 657 "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(ppy_text, ppy_leng);
|
|
newline(-1);
|
|
}
|
|
}
|
|
YY_BREAK
|
|
case 130:
|
|
YY_RULE_SETUP
|
|
#line 681 "ppl.l"
|
|
add_string(ppy_text, ppy_leng);
|
|
YY_BREAK
|
|
case 131:
|
|
/* rule 131 can match eol */
|
|
YY_RULE_SETUP
|
|
#line 682 "ppl.l"
|
|
{
|
|
newline(1);
|
|
add_string(ppy_text, ppy_leng);
|
|
ppy_warning("Newline in string constant encountered (started line %d)", string_start());
|
|
}
|
|
YY_BREAK
|
|
/*
|
|
* Identifier scanning
|
|
*/
|
|
case 132:
|
|
YY_RULE_SETUP
|
|
#line 691 "ppl.l"
|
|
{
|
|
pp_entry_t *ppp;
|
|
pp_incl_state.seen_junk++;
|
|
if(!(ppp = pplookup(ppy_text)))
|
|
{
|
|
if(yy_current_state() == pp_inc)
|
|
ppy_error("Expected include filename");
|
|
|
|
else if(yy_current_state() == pp_if)
|
|
{
|
|
ppy_lval.cptr = pp_xstrdup(ppy_text);
|
|
return tIDENT;
|
|
}
|
|
else {
|
|
if((yy_current_state()==INITIAL) && (strcasecmp(ppy_text,"RCINCLUDE")==0)){
|
|
yy_push_state(RCINCL);
|
|
return tRCINCLUDE;
|
|
}
|
|
else put_buffer(ppy_text, ppy_leng);
|
|
}
|
|
}
|
|
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);
|
|
}
|
|
}
|
|
else put_buffer(ppy_text, ppy_leng);
|
|
}
|
|
YY_BREAK
|
|
/*
|
|
* Everything else that needs to be passed and
|
|
* newline and continuation handling
|
|
*/
|
|
case 133:
|
|
YY_RULE_SETUP
|
|
#line 737 "ppl.l"
|
|
pp_incl_state.seen_junk++; put_buffer(ppy_text, ppy_leng);
|
|
YY_BREAK
|
|
case 134:
|
|
YY_RULE_SETUP
|
|
#line 738 "ppl.l"
|
|
put_buffer(ppy_text, ppy_leng);
|
|
YY_BREAK
|
|
case 135:
|
|
/* rule 135 can match eol */
|
|
YY_RULE_SETUP
|
|
#line 739 "ppl.l"
|
|
newline(1);
|
|
YY_BREAK
|
|
case 136:
|
|
/* rule 136 can match eol */
|
|
YY_RULE_SETUP
|
|
#line 740 "ppl.l"
|
|
newline(0);
|
|
YY_BREAK
|
|
case 137:
|
|
YY_RULE_SETUP
|
|
#line 741 "ppl.l"
|
|
pp_incl_state.seen_junk++; put_buffer(ppy_text, ppy_leng);
|
|
YY_BREAK
|
|
/*
|
|
* Special catcher for macro argmument expansion to prevent
|
|
* newlines to propagate to the output or admin.
|
|
*/
|
|
case 138:
|
|
/* rule 138 can match eol */
|
|
YY_RULE_SETUP
|
|
#line 747 "ppl.l"
|
|
put_buffer(ppy_text, ppy_leng);
|
|
YY_BREAK
|
|
case 139:
|
|
YY_RULE_SETUP
|
|
#line 749 "ppl.l"
|
|
{
|
|
ppy_lval.cptr=pp_xstrdup(ppy_text);
|
|
yy_pop_state();
|
|
return tRCINCLUDEPATH;
|
|
}
|
|
YY_BREAK
|
|
case 140:
|
|
YY_RULE_SETUP
|
|
#line 755 "ppl.l"
|
|
;
|
|
YY_BREAK
|
|
case 141:
|
|
YY_RULE_SETUP
|
|
#line 757 "ppl.l"
|
|
{
|
|
new_string(); add_string(ppy_text,ppy_leng);yy_push_state(pp_dqs);
|
|
}
|
|
YY_BREAK
|
|
/*
|
|
* This is a 'catch-all' rule to discover errors in the scanner
|
|
* in an orderly manner.
|
|
*/
|
|
case 142:
|
|
YY_RULE_SETUP
|
|
#line 765 "ppl.l"
|
|
pp_incl_state.seen_junk++; ppy_warning("Unmatched text '%c' (0x%02x); please report\n", isprint(*ppy_text & 0xff) ? *ppy_text : ' ', *ppy_text);
|
|
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 767 "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))
|
|
ppy_warning("Unmatched #if/#endif at end of file");
|
|
|
|
if(!bep)
|
|
{
|
|
if(YY_START != INITIAL)
|
|
{
|
|
ppy_error("Unexpected end of file during preprocessing");
|
|
BEGIN(INITIAL);
|
|
}
|
|
yyterminate();
|
|
}
|
|
else if(bep->should_pop == 2)
|
|
{
|
|
macexpstackentry_t *mac;
|
|
mac = pop_macro();
|
|
expand_macro(mac);
|
|
}
|
|
ppy__delete_buffer(b);
|
|
}
|
|
YY_BREAK
|
|
case 143:
|
|
YY_RULE_SETUP
|
|
#line 792 "ppl.l"
|
|
ECHO;
|
|
YY_BREAK
|
|
#line 2739 "ppl.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_LVALUE->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 ppy_in at a new source and called
|
|
* ppy_lex(). 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_LVALUE->yy_n_chars;
|
|
YY_CURRENT_BUFFER_LVALUE->yy_input_file = ppy_in;
|
|
YY_CURRENT_BUFFER_LVALUE->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_LVALUE->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_last_accepting_cpos);
|
|
yy_current_state = (yy_last_accepting_state);
|
|
goto yy_find_action;
|
|
}
|
|
}
|
|
|
|
else switch ( yy_get_next_buffer( ) )
|
|
{
|
|
case EOB_ACT_END_OF_FILE:
|
|
{
|
|
(yy_did_buffer_switch_on_eof) = 0;
|
|
|
|
if ( ppy_wrap( ) )
|
|
{
|
|
/* Note: because we've taken care in
|
|
* yy_get_next_buffer() to have set up
|
|
* ppy_text, 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_LVALUE->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 ppy_lex */
|
|
|
|
/* 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 (void)
|
|
{
|
|
register char *dest = YY_CURRENT_BUFFER_LVALUE->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_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
|
|
YY_FATAL_ERROR(
|
|
"fatal flex scanner internal error--end of buffer missed" );
|
|
|
|
if ( YY_CURRENT_BUFFER_LVALUE->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_LVALUE->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_LVALUE->yy_n_chars = (yy_n_chars) = 0;
|
|
|
|
else
|
|
{
|
|
int num_to_read =
|
|
YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
|
|
|
|
while ( num_to_read <= 0 )
|
|
{ /* Not enough room in the buffer - grow it. */
|
|
|
|
/* 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. */
|
|
ppy_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_LVALUE->yy_buf_size -
|
|
number_to_move - 1;
|
|
|
|
}
|
|
|
|
if ( num_to_read > YY_READ_BUF_SIZE )
|
|
num_to_read = YY_READ_BUF_SIZE;
|
|
|
|
/* Read in more data. */
|
|
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
|
|
(yy_n_chars), (size_t) num_to_read );
|
|
|
|
YY_CURRENT_BUFFER_LVALUE->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;
|
|
ppy_restart(ppy_in );
|
|
}
|
|
|
|
else
|
|
{
|
|
ret_val = EOB_ACT_LAST_MATCH;
|
|
YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
|
|
YY_BUFFER_EOF_PENDING;
|
|
}
|
|
}
|
|
|
|
else
|
|
ret_val = EOB_ACT_CONTINUE_SCAN;
|
|
|
|
if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
|
|
/* Extend the array by 50%, plus the number we really need. */
|
|
yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
|
|
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) ppy_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
|
|
if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
|
|
YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
|
|
}
|
|
|
|
(yy_n_chars) += number_to_move;
|
|
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
|
|
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
|
|
|
|
(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->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 (void)
|
|
{
|
|
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 >= 416 )
|
|
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 );
|
|
*/
|
|
static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
|
|
{
|
|
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 >= 416 )
|
|
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 == 415);
|
|
|
|
return yy_is_jam ? 0 : yy_current_state;
|
|
}
|
|
|
|
#ifndef YY_NO_INPUT
|
|
#ifdef __cplusplus
|
|
static int yyinput (void)
|
|
#else
|
|
static int input (void)
|
|
#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_LVALUE->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. */
|
|
ppy_restart(ppy_in );
|
|
|
|
/*FALLTHROUGH*/
|
|
|
|
case EOB_ACT_END_OF_FILE:
|
|
{
|
|
if ( ppy_wrap( ) )
|
|
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 ppy_text */
|
|
(yy_hold_char) = *++(yy_c_buf_p);
|
|
|
|
YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
|
|
|
|
return c;
|
|
}
|
|
#endif /* ifndef YY_NO_INPUT */
|
|
|
|
/** Immediately switch to a different input stream.
|
|
* @param input_file A readable stream.
|
|
*
|
|
* @note This function does not reset the start condition to @c INITIAL .
|
|
*/
|
|
void ppy_restart (FILE * input_file )
|
|
{
|
|
|
|
if ( ! YY_CURRENT_BUFFER ){
|
|
ppy_ensure_buffer_stack ();
|
|
YY_CURRENT_BUFFER_LVALUE =
|
|
ppy__create_buffer(ppy_in,YY_BUF_SIZE );
|
|
}
|
|
|
|
ppy__init_buffer(YY_CURRENT_BUFFER,input_file );
|
|
ppy__load_buffer_state( );
|
|
}
|
|
|
|
/** Switch to a different input buffer.
|
|
* @param new_buffer The new input buffer.
|
|
*
|
|
*/
|
|
void ppy__switch_to_buffer (YY_BUFFER_STATE new_buffer )
|
|
{
|
|
|
|
/* TODO. We should be able to replace this entire function body
|
|
* with
|
|
* ppy_pop_buffer_state();
|
|
* ppy_push_buffer_state(new_buffer);
|
|
*/
|
|
ppy_ensure_buffer_stack ();
|
|
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_LVALUE->yy_buf_pos = (yy_c_buf_p);
|
|
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
|
|
}
|
|
|
|
YY_CURRENT_BUFFER_LVALUE = new_buffer;
|
|
ppy__load_buffer_state( );
|
|
|
|
/* We don't actually know whether we did this switch during
|
|
* EOF (ppy_wrap()) processing, but the only time this flag
|
|
* is looked at is after ppy_wrap() is called, so it's safe
|
|
* to go ahead and always set it.
|
|
*/
|
|
(yy_did_buffer_switch_on_eof) = 1;
|
|
}
|
|
|
|
static void ppy__load_buffer_state (void)
|
|
{
|
|
(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
|
|
(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
|
|
ppy_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
|
|
(yy_hold_char) = *(yy_c_buf_p);
|
|
}
|
|
|
|
/** Allocate and initialize an input buffer state.
|
|
* @param file A readable stream.
|
|
* @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
|
|
*
|
|
* @return the allocated buffer state.
|
|
*/
|
|
YY_BUFFER_STATE ppy__create_buffer (FILE * file, int size )
|
|
{
|
|
YY_BUFFER_STATE b;
|
|
|
|
b = (YY_BUFFER_STATE) ppy_alloc(sizeof( struct yy_buffer_state ) );
|
|
if ( ! b )
|
|
YY_FATAL_ERROR( "out of dynamic memory in ppy__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 *) ppy_alloc(b->yy_buf_size + 2 );
|
|
if ( ! b->yy_ch_buf )
|
|
YY_FATAL_ERROR( "out of dynamic memory in ppy__create_buffer()" );
|
|
|
|
b->yy_is_our_buffer = 1;
|
|
|
|
ppy__init_buffer(b,file );
|
|
|
|
return b;
|
|
}
|
|
|
|
/** Destroy the buffer.
|
|
* @param b a buffer created with ppy__create_buffer()
|
|
*
|
|
*/
|
|
void ppy__delete_buffer (YY_BUFFER_STATE b )
|
|
{
|
|
|
|
if ( ! b )
|
|
return;
|
|
|
|
if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
|
|
YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
|
|
|
|
if ( b->yy_is_our_buffer )
|
|
ppy_free((void *) b->yy_ch_buf );
|
|
|
|
ppy_free((void *) b );
|
|
}
|
|
|
|
/* Initializes or reinitializes a buffer.
|
|
* This function is sometimes called more than once on the same buffer,
|
|
* such as during a ppy_restart() or at EOF.
|
|
*/
|
|
static void ppy__init_buffer (YY_BUFFER_STATE b, FILE * file )
|
|
|
|
{
|
|
int oerrno = errno;
|
|
|
|
ppy__flush_buffer(b );
|
|
|
|
b->yy_input_file = file;
|
|
b->yy_fill_buffer = 1;
|
|
|
|
/* If b is the current buffer, then ppy__init_buffer was _probably_
|
|
* called from ppy_restart() or through yy_get_next_buffer.
|
|
* In that case, we don't want to reset the lineno or column.
|
|
*/
|
|
if (b != YY_CURRENT_BUFFER){
|
|
b->yy_bs_lineno = 1;
|
|
b->yy_bs_column = 0;
|
|
}
|
|
|
|
b->yy_is_interactive = 0;
|
|
|
|
errno = oerrno;
|
|
}
|
|
|
|
/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
|
|
* @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
|
|
*
|
|
*/
|
|
void ppy__flush_buffer (YY_BUFFER_STATE b )
|
|
{
|
|
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 )
|
|
ppy__load_buffer_state( );
|
|
}
|
|
|
|
/** Pushes the new state onto the stack. The new state becomes
|
|
* the current state. This function will allocate the stack
|
|
* if necessary.
|
|
* @param new_buffer The new state.
|
|
*
|
|
*/
|
|
void ppy_push_buffer_state (YY_BUFFER_STATE new_buffer )
|
|
{
|
|
if (new_buffer == NULL)
|
|
return;
|
|
|
|
ppy_ensure_buffer_stack();
|
|
|
|
/* This block is copied from ppy__switch_to_buffer. */
|
|
if ( YY_CURRENT_BUFFER )
|
|
{
|
|
/* Flush out information for old buffer. */
|
|
*(yy_c_buf_p) = (yy_hold_char);
|
|
YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
|
|
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
|
|
}
|
|
|
|
/* Only push if top exists. Otherwise, replace top. */
|
|
if (YY_CURRENT_BUFFER)
|
|
(yy_buffer_stack_top)++;
|
|
YY_CURRENT_BUFFER_LVALUE = new_buffer;
|
|
|
|
/* copied from ppy__switch_to_buffer. */
|
|
ppy__load_buffer_state( );
|
|
(yy_did_buffer_switch_on_eof) = 1;
|
|
}
|
|
|
|
/** Removes and deletes the top of the stack, if present.
|
|
* The next element becomes the new top.
|
|
*
|
|
*/
|
|
void ppy_pop_buffer_state (void)
|
|
{
|
|
if (!YY_CURRENT_BUFFER)
|
|
return;
|
|
|
|
ppy__delete_buffer(YY_CURRENT_BUFFER );
|
|
YY_CURRENT_BUFFER_LVALUE = NULL;
|
|
if ((yy_buffer_stack_top) > 0)
|
|
--(yy_buffer_stack_top);
|
|
|
|
if (YY_CURRENT_BUFFER) {
|
|
ppy__load_buffer_state( );
|
|
(yy_did_buffer_switch_on_eof) = 1;
|
|
}
|
|
}
|
|
|
|
/* Allocates the stack if it does not exist.
|
|
* Guarantees space for at least one push.
|
|
*/
|
|
static void ppy_ensure_buffer_stack (void)
|
|
{
|
|
int num_to_alloc;
|
|
|
|
if (!(yy_buffer_stack)) {
|
|
|
|
/* First allocation is just for 2 elements, since we don't know if this
|
|
* scanner will even need a stack. We use 2 instead of 1 to avoid an
|
|
* immediate realloc on the next call.
|
|
*/
|
|
num_to_alloc = 1;
|
|
(yy_buffer_stack) = (struct yy_buffer_state**)ppy_alloc
|
|
(num_to_alloc * sizeof(struct yy_buffer_state*)
|
|
);
|
|
if ( ! (yy_buffer_stack) )
|
|
YY_FATAL_ERROR( "out of dynamic memory in ppy_ensure_buffer_stack()" );
|
|
|
|
memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
|
|
|
|
(yy_buffer_stack_max) = num_to_alloc;
|
|
(yy_buffer_stack_top) = 0;
|
|
return;
|
|
}
|
|
|
|
if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
|
|
|
|
/* Increase the buffer to prepare for a possible push. */
|
|
int grow_size = 8 /* arbitrary grow size */;
|
|
|
|
num_to_alloc = (yy_buffer_stack_max) + grow_size;
|
|
(yy_buffer_stack) = (struct yy_buffer_state**)ppy_realloc
|
|
((yy_buffer_stack),
|
|
num_to_alloc * sizeof(struct yy_buffer_state*)
|
|
);
|
|
if ( ! (yy_buffer_stack) )
|
|
YY_FATAL_ERROR( "out of dynamic memory in ppy_ensure_buffer_stack()" );
|
|
|
|
/* zero only the new slots.*/
|
|
memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
|
|
(yy_buffer_stack_max) = num_to_alloc;
|
|
}
|
|
}
|
|
|
|
/** Setup the input buffer state to scan directly from a user-specified character buffer.
|
|
* @param base the character buffer
|
|
* @param size the size in bytes of the character buffer
|
|
*
|
|
* @return the newly allocated buffer state object.
|
|
*/
|
|
YY_BUFFER_STATE ppy__scan_buffer (char * base, yy_size_t size )
|
|
{
|
|
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) ppy_alloc(sizeof( struct yy_buffer_state ) );
|
|
if ( ! b )
|
|
YY_FATAL_ERROR( "out of dynamic memory in ppy__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;
|
|
|
|
ppy__switch_to_buffer(b );
|
|
|
|
return b;
|
|
}
|
|
|
|
/** Setup the input buffer state to scan a string. The next call to ppy_lex() will
|
|
* scan from a @e copy of @a str.
|
|
* @param yystr a NUL-terminated string to scan
|
|
*
|
|
* @return the newly allocated buffer state object.
|
|
* @note If you want to scan bytes that may contain NUL values, then use
|
|
* ppy__scan_bytes() instead.
|
|
*/
|
|
YY_BUFFER_STATE ppy__scan_string (yyconst char * yystr )
|
|
{
|
|
|
|
return ppy__scan_bytes(yystr,strlen(yystr) );
|
|
}
|
|
|
|
/** Setup the input buffer state to scan the given bytes. The next call to ppy_lex() will
|
|
* scan from a @e copy of @a bytes.
|
|
* @param yybytes the byte buffer to scan
|
|
* @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
|
|
*
|
|
* @return the newly allocated buffer state object.
|
|
*/
|
|
YY_BUFFER_STATE ppy__scan_bytes (yyconst char * yybytes, int _yybytes_len )
|
|
{
|
|
YY_BUFFER_STATE b;
|
|
char *buf;
|
|
yy_size_t n;
|
|
int i;
|
|
|
|
/* Get memory for full buffer, including space for trailing EOB's. */
|
|
n = _yybytes_len + 2;
|
|
buf = (char *) ppy_alloc(n );
|
|
if ( ! buf )
|
|
YY_FATAL_ERROR( "out of dynamic memory in ppy__scan_bytes()" );
|
|
|
|
for ( i = 0; i < _yybytes_len; ++i )
|
|
buf[i] = yybytes[i];
|
|
|
|
buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
|
|
|
|
b = ppy__scan_buffer(buf,n );
|
|
if ( ! b )
|
|
YY_FATAL_ERROR( "bad buffer in ppy__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;
|
|
}
|
|
|
|
static void yy_push_state (int new_state )
|
|
{
|
|
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 *) ppy_alloc(new_size );
|
|
|
|
else
|
|
(yy_start_stack) = (int *) ppy_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);
|
|
}
|
|
|
|
static void yy_pop_state (void)
|
|
{
|
|
if ( --(yy_start_stack_ptr) < 0 )
|
|
YY_FATAL_ERROR( "start-condition stack underflow" );
|
|
|
|
BEGIN((yy_start_stack)[(yy_start_stack_ptr)]);
|
|
}
|
|
|
|
static int yy_top_state (void)
|
|
{
|
|
return (yy_start_stack)[(yy_start_stack_ptr) - 1];
|
|
}
|
|
|
|
#ifndef YY_EXIT_FAILURE
|
|
#define YY_EXIT_FAILURE 2
|
|
#endif
|
|
|
|
static void yy_fatal_error (yyconst char* msg )
|
|
{
|
|
(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 ppy_text. */ \
|
|
int yyless_macro_arg = (n); \
|
|
YY_LESS_LINENO(yyless_macro_arg);\
|
|
ppy_text[ppy_leng] = (yy_hold_char); \
|
|
(yy_c_buf_p) = ppy_text + yyless_macro_arg; \
|
|
(yy_hold_char) = *(yy_c_buf_p); \
|
|
*(yy_c_buf_p) = '\0'; \
|
|
ppy_leng = yyless_macro_arg; \
|
|
} \
|
|
while ( 0 )
|
|
|
|
/* Accessor methods (get/set functions) to struct members. */
|
|
|
|
/** Get the current line number.
|
|
*
|
|
*/
|
|
int ppy_get_lineno (void)
|
|
{
|
|
|
|
return ppy_lineno;
|
|
}
|
|
|
|
/** Get the input stream.
|
|
*
|
|
*/
|
|
FILE *ppy_get_in (void)
|
|
{
|
|
return ppy_in;
|
|
}
|
|
|
|
/** Get the output stream.
|
|
*
|
|
*/
|
|
FILE *ppy_get_out (void)
|
|
{
|
|
return ppy_out;
|
|
}
|
|
|
|
/** Get the length of the current token.
|
|
*
|
|
*/
|
|
int ppy_get_leng (void)
|
|
{
|
|
return ppy_leng;
|
|
}
|
|
|
|
/** Get the current token.
|
|
*
|
|
*/
|
|
|
|
char *ppy_get_text (void)
|
|
{
|
|
return ppy_text;
|
|
}
|
|
|
|
/** Set the current line number.
|
|
* @param line_number
|
|
*
|
|
*/
|
|
void ppy_set_lineno (int line_number )
|
|
{
|
|
|
|
ppy_lineno = line_number;
|
|
}
|
|
|
|
/** Set the input stream. This does not discard the current
|
|
* input buffer.
|
|
* @param in_str A readable stream.
|
|
*
|
|
* @see ppy__switch_to_buffer
|
|
*/
|
|
void ppy_set_in (FILE * in_str )
|
|
{
|
|
ppy_in = in_str ;
|
|
}
|
|
|
|
void ppy_set_out (FILE * out_str )
|
|
{
|
|
ppy_out = out_str ;
|
|
}
|
|
|
|
int ppy_get_debug (void)
|
|
{
|
|
return ppy__flex_debug;
|
|
}
|
|
|
|
void ppy_set_debug (int bdebug )
|
|
{
|
|
ppy__flex_debug = bdebug ;
|
|
}
|
|
|
|
static int yy_init_globals (void)
|
|
{
|
|
/* Initialization is the same as for the non-reentrant scanner.
|
|
* This function is called from ppy_lex_destroy(), so don't allocate here.
|
|
*/
|
|
|
|
(yy_buffer_stack) = 0;
|
|
(yy_buffer_stack_top) = 0;
|
|
(yy_buffer_stack_max) = 0;
|
|
(yy_c_buf_p) = (char *) 0;
|
|
(yy_init) = 0;
|
|
(yy_start) = 0;
|
|
|
|
(yy_start_stack_ptr) = 0;
|
|
(yy_start_stack_depth) = 0;
|
|
(yy_start_stack) = NULL;
|
|
|
|
/* Defined in main.c */
|
|
#ifdef YY_STDINIT
|
|
ppy_in = stdin;
|
|
ppy_out = stdout;
|
|
#else
|
|
ppy_in = (FILE *) 0;
|
|
ppy_out = (FILE *) 0;
|
|
#endif
|
|
|
|
/* For future reference: Set errno on error, since we are called by
|
|
* ppy_lex_init()
|
|
*/
|
|
return 0;
|
|
}
|
|
|
|
/* ppy_lex_destroy is for both reentrant and non-reentrant scanners. */
|
|
int ppy_lex_destroy (void)
|
|
{
|
|
|
|
/* Pop the buffer stack, destroying each element. */
|
|
while(YY_CURRENT_BUFFER){
|
|
ppy__delete_buffer(YY_CURRENT_BUFFER );
|
|
YY_CURRENT_BUFFER_LVALUE = NULL;
|
|
ppy_pop_buffer_state();
|
|
}
|
|
|
|
/* Destroy the stack itself. */
|
|
ppy_free((yy_buffer_stack) );
|
|
(yy_buffer_stack) = NULL;
|
|
|
|
/* Destroy the start condition stack. */
|
|
ppy_free((yy_start_stack) );
|
|
(yy_start_stack) = NULL;
|
|
|
|
/* Reset the globals. This is important in a non-reentrant scanner so the next time
|
|
* ppy_lex() is called, initialization will occur. */
|
|
yy_init_globals( );
|
|
|
|
return 0;
|
|
}
|
|
|
|
/*
|
|
* Internal utility routines.
|
|
*/
|
|
|
|
#ifndef yytext_ptr
|
|
static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
|
|
{
|
|
register int i;
|
|
for ( i = 0; i < n; ++i )
|
|
s1[i] = s2[i];
|
|
}
|
|
#endif
|
|
|
|
#ifdef YY_NEED_STRLEN
|
|
static int yy_flex_strlen (yyconst char * s )
|
|
{
|
|
register int n;
|
|
for ( n = 0; s[n]; ++n )
|
|
;
|
|
|
|
return n;
|
|
}
|
|
#endif
|
|
|
|
void *ppy_alloc (yy_size_t size )
|
|
{
|
|
return (void *) malloc( size );
|
|
}
|
|
|
|
void *ppy_realloc (void * ptr, yy_size_t size )
|
|
{
|
|
/* 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 );
|
|
}
|
|
|
|
void ppy_free (void * ptr )
|
|
{
|
|
free( (char *) ptr ); /* see ppy_realloc() for (char *) cast */
|
|
}
|
|
|
|
#define YYTABLES_NAME "yytables"
|
|
|
|
#line 792 "ppl.l"
|
|
|
|
|
|
/*
|
|
**************************************************************************
|
|
* Support functions
|
|
**************************************************************************
|
|
*/
|
|
|
|
#ifndef ppy_wrap
|
|
int ppy_wrap(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];
|
|
long l;
|
|
|
|
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"))
|
|
{
|
|
ppy_error("Invalid constant suffix");
|
|
return 0;
|
|
}
|
|
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)
|
|
{
|
|
/* Assume as in the declaration of wrc_ull_t and wrc_sll_t */
|
|
#ifdef HAVE_LONG_LONG
|
|
if (is_u)
|
|
{
|
|
errno = 0;
|
|
val->ull = strtoull(str, NULL, radix);
|
|
if (val->ull == ULLONG_MAX && errno == ERANGE)
|
|
ppy_error("integer constant %s is too large\n", str);
|
|
return tULONGLONG;
|
|
}
|
|
else
|
|
{
|
|
errno = 0;
|
|
val->sll = strtoll(str, NULL, radix);
|
|
if ((val->sll == LLONG_MIN || val->sll == LLONG_MAX) && errno == ERANGE)
|
|
ppy_error("integer constant %s is too large\n", str);
|
|
return tSLONGLONG;
|
|
}
|
|
#else
|
|
pp_internal_error(__FILE__, __LINE__, "long long constants not supported on this platform");
|
|
#endif
|
|
}
|
|
else if(is_u && is_l)
|
|
{
|
|
errno = 0;
|
|
val->ulong = strtoul(str, NULL, radix);
|
|
if (val->ulong == ULONG_MAX && errno == ERANGE)
|
|
ppy_error("integer constant %s is too large\n", str);
|
|
return tULONG;
|
|
}
|
|
else if(!is_u && is_l)
|
|
{
|
|
errno = 0;
|
|
val->slong = strtol(str, NULL, radix);
|
|
if ((val->slong == LONG_MIN || val->slong == LONG_MAX) && errno == ERANGE)
|
|
ppy_error("integer constant %s is too large\n", str);
|
|
return tSLONG;
|
|
}
|
|
else if(is_u && !is_l)
|
|
{
|
|
unsigned long ul;
|
|
errno = 0;
|
|
ul = strtoul(str, NULL, radix);
|
|
if ((ul == ULONG_MAX && errno == ERANGE) || (ul > UINT_MAX))
|
|
ppy_error("integer constant %s is too large\n", str);
|
|
val->uint = (unsigned int)ul;
|
|
return tUINT;
|
|
}
|
|
|
|
/* Else it must be an int... */
|
|
errno = 0;
|
|
l = strtol(str, NULL, radix);
|
|
if (((l == LONG_MIN || l == LONG_MAX) && errno == ERANGE) ||
|
|
(l > INT_MAX) || (l < INT_MIN))
|
|
ppy_error("integer constant %s is too large\n", str);
|
|
val->sint = (int)l;
|
|
return tSINT;
|
|
}
|
|
|
|
|
|
/*
|
|
*-------------------------------------------------------------------------
|
|
* Macro and define expansion support
|
|
*
|
|
* FIXME: Variable macro arguments.
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
static void expand_special(pp_entry_t *ppp)
|
|
{
|
|
static char *buf = NULL;
|
|
char *new_buf;
|
|
|
|
assert(ppp->type == def_special);
|
|
|
|
if(!strcmp(ppp->ident, "__LINE__"))
|
|
{
|
|
new_buf = pp_xrealloc(buf, 32);
|
|
if(!new_buf)
|
|
return;
|
|
buf = new_buf;
|
|
sprintf(buf, "%d", pp_status.line_number);
|
|
}
|
|
else if(!strcmp(ppp->ident, "__FILE__"))
|
|
{
|
|
new_buf = pp_xrealloc(buf, strlen(pp_status.input) + 3);
|
|
if(!new_buf)
|
|
return;
|
|
buf = new_buf;
|
|
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);
|
|
ppy__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);
|
|
ppy__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)
|
|
{
|
|
int new_alloc;
|
|
char *new_text;
|
|
|
|
if(len == 0)
|
|
return;
|
|
if(curdef_idx >= curdef_alloc || curdef_alloc - curdef_idx < len)
|
|
{
|
|
new_alloc = curdef_alloc + ((len + ALLOCBLOCKSIZE-1) & ~(ALLOCBLOCKSIZE-1));
|
|
new_text = pp_xrealloc(curdef_text, new_alloc * sizeof(curdef_text[0]));
|
|
if(!new_text)
|
|
return;
|
|
curdef_text = new_text;
|
|
curdef_alloc = new_alloc;
|
|
if(curdef_alloc > 65536)
|
|
ppy_warning("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))
|
|
{
|
|
ppy_error("Too %s macro arguments (%d)", nargs < abs(ppp->nargs) ? "few" : "many", nargs);
|
|
return;
|
|
}
|
|
|
|
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);
|
|
/*ppy__scan_bytes(curdef_text + n,k - n);*/
|
|
ppy__scan_string(curdef_text + n);
|
|
}
|
|
}
|
|
|
|
/*
|
|
*-------------------------------------------------------------------------
|
|
* String collection routines
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
static void new_string(void)
|
|
{
|
|
#ifdef DEBUG
|
|
if(strbuf_idx)
|
|
ppy_warning("new_string: strbuf_idx != 0");
|
|
#endif
|
|
strbuf_idx = 0;
|
|
str_startline = pp_status.line_number;
|
|
}
|
|
|
|
static void add_string(const char *str, int len)
|
|
{
|
|
int new_alloc;
|
|
char *new_buffer;
|
|
|
|
if(len == 0)
|
|
return;
|
|
if(strbuf_idx >= strbuf_alloc || strbuf_alloc - strbuf_idx < len)
|
|
{
|
|
new_alloc = strbuf_alloc + ((len + ALLOCBLOCKSIZE-1) & ~(ALLOCBLOCKSIZE-1));
|
|
new_buffer = pp_xrealloc(strbuffer, new_alloc * sizeof(strbuffer[0]));
|
|
if(!new_buffer)
|
|
return;
|
|
strbuffer = new_buffer;
|
|
strbuf_alloc = new_alloc;
|
|
if(strbuf_alloc > 65536)
|
|
ppy_warning("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);
|
|
if(!str)
|
|
return NULL;
|
|
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(ppy_debug)
|
|
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].filehandle = pp_status.file;
|
|
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;
|
|
|
|
if(ppp)
|
|
ppp->expanding = 1;
|
|
else if(filename)
|
|
{
|
|
/* These will track the ppy_error 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
|
|
{
|
|
includelogicentry_t *iep = NULL;
|
|
|
|
if(!bufferstack[bufferstackidx].should_pop)
|
|
{
|
|
wpp_callbacks->close(pp_status.file);
|
|
pp_writestring("# %d \"%s\" 2\n", bufferstack[bufferstackidx].line_number, bufferstack[bufferstackidx].filename);
|
|
|
|
/* 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)
|
|
{
|
|
iep = pp_xmalloc(sizeof(includelogicentry_t));
|
|
if (iep)
|
|
{
|
|
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",
|
|
bufferstack[bufferstackidx].filename, bufferstack[bufferstackidx].line_number, pp_incl_state.ppp, iep->filename);
|
|
}
|
|
}
|
|
}
|
|
free(pp_incl_state.ppp);
|
|
pp_incl_state = bufferstack[bufferstackidx].incl;
|
|
|
|
}
|
|
if (bufferstack[bufferstackidx].include_filename)
|
|
{
|
|
free(pp_status.input);
|
|
pp_status.input = bufferstack[bufferstackidx].filename;
|
|
}
|
|
pp_status.line_number = bufferstack[bufferstackidx].line_number;
|
|
pp_status.char_number = bufferstack[bufferstackidx].char_number;
|
|
ncontinuations = bufferstack[bufferstackidx].ncontinuations;
|
|
if (!iep)
|
|
free(bufferstack[bufferstackidx].include_filename);
|
|
}
|
|
|
|
if(ppy_debug)
|
|
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_status.file = bufferstack[bufferstackidx].filehandle;
|
|
ppy__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)
|
|
{
|
|
ppy_error("Too many nested macros");
|
|
return;
|
|
}
|
|
|
|
macexpstack[macexpstackidx] = pp_xmalloc(sizeof(macexpstack[0][0]));
|
|
if(!macexpstack[macexpstackidx])
|
|
return;
|
|
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]);
|
|
free(mep->args);
|
|
free(mep->nnls);
|
|
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' */
|
|
{
|
|
char *new_curarg;
|
|
int new_alloc = mep->curargalloc + ((ALLOCBLOCKSIZE > len+1) ? ALLOCBLOCKSIZE : len+1);
|
|
new_curarg = pp_xrealloc(mep->curarg, new_alloc * sizeof(mep->curarg[0]));
|
|
if(!new_curarg)
|
|
return;
|
|
mep->curarg = new_curarg;
|
|
mep->curargalloc = new_alloc;
|
|
}
|
|
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;
|
|
char **new_args, **new_ppargs;
|
|
int *new_nnls;
|
|
macexpstackentry_t *mep = top_macro();
|
|
|
|
assert(mep->ppp->expanding == 0);
|
|
|
|
new_args = pp_xrealloc(mep->args, (mep->nargs+1) * sizeof(mep->args[0]));
|
|
if(!new_args)
|
|
return;
|
|
mep->args = new_args;
|
|
|
|
new_ppargs = pp_xrealloc(mep->ppargs, (mep->nargs+1) * sizeof(mep->ppargs[0]));
|
|
if(!new_ppargs)
|
|
return;
|
|
mep->ppargs = new_ppargs;
|
|
|
|
new_nnls = pp_xrealloc(mep->nnls, (mep->nargs+1) * sizeof(mep->nnls[0]));
|
|
if(!new_nnls)
|
|
return;
|
|
mep->nnls = new_nnls;
|
|
|
|
mep->args[mep->nargs] = pp_xstrdup(mep->curarg ? mep->curarg : "");
|
|
if(!mep->args[mep->nargs])
|
|
return;
|
|
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);
|
|
ppy__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] ? 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
|
|
wpp_callbacks->write(s, len);
|
|
}
|
|
|
|
|
|
/*
|
|
*-------------------------------------------------------------------------
|
|
* Include management
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
void pp_do_include(char *fname, int type)
|
|
{
|
|
char *newpath;
|
|
int n;
|
|
includelogicentry_t *iep;
|
|
void *fp;
|
|
|
|
if(!fname)
|
|
return;
|
|
|
|
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.
|
|
*/
|
|
free(fname);
|
|
return;
|
|
}
|
|
}
|
|
|
|
n = strlen(fname);
|
|
|
|
if(n <= 2)
|
|
{
|
|
ppy_error("Empty include filename");
|
|
free(fname);
|
|
return;
|
|
}
|
|
|
|
/* Undo the effect of the quotation */
|
|
fname[n-1] = '\0';
|
|
|
|
if((fp = pp_open_include(fname+1, type, pp_status.input, &newpath)) == NULL)
|
|
{
|
|
ppy_error("Unable to open include file %s", fname+1);
|
|
free(fname);
|
|
return;
|
|
}
|
|
|
|
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(pp_status.debug)
|
|
fprintf(stderr, "pp_do_include: %s:%d: include_state=%d, include_ppp='%s', include_ifdepth=%d\n",
|
|
pp_status.input, pp_status.line_number, pp_incl_state.state, pp_incl_state.ppp, pp_incl_state.ifdepth);
|
|
pp_status.file = fp;
|
|
ppy__switch_to_buffer(ppy__create_buffer(NULL, YY_BUF_SIZE));
|
|
|
|
pp_writestring("# 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();
|
|
}
|
|
|