Am Sonntag, 23. Juli 2006 18:09 schrieb Vishal Soni: > Hi, > > Can some one help me with Flex debugging? > > Previously if I recall correctly the adding %option debug in imcc.l use > to spit out debug information to the console. This does not seem to work > now.
$ info flex sayeth: `-d, --debug, `%option debug'' makes the generated scanner run in "debug" mode. Whenever a pattern is recognized and the global variable `yy_flex_debug' is non-zero (which is the default), the scanner will write to `stderr' a line of the form: i.e. differently to previous versions, `yy_flex_debug' also needs turning on, which could probably done along with turning on 'yydebug' with the -y commandline switch. While above states that `yy_flex_debug' would be turned on by default, a 'find ... grep' shows no indications for that. *But* trying that [1], it seems that it's just not working. > -Vishal leo [1] the patch w/o func proto
Index: src/dynoplibs/myops.ops =================================================================== --- src/dynoplibs/myops.ops (Revision 13449) +++ src/dynoplibs/myops.ops (Arbeitskopie) @@ -101,6 +101,23 @@ goto NEXT(); } +=item B<if_else>(in INT, labelconst INT, labelconst INT) + +Opcode to test multiple lables. Branch to 1st label on true $1, else to 2nd. + +=cut + +op if_else(in INT, labelconst INT, labelconst INT) { + if ($1) { + goto OFFSET($2); + } + else { + goto OFFSET($3); + } + goto NEXT(); /* unused */ +} + + =back =cut Index: compilers/imcc/imclexer.c =================================================================== --- compilers/imcc/imclexer.c (Revision 13449) +++ compilers/imcc/imclexer.c (Arbeitskopie) @@ -14,16 +14,32 @@ #define FLEX_BETA #endif +/* %if-c++-only */ +/* %endif */ + +/* %if-c-only */ + +/* %endif */ + +/* %if-c-only */ + +/* %endif */ + /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ +/* %if-c-only */ #include <stdio.h> #include <string.h> #include <errno.h> #include <stdlib.h> +/* %endif */ +/* %if-tables-serialization */ +/* %endif */ /* end standard C headers. */ +/* %if-c-or-c++ */ /* flex integer type definitions */ #ifndef FLEXINT_H @@ -87,6 +103,11 @@ #endif /* ! FLEXINT_H */ +/* %endif */ + +/* %if-c++-only */ +/* %endif */ + #ifdef __cplusplus /* The "const" storage-class-modifier is valid. */ @@ -107,16 +128,24 @@ #define yyconst #endif +/* %not-for-header */ + /* Returned upon end-of-file. */ #define YY_NULL 0 +/* %ok-for-header */ +/* %not-for-header */ + /* 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) +/* %ok-for-header */ +/* %if-reentrant */ + /* An opaque pointer. */ #ifndef YY_TYPEDEF_YY_SCANNER_T #define YY_TYPEDEF_YY_SCANNER_T @@ -135,7 +164,11 @@ #define yy_flex_debug yyg->yy_flex_debug_r int yylex_init (yyscan_t* scanner); +/* %endif */ +/* %if-not-reentrant */ +/* %endif */ + /* 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. @@ -171,6 +204,14 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif +/* %if-not-reentrant */ +/* %endif */ + +/* %if-c-only */ +/* %if-not-reentrant */ +/* %endif */ +/* %endif */ + #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 @@ -207,8 +248,13 @@ #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { +/* %if-c-only */ FILE *yy_input_file; +/* %endif */ +/* %if-c++-only */ +/* %endif */ + char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ @@ -268,6 +314,15 @@ }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ +/* %if-c-only Standard (non-C++) definition */ +/* %not-for-header */ + +/* %if-not-reentrant */ +/* %endif */ +/* %ok-for-header */ + +/* %endif */ + /* 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". @@ -283,6 +338,15 @@ */ #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] +/* %if-c-only Standard (non-C++) definition */ + +/* %if-not-reentrant */ +/* %not-for-header */ + +/* %ok-for-header */ + +/* %endif */ + void yyrestart (FILE *input_file ,yyscan_t yyscanner ); void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner ); @@ -301,6 +365,8 @@ YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); +/* %endif */ + void *yyalloc (yy_size_t ,yyscan_t yyscanner ); void *yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); void yyfree (void * ,yyscan_t yyscanner ); @@ -329,29 +395,39 @@ #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) +/* %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here */ /* Begin user sect3 */ +#define FLEX_DEBUG + typedef unsigned char YY_CHAR; typedef int yy_state_type; #define yytext_ptr yytext_r +/* %if-c-only Standard (non-C++) definition */ + static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); static int yy_get_next_buffer (yyscan_t yyscanner ); static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); +/* %endif */ + /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ yyg->yytext_ptr = yy_bp; \ +/* %% [2.0] code to fiddle yytext and yyleng for yymore() goes here \ */\ yyleng = (size_t) (yy_cp - yy_bp); \ yyg->yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ +/* %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \ */\ yyg->yy_c_buf_p = yy_cp; +/* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */ #define YY_NUM_RULES 154 #define YY_END_OF_BUFFER 155 /* This struct is not used in this scanner, @@ -2902,6 +2978,27 @@ 1249, 1249, 1249, 1249, 1249, 1249, 1249, 1249, 1249 } ; +static yyconst flex_int16_t yy_rule_linenum[154] = + { 0, + 143, 148, 161, 188, 192, 196, 198, 199, 200, 205, + 207, 215, 216, 226, 231, 236, 241, 242, 243, 244, + 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, + 256, 257, 258, 259, 260, 261, 263, 265, 266, 267, + 268, 269, 270, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 283, 284, 285, 286, 287, 289, 290, + 291, 292, 293, 294, 296, 297, 298, 299, 300, 301, + 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, + 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, + 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, + + 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, + 342, 343, 344, 345, 346, 347, 348, 349, 350, 352, + 356, 384, 394, 412, 431, 433, 438, 453, 475, 476, + 477, 478, 479, 481, 487, 492, 514, 521, 522, 523, + 524, 526, 528, 544, 546, 551, 552, 571, 585, 586, + 587, 588, 589 + } ; + /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ @@ -3002,7 +3099,7 @@ -#line 3006 "compilers/imcc/imclexer.c" +#line 3103 "compilers/imcc/imclexer.c" #define INITIAL 0 #define emit 1 @@ -3021,13 +3118,20 @@ * 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. */ +/* %if-c-only */ #include <unistd.h> +/* %endif */ +/* %if-c++-only */ +/* %endif */ #endif #ifndef YY_EXTRA_TYPE #define YY_EXTRA_TYPE void * #endif +/* %if-c-only Reentrant structure and macros (non-C++). */ +/* %if-reentrant */ + /* Holds the entire state of the reentrant scanner. */ struct yyguts_t { @@ -3062,8 +3166,16 @@ }; /* end struct yyguts_t */ +/* %if-c-only */ + static int yy_init_globals (yyscan_t yyscanner ); +/* %endif */ + +/* %if-reentrant */ + +/* %endif */ + /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ @@ -3093,6 +3205,10 @@ void yyset_lineno (int line_number ,yyscan_t yyscanner ); +/* %if-bison-bridge */ +/* %endif */ +/* %endif End reentrant structures and macros. */ + /* Macros after this point can all be overridden by user definitions in * section 1. */ @@ -3105,8 +3221,14 @@ #endif #endif +/* %not-for-header */ + static void yyunput (int c,char *buf_ptr ,yyscan_t yyscanner); +/* %ok-for-header */ + +/* %endif */ + #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); #endif @@ -3116,21 +3238,29 @@ #endif #ifndef YY_NO_INPUT +/* %if-c-only Standard (non-C++) definition */ +/* %not-for-header */ #ifdef __cplusplus static int yyinput (yyscan_t yyscanner ); #else static int input (yyscan_t yyscanner ); #endif +/* %ok-for-header */ +/* %endif */ #endif +/* %if-c-only */ + static void yy_push_state (int new_state ,yyscan_t yyscanner); static void yy_pop_state (yyscan_t yyscanner ); static int yy_top_state (yyscan_t yyscanner ); +/* %endif */ + /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #define YY_READ_BUF_SIZE 8192 @@ -3138,10 +3268,14 @@ /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO +/* %if-c-only Standard (non-C++) definition */ /* 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 */ +/* %if-c++-only C++ definition */ +/* %endif */ #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -3149,6 +3283,7 @@ */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ +/* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ @@ -3177,6 +3312,8 @@ } \ }\ \ +/* %if-c++-only C++ definition \ */\ +/* %endif */ #endif @@ -3195,20 +3332,39 @@ /* Report a fatal error. */ #ifndef YY_FATAL_ERROR +/* %if-c-only */ #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner) +/* %endif */ +/* %if-c++-only */ +/* %endif */ #endif +/* %if-tables-serialization structures and prototypes */ +/* %not-for-header */ + +/* %ok-for-header */ + +/* %not-for-header */ + +/* %tables-yydmap generated elements */ +/* %endif */ /* end tables serialization structures and prototypes */ +/* %ok-for-header */ + /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL_IS_OURS 1 +/* %if-c-only Standard (non-C++) definition */ extern int yylex (yyscan_t yyscanner); #define YY_DECL int yylex (yyscan_t yyscanner) +/* %endif */ +/* %if-c++-only C++ definition */ +/* %endif */ #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after yytext and yyleng @@ -3223,12 +3379,15 @@ #define YY_BREAK break; #endif +/* %% [6.0] YY_RULE_SETUP definition goes here */ #define YY_RULE_SETUP \ if ( yyleng > 0 ) \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ (yytext[yyleng - 1] == '\n'); \ YY_USER_ACTION +/* %not-for-header */ + /** The main scanner function which does all the work. */ YY_DECL @@ -3238,7 +3397,8 @@ register int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; -#line 126 "compilers/imcc/imcc.l" +/* %% [7.0] user's declarations go here */ +#line 127 "compilers/imcc/imcc.l" /* for emacs "*/ if (expect_pasm == 1 && !in_pod) { @@ -3255,7 +3415,7 @@ return 0; } -#line 3259 "compilers/imcc/imclexer.c" +#line 3419 "compilers/imcc/imclexer.c" if ( !yyg->yy_init ) { @@ -3269,10 +3429,18 @@ yyg->yy_start = 1; /* first start state */ if ( ! yyin ) +/* %if-c-only */ yyin = stdin; +/* %endif */ +/* %if-c++-only */ +/* %endif */ if ( ! yyout ) +/* %if-c-only */ yyout = stdout; +/* %endif */ +/* %if-c++-only */ +/* %endif */ if ( ! YY_CURRENT_BUFFER ) { yyensure_buffer_stack (yyscanner); @@ -3285,6 +3453,7 @@ while ( 1 ) /* loops until end-of-file is reached */ { +/* %% [8.0] yymore()-related code goes here */ yy_cp = yyg->yy_c_buf_p; /* Support of yytext. */ @@ -3295,6 +3464,7 @@ */ yy_bp = yy_cp; +/* %% [9.0] code to set up and find next match goes here */ yy_current_state = yyg->yy_start; yy_current_state += YY_AT_BOL(); yy_match: @@ -3320,14 +3490,35 @@ yy_current_state = yyg->yy_last_accepting_state; yy_find_action: +/* %% [10.0] code to find the action number goes here */ yy_act = yy_accept[yy_current_state]; YY_DO_BEFORE_ACTION; +/* %% [11.0] code for yylineno update goes here */ + do_action: /* This label is used only to access EOF actions. */ +/* %% [12.0] debug code goes here */ + if ( yy_flex_debug ) + { + if ( yy_act == 0 ) + fprintf( stderr, "--scanner backing up\n" ); + else if ( yy_act < 154 ) + fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n", + (long)yy_rule_linenum[yy_act], yytext ); + else if ( yy_act == 154 ) + fprintf( stderr, "--accepting default rule (\"%s\")\n", + yytext ); + else if ( yy_act == 155 ) + fprintf( stderr, "--(end of buffer or a NUL)\n" ); + else + fprintf( stderr, "--EOF (start condition %d)\n", YY_START ); + } + switch ( yy_act ) { /* beginning of action switch */ +/* %% [13.0] actions go here */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = yyg->yy_hold_char; @@ -3338,7 +3529,7 @@ case 1: /* rule 1 can match eol */ YY_RULE_SETUP -#line 142 "compilers/imcc/imcc.l" +#line 143 "compilers/imcc/imcc.l" { frames->heredoc_rest = str_dup(yytext); BEGIN(heredoc2); @@ -3347,7 +3538,7 @@ case 2: /* rule 2 can match eol */ YY_RULE_SETUP -#line 147 "compilers/imcc/imcc.l" +#line 148 "compilers/imcc/imcc.l" { /* heredocs have highest priority * arrange them befor all wildcard state matches @@ -3363,7 +3554,7 @@ YY_BREAK case 3: YY_RULE_SETUP -#line 160 "compilers/imcc/imcc.l" +#line 161 "compilers/imcc/imcc.l" { /* Are we at the end of the heredoc? */ if (strcmp(heredoc_end, yytext) == 0) @@ -3392,7 +3583,7 @@ YY_BREAK case 4: YY_RULE_SETUP -#line 187 "compilers/imcc/imcc.l" +#line 188 "compilers/imcc/imcc.l" { prev_state = YYSTATE; BEGIN(cmt2); valp->t = atoi(yytext+6); return LINECOMMENT; @@ -3401,7 +3592,7 @@ case 5: /* rule 5 can match eol */ YY_RULE_SETUP -#line 191 "compilers/imcc/imcc.l" +#line 192 "compilers/imcc/imcc.l" { BEGIN(cmt3); valp->s = str_dup(yytext); return FILECOMMENT; @@ -3409,22 +3600,22 @@ YY_BREAK case 6: YY_RULE_SETUP -#line 195 "compilers/imcc/imcc.l" +#line 196 "compilers/imcc/imcc.l" { BEGIN(cmt4); } YY_BREAK case 7: YY_RULE_SETUP -#line 197 "compilers/imcc/imcc.l" +#line 198 "compilers/imcc/imcc.l" { prev_state = YYSTATE; BEGIN(cmt2); } YY_BREAK case 8: YY_RULE_SETUP -#line 198 "compilers/imcc/imcc.l" +#line 199 "compilers/imcc/imcc.l" { prev_state = YYSTATE; BEGIN(cmt1); } YY_BREAK case 9: YY_RULE_SETUP -#line 199 "compilers/imcc/imcc.l" +#line 200 "compilers/imcc/imcc.l" { valp->t = atoi(yytext); BEGIN(cmt4); @@ -3434,13 +3625,13 @@ case 10: /* rule 10 can match eol */ YY_RULE_SETUP -#line 204 "compilers/imcc/imcc.l" +#line 205 "compilers/imcc/imcc.l" { BEGIN(prev_state) ; line++; } YY_BREAK case 11: /* rule 11 can match eol */ YY_RULE_SETUP -#line 206 "compilers/imcc/imcc.l" +#line 207 "compilers/imcc/imcc.l" { if (expect_pasm == 2) BEGIN(INITIAL); @@ -3451,13 +3642,13 @@ YY_BREAK case 12: YY_RULE_SETUP -#line 214 "compilers/imcc/imcc.l" +#line 215 "compilers/imcc/imcc.l" { prev_state = YYSTATE; BEGIN(cmt5); } YY_BREAK case 13: /* rule 13 can match eol */ YY_RULE_SETUP -#line 215 "compilers/imcc/imcc.l" +#line 216 "compilers/imcc/imcc.l" { if (expect_pasm == 2) BEGIN(INITIAL); @@ -3471,7 +3662,7 @@ case 14: /* rule 14 can match eol */ YY_RULE_SETUP -#line 225 "compilers/imcc/imcc.l" +#line 226 "compilers/imcc/imcc.l" { BEGIN(emit); return(EMIT); @@ -3480,7 +3671,7 @@ case 15: /* rule 15 can match eol */ YY_RULE_SETUP -#line 230 "compilers/imcc/imcc.l" +#line 231 "compilers/imcc/imcc.l" { BEGIN(INITIAL); return EOM; @@ -3488,7 +3679,7 @@ YY_BREAK case 16: YY_RULE_SETUP -#line 235 "compilers/imcc/imcc.l" +#line 236 "compilers/imcc/imcc.l" { valp->s = str_dup(yytext); return REG; @@ -3496,532 +3687,532 @@ YY_BREAK case 17: YY_RULE_SETUP -#line 240 "compilers/imcc/imcc.l" +#line 241 "compilers/imcc/imcc.l" { in_pod = 1; yy_push_state(pod, yyscanner); } YY_BREAK case 18: /* rule 18 can match eol */ YY_RULE_SETUP -#line 241 "compilers/imcc/imcc.l" +#line 242 "compilers/imcc/imcc.l" { in_pod = 0; yy_pop_state(yyscanner); ++line; } YY_BREAK case 19: YY_RULE_SETUP -#line 242 "compilers/imcc/imcc.l" +#line 243 "compilers/imcc/imcc.l" { /*ignore*/ } YY_BREAK case 20: /* rule 20 can match eol */ YY_RULE_SETUP -#line 243 "compilers/imcc/imcc.l" +#line 244 "compilers/imcc/imcc.l" { ++line; } YY_BREAK case 21: YY_RULE_SETUP -#line 245 "compilers/imcc/imcc.l" +#line 246 "compilers/imcc/imcc.l" return(LOCAL); YY_BREAK case 22: YY_RULE_SETUP -#line 246 "compilers/imcc/imcc.l" +#line 247 "compilers/imcc/imcc.l" return(LEXICAL); YY_BREAK case 23: YY_RULE_SETUP -#line 247 "compilers/imcc/imcc.l" +#line 248 "compilers/imcc/imcc.l" return(ARG); YY_BREAK case 24: YY_RULE_SETUP -#line 248 "compilers/imcc/imcc.l" +#line 249 "compilers/imcc/imcc.l" return(SUB); YY_BREAK case 25: YY_RULE_SETUP -#line 249 "compilers/imcc/imcc.l" +#line 250 "compilers/imcc/imcc.l" return(ESUB); YY_BREAK case 26: YY_RULE_SETUP -#line 250 "compilers/imcc/imcc.l" +#line 251 "compilers/imcc/imcc.l" return(PCC_BEGIN); YY_BREAK case 27: YY_RULE_SETUP -#line 251 "compilers/imcc/imcc.l" +#line 252 "compilers/imcc/imcc.l" return(PCC_END); YY_BREAK case 28: YY_RULE_SETUP -#line 252 "compilers/imcc/imcc.l" +#line 253 "compilers/imcc/imcc.l" return(PCC_CALL); YY_BREAK case 29: YY_RULE_SETUP -#line 253 "compilers/imcc/imcc.l" +#line 254 "compilers/imcc/imcc.l" return(NCI_CALL); YY_BREAK case 30: YY_RULE_SETUP -#line 254 "compilers/imcc/imcc.l" +#line 255 "compilers/imcc/imcc.l" return(METH_CALL); YY_BREAK case 31: YY_RULE_SETUP -#line 255 "compilers/imcc/imcc.l" +#line 256 "compilers/imcc/imcc.l" return(INVOCANT); YY_BREAK case 32: YY_RULE_SETUP -#line 256 "compilers/imcc/imcc.l" +#line 257 "compilers/imcc/imcc.l" return(PCC_SUB); YY_BREAK case 33: YY_RULE_SETUP -#line 257 "compilers/imcc/imcc.l" +#line 258 "compilers/imcc/imcc.l" return(PCC_BEGIN_RETURN); YY_BREAK case 34: YY_RULE_SETUP -#line 258 "compilers/imcc/imcc.l" +#line 259 "compilers/imcc/imcc.l" return(PCC_END_RETURN); YY_BREAK case 35: YY_RULE_SETUP -#line 259 "compilers/imcc/imcc.l" +#line 260 "compilers/imcc/imcc.l" return(PCC_BEGIN_YIELD); YY_BREAK case 36: YY_RULE_SETUP -#line 260 "compilers/imcc/imcc.l" +#line 261 "compilers/imcc/imcc.l" return(PCC_END_YIELD); YY_BREAK case 37: YY_RULE_SETUP -#line 262 "compilers/imcc/imcc.l" +#line 263 "compilers/imcc/imcc.l" return(METHOD); /* old compat cruft - the canonical colon names are below */ YY_BREAK case 38: YY_RULE_SETUP -#line 264 "compilers/imcc/imcc.l" +#line 265 "compilers/imcc/imcc.l" return(MULTI); YY_BREAK case 39: YY_RULE_SETUP -#line 265 "compilers/imcc/imcc.l" +#line 266 "compilers/imcc/imcc.l" return(MAIN); YY_BREAK case 40: YY_RULE_SETUP -#line 266 "compilers/imcc/imcc.l" +#line 267 "compilers/imcc/imcc.l" return(LOAD); YY_BREAK case 41: YY_RULE_SETUP -#line 267 "compilers/imcc/imcc.l" +#line 268 "compilers/imcc/imcc.l" return(IMMEDIATE); YY_BREAK case 42: YY_RULE_SETUP -#line 268 "compilers/imcc/imcc.l" +#line 269 "compilers/imcc/imcc.l" return(POSTCOMP); YY_BREAK case 43: YY_RULE_SETUP -#line 269 "compilers/imcc/imcc.l" +#line 270 "compilers/imcc/imcc.l" return(ANON); YY_BREAK case 44: YY_RULE_SETUP -#line 271 "compilers/imcc/imcc.l" +#line 272 "compilers/imcc/imcc.l" return(METHOD); YY_BREAK case 45: YY_RULE_SETUP -#line 272 "compilers/imcc/imcc.l" +#line 273 "compilers/imcc/imcc.l" return(MULTI); YY_BREAK case 46: YY_RULE_SETUP -#line 273 "compilers/imcc/imcc.l" +#line 274 "compilers/imcc/imcc.l" return(MAIN); YY_BREAK case 47: YY_RULE_SETUP -#line 274 "compilers/imcc/imcc.l" +#line 275 "compilers/imcc/imcc.l" return(LOAD); YY_BREAK case 48: YY_RULE_SETUP -#line 275 "compilers/imcc/imcc.l" +#line 276 "compilers/imcc/imcc.l" return(IMMEDIATE); YY_BREAK case 49: YY_RULE_SETUP -#line 276 "compilers/imcc/imcc.l" +#line 277 "compilers/imcc/imcc.l" return(POSTCOMP); YY_BREAK case 50: YY_RULE_SETUP -#line 277 "compilers/imcc/imcc.l" +#line 278 "compilers/imcc/imcc.l" return(ANON); YY_BREAK case 51: YY_RULE_SETUP -#line 278 "compilers/imcc/imcc.l" +#line 279 "compilers/imcc/imcc.l" return(OUTER); YY_BREAK case 52: YY_RULE_SETUP -#line 279 "compilers/imcc/imcc.l" +#line 280 "compilers/imcc/imcc.l" return(NEED_LEX); YY_BREAK case 53: YY_RULE_SETUP -#line 280 "compilers/imcc/imcc.l" +#line 281 "compilers/imcc/imcc.l" return(UNIQUE_REG); YY_BREAK case 54: YY_RULE_SETUP -#line 282 "compilers/imcc/imcc.l" +#line 283 "compilers/imcc/imcc.l" return(RESULT); YY_BREAK case 55: YY_RULE_SETUP -#line 283 "compilers/imcc/imcc.l" +#line 284 "compilers/imcc/imcc.l" return(GET_RESULTS); YY_BREAK case 56: YY_RULE_SETUP -#line 284 "compilers/imcc/imcc.l" +#line 285 "compilers/imcc/imcc.l" return(YIELDT); YY_BREAK case 57: YY_RULE_SETUP -#line 285 "compilers/imcc/imcc.l" +#line 286 "compilers/imcc/imcc.l" return(RETURN); YY_BREAK case 58: YY_RULE_SETUP -#line 286 "compilers/imcc/imcc.l" +#line 287 "compilers/imcc/imcc.l" return(LOADLIB); YY_BREAK case 59: YY_RULE_SETUP -#line 288 "compilers/imcc/imcc.l" +#line 289 "compilers/imcc/imcc.l" return(ADV_FLAT); YY_BREAK case 60: YY_RULE_SETUP -#line 289 "compilers/imcc/imcc.l" +#line 290 "compilers/imcc/imcc.l" return(ADV_SLURPY); YY_BREAK case 61: YY_RULE_SETUP -#line 290 "compilers/imcc/imcc.l" +#line 291 "compilers/imcc/imcc.l" return(ADV_OPTIONAL); YY_BREAK case 62: YY_RULE_SETUP -#line 291 "compilers/imcc/imcc.l" +#line 292 "compilers/imcc/imcc.l" return(ADV_OPT_FLAG); YY_BREAK case 63: YY_RULE_SETUP -#line 292 "compilers/imcc/imcc.l" +#line 293 "compilers/imcc/imcc.l" return(ADV_NAMED); YY_BREAK case 64: YY_RULE_SETUP -#line 293 "compilers/imcc/imcc.l" +#line 294 "compilers/imcc/imcc.l" return(ADV_ARROW); YY_BREAK case 65: YY_RULE_SETUP -#line 295 "compilers/imcc/imcc.l" +#line 296 "compilers/imcc/imcc.l" return(NAMESPACE); YY_BREAK case 66: YY_RULE_SETUP -#line 296 "compilers/imcc/imcc.l" +#line 297 "compilers/imcc/imcc.l" return(HLL); YY_BREAK case 67: YY_RULE_SETUP -#line 297 "compilers/imcc/imcc.l" +#line 298 "compilers/imcc/imcc.l" return(HLL_MAP); YY_BREAK case 68: YY_RULE_SETUP -#line 298 "compilers/imcc/imcc.l" +#line 299 "compilers/imcc/imcc.l" return(ENDNAMESPACE); YY_BREAK case 69: YY_RULE_SETUP -#line 299 "compilers/imcc/imcc.l" +#line 300 "compilers/imcc/imcc.l" return(LOCAL); YY_BREAK case 70: YY_RULE_SETUP -#line 300 "compilers/imcc/imcc.l" +#line 301 "compilers/imcc/imcc.l" return(GLOBAL); YY_BREAK case 71: YY_RULE_SETUP -#line 301 "compilers/imcc/imcc.l" +#line 302 "compilers/imcc/imcc.l" return(CONST); YY_BREAK case 72: YY_RULE_SETUP -#line 302 "compilers/imcc/imcc.l" +#line 303 "compilers/imcc/imcc.l" return(GLOBAL_CONST); YY_BREAK case 73: YY_RULE_SETUP -#line 303 "compilers/imcc/imcc.l" +#line 304 "compilers/imcc/imcc.l" return(PARAM); YY_BREAK case 74: YY_RULE_SETUP -#line 304 "compilers/imcc/imcc.l" +#line 305 "compilers/imcc/imcc.l" return(PRAGMA); YY_BREAK case 75: YY_RULE_SETUP -#line 305 "compilers/imcc/imcc.l" +#line 306 "compilers/imcc/imcc.l" return(N_OPERATORS); YY_BREAK case 76: YY_RULE_SETUP -#line 306 "compilers/imcc/imcc.l" +#line 307 "compilers/imcc/imcc.l" return(GOTO); YY_BREAK case 77: YY_RULE_SETUP -#line 307 "compilers/imcc/imcc.l" +#line 308 "compilers/imcc/imcc.l" return(IF); YY_BREAK case 78: YY_RULE_SETUP -#line 308 "compilers/imcc/imcc.l" +#line 309 "compilers/imcc/imcc.l" return(UNLESS); YY_BREAK case 79: YY_RULE_SETUP -#line 309 "compilers/imcc/imcc.l" +#line 310 "compilers/imcc/imcc.l" return(PNULL); YY_BREAK case 80: YY_RULE_SETUP -#line 310 "compilers/imcc/imcc.l" +#line 311 "compilers/imcc/imcc.l" return(INTV); YY_BREAK case 81: YY_RULE_SETUP -#line 311 "compilers/imcc/imcc.l" +#line 312 "compilers/imcc/imcc.l" return(FLOATV); YY_BREAK case 82: YY_RULE_SETUP -#line 312 "compilers/imcc/imcc.l" +#line 313 "compilers/imcc/imcc.l" return(FLOATV); YY_BREAK case 83: YY_RULE_SETUP -#line 313 "compilers/imcc/imcc.l" +#line 314 "compilers/imcc/imcc.l" return(NEW); YY_BREAK case 84: YY_RULE_SETUP -#line 314 "compilers/imcc/imcc.l" +#line 315 "compilers/imcc/imcc.l" return(ADDR); YY_BREAK case 85: YY_RULE_SETUP -#line 315 "compilers/imcc/imcc.l" +#line 316 "compilers/imcc/imcc.l" return(GLOBALOP); YY_BREAK case 86: YY_RULE_SETUP -#line 316 "compilers/imcc/imcc.l" +#line 317 "compilers/imcc/imcc.l" return(OBJECTV); YY_BREAK case 87: YY_RULE_SETUP -#line 317 "compilers/imcc/imcc.l" +#line 318 "compilers/imcc/imcc.l" return(PMCV); YY_BREAK case 88: YY_RULE_SETUP -#line 318 "compilers/imcc/imcc.l" +#line 319 "compilers/imcc/imcc.l" return(STRINGV); YY_BREAK case 89: YY_RULE_SETUP -#line 319 "compilers/imcc/imcc.l" +#line 320 "compilers/imcc/imcc.l" return(SHIFT_LEFT); YY_BREAK case 90: YY_RULE_SETUP -#line 320 "compilers/imcc/imcc.l" +#line 321 "compilers/imcc/imcc.l" return(SHIFT_RIGHT); YY_BREAK case 91: YY_RULE_SETUP -#line 321 "compilers/imcc/imcc.l" +#line 322 "compilers/imcc/imcc.l" return(SHIFT_RIGHT_U); YY_BREAK case 92: YY_RULE_SETUP -#line 322 "compilers/imcc/imcc.l" +#line 323 "compilers/imcc/imcc.l" return(LOG_AND); YY_BREAK case 93: YY_RULE_SETUP -#line 323 "compilers/imcc/imcc.l" +#line 324 "compilers/imcc/imcc.l" return(LOG_OR); YY_BREAK case 94: YY_RULE_SETUP -#line 324 "compilers/imcc/imcc.l" +#line 325 "compilers/imcc/imcc.l" return(LOG_XOR); YY_BREAK case 95: YY_RULE_SETUP -#line 325 "compilers/imcc/imcc.l" +#line 326 "compilers/imcc/imcc.l" return(RELOP_LT); YY_BREAK case 96: YY_RULE_SETUP -#line 326 "compilers/imcc/imcc.l" +#line 327 "compilers/imcc/imcc.l" return(RELOP_LTE); YY_BREAK case 97: YY_RULE_SETUP -#line 327 "compilers/imcc/imcc.l" +#line 328 "compilers/imcc/imcc.l" return(RELOP_GT); YY_BREAK case 98: YY_RULE_SETUP -#line 328 "compilers/imcc/imcc.l" +#line 329 "compilers/imcc/imcc.l" return(RELOP_GTE); YY_BREAK case 99: YY_RULE_SETUP -#line 329 "compilers/imcc/imcc.l" +#line 330 "compilers/imcc/imcc.l" return(RELOP_EQ); YY_BREAK case 100: YY_RULE_SETUP -#line 330 "compilers/imcc/imcc.l" +#line 331 "compilers/imcc/imcc.l" return(RELOP_NE); YY_BREAK case 101: YY_RULE_SETUP -#line 331 "compilers/imcc/imcc.l" +#line 332 "compilers/imcc/imcc.l" return(POW); YY_BREAK case 102: YY_RULE_SETUP -#line 332 "compilers/imcc/imcc.l" +#line 333 "compilers/imcc/imcc.l" return(POINTY); YY_BREAK case 103: YY_RULE_SETUP -#line 333 "compilers/imcc/imcc.l" +#line 334 "compilers/imcc/imcc.l" return(CONCAT); YY_BREAK case 104: YY_RULE_SETUP -#line 334 "compilers/imcc/imcc.l" +#line 335 "compilers/imcc/imcc.l" return(DOT); YY_BREAK case 105: YY_RULE_SETUP -#line 335 "compilers/imcc/imcc.l" +#line 336 "compilers/imcc/imcc.l" return(DOTDOT); YY_BREAK case 106: YY_RULE_SETUP -#line 336 "compilers/imcc/imcc.l" +#line 337 "compilers/imcc/imcc.l" return(PLUS_ASSIGN); YY_BREAK case 107: YY_RULE_SETUP -#line 337 "compilers/imcc/imcc.l" +#line 338 "compilers/imcc/imcc.l" return(MINUS_ASSIGN); YY_BREAK case 108: YY_RULE_SETUP -#line 338 "compilers/imcc/imcc.l" +#line 339 "compilers/imcc/imcc.l" return(MUL_ASSIGN); YY_BREAK case 109: YY_RULE_SETUP -#line 339 "compilers/imcc/imcc.l" +#line 340 "compilers/imcc/imcc.l" return(DIV_ASSIGN); YY_BREAK case 110: YY_RULE_SETUP -#line 340 "compilers/imcc/imcc.l" +#line 341 "compilers/imcc/imcc.l" return(MOD_ASSIGN); YY_BREAK case 111: YY_RULE_SETUP -#line 341 "compilers/imcc/imcc.l" +#line 342 "compilers/imcc/imcc.l" return(FDIV); YY_BREAK case 112: YY_RULE_SETUP -#line 342 "compilers/imcc/imcc.l" +#line 343 "compilers/imcc/imcc.l" return(FDIV_ASSIGN); YY_BREAK case 113: YY_RULE_SETUP -#line 343 "compilers/imcc/imcc.l" +#line 344 "compilers/imcc/imcc.l" return(BAND_ASSIGN); YY_BREAK case 114: YY_RULE_SETUP -#line 344 "compilers/imcc/imcc.l" +#line 345 "compilers/imcc/imcc.l" return(BOR_ASSIGN); YY_BREAK case 115: YY_RULE_SETUP -#line 345 "compilers/imcc/imcc.l" +#line 346 "compilers/imcc/imcc.l" return(BXOR_ASSIGN); YY_BREAK case 116: YY_RULE_SETUP -#line 346 "compilers/imcc/imcc.l" +#line 347 "compilers/imcc/imcc.l" return(SHR_ASSIGN); YY_BREAK case 117: YY_RULE_SETUP -#line 347 "compilers/imcc/imcc.l" +#line 348 "compilers/imcc/imcc.l" return(SHL_ASSIGN); YY_BREAK case 118: YY_RULE_SETUP -#line 348 "compilers/imcc/imcc.l" +#line 349 "compilers/imcc/imcc.l" return(SHR_U_ASSIGN); YY_BREAK case 119: YY_RULE_SETUP -#line 349 "compilers/imcc/imcc.l" +#line 350 "compilers/imcc/imcc.l" return(CONCAT_ASSIGN); YY_BREAK case 120: YY_RULE_SETUP -#line 351 "compilers/imcc/imcc.l" +#line 352 "compilers/imcc/imcc.l" { return read_macro(valp, interp, yyscanner); } YY_BREAK case 121: YY_RULE_SETUP -#line 355 "compilers/imcc/imcc.l" +#line 356 "compilers/imcc/imcc.l" { int c; char *name; @@ -4052,7 +4243,7 @@ YY_BREAK case 122: YY_RULE_SETUP -#line 383 "compilers/imcc/imcc.l" +#line 384 "compilers/imcc/imcc.l" { int c; @@ -4065,7 +4256,7 @@ YY_BREAK case 123: YY_RULE_SETUP -#line 393 "compilers/imcc/imcc.l" +#line 394 "compilers/imcc/imcc.l" { char *label; @@ -4086,7 +4277,7 @@ YY_BREAK case 124: YY_RULE_SETUP -#line 411 "compilers/imcc/imcc.l" +#line 412 "compilers/imcc/imcc.l" { char *label; @@ -4108,12 +4299,12 @@ YY_BREAK case 125: YY_RULE_SETUP -#line 430 "compilers/imcc/imcc.l" +#line 431 "compilers/imcc/imcc.l" return(COMMA); YY_BREAK case 126: YY_RULE_SETUP -#line 432 "compilers/imcc/imcc.l" +#line 433 "compilers/imcc/imcc.l" { YYCHOP(); /* trim last ':' */ DUP_AND_RET(valp,LABEL); @@ -4121,7 +4312,7 @@ YY_BREAK case 127: YY_RULE_SETUP -#line 437 "compilers/imcc/imcc.l" +#line 438 "compilers/imcc/imcc.l" { int type = pmc_type(interp, string_from_cstring(interp, yytext+1, 0)); @@ -4139,7 +4330,7 @@ YY_BREAK case 128: YY_RULE_SETUP -#line 452 "compilers/imcc/imcc.l" +#line 453 "compilers/imcc/imcc.l" { if (!is_def) { SymReg *r = find_sym(interp, yytext); @@ -4164,32 +4355,32 @@ YY_BREAK case 129: YY_RULE_SETUP -#line 474 "compilers/imcc/imcc.l" +#line 475 "compilers/imcc/imcc.l" DUP_AND_RET(valp, FLOATC); YY_BREAK case 130: YY_RULE_SETUP -#line 475 "compilers/imcc/imcc.l" +#line 476 "compilers/imcc/imcc.l" DUP_AND_RET(valp, INTC); YY_BREAK case 131: YY_RULE_SETUP -#line 476 "compilers/imcc/imcc.l" +#line 477 "compilers/imcc/imcc.l" DUP_AND_RET(valp, INTC); YY_BREAK case 132: YY_RULE_SETUP -#line 477 "compilers/imcc/imcc.l" +#line 478 "compilers/imcc/imcc.l" DUP_AND_RET(valp, INTC); YY_BREAK case 133: YY_RULE_SETUP -#line 478 "compilers/imcc/imcc.l" +#line 479 "compilers/imcc/imcc.l" DUP_AND_RET(valp, INTC); YY_BREAK case 134: YY_RULE_SETUP -#line 480 "compilers/imcc/imcc.l" +#line 481 "compilers/imcc/imcc.l" { valp->s = str_dup(yytext); valp->s[strlen(valp->s) - 1] = '\0'; /* trailing 'L' */ @@ -4198,7 +4389,7 @@ YY_BREAK case 135: YY_RULE_SETUP -#line 486 "compilers/imcc/imcc.l" +#line 487 "compilers/imcc/imcc.l" { valp->s = str_dup(yytext); return(STRINGC); /* XXX delete quotes, -> emit, pbc */ @@ -4206,7 +4397,7 @@ YY_BREAK case 136: YY_RULE_SETUP -#line 491 "compilers/imcc/imcc.l" +#line 492 "compilers/imcc/imcc.l" { struct macro_frame_t *frame; /* Save the string we want to mark the end of the heredoc and snip @@ -4231,7 +4422,7 @@ YY_BREAK case 137: YY_RULE_SETUP -#line 513 "compilers/imcc/imcc.l" +#line 514 "compilers/imcc/imcc.l" { valp->s = str_dup(yytext); /* charset:"..." */ /* this is actually not unicode but a string with a charset */ @@ -4240,39 +4431,39 @@ YY_BREAK case 138: YY_RULE_SETUP -#line 520 "compilers/imcc/imcc.l" +#line 521 "compilers/imcc/imcc.l" DUP_AND_RET(valp, IREG); YY_BREAK case 139: YY_RULE_SETUP -#line 521 "compilers/imcc/imcc.l" +#line 522 "compilers/imcc/imcc.l" DUP_AND_RET(valp, NREG); YY_BREAK case 140: YY_RULE_SETUP -#line 522 "compilers/imcc/imcc.l" +#line 523 "compilers/imcc/imcc.l" DUP_AND_RET(valp, SREG); YY_BREAK case 141: YY_RULE_SETUP -#line 523 "compilers/imcc/imcc.l" +#line 524 "compilers/imcc/imcc.l" DUP_AND_RET(valp, PREG); YY_BREAK case 142: YY_RULE_SETUP -#line 525 "compilers/imcc/imcc.l" +#line 526 "compilers/imcc/imcc.l" /* skip */; YY_BREAK case 143: YY_RULE_SETUP -#line 527 "compilers/imcc/imcc.l" +#line 528 "compilers/imcc/imcc.l" { /* catch all except for state macro */ return yytext[0]; } YY_BREAK case YY_STATE_EOF(emit): -#line 532 "compilers/imcc/imcc.l" +#line 533 "compilers/imcc/imcc.l" { BEGIN (INITIAL); if (frames->s.pasm_file) { @@ -4283,18 +4474,18 @@ } YY_BREAK case YY_STATE_EOF(INITIAL): -#line 541 "compilers/imcc/imcc.l" +#line 542 "compilers/imcc/imcc.l" yyterminate(); YY_BREAK case 144: YY_RULE_SETUP -#line 543 "compilers/imcc/imcc.l" +#line 544 "compilers/imcc/imcc.l" DUP_AND_RET(valp, ENDM); YY_BREAK case 145: /* rule 145 can match eol */ YY_RULE_SETUP -#line 545 "compilers/imcc/imcc.l" +#line 546 "compilers/imcc/imcc.l" { line++; DUP_AND_RET(valp, '\n'); @@ -4302,12 +4493,12 @@ YY_BREAK case 146: YY_RULE_SETUP -#line 550 "compilers/imcc/imcc.l" +#line 551 "compilers/imcc/imcc.l" return LABEL; YY_BREAK case 147: YY_RULE_SETUP -#line 551 "compilers/imcc/imcc.l" +#line 552 "compilers/imcc/imcc.l" { char *label; char *name = macros[num_macros].name; @@ -4329,7 +4520,7 @@ YY_BREAK case 148: YY_RULE_SETUP -#line 570 "compilers/imcc/imcc.l" +#line 571 "compilers/imcc/imcc.l" { char *label; char *name = macros[num_macros].name; @@ -4346,39 +4537,39 @@ YY_BREAK case 149: YY_RULE_SETUP -#line 584 "compilers/imcc/imcc.l" +#line 585 "compilers/imcc/imcc.l" /* skip leading ws */; YY_BREAK case 150: YY_RULE_SETUP -#line 585 "compilers/imcc/imcc.l" +#line 586 "compilers/imcc/imcc.l" DUP_AND_RET(valp, ' '); YY_BREAK case 151: YY_RULE_SETUP -#line 586 "compilers/imcc/imcc.l" +#line 587 "compilers/imcc/imcc.l" DUP_AND_RET(valp, IDENTIFIER); YY_BREAK case 152: YY_RULE_SETUP -#line 587 "compilers/imcc/imcc.l" +#line 588 "compilers/imcc/imcc.l" DUP_AND_RET(valp, MACRO); YY_BREAK case 153: YY_RULE_SETUP -#line 588 "compilers/imcc/imcc.l" +#line 589 "compilers/imcc/imcc.l" DUP_AND_RET(valp, yytext[0]); YY_BREAK case YY_STATE_EOF(macro): -#line 589 "compilers/imcc/imcc.l" +#line 590 "compilers/imcc/imcc.l" yyterminate(); YY_BREAK case 154: YY_RULE_SETUP -#line 591 "compilers/imcc/imcc.l" +#line 592 "compilers/imcc/imcc.l" ECHO; YY_BREAK -#line 4382 "compilers/imcc/imclexer.c" +#line 4573 "compilers/imcc/imclexer.c" case YY_STATE_EOF(pod): case YY_STATE_EOF(cmt1): case YY_STATE_EOF(cmt2): @@ -4452,6 +4643,7 @@ else { +/* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */ yy_cp = yyg->yy_last_accepting_cpos; yy_current_state = yyg->yy_last_accepting_state; goto yy_find_action; @@ -4518,7 +4710,15 @@ } /* end of action switch */ } /* end of scanning one token */ } /* end of yylex */ +/* %ok-for-header */ +/* %if-c++-only */ +/* %not-for-header */ + +/* %ok-for-header */ + +/* %endif */ + /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: @@ -4526,7 +4726,11 @@ * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ +/* %if-c-only */ static int yy_get_next_buffer (yyscan_t yyscanner) +/* %endif */ +/* %if-c++-only */ +/* %endif */ { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; @@ -4653,17 +4857,25 @@ /* yy_get_previous_state - get the state just before the EOB char was reached */ +/* %if-c-only */ +/* %not-for-header */ + static yy_state_type yy_get_previous_state (yyscan_t yyscanner) +/* %endif */ +/* %if-c++-only */ +/* %endif */ { register yy_state_type yy_current_state; register char *yy_cp; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; +/* %% [15.0] code to get the start state into yy_current_state goes here */ yy_current_state = yyg->yy_start; yy_current_state += YY_AT_BOL(); for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) { +/* %% [16.0] code to find the next state goes here */ register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { @@ -4687,10 +4899,15 @@ * synopsis * next_state = yy_try_NUL_trans( current_state ); */ +/* %if-c-only */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) +/* %endif */ +/* %if-c++-only */ +/* %endif */ { register int yy_is_jam; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ +/* %% [17.0] code to find the next state, and perhaps do backing up, goes here */ register char *yy_cp = yyg->yy_c_buf_p; register YY_CHAR yy_c = 1; @@ -4711,7 +4928,12 @@ return yy_is_jam ? 0 : yy_current_state; } +/* %if-c-only */ + static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner) +/* %endif */ +/* %if-c++-only */ +/* %endif */ { register char *yy_cp; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; @@ -4744,11 +4966,17 @@ *--yy_cp = (char) c; +/* %% [18.0] update yylineno here */ + yyg->yytext_ptr = yy_bp; yyg->yy_hold_char = *yy_cp; yyg->yy_c_buf_p = yy_cp; } +/* %if-c-only */ +/* %endif */ + +/* %if-c-only */ #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (yyscan_t yyscanner) @@ -4756,6 +4984,9 @@ static int input (yyscan_t yyscanner) #endif +/* %endif */ +/* %if-c++-only */ +/* %endif */ { int c; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; @@ -4820,18 +5051,25 @@ *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ yyg->yy_hold_char = *++yyg->yy_c_buf_p; +/* %% [19.0] update BOL and yylineno */ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); return c; } +/* %if-c-only */ #endif /* ifndef YY_NO_INPUT */ +/* %endif */ /** Immediately switch to a different input stream. * @param input_file A readable stream. * @param yyscanner The scanner object. * @note This function does not reset the start condition to @c INITIAL . */ +/* %if-c-only */ void yyrestart (FILE * input_file , yyscan_t yyscanner) +/* %endif */ +/* %if-c++-only */ +/* %endif */ { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; @@ -4849,7 +5087,11 @@ * @param new_buffer The new input buffer. * @param yyscanner The scanner object. */ +/* %if-c-only */ void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +/* %endif */ +/* %if-c++-only */ +/* %endif */ { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; @@ -4881,7 +5123,11 @@ yyg->yy_did_buffer_switch_on_eof = 1; } +/* %if-c-only */ static void yy_load_buffer_state (yyscan_t yyscanner) +/* %endif */ +/* %if-c++-only */ +/* %endif */ { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; @@ -4896,7 +5142,11 @@ * @param yyscanner The scanner object. * @return the allocated buffer state. */ +/* %if-c-only */ YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) +/* %endif */ +/* %if-c++-only */ +/* %endif */ { YY_BUFFER_STATE b; @@ -4924,7 +5174,11 @@ * @param b a buffer created with yy_create_buffer() * @param yyscanner The scanner object. */ +/* %if-c-only */ void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +/* %endif */ +/* %if-c++-only */ +/* %endif */ { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; @@ -4940,11 +5194,22 @@ yyfree((void *) b ,yyscanner ); } +/* %if-c-only */ + +/* %endif */ + +/* %if-c++-only */ +/* %endif */ + /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a yyrestart() or at EOF. */ +/* %if-c-only */ static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) +/* %endif */ +/* %if-c++-only */ +/* %endif */ { int oerrno = errno; @@ -4964,8 +5229,13 @@ b->yy_bs_column = 0; } +/* %if-c-only */ + b->yy_is_interactive = 0; +/* %endif */ +/* %if-c++-only */ +/* %endif */ errno = oerrno; } @@ -4973,7 +5243,11 @@ * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * @param yyscanner The scanner object. */ +/* %if-c-only */ void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +/* %endif */ +/* %if-c++-only */ +/* %endif */ { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if ( ! b ) @@ -4997,13 +5271,18 @@ yy_load_buffer_state(yyscanner ); } +/* %if-c-or-c++ */ /** 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. * @param yyscanner The scanner object. */ +/* %if-c-only */ void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +/* %endif */ +/* %if-c++-only */ +/* %endif */ { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (new_buffer == NULL) @@ -5029,12 +5308,18 @@ yy_load_buffer_state(yyscanner ); yyg->yy_did_buffer_switch_on_eof = 1; } +/* %endif */ +/* %if-c-or-c++ */ /** Removes and deletes the top of the stack, if present. * The next element becomes the new top. * @param yyscanner The scanner object. */ +/* %if-c-only */ void yypop_buffer_state (yyscan_t yyscanner) +/* %endif */ +/* %if-c++-only */ +/* %endif */ { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (!YY_CURRENT_BUFFER) @@ -5050,11 +5335,17 @@ yyg->yy_did_buffer_switch_on_eof = 1; } } +/* %endif */ +/* %if-c-or-c++ */ /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ +/* %if-c-only */ static void yyensure_buffer_stack (yyscan_t yyscanner) +/* %endif */ +/* %if-c++-only */ +/* %endif */ { int num_to_alloc; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; @@ -5093,7 +5384,9 @@ yyg->yy_buffer_stack_max = num_to_alloc; } } +/* %endif */ +/* %if-c-only */ /** 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 @@ -5128,7 +5421,9 @@ return b; } +/* %endif */ +/* %if-c-only */ /** Setup the input buffer state to scan a string. The next call to yylex() will * scan from a @e copy of @a str. * @param str a NUL-terminated string to scan @@ -5142,7 +5437,9 @@ return yy_scan_bytes(yystr,strlen(yystr) ,yyscanner); } +/* %endif */ +/* %if-c-only */ /** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. * @param bytes the byte buffer to scan @@ -5179,8 +5476,13 @@ return b; } +/* %endif */ +/* %if-c-only */ static void yy_push_state (int new_state , yyscan_t yyscanner) +/* %endif */ +/* %if-c++-only */ +/* %endif */ { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if ( yyg->yy_start_stack_ptr >= yyg->yy_start_stack_depth ) @@ -5206,7 +5508,11 @@ BEGIN(new_state); } +/* %if-c-only */ static void yy_pop_state (yyscan_t yyscanner) +/* %endif */ +/* %if-c++-only */ +/* %endif */ { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if ( --yyg->yy_start_stack_ptr < 0 ) @@ -5215,7 +5521,11 @@ BEGIN(yyg->yy_start_stack[yyg->yy_start_stack_ptr]); } +/* %if-c-only */ static int yy_top_state (yyscan_t yyscanner) +/* %endif */ +/* %if-c++-only */ +/* %endif */ { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyg->yy_start_stack[yyg->yy_start_stack_ptr - 1]; @@ -5225,11 +5535,15 @@ #define YY_EXIT_FAILURE 2 #endif +/* %if-c-only */ static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) { (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } +/* %endif */ +/* %if-c++-only */ +/* %endif */ /* Redefine yyless() so it works in section 3 code. */ @@ -5250,6 +5564,9 @@ /* Accessor methods (get/set functions) to struct members. */ +/* %if-c-only */ +/* %if-reentrant */ + /** Get the user-defined data for this scanner. * @param yyscanner The scanner object. */ @@ -5259,6 +5576,8 @@ return yyextra; } +/* %endif */ + /** Get the current line number. * @param yyscanner The scanner object. */ @@ -5322,6 +5641,8 @@ return yytext; } +/* %if-reentrant */ + /** Set the user-defined data. This data is never touched by the scanner. * @param user_defined The data to be associated with this scanner. * @param yyscanner The scanner object. @@ -5332,6 +5653,8 @@ yyextra = user_defined ; } +/* %endif */ + /** Set the current line number. * @param line_number * @param yyscanner The scanner object. @@ -5392,8 +5715,14 @@ yy_flex_debug = bdebug ; } +/* %endif */ + +/* %if-reentrant */ /* Accessor methods for yylval and yylloc */ +/* %if-bison-bridge */ +/* %endif */ + /* User-visible API */ /* yylex_init is special because it creates the scanner itself, so it is @@ -5422,6 +5751,9 @@ return yy_init_globals ( *ptr_yy_globals ); } +/* %endif */ + +/* %if-c-only */ static int yy_init_globals (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; @@ -5454,7 +5786,9 @@ */ return 0; } +/* %endif */ +/* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */ /* yylex_destroy is for both reentrant and non-reentrant scanners. */ int yylex_destroy (yyscan_t yyscanner) { @@ -5479,11 +5813,14 @@ * yylex() is called, initialization will occur. */ yy_init_globals( yyscanner); +/* %if-reentrant */ /* Destroy the main struct (reentrant only). */ yyfree ( yyscanner , yyscanner ); yyscanner = NULL; +/* %endif */ return 0; } +/* %endif */ /* * Internal utility routines. @@ -5531,12 +5868,17 @@ free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ } +/* %if-tables-serialization definitions */ +/* %define-yytables The name for this specific scanner's tables. */ #define YYTABLES_NAME "yytables" +/* %endif */ -#line 591 "compilers/imcc/imcc.l" +/* %ok-for-header */ +#line 592 "compilers/imcc/imcc.l" + #ifdef yywrap #undef yywrap #endif @@ -6083,7 +6425,14 @@ return(yyg->yyin_r); } +void +imcc_lex_debug(int f, void *yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyg->yy_flex_debug_r = f; +} + /* * Local variables: * c-indentation-style: bsd Index: compilers/imcc/main.c =================================================================== --- compilers/imcc/main.c (Revision 13449) +++ compilers/imcc/main.c (Arbeitskopie) @@ -193,7 +193,7 @@ /* most stolen from test_main.c */ static char * -parseflags(Parrot_Interp interp, int *argc, char **argv[]) +parseflags(Parrot_Interp interp, int *argc, char **argv[], void *yyscanner) { struct longopt_opt_info opt = LONGOPT_OPT_INFO_INIT; int status; @@ -288,6 +288,7 @@ break; case 'y': yydebug = 1; + imcc_lex_debug(1, yyscanner); break; case 'E': pre_process = 1; @@ -514,7 +515,7 @@ imcc_init(interp); IMCC_ast_init(interp); - sourcefile = parseflags(interp, &argc, &argv); + sourcefile = parseflags(interp, &argc, &argv, yyscanner); output_file = interp->output_file; /* Default optimization level is zero; see optimizer.c, imc.h */ Index: compilers/imcc/imcc.l =================================================================== --- compilers/imcc/imcc.l (Revision 13449) +++ compilers/imcc/imcc.l (Arbeitskopie) @@ -85,6 +85,7 @@ %option reentrant %option never-interactive %option stack +%option debug LETTER [EMAIL PROTECTED] DIGIT [0-9] @@ -1136,7 +1137,14 @@ return(yyg->yyin_r); } +void +imcc_lex_debug(int f, void *yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyg->yy_flex_debug_r = f; +} + /* * Local variables: * c-indentation-style: bsd