/* A lexical scanner generated by flex */
/* Scanner skeleton version:
* $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $
*/
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
#include <stdio.h>
#include <unistd.h>
/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
#ifdef c_plusplus
#ifndef __cplusplus
#define __cplusplus
#endif
#endif
#ifdef __cplusplus
#include <stdlib.h>
/* Use prototypes in function declarations. */
#define YY_USE_PROTOS
/* The "const" storage-class-modifier is valid. */
#define YY_USE_CONST
#else /* ! __cplusplus */
#if __STDC__
#define YY_USE_PROTOS
#define YY_USE_CONST
#endif /* __STDC__ */
#endif /* ! __cplusplus */
#ifdef __TURBOC__
#pragma warn -rch
#pragma warn -use
#include <io.h>
#include <stdlib.h>
#define YY_USE_CONST
#define YY_USE_PROTOS
#endif
#ifdef YY_USE_CONST
#define yyconst const
#else
#define yyconst
#endif
#ifdef YY_USE_PROTOS
#define YY_PROTO(proto) proto
#else
#define YY_PROTO(proto) ()
#endif
/* Returned upon end-of-file. */
#define YY_NULL 0
/* Promotes a possibly negative, possibly signed char to an unsigned
* integer for use as an array index. If the signed char is negative,
* we want to instead treat it as an 8-bit unsigned char, hence the
* double cast.
*/
#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
/* Enter a start condition. This macro really ought to take a parameter,
* but we do it the disgusting crufty way forced on us by the ()-less
* definition of BEGIN.
*/
#define BEGIN yy_start = 1 + 2 *
/* Translate the current start state into a value that can be later handed
* to BEGIN to return to the state. The YYSTATE alias is for lex
* compatibility.
*/
#define YY_START ((yy_start - 1) / 2)
#define YYSTATE YY_START
/* Action number for EOF rule of a given start state. */
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
/* Special action meaning "start processing a new file". */
#define YY_NEW_FILE yyrestart( yyin )
#define YY_END_OF_BUFFER_CHAR 0
/* Size of default input buffer. */
#define YY_BUF_SIZE 16384
typedef struct yy_buffer_state *YY_BUFFER_STATE;
extern int yyleng;
extern FILE *yyin, *yyout;
#define EOB_ACT_CONTINUE_SCAN 0
#define EOB_ACT_END_OF_FILE 1
#define EOB_ACT_LAST_MATCH 2
/* The funky do-while in the following #define is used to turn the definition
* int a single C statement (which needs a semi-colon terminator). This
* avoids problems with code like:
*
* if ( condition_holds )
* yyless( 5 );
* else
* do_something_else();
*
* Prior to using the do-while the compiler would get upset at the
* "else" because it interpreted the "if" statement as being all
* done when it reached the ';' after the yyless() call.
*/
/* Return all but the first 'n' matched characters back to the input stream. */
#define yyless(n) \
do \
{ \
/* Undo effects of setting up yytext. */ \
*yy_cp = yy_hold_char; \
YY_RESTORE_YY_MORE_OFFSET \
yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
YY_DO_BEFORE_ACTION; /* set up yytext again */ \
} \
while ( 0 )
#define unput(c) yyunput( c, yytext_ptr )
/* The following is because we cannot portably get our hands on size_t
* (without autoconf's help, which isn't available because we want
* flex-generated scanners to compile on their own).
*/
typedef unsigned int yy_size_t;
struct yy_buffer_state
{
FILE *yy_input_file;
char *yy_ch_buf; /* input buffer */
char *yy_buf_pos; /* current position in input buffer */
/* Size of input buffer in bytes, not including room for EOB
* characters.
*/
yy_size_t yy_buf_size;
/* Number of characters read into yy_ch_buf, not including EOB
* characters.
*/
int yy_n_chars;
/* Whether we "own" the buffer - i.e., we know we created it,
* and can realloc() it to grow it, and should free() it to
* delete it.
*/
int yy_is_our_buffer;
/* Whether this is an "interactive" input source; if so, and
* if we're using stdio for input, then we want to use getc()
* instead of fread(), to make sure we stop fetching input after
* each newline.
*/
int yy_is_interactive;
/* Whether we're considered to be at the beginning of a line.
* If so, '^' rules will be active on the next match, otherwise
* not.
*/
int yy_at_bol;
/* Whether to try to fill the input buffer when we reach the
* end of it.
*/
int yy_fill_buffer;
int yy_buffer_status;
#define YY_BUFFER_NEW 0
#define YY_BUFFER_NORMAL 1
/* When an EOF's been seen but there's still some text to process
* then we mark the buffer as YY_EOF_PENDING, to indicate that we
* shouldn't try reading from the input source any more. We might
* still have a bunch of tokens to match, though, because of
* possible backing-up.
*
* When we actually see the EOF, we change the status to "new"
* (via yyrestart()), so that the user can continue scanning by
* just pointing yyin at a new input file.
*/
#define YY_BUFFER_EOF_PENDING 2
};
static YY_BUFFER_STATE yy_current_buffer = 0;
/* We provide macros for accessing buffer states in case in the
* future we want to put the buffer states in a more general
* "scanner state".
*/
#define YY_CURRENT_BUFFER yy_current_buffer
/* yy_hold_char holds the character lost when yytext is formed. */
static char yy_hold_char;
static int yy_n_chars; /* number of characters read into yy_ch_buf */
int yyleng;
/* Points to current character in buffer. */
static char *yy_c_buf_p = (char *) 0;
static int yy_init = 1; /* whether we need to initialize */
static int yy_start = 0; /* start state number */
/* Flag which is used to allow yywrap()'s to do buffer switches
* instead of setting up a fresh yyin. A bit of a hack ...
*/
static int yy_did_buffer_switch_on_eof;
void yyrestart YY_PROTO(( FILE *input_file ));
void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
void yy_load_buffer_state YY_PROTO(( void ));
YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
static void yy_flex_free YY_PROTO(( void * ));
#define yy_new_buffer yy_create_buffer
#define yy_set_interactive(is_interactive) \
{ \
if ( ! yy_current_buffer ) \
yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
yy_current_buffer->yy_is_interactive = is_interactive; \
}
#define yy_set_bol(at_bol) \
{ \
if ( ! yy_current_buffer ) \
yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
yy_current_buffer->yy_at_bol = at_bol; \
}
#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
#define yywrap() 1
#define YY_SKIP_YYWRAP
typedef unsigned char YY_CHAR;
FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
typedef int yy_state_type;
extern char *yytext;
#define yytext_ptr yytext
static yy_state_type yy_get_previous_state YY_PROTO(( void ));
static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
static int yy_get_next_buffer YY_PROTO(( void ));
static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
/* Done after the current pattern has been matched and before the
* corresponding action - sets up yytext.
*/
#define YY_DO_BEFORE_ACTION \
yytext_ptr = yy_bp; \
yyleng = (int) (yy_cp - yy_bp); \
yy_hold_char = *yy_cp; \
*yy_cp = '\0'; \
yy_c_buf_p = yy_cp;
#define YY_NUM_RULES 76
#define YY_END_OF_BUFFER 77
static yyconst short int yy_accept[448] =
{ 0,
72, 72, 2, 2, 0, 0, 0, 0, 5, 5,
9, 9, 77, 75, 72, 73, 75, 46, 33, 75,
75, 75, 75, 75, 75, 75, 75, 75, 44, 44,
74, 75, 75, 75, 33, 75, 33, 33, 33, 33,
33, 33, 33, 33, 33, 33, 33, 33, 33, 75,
72, 30, 75, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 2,
76, 2, 15, 76, 76, 16, 5, 5, 9, 9,
72, 54, 46, 46, 46, 33, 33, 33, 33, 33,
61, 55, 64, 0, 0, 32, 69, 70, 59, 71,
67, 57, 68, 58, 33, 41, 33, 60, 44, 35,
39, 42, 37, 44, 74, 49, 52, 53, 51, 50,
66, 0, 33, 33, 33, 33, 33, 0, 33, 0,
33, 33, 33, 33, 0, 33, 22, 33, 33, 0,
33, 33, 65, 56, 72, 0, 0, 0, 0, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 22,
30, 30, 30, 30, 30, 30, 30, 30, 2, 2,
15, 15, 0, 16, 5, 5, 9, 9, 46, 45,
46, 45, 46, 46, 46, 46, 33, 33, 33, 22,
33, 47, 47, 0, 0, 33, 34, 34, 34, 34,
34, 62, 63, 0, 0, 0, 0, 33, 0, 0,
33, 3, 33, 33, 0, 0, 33, 33, 33, 33,
19, 0, 0, 33, 33, 0, 0, 0, 0, 0,
30, 30, 30, 30, 22, 30, 30, 30, 30, 30,
3, 30, 30, 30, 30, 30, 30, 30, 19, 30,
30, 30, 30, 30, 46, 46, 46, 46, 46, 45,
46, 31, 33, 33, 33, 33, 33, 0, 0, 33,
48, 48, 0, 0, 36, 33, 40, 23, 12, 33,
33, 33, 43, 18, 33, 33, 20, 38, 33, 33,
0, 0, 0, 0, 0, 29, 30, 30, 30, 30,
30, 30, 30, 30, 30, 23, 12, 30, 30, 30,
18, 30, 30, 30, 20, 30, 30, 30, 30, 30,
46, 46, 23, 33, 33, 33, 33, 28, 0, 0,
33, 24, 33, 0, 13, 25, 33, 33, 17, 0,
0, 0, 0, 0, 30, 23, 30, 30, 30, 30,
30, 28, 30, 24, 30, 25, 30, 30, 30, 30,
30, 4, 17, 24, 25, 33, 33, 10, 33, 26,
33, 0, 0, 0, 0, 4, 30, 24, 25, 30,
30, 30, 10, 30, 26, 30, 30, 8, 30, 4,
4, 26, 33, 33, 33, 0, 0, 8, 0, 30,
26, 30, 30, 30, 1, 30, 8, 8, 7, 33,
33, 33, 0, 1, 7, 14, 1, 30, 30, 1,
1, 30, 7, 7, 6, 27, 33, 21, 6, 27,
30, 21, 6, 6, 11, 11, 0
} ;
static yyconst int 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, 2, 5, 6, 7, 1, 8, 9, 10, 11,
12, 13, 14, 1, 15, 16, 17, 18, 19, 19,
19, 19, 19, 19, 19, 20, 20, 21, 22, 23,
24, 25, 26, 27, 31, 32, 33, 34, 35, 36,
37, 38, 39, 40, 41, 42, 40, 43, 44, 45,
46, 47, 48, 49, 50, 51, 52, 53, 40, 40,
1, 28, 1, 29, 30, 1, 31, 32, 33, 34,
35, 36, 37, 38, 39, 40, 41, 42, 40, 43,
44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
40, 40, 1, 54, 1, 1, 1, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30
} ;
static yyconst int yy_meta[55] =
{ 0,
1, 1, 2, 3, 1, 4, 5, 1, 1, 6,
1, 1, 1, 1, 7, 8, 1, 9, 10, 10,
11, 12, 3, 1, 1, 13, 5, 14, 1, 15,
16, 16, 17, 17, 17, 16, 18, 18, 18, 18,
18, 18, 19, 18, 18, 18, 19, 18, 19, 18,
19, 18, 19, 1
} ;
static yyconst short int yy_base[481] =
{ 0,
0, 54, 106, 110, 135, 0, 1389, 1388, 187, 191,
195, 199, 1389, 1522, 113, 1522, 1364, 198, 185, 1362,
102, 1339, 0, 106, 110, 103, 188, 1325, 179, 195,
0, 192, 1324, 212, 1323, 1305, 235, 275, 199, 1293,
211, 209, 1291, 218, 202, 224, 1290, 230, 233, 220,
245, 265, 269, 239, 315, 355, 260, 1289, 285, 273,
1288, 287, 280, 296, 1287, 249, 288, 300, 298, 250,
1522, 1522, 0, 0, 1293, 1522, 1289, 1522, 1282, 1522,
262, 1522, 318, 1522, 396, 269, 1279, 326, 322, 307,
1522, 1522, 1522, 1275, 338, 0, 1522, 1522, 1522, 1522,
1522, 1522, 1522, 1522, 1274, 354, 264, 1522, 346, 366,
371, 387, 402, 418, 0, 1256, 1522, 1522, 1522, 1247,
1522, 1234, 1251, 1244, 1242, 1237, 1229, 1222, 324, 439,
270, 320, 341, 353, 1221, 307, 373, 360, 342, 1218,
367, 408, 1522, 1522, 459, 216, 1189, 347, 1192, 416,
423, 1522, 434, 444, 453, 461, 463, 464, 1214, 1212,
1207, 1206, 1199, 463, 365, 345, 425, 467, 465, 478,
466, 432, 468, 376, 471, 469, 473, 480, 486, 1522,
0, 0, 1204, 1522, 1200, 1522, 1196, 1522, 485, 1522,
516, 487, 488, 500, 1176, 564, 189, 488, 490, 507,
493, 1522, 1166, 511, 0, 510, 499, 522, 541, 542,
569, 1522, 1522, 1165, 528, 1159, 525, 513, 571, 592,
529, 522, 561, 552, 1158, 562, 568, 583, 594, 598,
1162, 1149, 599, 606, 607, 1127, 1128, 1119, 1125, 1107,
612, 613, 614, 617, 620, 615, 619, 622, 615, 620,
627, 634, 622, 635, 621, 636, 640, 642, 1139, 647,
648, 651, 657, 658, 666, 668, 0, 683, 670, 677,
702, 1522, 672, 670, 677, 674, 678, 692, 0, 688,
1522, 1137, 706, 0, 1522, 659, 1522, 1136, 1117, 694,
680, 729, 1522, 1115, 696, 716, 1108, 1522, 718, 719,
1080, 1073, 1062, 1061, 1049, 1522, 734, 735, 736, 737,
740, 738, 741, 742, 736, 1002, 1001, 742, 740, 779,
1000, 750, 744, 754, 999, 757, 755, 761, 758, 772,
777, 802, 1001, 777, 778, 781, 787, 1000, 780, 0,
791, 996, 797, 427, 1522, 995, 781, 792, 994, 963,
951, 958, 960, 963, 803, 804, 805, 808, 821, 824,
836, 840, 808, 987, 817, 985, 840, 796, 838, 842,
841, 852, 984, 985, 983, 846, 848, 979, 850, 974,
853, 940, 775, 773, 754, 865, 857, 858, 859, 862,
863, 874, 665, 858, 661, 879, 863, 894, 881, 897,
1522, 551, 887, 892, 895, 516, 514, 904, 384, 905,
901, 911, 908, 899, 931, 909, 919, 1522, 934, 917,
921, 918, 365, 932, 943, 362, 956, 940, 925, 962,
1522, 949, 965, 1522, 970, 353, 906, 347, 968, 966,
971, 115, 980, 1522, 112, 109, 1522, 1013, 1032, 1051,
1070, 1089, 1104, 1123, 1135, 1150, 1161, 1180, 1195, 1210,
1225, 1240, 1259, 1274, 1289, 1308, 1327, 1346, 1365, 1381,
1392, 1411, 1424, 1437, 1450, 1461, 1475, 1486, 1495, 1504
} ;
static yyconst short int yy_def[481] =
{ 0,
447, 447, 448, 448, 447, 5, 449, 449, 450, 450,
451, 451, 447, 447, 447, 447, 447, 452, 453, 447,
447, 454, 455, 447, 447, 447, 456, 447, 457, 457,
458, 447, 447, 447, 453, 447, 459, 459, 38, 38,
38, 38, 38, 38, 38, 38, 38, 38, 38, 447,
447, 460, 461, 460, 462, 462, 56, 56, 56, 56,
56, 56, 56, 56, 56, 56, 56, 56, 56, 463,
447, 447, 464, 465, 466, 447, 467, 447, 468, 447,
447, 447, 469, 447, 469, 453, 453, 453, 453, 453,
447, 447, 447, 447, 470, 455, 447, 447, 447, 447,
447, 447, 447, 447, 453, 447, 453, 447, 457, 457,
457, 457, 457, 471, 458, 447, 447, 447, 447, 447,
447, 472, 38, 38, 38, 38, 38, 473, 38, 447,
38, 38, 38, 38, 474, 38, 38, 38, 38, 475,
38, 38, 447, 447, 447, 447, 447, 447, 447, 460,
460, 447, 460, 460, 460, 460, 460, 460, 56, 56,
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
56, 56, 56, 56, 56, 56, 56, 56, 463, 447,
464, 464, 466, 447, 467, 447, 468, 447, 469, 447,
469, 469, 469, 469, 191, 469, 453, 453, 453, 453,
453, 447, 447, 447, 476, 453, 471, 471, 471, 471,
471, 447, 447, 447, 477, 473, 473, 38, 447, 447,
38, 38, 38, 38, 474, 474, 38, 38, 38, 38,
38, 475, 475, 38, 38, 447, 447, 447, 447, 447,
460, 460, 460, 460, 460, 460, 460, 460, 56, 56,
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
56, 56, 56, 56, 469, 469, 191, 196, 469, 469,
196, 447, 453, 453, 453, 453, 453, 447, 478, 453,
447, 447, 447, 479, 447, 38, 447, 38, 38, 38,
38, 38, 447, 38, 38, 38, 38, 447, 38, 38,
447, 447, 447, 447, 447, 447, 460, 460, 460, 460,
460, 460, 460, 460, 56, 56, 56, 56, 56, 56,
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
469, 196, 453, 453, 453, 453, 453, 453, 447, 480,
38, 38, 38, 447, 447, 38, 38, 38, 38, 447,
447, 447, 447, 447, 460, 460, 460, 460, 460, 460,
460, 460, 56, 56, 56, 56, 56, 56, 56, 56,
56, 56, 56, 453, 453, 453, 453, 38, 38, 38,
38, 447, 447, 447, 447, 447, 460, 460, 460, 460,
460, 460, 56, 56, 56, 56, 56, 56, 56, 447,
447, 453, 453, 38, 38, 447, 447, 447, 447, 460,
460, 460, 460, 56, 56, 56, 447, 447, 56, 453,
38, 38, 447, 447, 447, 447, 460, 460, 56, 447,
447, 56, 447, 447, 56, 453, 38, 38, 447, 460,
56, 56, 447, 447, 38, 56, 0, 447, 447, 447,
447, 447, 447, 447, 447, 447, 447, 447, 447, 447,
447, 447, 447, 447, 447, 447, 447, 447, 447, 447,
447, 447, 447, 447, 447, 447, 447, 447, 447, 447
} ;
static yyconst short int yy_nxt[1577] =
{ 0,
14, 15, 16, 15, 17, 18, 19, 20, 21, 22,
14, 23, 24, 25, 26, 27, 28, 29, 30, 30,
14, 31, 32, 33, 34, 35, 35, 14, 36, 35,
37, 38, 39, 40, 41, 42, 43, 44, 45, 43,
43, 46, 43, 47, 48, 47, 43, 43, 43, 49,
43, 43, 43, 50, 14, 51, 16, 15, 17, 18,
52, 20, 21, 22, 14, 23, 24, 25, 26, 53,
28, 29, 30, 30, 14, 31, 32, 33, 34, 54,
54, 14, 36, 54, 55, 56, 57, 58, 59, 60,
61, 62, 63, 61, 61, 64, 61, 65, 66, 65,
61, 67, 68, 69, 61, 61, 61, 50, 71, 71,
92, 72, 71, 71, 81, 72, 81, 103, 447, 97,
98, 447, 100, 101, 447, 93, 104, 71, 71, 99,
72, 71, 71, 102, 72, 71, 71, 71, 71, 71,
71, 73, 71, 71, 71, 71, 71, 71, 71, 71,
74, 71, 71, 71, 71, 71, 71, 71, 71, 71,
73, 73, 71, 71, 73, 73, 73, 73, 73, 73,
73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
73, 73, 73, 73, 73, 73, 73, 73, 71, 71,
71, 86, 78, 71, 71, 86, 78, 71, 71, 272,
80, 71, 71, 84, 80, 106, 106, 106, 447, 71,
110, 447, 111, 71, 116, 117, 112, 71, 447, 88,
447, 71, 113, 89, 113, 85, 110, 135, 111, 107,
129, 114, 112, 447, 90, 119, 120, 137, 113, 447,
113, 86, 447, 143, 122, 150, 145, 134, 81, 236,
87, 146, 131, 132, 147, 180, 136, 133, 447, 152,
87, 87, 138, 81, 87, 81, 124, 139, 125, 447,
86, 150, 126, 144, 180, 86, 141, 142, 127, 447,
127, 86, 447, 147, 128, 152, 106, 106, 106, 447,
87, 164, 148, 149, 447, 174, 135, 447, 153, 154,
87, 87, 206, 155, 87, 447, 124, 447, 125, 447,
158, 168, 126, 86, 156, 170, 447, 221, 127, 197,
127, 150, 171, 190, 122, 169, 165, 166, 86, 447,
151, 167, 86, 447, 172, 152, 175, 176, 177, 173,
151, 151, 178, 227, 151, 191, 160, 203, 161, 201,
447, 447, 162, 222, 447, 204, 447, 200, 163, 86,
163, 150, 447, 426, 128, 218, 426, 198, 199, 447,
151, 106, 106, 106, 447, 152, 447, 110, 251, 111,
151, 151, 447, 112, 151, 447, 160, 223, 161, 113,
205, 113, 162, 231, 224, 238, 239, 110, 163, 111,
163, 192, 110, 112, 111, 193, 228, 230, 112, 113,
234, 113, 250, 194, 113, 229, 113, 447, 110, 260,
111, 193, 150, 195, 112, 425, 193, 193, 344, 150,
113, 193, 113, 110, 447, 111, 152, 345, 193, 112,
150, 447, 193, 152, 193, 113, 193, 113, 196, 208,
150, 209, 235, 219, 152, 210, 220, 220, 220, 150,
145, 211, 81, 211, 152, 146, 241, 150, 242, 150,
150, 252, 447, 152, 447, 447, 447, 447, 447, 258,
447, 152, 447, 152, 152, 243, 244, 447, 245, 447,
84, 180, 190, 190, 86, 246, 86, 147, 257, 86,
262, 254, 248, 247, 249, 84, 148, 149, 253, 261,
180, 255, 191, 86, 191, 191, 86, 269, 269, 259,
256, 263, 447, 274, 264, 265, 277, 191, 278, 278,
208, 447, 209, 266, 285, 273, 210, 282, 447, 447,
275, 265, 211, 267, 211, 283, 265, 265, 424, 276,
423, 265, 280, 208, 289, 209, 286, 86, 265, 210,
290, 447, 265, 288, 265, 211, 265, 211, 268, 84,
447, 293, 208, 208, 209, 209, 447, 447, 210, 210,
284, 271, 271, 271, 211, 211, 211, 211, 220, 220,
220, 191, 447, 292, 271, 271, 271, 271, 271, 271,
208, 287, 209, 447, 291, 294, 210, 447, 298, 220,
220, 220, 211, 447, 211, 447, 447, 295, 150, 150,
150, 150, 306, 150, 447, 150, 150, 296, 150, 447,
447, 447, 152, 152, 152, 152, 447, 152, 299, 152,
152, 300, 152, 447, 447, 447, 297, 312, 307, 447,
309, 447, 313, 310, 316, 322, 447, 447, 315, 317,
447, 308, 311, 320, 314, 318, 447, 447, 447, 323,
447, 84, 321, 84, 447, 84, 86, 319, 86, 326,
86, 324, 84, 86, 86, 331, 331, 193, 193, 447,
325, 341, 330, 191, 86, 191, 327, 191, 329, 328,
332, 332, 332, 447, 191, 447, 333, 336, 334, 94,
94, 335, 337, 332, 332, 332, 332, 332, 332, 193,
193, 193, 338, 339, 339, 447, 343, 447, 447, 342,
344, 346, 193, 193, 193, 193, 193, 193, 447, 345,
150, 150, 150, 150, 150, 447, 150, 150, 150, 447,
347, 447, 348, 447, 152, 152, 152, 152, 152, 447,
152, 152, 152, 447, 447, 349, 447, 447, 363, 356,
447, 358, 355, 359, 357, 361, 362, 364, 367, 360,
344, 447, 84, 86, 86, 366, 365, 86, 447, 345,
447, 369, 372, 86, 265, 265, 370, 214, 214, 371,
447, 447, 409, 368, 191, 447, 447, 408, 407, 150,
150, 150, 374, 375, 150, 376, 380, 447, 373, 265,
265, 265, 377, 152, 152, 152, 447, 150, 152, 396,
150, 378, 265, 265, 265, 265, 265, 265, 379, 381,
388, 152, 150, 389, 152, 387, 150, 447, 393, 447,
447, 447, 86, 400, 86, 390, 152, 401, 394, 447,
152, 447, 447, 150, 150, 150, 400, 447, 150, 150,
401, 392, 447, 391, 401, 395, 398, 152, 152, 152,
150, 402, 152, 152, 404, 397, 403, 401, 447, 399,
447, 410, 414, 86, 152, 417, 412, 411, 400, 418,
405, 447, 401, 447, 447, 417, 426, 150, 447, 418,
416, 150, 413, 415, 150, 447, 418, 150, 447, 401,
417, 152, 419, 86, 418, 152, 418, 447, 152, 420,
447, 152, 430, 430, 447, 433, 431, 431, 422, 434,
447, 418, 421, 447, 433, 427, 150, 445, 434, 429,
428, 436, 432, 431, 431, 437, 434, 430, 447, 441,
152, 431, 150, 430, 438, 434, 433, 431, 435, 443,
434, 443, 150, 444, 440, 444, 152, 439, 431, 447,
447, 443, 406, 447, 431, 444, 152, 434, 447, 86,
444, 86, 444, 447, 447, 442, 447, 386, 385, 384,
383, 382, 444, 447, 447, 447, 86, 86, 447, 447,
447, 447, 446, 70, 70, 70, 70, 70, 70, 70,
70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
70, 70, 75, 75, 75, 75, 75, 75, 75, 75,
75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
75, 77, 77, 77, 77, 77, 77, 77, 77, 77,
77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
79, 79, 79, 79, 79, 79, 79, 79, 79, 83,
354, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 87, 353,
352, 87, 87, 87, 351, 350, 87, 447, 87, 87,
87, 87, 87, 94, 447, 94, 447, 94, 94, 94,
94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
94, 94, 96, 96, 96, 447, 281, 96, 447, 96,
96, 96, 96, 96, 105, 305, 304, 303, 105, 105,
302, 301, 105, 447, 105, 105, 105, 105, 105, 109,
109, 447, 447, 447, 281, 202, 109, 109, 109, 109,
115, 270, 115, 115, 115, 115, 115, 115, 115, 115,
115, 115, 115, 115, 115, 115, 115, 115, 115, 123,
123, 188, 123, 123, 123, 186, 184, 123, 447, 123,
123, 123, 123, 123, 151, 447, 447, 151, 151, 151,
151, 447, 151, 447, 151, 151, 151, 151, 151, 157,
240, 237, 232, 157, 157, 225, 216, 157, 447, 157,
157, 157, 157, 157, 159, 159, 447, 159, 159, 159,
159, 447, 159, 447, 159, 159, 159, 159, 159, 179,
447, 215, 179, 179, 179, 179, 179, 179, 179, 179,
213, 179, 179, 179, 179, 179, 179, 179, 181, 212,
86, 181, 181, 181, 202, 86, 181, 188, 181, 181,
181, 181, 181, 182, 186, 184, 140, 447, 130, 140,
447, 182, 130, 182, 182, 182, 182, 182, 183, 183,
183, 183, 183, 183, 183, 183, 183, 183, 183, 183,
183, 183, 183, 183, 183, 183, 183, 185, 121, 86,
185, 185, 185, 185, 185, 185, 185, 185, 185, 185,
185, 185, 185, 185, 185, 185, 187, 118, 108, 187,
187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
187, 187, 187, 187, 187, 189, 95, 189, 189, 189,
189, 189, 189, 189, 189, 189, 189, 189, 189, 189,
189, 189, 189, 189, 94, 91, 94, 82, 447, 94,
76, 76, 447, 94, 94, 447, 94, 447, 447, 94,
207, 207, 447, 447, 447, 447, 447, 207, 207, 207,
207, 214, 447, 214, 447, 214, 214, 214, 214, 214,
214, 214, 214, 214, 214, 214, 214, 214, 214, 214,
217, 447, 217, 217, 447, 447, 447, 447, 447, 217,
217, 217, 217, 226, 447, 226, 226, 447, 447, 447,
447, 447, 226, 226, 226, 226, 233, 447, 233, 233,
447, 447, 447, 447, 447, 233, 233, 233, 233, 279,
279, 447, 447, 447, 447, 447, 279, 279, 214, 447,
214, 447, 447, 214, 447, 447, 447, 214, 214, 447,
214, 447, 447, 214, 94, 94, 447, 447, 447, 447,
447, 94, 94, 340, 340, 447, 447, 447, 447, 447,
340, 340, 214, 214, 447, 447, 447, 447, 447, 214,
214, 13, 447, 447, 447, 447, 447, 447, 447, 447,
447, 447, 447, 447, 447, 447, 447, 447, 447, 447,
447, 447, 447, 447, 447, 447, 447, 447, 447, 447,
447, 447, 447, 447, 447, 447, 447, 447, 447, 447,
447, 447, 447, 447, 447, 447, 447, 447, 447, 447,
447, 447, 447, 447, 447, 447
} ;
static yyconst short int yy_chk[1577] =
{ 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, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 3, 3,
21, 3, 4, 4, 15, 4, 15, 26, 446, 24,
24, 445, 25, 25, 442, 21, 26, 3, 3, 24,
3, 4, 4, 25, 4, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 9,
9, 19, 9, 10, 10, 197, 10, 11, 11, 197,
11, 12, 12, 18, 12, 27, 27, 27, 39, 9,
29, 45, 29, 10, 32, 32, 29, 11, 42, 19,
41, 12, 29, 19, 29, 18, 30, 44, 30, 27,
39, 29, 30, 46, 19, 34, 34, 45, 30, 48,
30, 37, 49, 50, 37, 54, 51, 42, 51, 146,
37, 51, 41, 41, 146, 70, 44, 41, 66, 54,
37, 37, 46, 81, 37, 81, 37, 46, 37, 57,
107, 52, 37, 50, 70, 86, 48, 49, 37, 131,
37, 38, 60, 51, 38, 52, 53, 53, 53, 63,
38, 57, 51, 51, 59, 66, 62, 67, 52, 52,
38, 38, 107, 52, 38, 64, 38, 69, 38, 68,
53, 60, 38, 90, 52, 63, 136, 131, 38, 86,
38, 55, 63, 83, 55, 62, 59, 59, 89, 132,
55, 59, 88, 129, 64, 55, 67, 67, 68, 64,
55, 55, 69, 136, 55, 83, 55, 95, 55, 90,
133, 139, 55, 132, 166, 95, 438, 89, 55, 436,
55, 56, 134, 426, 56, 129, 423, 88, 88, 138,
56, 106, 106, 106, 165, 56, 141, 109, 166, 109,
56, 56, 137, 109, 56, 174, 56, 133, 56, 109,
95, 109, 56, 139, 134, 148, 148, 110, 56, 110,
56, 85, 111, 110, 111, 85, 137, 138, 111, 110,
141, 110, 165, 85, 111, 137, 111, 142, 112, 174,
112, 85, 150, 85, 112, 409, 85, 85, 344, 151,
112, 85, 112, 113, 167, 113, 150, 344, 85, 113,
153, 172, 85, 151, 85, 113, 85, 113, 85, 114,
154, 114, 142, 130, 153, 114, 130, 130, 130, 155,
145, 114, 145, 114, 154, 145, 150, 156, 153, 157,
158, 167, 164, 155, 169, 171, 168, 173, 176, 172,
175, 156, 177, 157, 158, 154, 154, 170, 155, 178,
189, 179, 192, 193, 198, 155, 199, 145, 171, 201,
176, 169, 158, 156, 164, 194, 145, 145, 168, 175,
179, 170, 189, 200, 192, 193, 206, 194, 194, 173,
170, 177, 218, 199, 178, 191, 201, 194, 204, 204,
207, 222, 207, 191, 217, 198, 207, 215, 221, 217,
200, 191, 207, 191, 207, 215, 191, 191, 407, 200,
406, 191, 206, 208, 222, 208, 218, 402, 191, 208,
222, 224, 191, 221, 191, 208, 191, 208, 191, 196,
223, 226, 209, 210, 209, 210, 226, 227, 209, 210,
215, 196, 196, 196, 209, 210, 209, 210, 219, 219,
219, 196, 228, 224, 196, 196, 196, 196, 196, 196,
211, 220, 211, 229, 223, 227, 211, 230, 233, 220,
220, 220, 211, 233, 211, 234, 235, 228, 241, 242,
243, 246, 241, 244, 249, 247, 245, 229, 248, 250,
255, 253, 241, 242, 243, 246, 251, 244, 234, 247,
245, 235, 248, 252, 254, 256, 230, 246, 242, 257,
244, 258, 247, 245, 250, 255, 260, 261, 249, 251,
262, 243, 245, 253, 248, 251, 263, 264, 286, 256,
395, 265, 254, 266, 393, 269, 274, 252, 273, 260,
276, 257, 270, 275, 277, 266, 266, 269, 269, 291,
258, 286, 264, 265, 280, 266, 261, 269, 263, 262,
268, 268, 268, 290, 270, 295, 273, 276, 274, 278,
278, 275, 277, 268, 268, 268, 268, 268, 268, 271,
271, 271, 280, 283, 283, 296, 291, 299, 300, 290,
292, 295, 271, 271, 271, 271, 271, 271, 292, 292,
307, 308, 309, 310, 312, 315, 311, 313, 314, 319,
296, 318, 299, 323, 307, 308, 309, 310, 312, 322,
311, 313, 314, 324, 327, 300, 326, 329, 315, 308,
328, 310, 307, 311, 309, 313, 314, 318, 323, 312,
320, 330, 331, 334, 335, 322, 319, 336, 320, 320,
347, 326, 329, 337, 331, 331, 327, 339, 339, 328,
341, 348, 385, 324, 331, 368, 343, 384, 383, 355,
356, 357, 334, 335, 358, 336, 347, 363, 330, 332,
332, 332, 337, 355, 356, 357, 365, 359, 358, 368,
360, 341, 332, 332, 332, 332, 332, 332, 343, 348,
357, 359, 361, 358, 360, 355, 362, 369, 363, 367,
371, 370, 376, 372, 377, 359, 361, 372, 365, 379,
362, 372, 381, 387, 388, 389, 386, 394, 390, 391,
386, 361, 397, 360, 372, 367, 370, 387, 388, 389,
392, 376, 390, 391, 379, 369, 377, 386, 396, 371,
399, 387, 394, 403, 392, 398, 391, 390, 400, 398,
381, 404, 400, 398, 405, 408, 410, 411, 414, 408,
397, 410, 392, 396, 413, 437, 398, 412, 416, 400,
417, 411, 399, 420, 417, 410, 408, 422, 413, 403,
421, 412, 415, 424, 429, 419, 415, 424, 405, 419,
415, 417, 404, 419, 425, 412, 428, 437, 425, 414,
413, 420, 416, 415, 424, 421, 419, 427, 432, 429,
428, 427, 427, 430, 422, 425, 433, 430, 419, 439,
433, 435, 440, 439, 428, 435, 427, 425, 427, 435,
441, 443, 382, 380, 430, 443, 440, 433, 378, 375,
439, 374, 435, 373, 366, 432, 364, 354, 353, 352,
351, 350, 443, 349, 346, 342, 338, 333, 325, 321,
317, 316, 441, 448, 448, 448, 448, 448, 448, 448,
448, 448, 448, 448, 448, 448, 448, 448, 448, 448,
448, 448, 449, 449, 449, 449, 449, 449, 449, 449,
449, 449, 449, 449, 449, 449, 449, 449, 449, 449,
449, 450, 450, 450, 450, 450, 450, 450, 450, 450,
450, 450, 450, 450, 450, 450, 450, 450, 450, 450,
451, 451, 451, 451, 451, 451, 451, 451, 451, 451,
451, 451, 451, 451, 451, 451, 451, 451, 451, 452,
305, 452, 452, 452, 452, 452, 452, 452, 452, 452,
452, 452, 452, 452, 452, 452, 452, 452, 453, 304,
303, 453, 453, 453, 302, 301, 453, 297, 453, 453,
453, 453, 453, 454, 294, 454, 289, 454, 454, 454,
454, 454, 454, 454, 454, 454, 454, 454, 454, 454,
454, 454, 455, 455, 455, 288, 282, 455, 259, 455,
455, 455, 455, 455, 456, 240, 239, 238, 456, 456,
237, 236, 456, 232, 456, 456, 456, 456, 456, 457,
457, 231, 225, 216, 214, 203, 457, 457, 457, 457,
458, 195, 458, 458, 458, 458, 458, 458, 458, 458,
458, 458, 458, 458, 458, 458, 458, 458, 458, 459,
459, 187, 459, 459, 459, 185, 183, 459, 163, 459,
459, 459, 459, 459, 460, 162, 161, 460, 460, 460,
460, 160, 460, 159, 460, 460, 460, 460, 460, 461,
149, 147, 140, 461, 461, 135, 128, 461, 127, 461,
461, 461, 461, 461, 462, 462, 126, 462, 462, 462,
462, 125, 462, 124, 462, 462, 462, 462, 462, 463,
123, 122, 463, 463, 463, 463, 463, 463, 463, 463,
120, 463, 463, 463, 463, 463, 463, 463, 464, 116,
105, 464, 464, 464, 94, 87, 464, 79, 464, 464,
464, 464, 464, 465, 77, 75, 65, 61, 58, 47,
43, 465, 40, 465, 465, 465, 465, 465, 466, 466,
466, 466, 466, 466, 466, 466, 466, 466, 466, 466,
466, 466, 466, 466, 466, 466, 466, 467, 36, 35,
467, 467, 467, 467, 467, 467, 467, 467, 467, 467,
467, 467, 467, 467, 467, 467, 468, 33, 28, 468,
468, 468, 468, 468, 468, 468, 468, 468, 468, 468,
468, 468, 468, 468, 468, 469, 22, 469, 469, 469,
469, 469, 469, 469, 469, 469, 469, 469, 469, 469,
469, 469, 469, 469, 470, 20, 470, 17, 13, 470,
8, 7, 0, 470, 470, 0, 470, 0, 0, 470,
471, 471, 0, 0, 0, 0, 0, 471, 471, 471,
471, 472, 0, 472, 0, 472, 472, 472, 472, 472,
472, 472, 472, 472, 472, 472, 472, 472, 472, 472,
473, 0, 473, 473, 0, 0, 0, 0, 0, 473,
473, 473, 473, 474, 0, 474, 474, 0, 0, 0,
0, 0, 474, 474, 474, 474, 475, 0, 475, 475,
0, 0, 0, 0, 0, 475, 475, 475, 475, 476,
476, 0, 0, 0, 0, 0, 476, 476, 477, 0,
477, 0, 0, 477, 0, 0, 0, 477, 477, 0,
477, 0, 0, 477, 478, 478, 0, 0, 0, 0,
0, 478, 478, 479, 479, 0, 0, 0, 0, 0,
479, 479, 480, 480, 0, 0, 0, 0, 0, 480,
480, 447, 447, 447, 447, 447, 447, 447, 447, 447,
447, 447, 447, 447, 447, 447, 447, 447, 447, 447,
447, 447, 447, 447, 447, 447, 447, 447, 447, 447,
447, 447, 447, 447, 447, 447, 447, 447, 447, 447,
447, 447, 447, 447, 447, 447, 447, 447, 447, 447,
447, 447, 447, 447, 447, 447
} ;
static yy_state_type yy_last_accepting_state;
static char *yy_last_accepting_cpos;
/* The intent behind this definition is that it'll catch
* any uses of REJECT which flex missed.
*/
#define REJECT reject_used_but_not_detected
#define yymore() yymore_used_but_not_detected
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
char *yytext;
#line 1 "scan.l"
#define INITIAL 0
#define incl 1
#define define 2
#define definition 3
#define title 4
#define subtitle 5
#line 9 "scan.l"
/* lexical analyser for gpasm
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
James Bowman, Craig Franklin
This file is part of gputils.
gputils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
gputils 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with gputils; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include "stdhdr.h"
#include "libgputils.h"
#include "gpasm.h"
#include "parse.h"
#include "scan.h"
#include "deps.h"
#include "gperror.h"
#include "directive.h"
#include "evaluate.h"
#include "macro.h"
#include "coff.h"
#define OPERATOR(x) return (yylval.i = (x))
/* YY_UNPUT not used, suppress the warning */
#define YY_NO_UNPUT
enum identtype { defines, directives, globals, macros, opcodes, unknown_type };
enum identtype identify(char *);
static void push_string(char *str);
static int found_end();
static int found_eof();
static char *check_defines(char *symbol);
static struct symbol *current_definition; /* Used in #define */
static int quoted; /* Used to prevent #define expansion in ifdef and
ifndef... */
int force_decimal; /* Used to force radix to decimal for some directives */
int force_ident; /* Used to force numbers to identifiers for processor names */
#line 929 "scan.c"
/* Macros after this point can all be overridden by user definitions in
* section 1.
*/
#ifndef YY_SKIP_YYWRAP
#ifdef __cplusplus
extern "C" int yywrap YY_PROTO(( void ));
#else
extern int yywrap YY_PROTO(( void ));
#endif
#endif
#ifndef YY_NO_UNPUT
static void yyunput YY_PROTO(( int c, char *buf_ptr ));
#endif
#ifndef yytext_ptr
static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
#endif
#ifdef YY_NEED_STRLEN
static int yy_flex_strlen YY_PROTO(( yyconst char * ));
#endif
#ifndef YY_NO_INPUT
#ifdef __cplusplus
static int yyinput YY_PROTO(( void ));
#else
static int input YY_PROTO(( void ));
#endif
#endif
#if YY_STACK_USED
static int yy_start_stack_ptr = 0;
static int yy_start_stack_depth = 0;
static int *yy_start_stack = 0;
#ifndef YY_NO_PUSH_STATE
static void yy_push_state YY_PROTO(( int new_state ));
#endif
#ifndef YY_NO_POP_STATE
static void yy_pop_state YY_PROTO(( void ));
#endif
#ifndef YY_NO_TOP_STATE
static int yy_top_state YY_PROTO(( void ));
#endif
#else
#define YY_NO_PUSH_STATE 1
#define YY_NO_POP_STATE 1
#define YY_NO_TOP_STATE 1
#endif
#ifdef YY_MALLOC_DECL
YY_MALLOC_DECL
#else
#if __STDC__
#ifndef __cplusplus
#include <stdlib.h>
#endif
#else
/* Just try to get by without declaring the routines. This will fail
* miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
* or sizeof(void*) != sizeof(int).
*/
#endif
#endif
/* Amount of stuff to slurp up with each read. */
#ifndef YY_READ_BUF_SIZE
#define YY_READ_BUF_SIZE 8192
#endif
/* Copy whatever the last rule matched to the standard output. */
#ifndef ECHO
/* This used to be an fputs(), but since the string might contain NUL's,
* we now use fwrite().
*/
#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
#endif
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
* is returned in "result".
*/
#ifndef YY_INPUT
#define YY_INPUT(buf,result,max_size) \
if ( yy_current_buffer->yy_is_interactive ) \
{ \
int c = '*', n; \
for ( n = 0; n < max_size && \
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \
buf[n] = (char) c; \
if ( c == '\n' ) \
buf[n++] = (char) c; \
if ( c == EOF && ferror( yyin ) ) \
YY_FATAL_ERROR( "input in flex scanner failed" ); \
result = n; \
} \
else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
&& ferror( yyin ) ) \
YY_FATAL_ERROR( "input in flex scanner failed" );
#endif
/* No semi-colon after return; correct usage is to write "yyterminate();" -
* we don't want an extra ';' after the "return" because that will cause
* some compilers to complain about unreachable statements.
*/
#ifndef yyterminate
#define yyterminate() return YY_NULL
#endif
/* Number of entries by which start-condition stack grows. */
#ifndef YY_START_STACK_INCR
#define YY_START_STACK_INCR 25
#endif
/* Report a fatal error. */
#ifndef YY_FATAL_ERROR
#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
#endif
/* Default declaration of generated scanner - a define so the user can
* easily add parameters.
*/
#ifndef YY_DECL
#define YY_DECL int yylex YY_PROTO(( void ))
#endif
/* Code executed at the beginning of each rule, after yytext and yyleng
* have been set up.
*/
#ifndef YY_USER_ACTION
#define YY_USER_ACTION
#endif
/* Code executed at the end of each rule. */
#ifndef YY_BREAK
#define YY_BREAK break;
#endif
#define YY_RULE_SETUP \
if ( yyleng > 0 ) \
yy_current_buffer->yy_at_bol = \
(yytext[yyleng - 1] == '\n'); \
YY_USER_ACTION
YY_DECL
{
register yy_state_type yy_current_state;
register char *yy_cp = NULL, *yy_bp = NULL;
register int yy_act;
#line 69 "scan.l"
#line 1085 "scan.c"
if ( yy_init )
{
yy_init = 0;
#ifdef YY_USER_INIT
YY_USER_INIT;
#endif
if ( ! yy_start )
yy_start = 1; /* first start state */
if ( ! yyin )
yyin = stdin;
if ( ! yyout )
yyout = stdout;
if ( ! yy_current_buffer )
yy_current_buffer =
yy_create_buffer( yyin, YY_BUF_SIZE );
yy_load_buffer_state();
}
while ( 1 ) /* loops until end-of-file is reached */
{
yy_cp = yy_c_buf_p;
/* Support of yytext. */
*yy_cp = yy_hold_char;
/* yy_bp points to the position in yy_ch_buf of the start of
* the current run.
*/
yy_bp = yy_cp;
yy_current_state = yy_start;
yy_current_state += YY_AT_BOL();
yy_match:
do
{
register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
if ( yy_accept[yy_current_state] )
{
yy_last_accepting_state = yy_current_state;
yy_last_accepting_cpos = yy_cp;
}
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 448 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
++yy_cp;
}
while ( yy_base[yy_current_state] != 1522 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
if ( yy_act == 0 )
{ /* have to back up */
yy_cp = yy_last_accepting_cpos;
yy_current_state = yy_last_accepting_state;
yy_act = yy_accept[yy_current_state];
}
YY_DO_BEFORE_ACTION;
do_action: /* This label is used only to access EOF actions. */
switch ( yy_act )
{ /* beginning of action switch */
case 0: /* must back up */
/* undo the effects of YY_DO_BEFORE_ACTION */
*yy_cp = yy_hold_char;
yy_cp = yy_last_accepting_cpos;
yy_current_state = yy_last_accepting_state;
goto yy_find_action;
case 1:
YY_RULE_SETUP
#line 70 "scan.l"
{ BEGIN(incl); }
YY_BREAK
case 2:
YY_RULE_SETUP
#line 71 "scan.l"
{ /* got the include file name */
char *pc = &yytext[yyleng - 1];
if ((*pc == '"') || (*pc == '>'))
*pc = '\0';
BEGIN(INITIAL);
yylval.s = strdup(yytext);
return INCLUDE;
}
YY_BREAK
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(incl):
case YY_STATE_EOF(define):
case YY_STATE_EOF(definition):
case YY_STATE_EOF(title):
case YY_STATE_EOF(subtitle):
#line 79 "scan.l"
{
if (found_eof())
yyterminate();
}
YY_BREAK
case 3:
YY_RULE_SETUP
#line 83 "scan.l"
{
found_end();
yyterminate();
}
YY_BREAK
case 4:
YY_RULE_SETUP
#line 87 "scan.l"
{ BEGIN(title); }
YY_BREAK
case 5:
YY_RULE_SETUP
#line 88 "scan.l"
{ /* got the title text */
#define LEN sizeof(state.lst.title_name)
yytext[yyleng - 1] = '\0';
strncpy(state.lst.title_name, yytext, LEN);
BEGIN(INITIAL);
#undef LEN
}
YY_BREAK
case 6:
YY_RULE_SETUP
#line 95 "scan.l"
{ BEGIN(subtitle); }
YY_BREAK
case 7:
YY_RULE_SETUP
#line 96 "scan.l"
{ BEGIN(subtitle); }
YY_BREAK
case 8:
YY_RULE_SETUP
#line 97 "scan.l"
{ BEGIN(subtitle); }
YY_BREAK
case 9:
YY_RULE_SETUP
#line 98 "scan.l"
{ /* got the subtitle text */
#define LEN sizeof(state.lst.subtitle_name)
yytext[yyleng - 1] = '\0';
strncpy(state.lst.subtitle_name, yytext, LEN);
BEGIN(INITIAL);
#undef LEN
}
YY_BREAK
case 10:
YY_RULE_SETUP
#line 105 "scan.l"
{
return CBLOCK;
}
YY_BREAK
case 11:
YY_RULE_SETUP
#line 108 "scan.l"
{
yylval.s = strdup(yytext);
return ERRORLEVEL;
}
YY_BREAK
case 12:
YY_RULE_SETUP
#line 112 "scan.l"
{
return ENDC;
}
YY_BREAK
case 13:
YY_RULE_SETUP
#line 115 "scan.l"
{
/* fill with ( ) as first argument */
yylval.i = FILL;
return FILL;
}
YY_BREAK
case 14:
YY_RULE_SETUP
#line 120 "scan.l"
{
BEGIN(define);
}
YY_BREAK
case 15:
YY_RULE_SETUP
#line 123 "scan.l"
{
if((asm_enabled()) && (!state.mac_prev)) {
if ((get_symbol(state.stDefines, yytext) != NULL)
&& (state.pass == 1)) {
/* FIXME: find a more elegant way to do this */
state.pass = 2;
gperror(GPE_DUPLAB, NULL);
exit(1);
}
current_definition = add_symbol(state.stDefines,
yytext);
}
BEGIN(definition);
}
YY_BREAK
case 16:
*yy_cp = yy_hold_char; /* undo effects of setting up yytext */
yy_c_buf_p = yy_cp -= 1;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
#line 137 "scan.l"
{
if((asm_enabled()) && (!state.mac_prev)) {
char *string_ptr = yytext;
/* Should have a #define in progress */
assert(current_definition != NULL);
/* if there is a comment remove it */
while(*string_ptr != '\0') {
if (*string_ptr == ';') {
*string_ptr = '\0';
break;
}
string_ptr++;
}
/* remove leading spaces or tabs */
string_ptr = yytext;
while(*string_ptr == '\t' || *string_ptr == ' ') {
string_ptr++;
}
annotate_symbol(current_definition,
strdup(string_ptr));
current_definition = NULL;
}
BEGIN(INITIAL);
}
YY_BREAK
case 17:
YY_RULE_SETUP
#line 165 "scan.l"
{
yylval.i = UPPER;
return UPPER;
}
YY_BREAK
case 18:
YY_RULE_SETUP
#line 169 "scan.l"
{
yylval.i = HIGH;
return HIGH;
}
YY_BREAK
case 19:
YY_RULE_SETUP
#line 173 "scan.l"
{
yylval.i = LOW;
return LOW;
}
YY_BREAK
case 20:
YY_RULE_SETUP
#line 177 "scan.l"
{
yylval.s = strdup(yytext);
return LIST;
}
YY_BREAK
case 21:
YY_RULE_SETUP
#line 181 "scan.l"
{
yylval.s = strdup(yytext);
return PROCESSOR;
}
YY_BREAK
case 22:
YY_RULE_SETUP
#line 185 "scan.l"
{
/* #if and if can appear in column 1 */
yylval.s = strdup(yytext);
return IDENTIFIER;
}
YY_BREAK
case 23:
YY_RULE_SETUP
#line 190 "scan.l"
{
/* #else and else can appear in column 1 */
yylval.s = strdup(yytext);
return IDENTIFIER;
}
YY_BREAK
case 24:
YY_RULE_SETUP
#line 195 "scan.l"
{
/* #endif and endif can appear in column 1 */
yylval.s = strdup(yytext);
return IDENTIFIER;
}
YY_BREAK
case 25:
YY_RULE_SETUP
#line 200 "scan.l"
{
/* #ifdef and ifdef can appear in column 1 */
quoted = 1;
yylval.s = strdup(yytext);
return IDENTIFIER;
}
YY_BREAK
case 26:
YY_RULE_SETUP
#line 206 "scan.l"
{
/* #ifndef and ifndef can appear in column 1 */
quoted = 1;
yylval.s = strdup(yytext);
return IDENTIFIER;
}
YY_BREAK
case 27:
YY_RULE_SETUP
#line 212 "scan.l"
{
/* #undefine can appear in column 1 */
quoted = 1;
yylval.s = strdup(yytext);
return IDENTIFIER;
}
YY_BREAK
case 28:
YY_RULE_SETUP
#line 218 "scan.l"
{
yylval.s = strdup(yytext);
return DEBUG_LINE;
}
YY_BREAK
case 29:
YY_RULE_SETUP
#line 222 "scan.l"
{
char *symbol;
yytext[strlen(yytext) - 3] = '\0';
symbol = check_defines(yytext);
if (symbol) {
yylval.s = strdup(symbol);
} else {
yylval.s = strdup(yytext);
}
return VARLAB_BEGIN;
}
YY_BREAK
case 30:
YY_RULE_SETUP
#line 235 "scan.l"
{
int has_collon = 0;
struct symbol *sym;
struct macro_head *h;
char *subst;
if (yytext[strlen(yytext) - 1] == ':') {
yytext[strlen(yytext) - 1] = '\0';
has_collon = 1;
}
yylval.s = strdup(yytext);
switch(identify(yytext)) {
case defines:
sym = get_symbol(state.stTopDefines, yytext);
subst = get_symbol_annotation(sym);
push_string(subst);
break;
case directives:
gpwarning(GPW_DIR_COLUMN_ONE, NULL);
if (has_collon)
gperror(GPE_BADCHAR, "Illegal character (:)");
return IDENTIFIER;
break;
case macros:
if(asm_enabled()) {
/* make sure macro definition on second pass
is ignored */
sym = get_symbol(state.stMacros, yytext);
h = get_symbol_annotation(sym);
if (h->line_number == state.src->line_number) {
return LABEL;
} else {
gpwarning(GPW_MACRO_COLUMN_ONE, NULL);
if (has_collon)
gperror(GPE_BADCHAR,
"Illegal character (:)");
return IDENTIFIER;
}
} else {
/* if assembly is not enabled don't issue
warnings about macro calls in column 1, they
could be an alternate definition */
return LABEL;
}
break;
case opcodes:
gpwarning(GPW_OP_COLUMN_ONE, NULL);
if (has_collon)
gperror(GPE_BADCHAR, "Illegal character (:)");
return IDENTIFIER;
break;
case unknown_type:
return LABEL;
default:
return LABEL;
}
}
YY_BREAK
case 31:
YY_RULE_SETUP
#line 292 "scan.l"
{
char *symbol;
yytext[strlen(yytext) - 3] = '\0';
symbol = check_defines(yytext);
if (symbol) {
yylval.s = strdup(symbol);
} else {
yylval.s = strdup(yytext);
}
return VAR_BEGIN;
}
YY_BREAK
case 32:
YY_RULE_SETUP
#line 305 "scan.l"
{
char *symbol;
symbol = check_defines(yytext+1);
if (symbol) {
yylval.s = strdup(symbol);
} else {
yylval.s = strdup(yytext+1);
}
return VAR_END;
}
YY_BREAK
case 33:
YY_RULE_SETUP
#line 316 "scan.l"
{
char *symbol;
symbol = check_defines(yytext);
if (symbol) {
char buffer[BUFSIZ];
/* Make the substitution with a leading space,
so it won't be a label */
sprintf(buffer, " %s", symbol);
push_string(buffer);
} else {
yylval.s = strdup(yytext);
return IDENTIFIER;
}
}
YY_BREAK
case 34:
YY_RULE_SETUP
#line 332 "scan.l"
{
yylval.i = stringtolong(yytext + 2, 16);
return NUMBER;
}
YY_BREAK
case 35:
YY_RULE_SETUP
#line 336 "scan.l"
{
if (force_ident) {
yylval.s = strdup(yytext);
return IDENTIFIER;
} else if (state.radix == 16) {
yylval.i = stringtolong(yytext, 16);
return NUMBER;
} else {
yytext[yyleng - 1] = '\0';
yylval.i = stringtolong(yytext, 2);
return NUMBER;
}
}
YY_BREAK
case 36:
YY_RULE_SETUP
#line 349 "scan.l"
{
yytext[yyleng - 1] = '\0';
yylval.i = stringtolong(yytext + 2, 2);
return NUMBER;
}
YY_BREAK
case 37:
YY_RULE_SETUP
#line 354 "scan.l"
{
if (force_ident) {
yylval.s = strdup(yytext);
return IDENTIFIER;
} else {
yytext[yyleng - 1] = '\0';
yylval.i = stringtolong(yytext, 8);
return NUMBER;
}
}
YY_BREAK
case 38:
YY_RULE_SETUP
#line 364 "scan.l"
{
yytext[yyleng - 1] = '\0';
yylval.i = stringtolong(yytext + 2, 8);
return NUMBER;
}
YY_BREAK
case 39:
YY_RULE_SETUP
#line 369 "scan.l"
{
if (force_ident) {
yylval.s = strdup(yytext);
return IDENTIFIER;
} else if (state.radix == 16) {
yylval.i = stringtolong(yytext, 16);
return NUMBER;
} else {
yytext[yyleng - 1] = '\0';
yylval.i = stringtolong(yytext, 10);
return NUMBER;
}
}
YY_BREAK
case 40:
YY_RULE_SETUP
#line 382 "scan.l"
{
yytext[yyleng - 1] = '\0';
yylval.i = stringtolong(yytext + 2, 10);
return NUMBER;
}
YY_BREAK
case 41:
YY_RULE_SETUP
#line 387 "scan.l"
{
yylval.i = stringtolong(yytext + 1, 10);
return NUMBER;
}
YY_BREAK
case 42:
YY_RULE_SETUP
#line 391 "scan.l"
{
if (force_ident) {
yylval.s = strdup(yytext);
return IDENTIFIER;
} else {
yytext[yyleng - 1] = '\0';
yylval.i = stringtolong(yytext, 16);
return NUMBER;
}
}
YY_BREAK
case 43:
YY_RULE_SETUP
#line 401 "scan.l"
{
yytext[yyleng - 1] = '\0';
yylval.i = stringtolong(yytext + 2, 16);
return NUMBER;
}
YY_BREAK
case 44:
YY_RULE_SETUP
#line 406 "scan.l"
{
if (force_ident) {
yylval.s = strdup(yytext);
return IDENTIFIER;
} else if (force_decimal) {
yylval.i = stringtolong(yytext, 10);
return NUMBER;
} else {
yylval.i = stringtolong(yytext, state.radix);
return NUMBER;
}
}
YY_BREAK
case 45:
YY_RULE_SETUP
#line 418 "scan.l"
{
yylval.i = gpasm_magic(yytext + 1);
return NUMBER;
}
YY_BREAK
case 46:
YY_RULE_SETUP
#line 422 "scan.l"
{
char *pc = &yytext[yyleng - 1];
if (*pc == '"')
*pc = '\0';
else
gpwarning(GPW_MISSING_QUOTE, NULL);
yylval.s = strdup(yytext + 1);
return STRING;
}
YY_BREAK
case 47:
YY_RULE_SETUP
#line 431 "scan.l"
{
yylval.i = gpasm_magic(yytext + 1);
return NUMBER;
}
YY_BREAK
case 48:
YY_RULE_SETUP
#line 435 "scan.l"
{
yylval.i = yytext[2];
return NUMBER;
}
YY_BREAK
case 49:
YY_RULE_SETUP
#line 439 "scan.l"
OPERATOR(LSH);
YY_BREAK
case 50:
YY_RULE_SETUP
#line 440 "scan.l"
OPERATOR(RSH);
YY_BREAK
case 51:
YY_RULE_SETUP
#line 441 "scan.l"
OPERATOR(GREATER_EQUAL);
YY_BREAK
case 52:
YY_RULE_SETUP
#line 442 "scan.l"
OPERATOR(LESS_EQUAL);
YY_BREAK
case 53:
YY_RULE_SETUP
#line 443 "scan.l"
OPERATOR(EQUAL);
YY_BREAK
case 54:
YY_RULE_SETUP
#line 444 "scan.l"
OPERATOR(NOT_EQUAL);
YY_BREAK
case 55:
YY_RULE_SETUP
#line 445 "scan.l"
OPERATOR(LOGICAL_AND);
YY_BREAK
case 56:
YY_RULE_SETUP
#line 446 "scan.l"
OPERATOR(LOGICAL_OR);
YY_BREAK
case 57:
YY_RULE_SETUP
#line 448 "scan.l"
OPERATOR(ASSIGN_PLUS);
YY_BREAK
case 58:
YY_RULE_SETUP
#line 449 "scan.l"
OPERATOR(ASSIGN_MINUS);
YY_BREAK
case 59:
YY_RULE_SETUP
#line 450 "scan.l"
OPERATOR(ASSIGN_MULTIPLY);
YY_BREAK
case 60:
YY_RULE_SETUP
#line 451 "scan.l"
OPERATOR(ASSIGN_DIVIDE);
YY_BREAK
case 61:
YY_RULE_SETUP
#line 452 "scan.l"
OPERATOR(ASSIGN_MODULUS);
YY_BREAK
case 62:
YY_RULE_SETUP
#line 453 "scan.l"
OPERATOR(ASSIGN_LSH);
YY_BREAK
case 63:
YY_RULE_SETUP
#line 454 "scan.l"
OPERATOR(ASSIGN_RSH);
YY_BREAK
case 64:
YY_RULE_SETUP
#line 455 "scan.l"
OPERATOR(ASSIGN_AND);
YY_BREAK
case 65:
YY_RULE_SETUP
#line 456 "scan.l"
OPERATOR(ASSIGN_OR);
YY_BREAK
case 66:
YY_RULE_SETUP
#line 457 "scan.l"
OPERATOR(ASSIGN_XOR);
YY_BREAK
case 67:
YY_RULE_SETUP
#line 459 "scan.l"
OPERATOR(INCREMENT);
YY_BREAK
case 68:
YY_RULE_SETUP
#line 460 "scan.l"
OPERATOR(DECREMENT);
YY_BREAK
case 69:
YY_RULE_SETUP
#line 462 "scan.l"
OPERATOR(TBL_POST_INC);
YY_BREAK
case 70:
YY_RULE_SETUP
#line 463 "scan.l"
OPERATOR(TBL_POST_DEC);
YY_BREAK
case 71:
YY_RULE_SETUP
#line 464 "scan.l"
OPERATOR(TBL_PRE_INC);
YY_BREAK
case 72:
YY_RULE_SETUP
#line 466 "scan.l"
YY_BREAK
case 73:
YY_RULE_SETUP
#line 467 "scan.l"
{
quoted = 0;
force_decimal = 0;
force_ident = 0;
return yytext[0];
}
YY_BREAK
case 74:
YY_RULE_SETUP
#line 473 "scan.l"
{ }
YY_BREAK
case 75:
YY_RULE_SETUP
#line 474 "scan.l"
{
yylval.i = yytext[0];
return yytext[0];
}
YY_BREAK
case 76:
YY_RULE_SETUP
#line 478 "scan.l"
ECHO;
YY_BREAK
#line 1889 "scan.c"
case YY_END_OF_BUFFER:
{
/* Amount of text matched not including the EOB char. */
int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
/* Undo the effects of YY_DO_BEFORE_ACTION. */
*yy_cp = yy_hold_char;
YY_RESTORE_YY_MORE_OFFSET
if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
{
/* We're scanning a new file or input source. It's
* possible that this happened because the user
* just pointed yyin at a new source and called
* yylex(). If so, then we have to assure
* consistency between yy_current_buffer and our
* globals. Here is the right place to do so, because
* this is the first action (other than possibly a
* back-up) that will match for the new input source.
*/
yy_n_chars = yy_current_buffer->yy_n_chars;
yy_current_buffer->yy_input_file = yyin;
yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
}
/* Note that here we test for yy_c_buf_p "<=" to the position
* of the first EOB in the buffer, since yy_c_buf_p will
* already have been incremented past the NUL character
* (since all states make transitions on EOB to the
* end-of-buffer state). Contrast this with the test
* in input().
*/
if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
{ /* This was really a NUL. */
yy_state_type yy_next_state;
yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
yy_current_state = yy_get_previous_state();
/* Okay, we're now positioned to make the NUL
* transition. We couldn't have
* yy_get_previous_state() go ahead and do it
* for us because it doesn't know how to deal
* with the possibility of jamming (and we don't
* want to build jamming into it because then it
* will run more slowly).
*/
yy_next_state = yy_try_NUL_trans( yy_current_state );
yy_bp = yytext_ptr + YY_MORE_ADJ;
if ( yy_next_state )
{
/* Consume the NUL. */
yy_cp = ++yy_c_buf_p;
yy_current_state = yy_next_state;
goto yy_match;
}
else
{
yy_cp = yy_c_buf_p;
goto yy_find_action;
}
}
else switch ( yy_get_next_buffer() )
{
case EOB_ACT_END_OF_FILE:
{
yy_did_buffer_switch_on_eof = 0;
if ( yywrap() )
{
/* Note: because we've taken care in
* yy_get_next_buffer() to have set up
* yytext, we can now set up
* yy_c_buf_p so that if some total
* hoser (like flex itself) wants to
* call the scanner after we return the
* YY_NULL, it'll still work - another
* YY_NULL will get returned.
*/
yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
yy_act = YY_STATE_EOF(YY_START);
goto do_action;
}
else
{
if ( ! yy_did_buffer_switch_on_eof )
YY_NEW_FILE;
}
break;
}
case EOB_ACT_CONTINUE_SCAN:
yy_c_buf_p =
yytext_ptr + yy_amount_of_matched_text;
yy_current_state = yy_get_previous_state();
yy_cp = yy_c_buf_p;
yy_bp = yytext_ptr + YY_MORE_ADJ;
goto yy_match;
case EOB_ACT_LAST_MATCH:
yy_c_buf_p =
&yy_current_buffer->yy_ch_buf[yy_n_chars];
yy_current_state = yy_get_previous_state();
yy_cp = yy_c_buf_p;
yy_bp = yytext_ptr + YY_MORE_ADJ;
goto yy_find_action;
}
break;
}
default:
YY_FATAL_ERROR(
"fatal flex scanner internal error--no action found" );
} /* end of action switch */
} /* end of scanning one token */
} /* end of yylex */
/* yy_get_next_buffer - try to read in a new buffer
*
* Returns a code representing an action:
* EOB_ACT_LAST_MATCH -
* EOB_ACT_CONTINUE_SCAN - continue scanning from current position
* EOB_ACT_END_OF_FILE - end of file
*/
static int yy_get_next_buffer()
{
register char *dest = yy_current_buffer->yy_ch_buf;
register char *source = yytext_ptr;
register int number_to_move, i;
int ret_val;
if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
YY_FATAL_ERROR(
"fatal flex scanner internal error--end of buffer missed" );
if ( yy_current_buffer->yy_fill_buffer == 0 )
{ /* Don't try to fill the buffer, so this is an EOF. */
if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
{
/* We matched a single character, the EOB, so
* treat this as a final EOF.
*/
return EOB_ACT_END_OF_FILE;
}
else
{
/* We matched some text prior to the EOB, first
* process it.
*/
return EOB_ACT_LAST_MATCH;
}
}
/* Try to read more data. */
/* First move last chars to start of buffer. */
number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
for ( i = 0; i < number_to_move; ++i )
*(dest++) = *(source++);
if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
/* don't do the read, it's not guaranteed to return an EOF,
* just force an EOF
*/
yy_current_buffer->yy_n_chars = yy_n_chars = 0;
else
{
int num_to_read =
yy_current_buffer->yy_buf_size - number_to_move - 1;
while ( num_to_read <= 0 )
{ /* Not enough room in the buffer - grow it. */
#ifdef YY_USES_REJECT
YY_FATAL_ERROR(
"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
#else
/* just a shorter name for the current buffer */
YY_BUFFER_STATE b = yy_current_buffer;
int yy_c_buf_p_offset =
(int) (yy_c_buf_p - b->yy_ch_buf);
if ( b->yy_is_our_buffer )
{
int new_size = b->yy_buf_size * 2;
if ( new_size <= 0 )
b->yy_buf_size += b->yy_buf_size / 8;
else
b->yy_buf_size *= 2;
b->yy_ch_buf = (char *)
/* Include room in for 2 EOB chars. */
yy_flex_realloc( (void *) b->yy_ch_buf,
b->yy_buf_size + 2 );
}
else
/* Can't grow it, we don't own it. */
b->yy_ch_buf = 0;
if ( ! b->yy_ch_buf )
YY_FATAL_ERROR(
"fatal error - scanner input buffer overflow" );
yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
num_to_read = yy_current_buffer->yy_buf_size -
number_to_move - 1;
#endif
}
if ( num_to_read > YY_READ_BUF_SIZE )
num_to_read = YY_READ_BUF_SIZE;
/* Read in more data. */
YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
yy_n_chars, num_to_read );
yy_current_buffer->yy_n_chars = yy_n_chars;
}
if ( yy_n_chars == 0 )
{
if ( number_to_move == YY_MORE_ADJ )
{
ret_val = EOB_ACT_END_OF_FILE;
yyrestart( yyin );
}
else
{
ret_val = EOB_ACT_LAST_MATCH;
yy_current_buffer->yy_buffer_status =
YY_BUFFER_EOF_PENDING;
}
}
else
ret_val = EOB_ACT_CONTINUE_SCAN;
yy_n_chars += number_to_move;
yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
return ret_val;
}
/* yy_get_previous_state - get the state just before the EOB char was reached */
static yy_state_type yy_get_previous_state()
{
register yy_state_type yy_current_state;
register char *yy_cp;
yy_current_state = yy_start;
yy_current_state += YY_AT_BOL();
for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
{
register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
if ( yy_accept[yy_current_state] )
{
yy_last_accepting_state = yy_current_state;
yy_last_accepting_cpos = yy_cp;
}
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 448 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
}
return yy_current_state;
}
/* yy_try_NUL_trans - try to make a transition on the NUL character
*
* synopsis
* next_state = yy_try_NUL_trans( current_state );
*/
#ifdef YY_USE_PROTOS
static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
#else
static yy_state_type yy_try_NUL_trans( yy_current_state )
yy_state_type yy_current_state;
#endif
{
register int yy_is_jam;
register char *yy_cp = yy_c_buf_p;
register YY_CHAR yy_c = 1;
if ( yy_accept[yy_current_state] )
{
yy_last_accepting_state = yy_current_state;
yy_last_accepting_cpos = yy_cp;
}
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 448 )
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 == 447);
return yy_is_jam ? 0 : yy_current_state;
}
#ifndef YY_NO_UNPUT
#ifdef YY_USE_PROTOS
static void yyunput( int c, register char *yy_bp )
#else
static void yyunput( c, yy_bp )
int c;
register char *yy_bp;
#endif
{
register char *yy_cp = yy_c_buf_p;
/* undo effects of setting up yytext */
*yy_cp = yy_hold_char;
if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
{ /* need to shift things up to make room */
/* +2 for EOB chars. */
register int number_to_move = yy_n_chars + 2;
register char *dest = &yy_current_buffer->yy_ch_buf[
yy_current_buffer->yy_buf_size + 2];
register char *source =
&yy_current_buffer->yy_ch_buf[number_to_move];
while ( source > yy_current_buffer->yy_ch_buf )
*--dest = *--source;
yy_cp += (int) (dest - source);
yy_bp += (int) (dest - source);
yy_current_buffer->yy_n_chars =
yy_n_chars = yy_current_buffer->yy_buf_size;
if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
YY_FATAL_ERROR( "flex scanner push-back overflow" );
}
*--yy_cp = (char) c;
yytext_ptr = yy_bp;
yy_hold_char = *yy_cp;
yy_c_buf_p = yy_cp;
}
#endif /* ifndef YY_NO_UNPUT */
#ifndef YY_NO_INPUT
#ifdef __cplusplus
static int yyinput()
#else
static int input()
#endif
{
int c;
*yy_c_buf_p = yy_hold_char;
if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
{
/* yy_c_buf_p now points to the character we want to return.
* If this occurs *before* the EOB characters, then it's a
* valid NUL; if not, then we've hit the end of the buffer.
*/
if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
/* This was really a NUL. */
*yy_c_buf_p = '\0';
else
{ /* need more input */
int offset = yy_c_buf_p - yytext_ptr;
++yy_c_buf_p;
switch ( yy_get_next_buffer() )
{
case EOB_ACT_LAST_MATCH:
/* This happens because yy_g_n_b()
* sees that we've accumulated a
* token and flags that we need to
* try matching the token before
* proceeding. But for input(),
* there's no matching to consider.
* So convert the EOB_ACT_LAST_MATCH
* to EOB_ACT_END_OF_FILE.
*/
/* Reset buffer status. */
yyrestart( yyin );
/* fall through */
case EOB_ACT_END_OF_FILE:
{
if ( yywrap() )
return EOF;
if ( ! yy_did_buffer_switch_on_eof )
YY_NEW_FILE;
#ifdef __cplusplus
return yyinput();
#else
return input();
#endif
}
case EOB_ACT_CONTINUE_SCAN:
yy_c_buf_p = yytext_ptr + offset;
break;
}
}
}
c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
*yy_c_buf_p = '\0'; /* preserve yytext */
yy_hold_char = *++yy_c_buf_p;
yy_current_buffer->yy_at_bol = (c == '\n');
return c;
}
#endif /* YY_NO_INPUT */
#ifdef YY_USE_PROTOS
void yyrestart( FILE *input_file )
#else
void yyrestart( input_file )
FILE *input_file;
#endif
{
if ( ! yy_current_buffer )
yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
yy_init_buffer( yy_current_buffer, input_file );
yy_load_buffer_state();
}
#ifdef YY_USE_PROTOS
void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
#else
void yy_switch_to_buffer( new_buffer )
YY_BUFFER_STATE new_buffer;
#endif
{
if ( yy_current_buffer == new_buffer )
return;
if ( yy_current_buffer )
{
/* Flush out information for old buffer. */
*yy_c_buf_p = yy_hold_char;
yy_current_buffer->yy_buf_pos = yy_c_buf_p;
yy_current_buffer->yy_n_chars = yy_n_chars;
}
yy_current_buffer = new_buffer;
yy_load_buffer_state();
/* We don't actually know whether we did this switch during
* EOF (yywrap()) processing, but the only time this flag
* is looked at is after yywrap() is called, so it's safe
* to go ahead and always set it.
*/
yy_did_buffer_switch_on_eof = 1;
}
#ifdef YY_USE_PROTOS
void yy_load_buffer_state( void )
#else
void yy_load_buffer_state()
#endif
{
yy_n_chars = yy_current_buffer->yy_n_chars;
yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
yyin = yy_current_buffer->yy_input_file;
yy_hold_char = *yy_c_buf_p;
}
#ifdef YY_USE_PROTOS
YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
#else
YY_BUFFER_STATE yy_create_buffer( file, size )
FILE *file;
int size;
#endif
{
YY_BUFFER_STATE b;
b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
b->yy_buf_size = size;
/* yy_ch_buf has to be 2 characters longer than the size given because
* we need to put in 2 end-of-buffer characters.
*/
b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
if ( ! b->yy_ch_buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
b->yy_is_our_buffer = 1;
yy_init_buffer( b, file );
return b;
}
#ifdef YY_USE_PROTOS
void yy_delete_buffer( YY_BUFFER_STATE b )
#else
void yy_delete_buffer( b )
YY_BUFFER_STATE b;
#endif
{
if ( ! b )
return;
if ( b == yy_current_buffer )
yy_current_buffer = (YY_BUFFER_STATE) 0;
if ( b->yy_is_our_buffer )
yy_flex_free( (void *) b->yy_ch_buf );
yy_flex_free( (void *) b );
}
#ifdef YY_USE_PROTOS
void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
#else
void yy_init_buffer( b, file )
YY_BUFFER_STATE b;
FILE *file;
#endif
{
yy_flush_buffer( b );
b->yy_input_file = file;
b->yy_fill_buffer = 1;
#if YY_ALWAYS_INTERACTIVE
b->yy_is_interactive = 1;
#else
#if YY_NEVER_INTERACTIVE
b->yy_is_interactive = 0;
#else
b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
#endif
#endif
}
#ifdef YY_USE_PROTOS
void yy_flush_buffer( YY_BUFFER_STATE b )
#else
void yy_flush_buffer( b )
YY_BUFFER_STATE b;
#endif
{
if ( ! b )
return;
b->yy_n_chars = 0;
/* We always need two end-of-buffer characters. The first causes
* a transition to the end-of-buffer state. The second causes
* a jam in that state.
*/
b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
b->yy_buf_pos = &b->yy_ch_buf[0];
b->yy_at_bol = 1;
b->yy_buffer_status = YY_BUFFER_NEW;
if ( b == yy_current_buffer )
yy_load_buffer_state();
}
#ifndef YY_NO_SCAN_BUFFER
#ifdef YY_USE_PROTOS
YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
#else
YY_BUFFER_STATE yy_scan_buffer( base, size )
char *base;
yy_size_t size;
#endif
{
YY_BUFFER_STATE b;
if ( size < 2 ||
base[size-2] != YY_END_OF_BUFFER_CHAR ||
base[size-1] != YY_END_OF_BUFFER_CHAR )
/* They forgot to leave room for the EOB's. */
return 0;
b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
b->yy_buf_pos = b->yy_ch_buf = base;
b->yy_is_our_buffer = 0;
b->yy_input_file = 0;
b->yy_n_chars = b->yy_buf_size;
b->yy_is_interactive = 0;
b->yy_at_bol = 1;
b->yy_fill_buffer = 0;
b->yy_buffer_status = YY_BUFFER_NEW;
yy_switch_to_buffer( b );
return b;
}
#endif
#ifndef YY_NO_SCAN_STRING
#ifdef YY_USE_PROTOS
YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
#else
YY_BUFFER_STATE yy_scan_string( yy_str )
yyconst char *yy_str;
#endif
{
int len;
for ( len = 0; yy_str[len]; ++len )
;
return yy_scan_bytes( yy_str, len );
}
#endif
#ifndef YY_NO_SCAN_BYTES
#ifdef YY_USE_PROTOS
YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
#else
YY_BUFFER_STATE yy_scan_bytes( bytes, len )
yyconst char *bytes;
int len;
#endif
{
YY_BUFFER_STATE b;
char *buf;
yy_size_t n;
int i;
/* Get memory for full buffer, including space for trailing EOB's. */
n = len + 2;
buf = (char *) yy_flex_alloc( n );
if ( ! buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
for ( i = 0; i < len; ++i )
buf[i] = bytes[i];
buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
b = yy_scan_buffer( buf, n );
if ( ! b )
YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
/* It's okay to grow etc. this buffer, and we should throw it
* away when we're done.
*/
b->yy_is_our_buffer = 1;
return b;
}
#endif
#ifndef YY_NO_PUSH_STATE
#ifdef YY_USE_PROTOS
static void yy_push_state( int new_state )
#else
static void yy_push_state( new_state )
int new_state;
#endif
{
if ( yy_start_stack_ptr >= yy_start_stack_depth )
{
yy_size_t new_size;
yy_start_stack_depth += YY_START_STACK_INCR;
new_size = yy_start_stack_depth * sizeof( int );
if ( ! yy_start_stack )
yy_start_stack = (int *) yy_flex_alloc( new_size );
else
yy_start_stack = (int *) yy_flex_realloc(
(void *) yy_start_stack, new_size );
if ( ! yy_start_stack )
YY_FATAL_ERROR(
"out of memory expanding start-condition stack" );
}
yy_start_stack[yy_start_stack_ptr++] = YY_START;
BEGIN(new_state);
}
#endif
#ifndef YY_NO_POP_STATE
static void yy_pop_state()
{
if ( --yy_start_stack_ptr < 0 )
YY_FATAL_ERROR( "start-condition stack underflow" );
BEGIN(yy_start_stack[yy_start_stack_ptr]);
}
#endif
#ifndef YY_NO_TOP_STATE
static int yy_top_state()
{
return yy_start_stack[yy_start_stack_ptr - 1];
}
#endif
#ifndef YY_EXIT_FAILURE
#define YY_EXIT_FAILURE 2
#endif
#ifdef YY_USE_PROTOS
static void yy_fatal_error( yyconst char msg[] )
#else
static void yy_fatal_error( msg )
char msg[];
#endif
{
(void) fprintf( stderr, "%s\n", msg );
exit( YY_EXIT_FAILURE );
}
/* Redefine yyless() so it works in section 3 code. */
#undef yyless
#define yyless(n) \
do \
{ \
/* Undo effects of setting up yytext. */ \
yytext[yyleng] = yy_hold_char; \
yy_c_buf_p = yytext + n; \
yy_hold_char = *yy_c_buf_p; \
*yy_c_buf_p = '\0'; \
yyleng = n; \
} \
while ( 0 )
/* Internal utility routines. */
#ifndef yytext_ptr
#ifdef YY_USE_PROTOS
static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
#else
static void yy_flex_strncpy( s1, s2, n )
char *s1;
yyconst char *s2;
int n;
#endif
{
register int i;
for ( i = 0; i < n; ++i )
s1[i] = s2[i];
}
#endif
#ifdef YY_NEED_STRLEN
#ifdef YY_USE_PROTOS
static int yy_flex_strlen( yyconst char *s )
#else
static int yy_flex_strlen( s )
yyconst char *s;
#endif
{
register int n;
for ( n = 0; s[n]; ++n )
;
return n;
}
#endif
#ifdef YY_USE_PROTOS
static void *yy_flex_alloc( yy_size_t size )
#else
static void *yy_flex_alloc( size )
yy_size_t size;
#endif
{
return (void *) malloc( size );
}
#ifdef YY_USE_PROTOS
static void *yy_flex_realloc( void *ptr, yy_size_t size )
#else
static void *yy_flex_realloc( ptr, size )
void *ptr;
yy_size_t size;
#endif
{
/* The cast to (char *) in the following accommodates both
* implementations that use char* generic pointers, and those
* that use void* generic pointers. It works with the latter
* because both ANSI C and C++ allow castless assignment from
* any pointer type to void*, and deal with argument conversions
* as though doing an assignment.
*/
return (void *) realloc( (char *) ptr, size );
}
#ifdef YY_USE_PROTOS
static void yy_flex_free( void *ptr )
#else
static void yy_flex_free( ptr )
void *ptr;
#endif
{
free( ptr );
}
#if YY_MAIN
int main()
{
yylex();
return 0;
}
#endif
#line 478 "scan.l"
static void
search_pathes(struct source_context *new, char *name)
{
char tryname[BUFSIZ];
int i;
for(i = 0; i < state.path_num; i++) {
strncpy(tryname, state.paths[i], sizeof(tryname));
strncat(tryname, COPY_CHAR, sizeof(tryname));
strncat(tryname, name, sizeof(tryname));
new->f = fopen(tryname, "rt");
if(new->f) {
new->name = strdup(tryname);
break;
}
}
return;
}
void open_src(char *name, int isinclude)
{
extern FILE *yyin;
struct source_context *new = malloc(sizeof(*new));
if (state.src)
state.src->yybuf = YY_CURRENT_BUFFER;
new->f = fopen(name, "rt");
if(new->f)
new->name = strdup(name);
else if(isinclude && (strchr(name, PATH_CHAR) == 0)) {
/* If include file and no PATH_CHAR in name, try searching include
path */
search_pathes(new, name);
if (new->f == NULL) {
/* We didn't find a match so check for lower case. This is mainly for
Microchip examples and some includes in which filenames were written
without regard to case */
char *lower_case_name = gp_lower_case(name);
search_pathes(new, lower_case_name);
free(lower_case_name);
if (new->f != NULL)
gpwarning(GPW_UNKNOWN, "found lower case match for include filename");
}
}
if(new->f)
new->lst.f = fopen(new->name, "rt");
yyin = new->f;
if (new->f == NULL) {
if (state.src) {
char complaint[BUFSIZ];
snprintf(complaint, sizeof(complaint),
"Unable to open file \"%s\" - %s",
name,
strerror(errno));
state.pass = 2; /* Ensure error actually gets displayed */
gperror(GPE_UNKNOWN, complaint);
} else {
perror(name);
}
exit(1);
}
if (state.src) {
yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
}
if (state.use_absolute_path) {
new->name = gp_absolute_path(new->name);
}
new->type = src_file;
new->h = NULL;
new->line_number = 1;
new->loop_number = 1;
if (state.debug_info) {
new->file_symbol = NULL;
} else {
new->file_symbol = coff_add_filesym(new->name, isinclude);
}
new->prev = state.src;
state.src = new;
state.src->fc = add_file(ft_src, new->name);
deps_add(new->name);
if (!isinclude) {
/* it is the top level file so initialize the lexer */
quoted = 0;
force_decimal = 0;
force_ident = 0;
}
}
void execute_macro(struct macro_head *h, int is_while)
{
struct source_context *new = malloc(sizeof(*new));
yy_size_t macro_src_size = 0;
char *macro_src;
assert(state.src != NULL);
state.src->yybuf = YY_CURRENT_BUFFER;
/* store the stack so it can be returned when the macro is complete */
state.src->astack = state.astack;
macro_src = make_macro_buffer(h);
macro_src_size = strlen(macro_src) + 2;
/* create new source_context */
new->name = strdup(h->src_name);
if (is_while) {
new->type = src_while;
} else {
new->type = src_macro;
}
new->line_number = h->line_number + 1;
new->loop_number = 1;
new->file_symbol = h->file_symbol;
new->f = NULL;
new->h = h;
new->lst.m = h->body;
new->prev = state.src;
state.src = new;
state.src->fc = add_file(ft_src, new->name); /* scan list for fc */
yy_scan_buffer(macro_src, macro_src_size);
}
void repeat_while(void)
{
struct macro_head *h;
yy_size_t macro_src_size = 0;
char *macro_src;
h = state.src->h;
/* rebuild the macro buffer, because it may have been modified */
macro_src = make_macro_buffer(h);
macro_src_size = strlen(macro_src) + 2;
state.src->line_number = h->line_number + 1;
state.src->loop_number++;
state.src->lst.m = h->body;
yy_delete_buffer(YY_CURRENT_BUFFER);
yy_scan_buffer(macro_src, macro_src_size);
}
static void push_string(char *str)
{
struct source_context *new = malloc(sizeof(*new));
assert(state.src != NULL);
state.src->yybuf = YY_CURRENT_BUFFER;
new->name = strdup(state.src->name);
new->type = src_substitution;
new->line_number = state.src->line_number;
new->loop_number = 1;
new->file_symbol = state.src->file_symbol;
new->f = NULL;
new->h = NULL;
new->lst.f = NULL;
new->fc = add_file(ft_src, new->name); /* scan list for fc */
yy_scan_string(str);
new->prev = state.src;
state.src = new;
}
void close_file()
{
struct source_context *old;
old = state.src;
state.src = state.src->prev;
if (old->type == src_file) {
if (old->f != NULL) {
fclose(old->f);
}
if (old->lst.f != NULL)
fclose(old->lst.f);
free(old->name);
if (!state.debug_info) {
coff_add_eofsym();
}
} else if (old->type == src_macro) {
state.stTop = pop_symbol_table(state.stTop);
state.stTopDefines = pop_symbol_table(state.stTopDefines);
if (state.src->astack != state.astack) {
gperror(GPE_ILLEGAL_NESTING, NULL);
}
assert(state.stTop != NULL);
assert(state.stTopDefines != NULL);
free(old->name);
} else if (old->type == src_while) {
free(old->name);
}
free(old);
}
void execute_exitm()
{
struct amode *previous;
struct amode *old;
/* The macro is ended early, so return the stack to its previous state */
previous = state.src->prev->astack;
while ((state.astack != NULL) &&
(state.astack != previous)) {
old = state.astack;
state.astack = state.astack->prev;
free(old);
}
close_file();
if (state.src) {
yy_delete_buffer(YY_CURRENT_BUFFER);
yy_switch_to_buffer(state.src->yybuf);
}
}
/* found end directive, close all files and stop the parser */
static int found_end()
{
if (state.while_head) {
state.mac_body = NULL;
state.mac_prev = NULL;
state.while_head = NULL;
gperror(GPE_EXPECTED, "Expected (ENDW)");
}
if (state.astack != NULL) {
struct amode *old;
while (state.astack) {
old = state.astack;
state.astack = state.astack->prev;
free(old);
}
gpwarning(GPW_EXPECTED, "Expected (ENDIF)");
}
if (state.mac_prev != NULL) {
gperror(GPW_EXPECTED,"Expected (ENDM)");
}
/* close all open files */
while(state.src) {
close_file();
}
/* make sure the buffer is empty when pass 2 starts */
if (YY_CURRENT_BUFFER)
yy_flush_buffer(YY_CURRENT_BUFFER);
return 1;
}
static int found_eof()
{
int terminate = 0;
if (state.src->type == src_while) {
if (maybe_evaluate(state.src->h->parms)) {
if (state.src->loop_number > 255) {
gperror(GPE_BAD_WHILE_LOOP, NULL);
} else {
/* repeat the while loop */
repeat_while();
return 0;
}
}
}
close_file();
if (state.src) {
/* Just an include file */
yy_delete_buffer(YY_CURRENT_BUFFER);
yy_switch_to_buffer(state.src->yybuf);
} else {
gperror(GPE_ILLEGAL_COND,
"Illegal condition (EOF encountered before END)");
terminate = found_end();
}
return terminate;
}
enum identtype identify(char *text)
{
enum identtype type;
struct symbol *sym;
if ((sym = get_symbol(state.stTopDefines, text)) != NULL) {
type = defines;
} else if ((sym = get_symbol(state.stDirective, text)) != NULL) {
type = directives;
} else if ((sym = get_symbol(state.stBuiltin, text)) != NULL) {
type = opcodes;
} else if ((sym = get_symbol(state.stGlobal, text)) != NULL) {
type = globals;
} else if ((sym = get_symbol(state.stMacros, text)) != NULL) {
type = macros;
} else {
type = unknown_type;
}
return type;
}
static char *
check_defines(char *symbol)
{
struct symbol *sym;
char *subst = NULL;
/* If not quoted, check for #define substitution */
if (!quoted &&
(sym = get_symbol(state.stTopDefines, yytext)) != NULL) {
subst = get_symbol_annotation(sym);
assert(subst != NULL);
if (strcmp(yytext, subst) == 0) {
/* check for a bad subsitution */
subst = NULL;
}
}
return subst;
}
syntax highlighted by Code2HTML, v. 0.9.1