mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
2636 lines
68 KiB
Plaintext
2636 lines
68 KiB
Plaintext
#line 2 "lex.yy.c"
|
|
|
|
#line 4 "lex.yy.c"
|
|
|
|
#define YY_INT_ALIGNED short int
|
|
|
|
/* A lexical scanner generated by flex */
|
|
|
|
#define yy_create_buffer xyy_create_buffer
|
|
#define yy_delete_buffer xyy_delete_buffer
|
|
#define yy_flex_debug xyy_flex_debug
|
|
#define yy_init_buffer xyy_init_buffer
|
|
#define yy_flush_buffer xyy_flush_buffer
|
|
#define yy_load_buffer_state xyy_load_buffer_state
|
|
#define yy_switch_to_buffer xyy_switch_to_buffer
|
|
#define yyin xyyin
|
|
#define yyleng xyyleng
|
|
#define yylex xyylex
|
|
#define yylineno xyylineno
|
|
#define yyout xyyout
|
|
#define yyrestart xyyrestart
|
|
#define yytext xyytext
|
|
#define yywrap xyywrap
|
|
#define yyalloc xyyalloc
|
|
#define yyrealloc xyyrealloc
|
|
#define yyfree xyyfree
|
|
|
|
#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;
|
|
#endif /* ! C99 */
|
|
|
|
/* 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 /* ! 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 xyyrestart(xyyin )
|
|
|
|
#define YY_END_OF_BUFFER_CHAR 0
|
|
|
|
/* Size of default input buffer. */
|
|
#ifndef YY_BUF_SIZE
|
|
#define YY_BUF_SIZE 16384
|
|
#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 xyyleng;
|
|
|
|
extern FILE *xyyin, *xyyout;
|
|
|
|
#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 xyytext. */ \
|
|
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 xyytext 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 xyyrestart()), so that the user can continue scanning by
|
|
* just pointing xyyin 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 xyytext is formed. */
|
|
static char yy_hold_char;
|
|
static int yy_n_chars; /* number of characters read into yy_ch_buf */
|
|
int xyyleng;
|
|
|
|
/* 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 xyywrap()'s to do buffer switches
|
|
* instead of setting up a fresh xyyin. A bit of a hack ...
|
|
*/
|
|
static int yy_did_buffer_switch_on_eof;
|
|
|
|
void xyyrestart (FILE *input_file );
|
|
void xyy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
|
|
YY_BUFFER_STATE xyy_create_buffer (FILE *file,int size );
|
|
void xyy_delete_buffer (YY_BUFFER_STATE b );
|
|
void xyy_flush_buffer (YY_BUFFER_STATE b );
|
|
void xyypush_buffer_state (YY_BUFFER_STATE new_buffer );
|
|
void xyypop_buffer_state (void );
|
|
|
|
static void xyyensure_buffer_stack (void );
|
|
static void xyy_load_buffer_state (void );
|
|
static void xyy_init_buffer (YY_BUFFER_STATE b,FILE *file );
|
|
|
|
#define YY_FLUSH_BUFFER xyy_flush_buffer(YY_CURRENT_BUFFER )
|
|
|
|
YY_BUFFER_STATE xyy_scan_buffer (char *base,yy_size_t size );
|
|
YY_BUFFER_STATE xyy_scan_string (yyconst char *yy_str );
|
|
YY_BUFFER_STATE xyy_scan_bytes (yyconst char *bytes,int len );
|
|
|
|
void *xyyalloc (yy_size_t );
|
|
void *xyyrealloc (void *,yy_size_t );
|
|
void xyyfree (void * );
|
|
|
|
#define yy_new_buffer xyy_create_buffer
|
|
|
|
#define yy_set_interactive(is_interactive) \
|
|
{ \
|
|
if ( ! YY_CURRENT_BUFFER ){ \
|
|
xyyensure_buffer_stack (); \
|
|
YY_CURRENT_BUFFER_LVALUE = \
|
|
xyy_create_buffer(xyyin,YY_BUF_SIZE ); \
|
|
} \
|
|
YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
|
|
}
|
|
|
|
#define yy_set_bol(at_bol) \
|
|
{ \
|
|
if ( ! YY_CURRENT_BUFFER ){\
|
|
xyyensure_buffer_stack (); \
|
|
YY_CURRENT_BUFFER_LVALUE = \
|
|
xyy_create_buffer(xyyin,YY_BUF_SIZE ); \
|
|
} \
|
|
YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
|
|
}
|
|
|
|
#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
|
|
|
|
typedef unsigned char YY_CHAR;
|
|
|
|
FILE *xyyin = (FILE *) 0, *xyyout = (FILE *) 0;
|
|
|
|
typedef int yy_state_type;
|
|
|
|
extern int xyylineno;
|
|
|
|
int xyylineno = 1;
|
|
|
|
extern char *xyytext;
|
|
#define yytext_ptr xyytext
|
|
|
|
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 xyytext.
|
|
*/
|
|
#define YY_DO_BEFORE_ACTION \
|
|
(yytext_ptr) = yy_bp; \
|
|
xyyleng = (size_t) (yy_cp - yy_bp); \
|
|
(yy_hold_char) = *yy_cp; \
|
|
*yy_cp = '\0'; \
|
|
(yy_c_buf_p) = yy_cp;
|
|
|
|
#define YY_NUM_RULES 35
|
|
#define YY_END_OF_BUFFER 36
|
|
/* 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_acclist[200] =
|
|
{ 0,
|
|
36, 34, 35, 2, 34, 35, 1, 35, 30, 34,
|
|
35, 4, 34, 35, 34, 35, 10, 34, 35, 32,
|
|
34, 35, 9, 34, 35, 34, 35, 26, 34, 35,
|
|
11, 34, 35, 31, 34, 35, 32, 34, 35, 32,
|
|
34, 35, 32, 34, 35, 32, 34, 35, 32, 34,
|
|
35, 32, 34, 35, 32, 34, 35, 32, 34, 35,
|
|
32, 34, 35, 32, 34, 35, 7, 34, 35, 8,
|
|
34, 35, 5, 34, 35, 6, 34, 35, 1, 4,
|
|
26, 32, 33, 32, 26, 32, 32, 33, 3, 27,
|
|
16412, 26, 27,16412, 33, 26, 33, 32, 32, 32,
|
|
|
|
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
|
|
32, 32, 32, 33, 32, 33, 32, 33, 32, 33,
|
|
32, 32, 29, 3, 27, 33, 33, 33, 33, 32,
|
|
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
|
|
32, 32, 32, 32, 8220, 32, 13, 32, 14, 32,
|
|
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
|
|
25, 32, 32, 32, 29, 29, 12, 32, 32, 32,
|
|
17, 32, 19, 32, 32, 32, 24, 32, 32, 22,
|
|
32, 32, 32, 16, 32, 18, 32, 20, 32, 32,
|
|
32, 29, 15, 32, 32, 23, 32, 21, 32
|
|
|
|
} ;
|
|
|
|
static yyconst flex_int16_t yy_accept[142] =
|
|
{ 0,
|
|
1, 1, 1, 2, 4, 7, 9, 12, 15, 17,
|
|
20, 23, 26, 28, 31, 34, 37, 40, 43, 46,
|
|
49, 52, 55, 58, 61, 64, 67, 70, 73, 76,
|
|
79, 80, 81, 81, 82, 84, 85, 87, 89, 89,
|
|
90, 92, 95, 96, 96, 97, 98, 99, 100, 101,
|
|
102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
|
|
112, 113, 115, 117, 119, 121, 122, 123, 124, 124,
|
|
125, 125, 126, 127, 128, 129, 130, 131, 132, 133,
|
|
134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
|
|
144, 145, 145, 145, 145, 145, 145, 146, 147, 149,
|
|
|
|
151, 152, 153, 154, 155, 156, 157, 158, 159, 160,
|
|
161, 163, 164, 165, 166, 167, 169, 170, 171, 173,
|
|
175, 176, 177, 179, 180, 182, 183, 183, 184, 186,
|
|
188, 190, 191, 192, 192, 193, 195, 196, 198, 200,
|
|
200
|
|
} ;
|
|
|
|
static yyconst flex_int32_t yy_ec[256] =
|
|
{ 0,
|
|
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
|
|
1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
1, 5, 1, 6, 7, 1, 1, 1, 1, 1,
|
|
1, 1, 8, 9, 10, 11, 12, 13, 13, 13,
|
|
13, 13, 13, 13, 13, 13, 13, 1, 14, 15,
|
|
1, 1, 1, 1, 16, 17, 18, 19, 20, 21,
|
|
22, 23, 24, 25, 25, 26, 27, 28, 29, 30,
|
|
25, 31, 32, 33, 34, 25, 35, 25, 36, 25,
|
|
37, 1, 38, 1, 25, 1, 39, 40, 41, 42,
|
|
|
|
43, 44, 45, 46, 47, 25, 25, 48, 49, 50,
|
|
51, 52, 25, 53, 54, 55, 56, 25, 57, 25,
|
|
58, 25, 59, 1, 60, 1, 1, 1, 1, 1,
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
1, 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[61] =
|
|
{ 0,
|
|
1, 2, 3, 1, 2, 1, 1, 1, 2, 4,
|
|
4, 1, 4, 2, 1, 4, 4, 4, 4, 4,
|
|
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
|
4, 4, 4, 4, 4, 4, 1, 1, 4, 4,
|
|
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
|
4, 4, 4, 4, 4, 4, 4, 4, 1, 1
|
|
} ;
|
|
|
|
static yyconst flex_int16_t yy_base[151] =
|
|
{ 0,
|
|
0, 0, 225, 385, 385, 0, 385, 0, 50, 385,
|
|
54, 209, 183, 64, 385, 385, 31, 32, 47, 47,
|
|
0, 46, 64, 60, 67, 58, 385, 385, 385, 385,
|
|
0, 0, 177, 109, 78, 173, 122, 0, 132, 0,
|
|
145, 155, 102, 165, 178, 0, 0, 76, 83, 86,
|
|
93, 105, 111, 115, 114, 120, 143, 149, 82, 153,
|
|
150, 186, 0, 191, 0, 204, 214, 227, 197, 0,
|
|
143, 237, 201, 0, 220, 0, 204, 201, 162, 214,
|
|
209, 221, 237, 226, 232, 227, 229, 244, 243, 243,
|
|
255, 171, 130, 253, 129, 273, 385, 233, 0, 0,
|
|
|
|
246, 246, 254, 255, 258, 262, 273, 269, 266, 269,
|
|
0, 117, 300, 316, 326, 0, 272, 281, 0, 0,
|
|
284, 282, 0, 316, 0, 314, 334, 312, 0, 0,
|
|
0, 283, 317, 97, 349, 0, 321, 0, 0, 385,
|
|
369, 373, 96, 376, 92, 88, 82, 380, 77, 67
|
|
} ;
|
|
|
|
static yyconst flex_int16_t yy_def[151] =
|
|
{ 0,
|
|
140, 1, 140, 140, 140, 141, 140, 142, 140, 140,
|
|
143, 140, 140, 144, 140, 140, 145, 145, 145, 145,
|
|
145, 145, 145, 145, 145, 145, 140, 140, 140, 140,
|
|
141, 142, 140, 140, 146, 145, 143, 147, 140, 148,
|
|
140, 140, 149, 140, 144, 150, 145, 145, 145, 145,
|
|
145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
|
|
145, 146, 147, 146, 147, 145, 145, 140, 140, 148,
|
|
140, 140, 149, 150, 149, 150, 145, 145, 145, 145,
|
|
145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
|
|
145, 140, 140, 140, 140, 140, 140, 145, 145, 145,
|
|
|
|
145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
|
|
145, 145, 145, 140, 140, 145, 145, 145, 145, 145,
|
|
145, 145, 145, 145, 145, 145, 140, 145, 145, 145,
|
|
145, 145, 145, 140, 140, 145, 145, 145, 145, 0,
|
|
140, 140, 140, 140, 140, 140, 140, 140, 140, 140
|
|
} ;
|
|
|
|
static yyconst flex_int16_t yy_nxt[446] =
|
|
{ 0,
|
|
4, 5, 6, 5, 5, 7, 8, 9, 10, 11,
|
|
12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
|
|
22, 21, 21, 21, 21, 21, 21, 21, 21, 21,
|
|
21, 23, 24, 25, 26, 21, 27, 28, 17, 18,
|
|
19, 20, 21, 22, 21, 21, 21, 21, 21, 21,
|
|
21, 21, 21, 23, 24, 25, 26, 21, 29, 30,
|
|
33, 48, 34, 35, 36, 41, 37, 49, 42, 50,
|
|
74, 54, 41, 43, 44, 52, 45, 41, 51, 58,
|
|
76, 53, 55, 48, 59, 63, 61, 62, 63, 49,
|
|
64, 65, 50, 54, 60, 47, 56, 52, 57, 38,
|
|
|
|
51, 79, 58, 53, 88, 55, 77, 59, 61, 135,
|
|
41, 73, 74, 42, 75, 78, 60, 41, 56, 44,
|
|
57, 34, 41, 41, 79, 80, 42, 88, 77, 113,
|
|
41, 35, 67, 68, 37, 41, 68, 78, 81, 82,
|
|
68, 96, 114, 83, 39, 68, 41, 80, 84, 41,
|
|
85, 69, 71, 41, 71, 72, 41, 72, 41, 42,
|
|
81, 82, 71, 41, 71, 83, 68, 72, 41, 68,
|
|
84, 86, 85, 68, 69, 87, 89, 39, 68, 41,
|
|
90, 93, 42, 94, 69, 66, 41, 43, 44, 39,
|
|
45, 41, 100, 86, 40, 62, 63, 87, 64, 89,
|
|
|
|
62, 63, 90, 64, 95, 68, 95, 69, 68, 96,
|
|
73, 74, 68, 75, 100, 68, 66, 68, 68, 98,
|
|
99, 39, 68, 91, 140, 102, 66, 68, 68, 73,
|
|
74, 68, 75, 91, 92, 68, 92, 93, 41, 94,
|
|
68, 41, 98, 99, 101, 41, 91, 97, 102, 72,
|
|
41, 103, 104, 140, 105, 106, 91, 107, 108, 109,
|
|
110, 111, 95, 115, 112, 94, 101, 113, 116, 117,
|
|
140, 118, 119, 103, 68, 104, 105, 68, 106, 107,
|
|
108, 68, 109, 110, 111, 96, 68, 120, 121, 122,
|
|
116, 123, 117, 118, 124, 119, 125, 126, 140, 128,
|
|
|
|
129, 68, 130, 131, 68, 140, 140, 140, 68, 120,
|
|
121, 122, 113, 68, 123, 137, 124, 68, 125, 126,
|
|
68, 128, 140, 129, 68, 130, 131, 68, 114, 68,
|
|
68, 132, 133, 136, 68, 127, 138, 137, 114, 68,
|
|
139, 134, 140, 134, 140, 127, 135, 140, 140, 140,
|
|
68, 140, 140, 68, 132, 133, 136, 68, 127, 138,
|
|
140, 135, 68, 139, 140, 140, 140, 140, 127, 31,
|
|
31, 140, 31, 32, 32, 140, 32, 46, 140, 46,
|
|
70, 70, 140, 70, 3, 140, 140, 140, 140, 140,
|
|
140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
|
|
|
|
140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
|
|
140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
|
|
140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
|
|
140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
|
|
140, 140, 140, 140, 140
|
|
} ;
|
|
|
|
static yyconst flex_int16_t yy_chk[446] =
|
|
{ 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, 1,
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
9, 17, 9, 11, 11, 14, 11, 18, 14, 19,
|
|
150, 22, 14, 14, 14, 20, 14, 14, 19, 24,
|
|
149, 20, 23, 17, 25, 147, 26, 35, 35, 18,
|
|
35, 146, 19, 22, 25, 145, 23, 20, 23, 143,
|
|
|
|
19, 50, 24, 20, 59, 23, 48, 25, 26, 134,
|
|
34, 43, 43, 34, 43, 49, 25, 34, 23, 34,
|
|
23, 34, 34, 37, 50, 51, 37, 59, 48, 112,
|
|
37, 37, 37, 39, 37, 37, 39, 49, 52, 53,
|
|
39, 95, 93, 54, 39, 39, 41, 51, 55, 41,
|
|
56, 39, 41, 41, 41, 71, 42, 41, 41, 42,
|
|
52, 53, 42, 42, 42, 54, 44, 42, 42, 44,
|
|
55, 57, 56, 44, 39, 58, 60, 44, 44, 45,
|
|
61, 92, 45, 92, 44, 36, 45, 45, 45, 33,
|
|
45, 45, 79, 57, 13, 62, 62, 58, 62, 60,
|
|
|
|
64, 64, 61, 64, 69, 66, 69, 44, 66, 69,
|
|
73, 73, 66, 73, 79, 67, 66, 66, 67, 77,
|
|
78, 12, 67, 66, 3, 81, 67, 67, 68, 75,
|
|
75, 68, 75, 67, 68, 68, 68, 68, 72, 68,
|
|
68, 72, 77, 78, 80, 72, 66, 72, 81, 72,
|
|
72, 82, 83, 0, 84, 85, 67, 86, 87, 88,
|
|
89, 90, 91, 94, 91, 94, 80, 91, 98, 101,
|
|
0, 102, 103, 82, 96, 83, 84, 96, 85, 86,
|
|
87, 96, 88, 89, 90, 96, 96, 104, 105, 106,
|
|
98, 107, 101, 102, 108, 103, 109, 110, 0, 117,
|
|
|
|
118, 113, 121, 122, 113, 0, 0, 0, 113, 104,
|
|
105, 106, 113, 113, 107, 132, 108, 114, 109, 110,
|
|
114, 117, 0, 118, 114, 121, 122, 115, 114, 114,
|
|
115, 124, 126, 128, 115, 114, 133, 132, 115, 115,
|
|
137, 127, 0, 127, 0, 115, 127, 0, 0, 0,
|
|
135, 0, 0, 135, 124, 126, 128, 135, 114, 133,
|
|
0, 135, 135, 137, 0, 0, 0, 0, 115, 141,
|
|
141, 0, 141, 142, 142, 0, 142, 144, 0, 144,
|
|
148, 148, 0, 148, 140, 140, 140, 140, 140, 140,
|
|
140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
|
|
|
|
140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
|
|
140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
|
|
140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
|
|
140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
|
|
140, 140, 140, 140, 140
|
|
} ;
|
|
|
|
extern int xyy_flex_debug;
|
|
int xyy_flex_debug = 0;
|
|
|
|
static yy_state_type *yy_state_buf=0, *yy_state_ptr=0;
|
|
static char *yy_full_match;
|
|
static int yy_lp;
|
|
static int yy_looking_for_trail_begin = 0;
|
|
static int yy_full_lp;
|
|
static int *yy_full_state;
|
|
#define YY_TRAILING_MASK 0x2000
|
|
#define YY_TRAILING_HEAD_MASK 0x4000
|
|
#define REJECT \
|
|
{ \
|
|
*yy_cp = (yy_hold_char); /* undo effects of setting up xyytext */ \
|
|
yy_cp = (yy_full_match); /* restore poss. backed-over text */ \
|
|
(yy_lp) = (yy_full_lp); /* restore orig. accepting pos. */ \
|
|
(yy_state_ptr) = (yy_full_state); /* restore orig. state */ \
|
|
yy_current_state = *(yy_state_ptr); /* restore curr. state */ \
|
|
++(yy_lp); \
|
|
goto find_rule; \
|
|
}
|
|
|
|
#define yymore() yymore_used_but_not_detected
|
|
#define YY_MORE_ADJ 0
|
|
#define YY_RESTORE_YY_MORE_OFFSET
|
|
char *xyytext;
|
|
#line 1 "xLexer.lxx"
|
|
/*
|
|
// Filename: xLexer.lxx
|
|
// Created by: drose (03Oct04)
|
|
//
|
|
////////////////////////////////////////////////////////////////////
|
|
*/
|
|
#line 9 "xLexer.lxx"
|
|
#include "xLexerDefs.h"
|
|
#include "xParserDefs.h"
|
|
#include "xParser.h"
|
|
#include "indent.h"
|
|
#include "string_utils.h"
|
|
#include "config_xfile.h"
|
|
|
|
static int yyinput(void); // declared by flex.
|
|
extern "C" int xyywrap();
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Static variables
|
|
////////////////////////////////////////////////////////////////////
|
|
|
|
// We'll increment line_number and col_number as we parse the file, so
|
|
// that we can report the position of an error.
|
|
int x_line_number = 0;
|
|
int x_col_number = 0;
|
|
|
|
// current_line holds as much of the current line as will fit. Its
|
|
// only purpose is for printing it out to report an error to the user.
|
|
static const int max_error_width = 1024;
|
|
char x_current_line[max_error_width + 1];
|
|
|
|
static int error_count = 0;
|
|
static int warning_count = 0;
|
|
|
|
// This is the pointer to the current input stream.
|
|
static istream *inp = NULL;
|
|
|
|
// This is the name of the x file we're parsing. We keep it so we
|
|
// can print it out for error messages.
|
|
static string x_filename;
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Defining the interface to the lexer.
|
|
////////////////////////////////////////////////////////////////////
|
|
|
|
void
|
|
x_init_lexer(istream &in, const string &filename) {
|
|
inp = ∈
|
|
x_filename = filename;
|
|
x_line_number = 0;
|
|
x_col_number = 0;
|
|
error_count = 0;
|
|
warning_count = 0;
|
|
}
|
|
|
|
int
|
|
x_error_count() {
|
|
return error_count;
|
|
}
|
|
|
|
int
|
|
x_warning_count() {
|
|
return warning_count;
|
|
}
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Internal support functions.
|
|
////////////////////////////////////////////////////////////////////
|
|
|
|
int
|
|
xyywrap(void) {
|
|
return 1;
|
|
}
|
|
|
|
void
|
|
xyyerror(const string &msg) {
|
|
xyyerror(msg, x_line_number, x_col_number, x_current_line);
|
|
}
|
|
|
|
void
|
|
xyyerror(const string &msg, int line_number, int col_number,
|
|
const string ¤t_line) {
|
|
xfile_cat.error(false) << "\nError";
|
|
if (!x_filename.empty()) {
|
|
xfile_cat.error(false) << " in " << x_filename;
|
|
}
|
|
xfile_cat.error(false)
|
|
<< " at line " << line_number << ", column " << col_number << ":\n"
|
|
<< current_line << "\n";
|
|
indent(xfile_cat.error(false), col_number-1)
|
|
<< "^\n" << msg << "\n\n";
|
|
|
|
error_count++;
|
|
}
|
|
|
|
void
|
|
xyywarning(const string &msg) {
|
|
xfile_cat.warning(false) << "\nWarning";
|
|
if (!x_filename.empty()) {
|
|
xfile_cat.warning(false) << " in " << x_filename;
|
|
}
|
|
xfile_cat.warning(false)
|
|
<< " at line " << x_line_number << ", column " << x_col_number << ":\n"
|
|
<< x_current_line << "\n";
|
|
indent(xfile_cat.warning(false), x_col_number-1)
|
|
<< "^\n" << msg << "\n\n";
|
|
|
|
warning_count++;
|
|
}
|
|
|
|
// Now define a function to take input from an istream instead of a
|
|
// stdio FILE pointer. This is flex-specific.
|
|
static void
|
|
input_chars(char *buffer, int &result, int max_size) {
|
|
nassertv(inp != NULL);
|
|
if (*inp) {
|
|
inp->read(buffer, max_size);
|
|
result = inp->gcount();
|
|
if (result >= 0 && result < max_size) {
|
|
// Truncate at the end of the read.
|
|
buffer[result] = '\0';
|
|
}
|
|
|
|
if (x_line_number == 0) {
|
|
// This is a special case. If we are reading the very first bit
|
|
// from the stream, copy it into the x_current_line array. This
|
|
// is because the \n.* rule below, which fills x_current_line
|
|
// normally, doesn't catch the first line.
|
|
strncpy(x_current_line, xyytext, max_error_width);
|
|
x_current_line[max_error_width] = '\0';
|
|
x_line_number++;
|
|
x_col_number = 0;
|
|
|
|
// Truncate it at the newline.
|
|
char *end = strchr(x_current_line, '\n');
|
|
if (end != NULL) {
|
|
*end = '\0';
|
|
}
|
|
}
|
|
|
|
} else {
|
|
// End of file or I/O error.
|
|
result = 0;
|
|
}
|
|
}
|
|
#undef YY_INPUT
|
|
#define YY_INPUT(buffer, result, max_size) input_chars(buffer, result, max_size)
|
|
|
|
// read_char reads and returns a single character, incrementing the
|
|
// supplied line and column numbers as appropriate. A convenience
|
|
// function for the scanning functions below.
|
|
static int
|
|
read_char(int &line, int &col) {
|
|
int c = yyinput();
|
|
if (c == '\n') {
|
|
line++;
|
|
col = 0;
|
|
} else {
|
|
col++;
|
|
}
|
|
return c;
|
|
}
|
|
|
|
// scan_quoted_string reads a string delimited by quotation marks and
|
|
// returns it.
|
|
static string
|
|
scan_quoted_string(char quote_mark) {
|
|
string result;
|
|
|
|
// We don't touch the current line number and column number during
|
|
// scanning, so that if we detect an error while scanning the string
|
|
// (e.g. an unterminated string), we'll report the error as
|
|
// occurring at the start of the string, not at the end--somewhat
|
|
// more convenient for the user.
|
|
|
|
// Instead of adjusting the global x_line_number and x_col_number
|
|
// variables, we'll operate on our own local variables for the
|
|
// interim.
|
|
int line = x_line_number;
|
|
int col = x_col_number;
|
|
|
|
int c;
|
|
c = read_char(line, col);
|
|
while (c != quote_mark && c != EOF) {
|
|
// A newline is not allowed within a string unless it is escaped.
|
|
if (c == '\n') {
|
|
c = EOF;
|
|
break;
|
|
|
|
} else if (c == '\\') {
|
|
// Backslash escapes the following character. We also respect
|
|
// some C conventions.
|
|
c = read_char(line, col);
|
|
switch (c) {
|
|
case 'a':
|
|
result += '\a';
|
|
c = read_char(line, col);
|
|
break;
|
|
|
|
case 'n':
|
|
result += '\n';
|
|
c = read_char(line, col);
|
|
break;
|
|
|
|
case 'r':
|
|
result += '\r';
|
|
c = read_char(line, col);
|
|
break;
|
|
|
|
case 't':
|
|
result += '\t';
|
|
c = read_char(line, col);
|
|
break;
|
|
|
|
case 'x':
|
|
{
|
|
int hex = 0;
|
|
c = read_char(line, col);
|
|
for (int i = 0; i < 2 && isxdigit(c); i++) {
|
|
hex = hex * 16 + (isdigit(c) ? c - '0' : tolower(c) - 'a' + 10);
|
|
c = read_char(line, col);
|
|
}
|
|
|
|
result += hex;
|
|
}
|
|
break;
|
|
|
|
case '0':
|
|
{
|
|
int oct = 0;
|
|
c = read_char(line, col);
|
|
for (int i = 0; i < 3 && (c >= '0' && c < '7'); i++) {
|
|
oct = oct * 8 + (c - '0');
|
|
c = read_char(line, col);
|
|
}
|
|
|
|
result += oct;
|
|
}
|
|
break;
|
|
|
|
case '1':
|
|
case '2':
|
|
case '3':
|
|
case '4':
|
|
case '5':
|
|
case '6':
|
|
case '7':
|
|
case '8':
|
|
case '9':
|
|
{
|
|
int dec = 0;
|
|
c = read_char(line, col);
|
|
for (int i = 0; i < 3 && isdigit(c); i++) {
|
|
dec = dec * 10 + (c - '0');
|
|
c = read_char(line, col);
|
|
}
|
|
|
|
result += dec;
|
|
}
|
|
break;
|
|
|
|
case EOF:
|
|
break;
|
|
|
|
default:
|
|
result += c;
|
|
c = read_char(line, col);
|
|
}
|
|
|
|
} else {
|
|
result += c;
|
|
c = read_char(line, col);
|
|
}
|
|
}
|
|
|
|
if (c == EOF) {
|
|
xyyerror("This quotation mark is unterminated.");
|
|
}
|
|
|
|
x_line_number = line;
|
|
x_col_number = col;
|
|
|
|
return result;
|
|
}
|
|
|
|
// scan_guid_string reads a string of hexadecimal digits delimited by
|
|
// angle brackets and returns the corresponding string.
|
|
static string
|
|
scan_guid_string() {
|
|
// We don't touch the current line number and column number during
|
|
// scanning, so that if we detect an error while scanning the string
|
|
// (e.g. an unterminated string), we'll report the error as
|
|
// occurring at the start of the string, not at the end--somewhat
|
|
// more convenient for the user.
|
|
|
|
// Instead of adjusting the global x_line_number and x_col_number
|
|
// variables, we'll operate on our own local variables for the
|
|
// interim.
|
|
int line = x_line_number;
|
|
int col = x_col_number;
|
|
|
|
int num_digits = 0;
|
|
int num_hyphens = 0;
|
|
|
|
string result;
|
|
|
|
int c;
|
|
c = read_char(line, col);
|
|
while (c != '>' && c != EOF) {
|
|
if (isxdigit(c)) {
|
|
num_digits++;
|
|
|
|
} else if (c == '-') {
|
|
num_hyphens++;
|
|
|
|
} else {
|
|
x_line_number = line;
|
|
x_col_number = col;
|
|
xyyerror("Invalid character in GUID.");
|
|
return string();
|
|
}
|
|
|
|
result += c;
|
|
|
|
c = read_char(line, col);
|
|
}
|
|
|
|
if (c == EOF) {
|
|
xyyerror("This GUID string is unterminated.");
|
|
return string();
|
|
|
|
} else if (num_digits != 32) {
|
|
xyyerror("Incorrect number of hex digits in GUID.");
|
|
return string();
|
|
|
|
} else if (num_hyphens != 4) {
|
|
xyyerror("Incorrect number of hyphens in GUID.");
|
|
return string();
|
|
}
|
|
|
|
x_line_number = line;
|
|
x_col_number = col;
|
|
|
|
return result;
|
|
}
|
|
|
|
// Parses the text into a list of integers and returns them.
|
|
static PTA_int
|
|
scan_int_list(const string &text) {
|
|
PTA_int result;
|
|
|
|
vector_string words;
|
|
tokenize(text, words, ",;");
|
|
|
|
vector_string::const_iterator wi;
|
|
for (wi = words.begin(); wi != words.end(); ++wi) {
|
|
string trimmed = trim(*wi);
|
|
if (!trimmed.empty()) {
|
|
int number = 0;
|
|
string_to_int(trimmed, number);
|
|
result.push_back(number);
|
|
}
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
// Parses the text into a list of doubles and returns them.
|
|
static PTA_double
|
|
scan_double_list(const string &text) {
|
|
PTA_double result;
|
|
|
|
vector_string words;
|
|
tokenize(text, words, ",;");
|
|
|
|
vector_string::const_iterator wi;
|
|
for (wi = words.begin(); wi != words.end(); ++wi) {
|
|
string trimmed = trim(*wi);
|
|
if (!trimmed.empty()) {
|
|
double number = 0.0;
|
|
string_to_double(trimmed, number);
|
|
result.push_back(number);
|
|
}
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
|
|
|
|
// accept() is called below as each piece is pulled off and
|
|
// accepted by the lexer; it increments the current column number.
|
|
inline void accept() {
|
|
x_col_number += xyyleng;
|
|
}
|
|
|
|
#line 1049 "lex.yy.c"
|
|
|
|
#define INITIAL 0
|
|
|
|
#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.
|
|
*/
|
|
#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 xyylex_destroy (void );
|
|
|
|
int xyyget_debug (void );
|
|
|
|
void xyyset_debug (int debug_flag );
|
|
|
|
YY_EXTRA_TYPE xyyget_extra (void );
|
|
|
|
void xyyset_extra (YY_EXTRA_TYPE user_defined );
|
|
|
|
FILE *xyyget_in (void );
|
|
|
|
void xyyset_in (FILE * in_str );
|
|
|
|
FILE *xyyget_out (void );
|
|
|
|
void xyyset_out (FILE * out_str );
|
|
|
|
int xyyget_leng (void );
|
|
|
|
char *xyyget_text (void );
|
|
|
|
int xyyget_lineno (void );
|
|
|
|
void xyyset_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 xyywrap (void );
|
|
#else
|
|
extern int xyywrap (void );
|
|
#endif
|
|
#endif
|
|
|
|
static void yyunput (int c,char *buf_ptr );
|
|
|
|
#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
|
|
|
|
/* Amount of stuff to slurp up with each read. */
|
|
#ifndef YY_READ_BUF_SIZE
|
|
#define YY_READ_BUF_SIZE 8192
|
|
#endif
|
|
|
|
/* Copy whatever the last rule matched to the standard output. */
|
|
#ifndef ECHO
|
|
/* This used to be an fputs(), but since the string might contain NUL's,
|
|
* we now use fwrite().
|
|
*/
|
|
#define ECHO fwrite( xyytext, xyyleng, 1, xyyout )
|
|
#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 = '*'; \
|
|
unsigned n; \
|
|
for ( n = 0; n < max_size && \
|
|
(c = getc( xyyin )) != EOF && c != '\n'; ++n ) \
|
|
buf[n] = (char) c; \
|
|
if ( c == '\n' ) \
|
|
buf[n++] = (char) c; \
|
|
if ( c == EOF && ferror( xyyin ) ) \
|
|
YY_FATAL_ERROR( "input in flex scanner failed" ); \
|
|
result = n; \
|
|
} \
|
|
else \
|
|
{ \
|
|
errno=0; \
|
|
while ( (result = fread(buf, 1, max_size, xyyin))==0 && ferror(xyyin)) \
|
|
{ \
|
|
if( errno != EINTR) \
|
|
{ \
|
|
YY_FATAL_ERROR( "input in flex scanner failed" ); \
|
|
break; \
|
|
} \
|
|
errno=0; \
|
|
clearerr(xyyin); \
|
|
} \
|
|
}\
|
|
\
|
|
|
|
#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 xyylex (void);
|
|
|
|
#define YY_DECL int xyylex (void)
|
|
#endif /* !YY_DECL */
|
|
|
|
/* Code executed at the beginning of each rule, after xyytext and xyyleng
|
|
* 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 \
|
|
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 407 "xLexer.lxx"
|
|
|
|
|
|
|
|
|
|
|
|
#line 1237 "lex.yy.c"
|
|
|
|
if ( !(yy_init) )
|
|
{
|
|
(yy_init) = 1;
|
|
|
|
#ifdef YY_USER_INIT
|
|
YY_USER_INIT;
|
|
#endif
|
|
|
|
/* Create the reject buffer large enough to save one state per allowed character. */
|
|
if ( ! (yy_state_buf) )
|
|
(yy_state_buf) = (yy_state_type *)xyyalloc(YY_STATE_BUF_SIZE );
|
|
if ( ! (yy_state_buf) )
|
|
YY_FATAL_ERROR( "out of dynamic memory in xyylex()" );
|
|
|
|
if ( ! (yy_start) )
|
|
(yy_start) = 1; /* first start state */
|
|
|
|
if ( ! xyyin )
|
|
xyyin = stdin;
|
|
|
|
if ( ! xyyout )
|
|
xyyout = stdout;
|
|
|
|
if ( ! YY_CURRENT_BUFFER ) {
|
|
xyyensure_buffer_stack ();
|
|
YY_CURRENT_BUFFER_LVALUE =
|
|
xyy_create_buffer(xyyin,YY_BUF_SIZE );
|
|
}
|
|
|
|
xyy_load_buffer_state( );
|
|
}
|
|
|
|
while ( 1 ) /* loops until end-of-file is reached */
|
|
{
|
|
yy_cp = (yy_c_buf_p);
|
|
|
|
/* Support of xyytext. */
|
|
*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_state_ptr) = (yy_state_buf);
|
|
*(yy_state_ptr)++ = yy_current_state;
|
|
|
|
yy_match:
|
|
do
|
|
{
|
|
register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*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 >= 141 )
|
|
yy_c = yy_meta[(unsigned int) yy_c];
|
|
}
|
|
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
|
*(yy_state_ptr)++ = yy_current_state;
|
|
++yy_cp;
|
|
}
|
|
while ( yy_base[yy_current_state] != 385 );
|
|
|
|
yy_find_action:
|
|
yy_current_state = *--(yy_state_ptr);
|
|
(yy_lp) = yy_accept[yy_current_state];
|
|
find_rule: /* we branch to this label when backing up */
|
|
for ( ; ; ) /* until we find what rule we matched */
|
|
{
|
|
if ( (yy_lp) && (yy_lp) < yy_accept[yy_current_state + 1] )
|
|
{
|
|
yy_act = yy_acclist[(yy_lp)];
|
|
if ( yy_act & YY_TRAILING_HEAD_MASK ||
|
|
(yy_looking_for_trail_begin) )
|
|
{
|
|
if ( yy_act == (yy_looking_for_trail_begin) )
|
|
{
|
|
(yy_looking_for_trail_begin) = 0;
|
|
yy_act &= ~YY_TRAILING_HEAD_MASK;
|
|
break;
|
|
}
|
|
}
|
|
else if ( yy_act & YY_TRAILING_MASK )
|
|
{
|
|
(yy_looking_for_trail_begin) = yy_act & ~YY_TRAILING_MASK;
|
|
(yy_looking_for_trail_begin) |= YY_TRAILING_HEAD_MASK;
|
|
}
|
|
else
|
|
{
|
|
(yy_full_match) = yy_cp;
|
|
(yy_full_state) = (yy_state_ptr);
|
|
(yy_full_lp) = (yy_lp);
|
|
break;
|
|
}
|
|
++(yy_lp);
|
|
goto find_rule;
|
|
}
|
|
--yy_cp;
|
|
yy_current_state = *--(yy_state_ptr);
|
|
(yy_lp) = 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 1:
|
|
/* rule 1 can match eol */
|
|
YY_RULE_SETUP
|
|
#line 412 "xLexer.lxx"
|
|
{
|
|
// New line. Save a copy of the line so we can print it out for the
|
|
// benefit of the user in case we get an error.
|
|
|
|
strncpy(x_current_line, xyytext+1, max_error_width);
|
|
x_current_line[max_error_width] = '\0';
|
|
x_line_number++;
|
|
x_col_number=0;
|
|
|
|
// Return the whole line to the lexer, except the newline character,
|
|
// which we eat.
|
|
yyless(1);
|
|
}
|
|
YY_BREAK
|
|
case 2:
|
|
YY_RULE_SETUP
|
|
#line 426 "xLexer.lxx"
|
|
{
|
|
// Eat whitespace.
|
|
accept();
|
|
}
|
|
YY_BREAK
|
|
case 3:
|
|
YY_RULE_SETUP
|
|
#line 431 "xLexer.lxx"
|
|
{
|
|
// Eat C++-style comments.
|
|
accept();
|
|
}
|
|
YY_BREAK
|
|
case 4:
|
|
YY_RULE_SETUP
|
|
#line 436 "xLexer.lxx"
|
|
{
|
|
// Eat sh-style comments.
|
|
accept();
|
|
}
|
|
YY_BREAK
|
|
case 5:
|
|
YY_RULE_SETUP
|
|
#line 441 "xLexer.lxx"
|
|
{
|
|
accept();
|
|
return TOKEN_OBRACE;
|
|
}
|
|
YY_BREAK
|
|
case 6:
|
|
YY_RULE_SETUP
|
|
#line 446 "xLexer.lxx"
|
|
{
|
|
accept();
|
|
return TOKEN_CBRACE;
|
|
}
|
|
YY_BREAK
|
|
case 7:
|
|
YY_RULE_SETUP
|
|
#line 451 "xLexer.lxx"
|
|
{
|
|
accept();
|
|
return TOKEN_OBRACKET;
|
|
}
|
|
YY_BREAK
|
|
case 8:
|
|
YY_RULE_SETUP
|
|
#line 456 "xLexer.lxx"
|
|
{
|
|
accept();
|
|
return TOKEN_CBRACKET;
|
|
}
|
|
YY_BREAK
|
|
case 9:
|
|
YY_RULE_SETUP
|
|
#line 461 "xLexer.lxx"
|
|
{
|
|
accept();
|
|
return TOKEN_DOT;
|
|
}
|
|
YY_BREAK
|
|
case 10:
|
|
YY_RULE_SETUP
|
|
#line 466 "xLexer.lxx"
|
|
{
|
|
accept();
|
|
return TOKEN_COMMA;
|
|
}
|
|
YY_BREAK
|
|
case 11:
|
|
YY_RULE_SETUP
|
|
#line 471 "xLexer.lxx"
|
|
{
|
|
accept();
|
|
return TOKEN_SEMICOLON;
|
|
}
|
|
YY_BREAK
|
|
case 12:
|
|
YY_RULE_SETUP
|
|
#line 476 "xLexer.lxx"
|
|
{
|
|
accept();
|
|
return TOKEN_ARRAY;
|
|
}
|
|
YY_BREAK
|
|
case 13:
|
|
YY_RULE_SETUP
|
|
#line 481 "xLexer.lxx"
|
|
{
|
|
accept();
|
|
return TOKEN_UCHAR;
|
|
}
|
|
YY_BREAK
|
|
case 14:
|
|
YY_RULE_SETUP
|
|
#line 486 "xLexer.lxx"
|
|
{
|
|
accept();
|
|
return TOKEN_CHAR;
|
|
}
|
|
YY_BREAK
|
|
case 15:
|
|
YY_RULE_SETUP
|
|
#line 491 "xLexer.lxx"
|
|
{
|
|
accept();
|
|
return TOKEN_CSTRING;
|
|
}
|
|
YY_BREAK
|
|
case 16:
|
|
YY_RULE_SETUP
|
|
#line 496 "xLexer.lxx"
|
|
{
|
|
accept();
|
|
return TOKEN_DOUBLE;
|
|
}
|
|
YY_BREAK
|
|
case 17:
|
|
YY_RULE_SETUP
|
|
#line 501 "xLexer.lxx"
|
|
{
|
|
accept();
|
|
return TOKEN_DWORD;
|
|
}
|
|
YY_BREAK
|
|
case 18:
|
|
YY_RULE_SETUP
|
|
#line 506 "xLexer.lxx"
|
|
{
|
|
accept();
|
|
return TOKEN_SDWORD;
|
|
}
|
|
YY_BREAK
|
|
case 19:
|
|
YY_RULE_SETUP
|
|
#line 511 "xLexer.lxx"
|
|
{
|
|
accept();
|
|
return TOKEN_FLOAT;
|
|
}
|
|
YY_BREAK
|
|
case 20:
|
|
YY_RULE_SETUP
|
|
#line 516 "xLexer.lxx"
|
|
{
|
|
accept();
|
|
return TOKEN_LPSTR;
|
|
}
|
|
YY_BREAK
|
|
case 21:
|
|
YY_RULE_SETUP
|
|
#line 521 "xLexer.lxx"
|
|
{
|
|
accept();
|
|
return TOKEN_TEMPLATE;
|
|
}
|
|
YY_BREAK
|
|
case 22:
|
|
YY_RULE_SETUP
|
|
#line 526 "xLexer.lxx"
|
|
{
|
|
accept();
|
|
return TOKEN_UCHAR;
|
|
}
|
|
YY_BREAK
|
|
case 23:
|
|
YY_RULE_SETUP
|
|
#line 531 "xLexer.lxx"
|
|
{
|
|
accept();
|
|
return TOKEN_UNICODE;
|
|
}
|
|
YY_BREAK
|
|
case 24:
|
|
YY_RULE_SETUP
|
|
#line 536 "xLexer.lxx"
|
|
{
|
|
accept();
|
|
return TOKEN_SWORD;
|
|
}
|
|
YY_BREAK
|
|
case 25:
|
|
YY_RULE_SETUP
|
|
#line 541 "xLexer.lxx"
|
|
{
|
|
accept();
|
|
return TOKEN_WORD;
|
|
}
|
|
YY_BREAK
|
|
case 26:
|
|
YY_RULE_SETUP
|
|
#line 546 "xLexer.lxx"
|
|
{
|
|
// A signed or unsigned integer number.
|
|
accept();
|
|
xyylval.u.number = atol(xyytext);
|
|
xyylval.str = trim_right(xyytext);
|
|
|
|
return TOKEN_INTEGER;
|
|
}
|
|
YY_BREAK
|
|
case 27:
|
|
YY_RULE_SETUP
|
|
#line 555 "xLexer.lxx"
|
|
{
|
|
// An integer as part of a semicolon- or comma-delimited list.
|
|
accept();
|
|
xyylval.int_list = scan_int_list(xyytext);
|
|
|
|
return TOKEN_INTEGER_LIST;
|
|
}
|
|
YY_BREAK
|
|
case 28:
|
|
YY_RULE_SETUP
|
|
#line 563 "xLexer.lxx"
|
|
{
|
|
// This rule is used to match an integer list that is followed by a
|
|
// floating-point number. It's designed to prevent "0;0.5" from
|
|
// being interpreted as "0;0" followed by ".5".
|
|
accept();
|
|
xyylval.int_list = scan_int_list(xyytext);
|
|
|
|
return TOKEN_INTEGER_LIST;
|
|
}
|
|
YY_BREAK
|
|
case 29:
|
|
YY_RULE_SETUP
|
|
#line 573 "xLexer.lxx"
|
|
{
|
|
// A floating-point number as part of a semicolon- or comma-delimited list.
|
|
accept();
|
|
xyylval.double_list = scan_double_list(xyytext);
|
|
|
|
return TOKEN_REALNUM_LIST;
|
|
}
|
|
YY_BREAK
|
|
case 30:
|
|
YY_RULE_SETUP
|
|
#line 581 "xLexer.lxx"
|
|
{
|
|
// Quoted string.
|
|
accept();
|
|
xyylval.str = scan_quoted_string('"');
|
|
return TOKEN_STRING;
|
|
}
|
|
YY_BREAK
|
|
case 31:
|
|
YY_RULE_SETUP
|
|
#line 588 "xLexer.lxx"
|
|
{
|
|
// Long GUID string.
|
|
accept();
|
|
xyylval.str = scan_guid_string();
|
|
|
|
if (!xyylval.guid.parse_string(xyylval.str)) {
|
|
xyyerror("Malformed GUID.");
|
|
}
|
|
|
|
return TOKEN_GUID;
|
|
}
|
|
YY_BREAK
|
|
case 32:
|
|
YY_RULE_SETUP
|
|
#line 600 "xLexer.lxx"
|
|
{
|
|
// Identifier.
|
|
accept();
|
|
xyylval.str = xyytext;
|
|
return TOKEN_NAME;
|
|
}
|
|
YY_BREAK
|
|
case 33:
|
|
YY_RULE_SETUP
|
|
#line 607 "xLexer.lxx"
|
|
{
|
|
// Identifier with leading digit.
|
|
accept();
|
|
xyylval.str = xyytext;
|
|
return TOKEN_NAME;
|
|
}
|
|
YY_BREAK
|
|
case 34:
|
|
YY_RULE_SETUP
|
|
#line 614 "xLexer.lxx"
|
|
{
|
|
// Any other character is invalid.
|
|
accept();
|
|
xyyerror("Invalid character '" + string(xyytext) + "'.");
|
|
}
|
|
YY_BREAK
|
|
case 35:
|
|
YY_RULE_SETUP
|
|
#line 619 "xLexer.lxx"
|
|
ECHO;
|
|
YY_BREAK
|
|
#line 1665 "lex.yy.c"
|
|
case YY_STATE_EOF(INITIAL):
|
|
yyterminate();
|
|
|
|
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 xyyin at a new source and called
|
|
* xyylex(). 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 = xyyin;
|
|
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_c_buf_p);
|
|
goto yy_find_action;
|
|
}
|
|
}
|
|
|
|
else switch ( yy_get_next_buffer( ) )
|
|
{
|
|
case EOB_ACT_END_OF_FILE:
|
|
{
|
|
(yy_did_buffer_switch_on_eof) = 0;
|
|
|
|
if ( xyywrap( ) )
|
|
{
|
|
/* Note: because we've taken care in
|
|
* yy_get_next_buffer() to have set up
|
|
* xyytext, 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 xyylex */
|
|
|
|
/* 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. */
|
|
|
|
YY_FATAL_ERROR(
|
|
"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
|
|
|
|
}
|
|
|
|
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;
|
|
xyyrestart(xyyin );
|
|
}
|
|
|
|
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 *) xyyrealloc((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_state_ptr) = (yy_state_buf);
|
|
*(yy_state_ptr)++ = yy_current_state;
|
|
|
|
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);
|
|
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 >= 141 )
|
|
yy_c = yy_meta[(unsigned int) yy_c];
|
|
}
|
|
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
|
*(yy_state_ptr)++ = yy_current_state;
|
|
}
|
|
|
|
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 YY_CHAR yy_c = 1;
|
|
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 >= 141 )
|
|
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 == 140);
|
|
if ( ! yy_is_jam )
|
|
*(yy_state_ptr)++ = yy_current_state;
|
|
|
|
return yy_is_jam ? 0 : yy_current_state;
|
|
}
|
|
|
|
static void yyunput (int c, register char * yy_bp )
|
|
{
|
|
register char *yy_cp;
|
|
|
|
yy_cp = (yy_c_buf_p);
|
|
|
|
/* undo effects of setting up xyytext */
|
|
*yy_cp = (yy_hold_char);
|
|
|
|
if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
|
|
{ /* need to shift things up to make room */
|
|
/* +2 for EOB chars. */
|
|
register int number_to_move = (yy_n_chars) + 2;
|
|
register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
|
|
YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
|
|
register char *source =
|
|
&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
|
|
|
|
while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
|
|
*--dest = *--source;
|
|
|
|
yy_cp += (int) (dest - source);
|
|
yy_bp += (int) (dest - source);
|
|
YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
|
|
(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
|
|
|
|
if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
|
|
YY_FATAL_ERROR( "flex scanner push-back overflow" );
|
|
}
|
|
|
|
*--yy_cp = (char) c;
|
|
|
|
(yytext_ptr) = yy_bp;
|
|
(yy_hold_char) = *yy_cp;
|
|
(yy_c_buf_p) = yy_cp;
|
|
}
|
|
|
|
#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. */
|
|
xyyrestart(xyyin );
|
|
|
|
/*FALLTHROUGH*/
|
|
|
|
case EOB_ACT_END_OF_FILE:
|
|
{
|
|
if ( xyywrap( ) )
|
|
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 xyytext */
|
|
(yy_hold_char) = *++(yy_c_buf_p);
|
|
|
|
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 xyyrestart (FILE * input_file )
|
|
{
|
|
|
|
if ( ! YY_CURRENT_BUFFER ){
|
|
xyyensure_buffer_stack ();
|
|
YY_CURRENT_BUFFER_LVALUE =
|
|
xyy_create_buffer(xyyin,YY_BUF_SIZE );
|
|
}
|
|
|
|
xyy_init_buffer(YY_CURRENT_BUFFER,input_file );
|
|
xyy_load_buffer_state( );
|
|
}
|
|
|
|
/** Switch to a different input buffer.
|
|
* @param new_buffer The new input buffer.
|
|
*
|
|
*/
|
|
void xyy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
|
|
{
|
|
|
|
/* TODO. We should be able to replace this entire function body
|
|
* with
|
|
* xyypop_buffer_state();
|
|
* xyypush_buffer_state(new_buffer);
|
|
*/
|
|
xyyensure_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;
|
|
xyy_load_buffer_state( );
|
|
|
|
/* We don't actually know whether we did this switch during
|
|
* EOF (xyywrap()) processing, but the only time this flag
|
|
* is looked at is after xyywrap() is called, so it's safe
|
|
* to go ahead and always set it.
|
|
*/
|
|
(yy_did_buffer_switch_on_eof) = 1;
|
|
}
|
|
|
|
static void xyy_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;
|
|
xyyin = 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 xyy_create_buffer (FILE * file, int size )
|
|
{
|
|
YY_BUFFER_STATE b;
|
|
|
|
b = (YY_BUFFER_STATE) xyyalloc(sizeof( struct yy_buffer_state ) );
|
|
if ( ! b )
|
|
YY_FATAL_ERROR( "out of dynamic memory in xyy_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 *) xyyalloc(b->yy_buf_size + 2 );
|
|
if ( ! b->yy_ch_buf )
|
|
YY_FATAL_ERROR( "out of dynamic memory in xyy_create_buffer()" );
|
|
|
|
b->yy_is_our_buffer = 1;
|
|
|
|
xyy_init_buffer(b,file );
|
|
|
|
return b;
|
|
}
|
|
|
|
/** Destroy the buffer.
|
|
* @param b a buffer created with xyy_create_buffer()
|
|
*
|
|
*/
|
|
void xyy_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 )
|
|
xyyfree((void *) b->yy_ch_buf );
|
|
|
|
xyyfree((void *) b );
|
|
}
|
|
|
|
#ifndef __cplusplus
|
|
extern int isatty (int );
|
|
#endif /* __cplusplus */
|
|
|
|
/* Initializes or reinitializes a buffer.
|
|
* This function is sometimes called more than once on the same buffer,
|
|
* such as during a xyyrestart() or at EOF.
|
|
*/
|
|
static void xyy_init_buffer (YY_BUFFER_STATE b, FILE * file )
|
|
|
|
{
|
|
int oerrno = errno;
|
|
|
|
xyy_flush_buffer(b );
|
|
|
|
b->yy_input_file = file;
|
|
b->yy_fill_buffer = 1;
|
|
|
|
/* If b is the current buffer, then xyy_init_buffer was _probably_
|
|
* called from xyyrestart() 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 = file ? (isatty( fileno(file) ) > 0) : 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 xyy_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 )
|
|
xyy_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 xyypush_buffer_state (YY_BUFFER_STATE new_buffer )
|
|
{
|
|
if (new_buffer == NULL)
|
|
return;
|
|
|
|
xyyensure_buffer_stack();
|
|
|
|
/* This block is copied from xyy_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 xyy_switch_to_buffer. */
|
|
xyy_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 xyypop_buffer_state (void)
|
|
{
|
|
if (!YY_CURRENT_BUFFER)
|
|
return;
|
|
|
|
xyy_delete_buffer(YY_CURRENT_BUFFER );
|
|
YY_CURRENT_BUFFER_LVALUE = NULL;
|
|
if ((yy_buffer_stack_top) > 0)
|
|
--(yy_buffer_stack_top);
|
|
|
|
if (YY_CURRENT_BUFFER) {
|
|
xyy_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 xyyensure_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**)xyyalloc
|
|
(num_to_alloc * sizeof(struct yy_buffer_state*)
|
|
);
|
|
if ( ! (yy_buffer_stack) )
|
|
YY_FATAL_ERROR( "out of dynamic memory in xyyensure_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**)xyyrealloc
|
|
((yy_buffer_stack),
|
|
num_to_alloc * sizeof(struct yy_buffer_state*)
|
|
);
|
|
if ( ! (yy_buffer_stack) )
|
|
YY_FATAL_ERROR( "out of dynamic memory in xyyensure_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 xyy_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) xyyalloc(sizeof( struct yy_buffer_state ) );
|
|
if ( ! b )
|
|
YY_FATAL_ERROR( "out of dynamic memory in xyy_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;
|
|
|
|
xyy_switch_to_buffer(b );
|
|
|
|
return b;
|
|
}
|
|
|
|
/** Setup the input buffer state to scan a string. The next call to xyylex() 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
|
|
* xyy_scan_bytes() instead.
|
|
*/
|
|
YY_BUFFER_STATE xyy_scan_string (yyconst char * yystr )
|
|
{
|
|
|
|
return xyy_scan_bytes(yystr,strlen(yystr) );
|
|
}
|
|
|
|
/** Setup the input buffer state to scan the given bytes. The next call to xyylex() will
|
|
* scan from a @e copy of @a bytes.
|
|
* @param bytes the byte buffer to scan
|
|
* @param len the number of bytes in the buffer pointed to by @a bytes.
|
|
*
|
|
* @return the newly allocated buffer state object.
|
|
*/
|
|
YY_BUFFER_STATE xyy_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 *) xyyalloc(n );
|
|
if ( ! buf )
|
|
YY_FATAL_ERROR( "out of dynamic memory in xyy_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 = xyy_scan_buffer(buf,n );
|
|
if ( ! b )
|
|
YY_FATAL_ERROR( "bad buffer in xyy_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;
|
|
}
|
|
|
|
#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 xyytext. */ \
|
|
int yyless_macro_arg = (n); \
|
|
YY_LESS_LINENO(yyless_macro_arg);\
|
|
xyytext[xyyleng] = (yy_hold_char); \
|
|
(yy_c_buf_p) = xyytext + yyless_macro_arg; \
|
|
(yy_hold_char) = *(yy_c_buf_p); \
|
|
*(yy_c_buf_p) = '\0'; \
|
|
xyyleng = yyless_macro_arg; \
|
|
} \
|
|
while ( 0 )
|
|
|
|
/* Accessor methods (get/set functions) to struct members. */
|
|
|
|
/** Get the current line number.
|
|
*
|
|
*/
|
|
int xyyget_lineno (void)
|
|
{
|
|
|
|
return xyylineno;
|
|
}
|
|
|
|
/** Get the input stream.
|
|
*
|
|
*/
|
|
FILE *xyyget_in (void)
|
|
{
|
|
return xyyin;
|
|
}
|
|
|
|
/** Get the output stream.
|
|
*
|
|
*/
|
|
FILE *xyyget_out (void)
|
|
{
|
|
return xyyout;
|
|
}
|
|
|
|
/** Get the length of the current token.
|
|
*
|
|
*/
|
|
int xyyget_leng (void)
|
|
{
|
|
return xyyleng;
|
|
}
|
|
|
|
/** Get the current token.
|
|
*
|
|
*/
|
|
|
|
char *xyyget_text (void)
|
|
{
|
|
return xyytext;
|
|
}
|
|
|
|
/** Set the current line number.
|
|
* @param line_number
|
|
*
|
|
*/
|
|
void xyyset_lineno (int line_number )
|
|
{
|
|
|
|
xyylineno = line_number;
|
|
}
|
|
|
|
/** Set the input stream. This does not discard the current
|
|
* input buffer.
|
|
* @param in_str A readable stream.
|
|
*
|
|
* @see xyy_switch_to_buffer
|
|
*/
|
|
void xyyset_in (FILE * in_str )
|
|
{
|
|
xyyin = in_str ;
|
|
}
|
|
|
|
void xyyset_out (FILE * out_str )
|
|
{
|
|
xyyout = out_str ;
|
|
}
|
|
|
|
int xyyget_debug (void)
|
|
{
|
|
return xyy_flex_debug;
|
|
}
|
|
|
|
void xyyset_debug (int bdebug )
|
|
{
|
|
xyy_flex_debug = bdebug ;
|
|
}
|
|
|
|
static int yy_init_globals (void)
|
|
{
|
|
/* Initialization is the same as for the non-reentrant scanner.
|
|
* This function is called from xyylex_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_state_buf) = 0;
|
|
(yy_state_ptr) = 0;
|
|
(yy_full_match) = 0;
|
|
(yy_lp) = 0;
|
|
|
|
/* Defined in main.c */
|
|
#ifdef YY_STDINIT
|
|
xyyin = stdin;
|
|
xyyout = stdout;
|
|
#else
|
|
xyyin = (FILE *) 0;
|
|
xyyout = (FILE *) 0;
|
|
#endif
|
|
|
|
/* For future reference: Set errno on error, since we are called by
|
|
* xyylex_init()
|
|
*/
|
|
return 0;
|
|
}
|
|
|
|
/* xyylex_destroy is for both reentrant and non-reentrant scanners. */
|
|
int xyylex_destroy (void)
|
|
{
|
|
|
|
/* Pop the buffer stack, destroying each element. */
|
|
while(YY_CURRENT_BUFFER){
|
|
xyy_delete_buffer(YY_CURRENT_BUFFER );
|
|
YY_CURRENT_BUFFER_LVALUE = NULL;
|
|
xyypop_buffer_state();
|
|
}
|
|
|
|
/* Destroy the stack itself. */
|
|
xyyfree((yy_buffer_stack) );
|
|
(yy_buffer_stack) = NULL;
|
|
|
|
xyyfree ( (yy_state_buf) );
|
|
(yy_state_buf) = NULL;
|
|
|
|
/* Reset the globals. This is important in a non-reentrant scanner so the next time
|
|
* xyylex() 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 *xyyalloc (yy_size_t size )
|
|
{
|
|
return (void *) malloc( size );
|
|
}
|
|
|
|
void *xyyrealloc (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 xyyfree (void * ptr )
|
|
{
|
|
free( (char *) ptr ); /* see xyyrealloc() for (char *) cast */
|
|
}
|
|
|
|
#define YYTABLES_NAME "yytables"
|
|
|
|
#line 619 "xLexer.lxx"
|