diff options
-rw-r--r-- | src/cpp-flex.skl | 2277 |
1 files changed, 1099 insertions, 1178 deletions
diff --git a/src/cpp-flex.skl b/src/cpp-flex.skl index c9f1bfd..ac433ce 100644 --- a/src/cpp-flex.skl +++ b/src/cpp-flex.skl @@ -21,6 +21,12 @@ %# The exception to this rule is YY_G, which is an m4 macro, %# but it needs to be remain short because it is used everywhere. %# +%# The m4 macros complicate reading this code enough that being +%# prescriptive about whitespace and braces is more than usually +%# important. So please set your C style to K&R, aka 1TBS with +%# tabs when editing this file. Braces around single-statement +%# if/while/fo/do/switch/break bodies are mandatory. +%# /* A lexical scanner generated by flex */ %# Macros for preproc stage. @@ -484,12 +490,9 @@ struct yy_buffer_state %if-c-only FILE *yy_input_file; %endif - %if-c++-only std::streambuf* yy_input_file; %endif - - char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ @@ -522,9 +525,8 @@ struct yy_buffer_state */ int yy_at_bol; - int yy_bs_lineno; /**< The line count. */ - int yy_bs_column; /**< The column count. */ - + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ /* Whether to try to fill the input buffer when we reach the * end of it. @@ -885,71 +887,61 @@ m4_ifdef( [[M4_EXTRA_TYPE_DEFS]], m4_ifdef( [[M4_YY_NOT_IN_HEADER]], [[ /* Holds the entire state of the reentrant scanner. */ -struct yyguts_t - { - - /* User-defined. Not touched by flex. */ - YY_EXTRA_TYPE yyextra_r; - - /* The rest are the same as the globals declared in the non-reentrant scanner. */ - FILE *yyin_r, *yyout_r; - size_t yy_buffer_stack_top; /**< index of top of stack. */ - size_t yy_buffer_stack_max; /**< capacity of stack. */ - YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ - char yy_hold_char; - int yy_n_chars; - int yyleng_r; - char *yy_c_buf_p; - int yy_init; - int yy_start; - int yy_did_buffer_switch_on_eof; - int yy_start_stack_ptr; - int yy_start_stack_depth; - int *yy_start_stack; - yy_state_type yy_last_accepting_state; - char* yy_last_accepting_cpos; - - int yylineno_r; - int yy_flex_debug_r; +struct yyguts_t { + /* User-defined. Not touched by flex. */ + YY_EXTRA_TYPE yyextra_r; + + /* The rest are the same as the globals declared in the non-reentrant scanner. */ + FILE *yyin_r, *yyout_r; + size_t yy_buffer_stack_top; /**< index of top of stack. */ + size_t yy_buffer_stack_max; /**< capacity of stack. */ + YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ + char yy_hold_char; + int yy_n_chars; + int yyleng_r; + char *yy_c_buf_p; + int yy_init; + int yy_start; + int yy_did_buffer_switch_on_eof; + int yy_start_stack_ptr; + int yy_start_stack_depth; + int *yy_start_stack; + yy_state_type yy_last_accepting_state; + char* yy_last_accepting_cpos; -m4_ifdef( [[M4_MODE_USES_REJECT]], -[[ - yy_state_type *yy_state_buf; - yy_state_type *yy_state_ptr; - char *yy_full_match; - int yy_lp; + int yylineno_r; + int yy_flex_debug_r; - /* These are only needed for trailing context rules, - * but there's no conditional variable for that yet. */ - int yy_looking_for_trail_begin; - int yy_full_lp; - int *yy_full_state; -]]) +m4_ifdef( [[M4_MODE_USES_REJECT]], [[ + yy_state_type *yy_state_buf; + yy_state_type *yy_state_ptr; + char *yy_full_match; + int yy_lp; -m4_ifdef( [[M4_YY_TEXT_IS_ARRAY]], -[[ - char yytext_r[YYLMAX]; - char *yytext_ptr; - int yy_more_offset; - int yy_prev_more_offset; -]], -[[ - char *yytext_r; - int yy_more_flag; - int yy_more_len; + /* These are only needed for trailing context rules, + * but there's no conditional variable for that yet. */ + int yy_looking_for_trail_begin; + int yy_full_lp; + int *yy_full_state; ]]) - -m4_ifdef( [[M4_YY_BISON_LVAL]], -[[ - YYSTYPE * yylval_r; +m4_ifdef( [[M4_YY_TEXT_IS_ARRAY]], [[ + char yytext_r[YYLMAX]; + char *yytext_ptr; + int yy_more_offset; + int yy_prev_more_offset; +]], [[ + char *yytext_r; + int yy_more_flag; + int yy_more_len; ]]) - -m4_ifdef( [[<M4_YY_BISON_LLOC>]], -[[ - YYLTYPE * yylloc_r; +m4_ifdef( [[M4_YY_BISON_LVAL]], [[ + YYSTYPE * yylval_r; ]]) - }; /* end struct yyguts_t */ +m4_ifdef( [[<M4_YY_BISON_LLOC>]], [[ + YYLTYPE * yylloc_r; +]]) +}; /* end struct yyguts_t */ ]]) @@ -1309,8 +1301,7 @@ struct yytbl_dmap { }; /** A {0,0,0}-terminated list of structs, forming the map */ -static struct yytbl_dmap yydmap[] = -{ +static struct yytbl_dmap yydmap[] = { %tables-yydmap generated elements {0,0,0} }; @@ -1483,8 +1474,7 @@ m4_ifdef([[M4_NOT_MODE_USEECS]], [[m4_define([[M4_EC]], [[$1]])]]) %not-for-header /** The main scanner function which does all the work. */ -YY_DECL -{ +YY_DECL { yy_state_type yy_current_state; char *yy_cp, *yy_bp; int yy_act; @@ -1512,8 +1502,7 @@ m4_ifdef( [[<M4_YY_BISON_LLOC>]], yylloc = yylloc_param; ]]) - if ( !YY_G(yy_init) ) - { + if ( !YY_G(yy_init) ) { YY_G(yy_init) = 1; #ifdef YY_USER_INIT @@ -1523,31 +1512,33 @@ m4_ifdef( [[<M4_YY_BISON_LLOC>]], m4_ifdef( [[M4_MODE_USES_REJECT]], [[ /* Create the reject buffer large enough to save one state per allowed character. */ - if ( ! YY_G(yy_state_buf) ) + if ( ! YY_G(yy_state_buf) ) { YY_G(yy_state_buf) = (yy_state_type *)yyalloc(YY_STATE_BUF_SIZE M4_YY_CALL_LAST_ARG); - if ( ! YY_G(yy_state_buf) ) + } + if ( ! YY_G(yy_state_buf) ) { YY_FATAL_ERROR( "out of dynamic memory in yylex()" ); + } ]]) - if ( ! YY_G(yy_start) ) + if ( ! YY_G(yy_start) ) { YY_G(yy_start) = 1; /* first start state */ - - if ( ! yyin ) + } + if ( ! yyin ) { %if-c-only yyin = stdin; %endif %if-c++-only yyin.rdbuf(std::cin.rdbuf()); %endif - - if ( ! yyout ) + } + if ( ! yyout ) { %if-c-only yyout = stdout; %endif %if-c++-only yyout.rdbuf(std::cout.rdbuf()); %endif - + } if ( ! YY_CURRENT_BUFFER ) { yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); YY_CURRENT_BUFFER_LVALUE = @@ -1555,381 +1546,359 @@ m4_ifdef( [[M4_MODE_USES_REJECT]], } yy_load_buffer_state( M4_YY_CALL_ONLY_ARG ); - } + } + /* open scope of user declarationns */ { %% [4.0] user's declarations go here - while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ - { + while ( /*CONSTCOND*/1 ) { /* loops until end-of-file is reached */ m4_ifdef( [[M4_MODE_YYMORE_USED]], [[ m4_ifdef( [[M4_MODE_NO_YYTEXT_IS_ARRAY]], [[ - YY_G(yy_more_len) = 0; - if ( YY_G(yy_more_flag) ) - { - YY_G(yy_more_len) = (int) (YY_G(yy_c_buf_p) - YY_G(yytext_ptr)); - YY_G(yy_more_flag) = 0; + YY_G(yy_more_len) = 0; + if ( YY_G(yy_more_flag) ) { + YY_G(yy_more_len) = (int) (YY_G(yy_c_buf_p) - YY_G(yytext_ptr)); + YY_G(yy_more_flag) = 0; } ]]) ]]) - yy_cp = YY_G(yy_c_buf_p); + yy_cp = YY_G(yy_c_buf_p); - /* Support of yytext. */ - *yy_cp = YY_G(yy_hold_char); + /* Support of yytext. */ + *yy_cp = YY_G(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_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; M4_GEN_START_STATE -yy_match: - - /* Generate the code to find the next match. */ + yy_match: + /* Generate the code to find the next match. */ m4_ifdef([[M4_MODE_FIND_ACTION_FULLTBL]], [[ m4_ifdef([[M4_MODE_GENTABLES]], [[ - while ((yy_current_state = yy_nxt[yy_current_state][ M4_EC(YY_SC_TO_UI(*yy_cp)) ]) > 0) { + while ((yy_current_state = yy_nxt[yy_current_state][ M4_EC(YY_SC_TO_UI(*yy_cp)) ]) > 0) { ]]) m4_ifdef([[M4_MODE_NO_GENTABLES]], [[ - while ((yy_current_state = yy_nxt[yy_current_state*YY_NXT_LOLEN + M4_EC(YY_SC_TO_UI(*yy_cp)) ]) > 0) - { + while ((yy_current_state = yy_nxt[yy_current_state*YY_NXT_LOLEN + M4_EC(YY_SC_TO_UI(*yy_cp)) ]) > 0) { ]]) M4_GEN_BACKING_UP - yy_cp++; + yy_cp++; } - yy_current_state = -yy_current_state; + yy_current_state = -yy_current_state; ]]) m4_ifdef([[M4_MODE_FULLSPD]], [[ - M4_GEN_NEXT_MATCH_FULLSPD(M4_EC(YY_SC_TO_UI(*yy_cp)), M4_EC(YY_SC_TO_UI(*++yy_cp))) + M4_GEN_NEXT_MATCH_FULLSPD(M4_EC(YY_SC_TO_UI(*yy_cp)), M4_EC(YY_SC_TO_UI(*++yy_cp))) ]]) m4_ifdef([[M4_MODE_NO_FULLSPD_OR_FULLTBL]], [[ - do - { - M4_GEN_NEXT_COMPRESSED_STATE(M4_EC(YY_SC_TO_UI(*yy_cp))) + do { + M4_GEN_NEXT_COMPRESSED_STATE(M4_EC(YY_SC_TO_UI(*yy_cp))) - m4_ifdef([[M4_MODE_USES_REJECT]], [[*YY_G(yy_state_ptr)++ = yy_current_state;]]) - ++yy_cp; + m4_ifdef([[M4_MODE_USES_REJECT]], [[*YY_G(yy_state_ptr)++ = yy_current_state;]]) + ++yy_cp; } - m4_ifdef([[M4_MODE_INTERACTIVE]], [[while ( yy_base[yy_current_state] != YY_JAMBASE );]]) - m4_ifdef([[M4_MODE_NO_INTERACTIVE]], [[while ( yy_current_state != YY_JAMSTATE );]]) + m4_ifdef([[M4_MODE_INTERACTIVE]], [[while ( yy_base[yy_current_state] != YY_JAMBASE );]]) + m4_ifdef([[M4_MODE_NO_INTERACTIVE]], [[while ( yy_current_state != YY_JAMSTATE );]]) m4_ifdef([[M4_MODE_NO_USES_REJECT]], [[ m4_ifdef([[M4_MODE_NO_INTERACTIVE]], [[ - /* Do the guaranteed-needed backing up to figure out - * the match. - */ - yy_cp = YY_G(yy_last_accepting_cpos); - yy_current_state = YY_G(yy_last_accepting_state); + /* Do the guaranteed-needed backing up to figure out + * the match. + */ + yy_cp = YY_G(yy_last_accepting_cpos); + yy_current_state = YY_G(yy_last_accepting_state); ]]) ]]) ]]) -yy_find_action: - /* code to find the action number goes here */ - m4_ifdef([[M4_MODE_FULLSPD]], [[yy_act = yy_current_state[-1].yy_nxt;]]) - m4_ifdef([[M4_MODE_FIND_ACTION_FULLTBL]], [[yy_act = yy_accept[yy_current_state];]]) + yy_find_action: + /* code to find the action number goes here */ + m4_ifdef([[M4_MODE_FULLSPD]], [[yy_act = yy_current_state[-1].yy_nxt;]]) + m4_ifdef([[M4_MODE_FIND_ACTION_FULLTBL]], [[yy_act = yy_accept[yy_current_state];]]) m4_ifdef([[M4_MODE_FIND_ACTION_REJECT]], [[ - yy_current_state = *--YY_G(yy_state_ptr); - YY_G(yy_lp) = yy_accept[yy_current_state]; + yy_current_state = *--YY_G(yy_state_ptr); + YY_G(yy_lp) = yy_accept[yy_current_state]; m4_ifdef([[M4_MODE_FIND_ACTION_REJECT_REALLY_USED]], [[find_rule: /* we branch to this label when backing up */]]) - for ( ; ; ) { /* loop until we find out what rule we matched */ - if (YY_G(yy_lp) && YY_G(yy_lp) < yy_accept[yy_current_state + 1]) { - yy_act = yy_acclist[YY_G(yy_lp)]; + for ( ; ; ) { /* loop until we find out what rule we matched */ + if (YY_G(yy_lp) && YY_G(yy_lp) < yy_accept[yy_current_state + 1]) { + yy_act = yy_acclist[YY_G(yy_lp)]; m4_ifdef([[M4_MODE_VARIABLE_TRAILING_CONTEXT_RULES]], [[ - if ((yy_act & YY_TRAILING_HEAD_MASK) != 0 || YY_G(yy_looking_for_trail_begin)) { - if (yy_act == YY_G(yy_looking_for_trail_begin)) { - YY_G(yy_looking_for_trail_begin) = 0; - yy_act &= ~YY_TRAILING_HEAD_MASK; - break; - } - } - else if (( yy_act & YY_TRAILING_MASK) != 0) { - YY_G(yy_looking_for_trail_begin) = yy_act & ~YY_TRAILING_MASK; - YY_G(yy_looking_for_trail_begin) |= YY_TRAILING_HEAD_MASK; + if ((yy_act & YY_TRAILING_HEAD_MASK) != 0 || YY_G(yy_looking_for_trail_begin)) { + if (yy_act == YY_G(yy_looking_for_trail_begin)) { + YY_G(yy_looking_for_trail_begin) = 0; + yy_act &= ~YY_TRAILING_HEAD_MASK; + break; + } + } else if (( yy_act & YY_TRAILING_MASK) != 0) { + YY_G(yy_looking_for_trail_begin) = yy_act & ~YY_TRAILING_MASK; + YY_G(yy_looking_for_trail_begin) |= YY_TRAILING_HEAD_MASK; m4_ifdef([[M4_MODE_REAL_REJECT]], [[ - /* Remember matched text in case we back up - * due to REJECT. - */ - YY_G(yy_full_match) = yy_cp; - YY_G(yy_full_state) = YY_G(yy_state_ptr); - YY_G(yy_full_lp) = YY_G(yy_lp); -]]) - } - else - { - YY_G(yy_full_match) = yy_cp; - YY_G(yy_full_state) = YY_G(yy_state_ptr); - YY_G(yy_full_lp) = YY_G(yy_lp); - break; - } - ++YY_G(yy_lp); - goto find_rule; + /* Remember matched text in case we back up + * due to REJECT. + */ + YY_G(yy_full_match) = yy_cp; + YY_G(yy_full_state) = YY_G(yy_state_ptr); + YY_G(yy_full_lp) = YY_G(yy_lp); +]]) + } else { + YY_G(yy_full_match) = yy_cp; + YY_G(yy_full_state) = YY_G(yy_state_ptr); + YY_G(yy_full_lp) = YY_G(yy_lp); + break; + } + ++YY_G(yy_lp); + goto find_rule; ]]) m4_ifdef([[M4_MODE_NO_VARIABLE_TRAILING_CONTEXT_RULES]], [[ - /* Remember matched text in case we back up due to - * trailing context plus REJECT. - */ - YY_G(yy_full_match) = yy_cp; - break; + /* Remember matched text in case we back up due to + * trailing context plus REJECT. + */ + YY_G(yy_full_match) = yy_cp; + break; ]]) - } + } - --yy_cp; + --yy_cp; - /* We could consolidate the following two lines with those at - * the beginning, but at the cost of complaints that we're - * branching inside a loop. - */ - yy_current_state = *--YY_G(yy_state_ptr); - YY_G(yy_lp) = yy_accept[yy_current_state]; - } + /* We could consolidate the following two lines with those at + * the beginning, but at the cost of complaints that we're + * branching inside a loop. + */ + yy_current_state = *--YY_G(yy_state_ptr); + YY_G(yy_lp) = yy_accept[yy_current_state]; + } /* close for */ ]]) m4_ifdef([[M4_MODE_FIND_ACTION_COMPRESSED]], [[ yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = YY_G(yy_last_accepting_cpos); - yy_current_state = YY_G(yy_last_accepting_state); - yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) { /* have to back up */ + yy_cp = YY_G(yy_last_accepting_cpos); + yy_current_state = YY_G(yy_last_accepting_state); + yy_act = yy_accept[yy_current_state]; } ]]) - YY_DO_BEFORE_ACTION; + YY_DO_BEFORE_ACTION; m4_ifdef( [[M4_YY_USE_LINENO]],[[ m4_define([[M4_YYL_BASE]], [[m4_ifdef([[M4_MODE_YYMORE_USED]], [[m4_ifdef([[M4_MODE_YYTECT_IS_ARRAY]], [["YY_G(yy_prev_more_offset)"]], [["YY_G(yy_more_len)"]])]], [[0]])]]) - if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) - { - int yyl; - for ( yyl = M4_YYL_BASE; yyl < yyleng; ++yyl ) - if ( yytext[yyl] == '\n' ) - M4_YY_INCR_LINENO(); - } + if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) { + int yyl; + for ( yyl = M4_YYL_BASE; yyl < yyleng; ++yyl ) { + if ( yytext[yyl] == '\n' ) { + M4_YY_INCR_LINENO(); + + } + } + } ]]) -do_action: /* This label is used only to access EOF actions. */ + do_action: /* This label is used only to access EOF actions. */ m4_ifdef([[M4_MODE_DEBUG]], [[ - if ( yy_flex_debug ) { - if ( yy_act == 0 ) { + if ( yy_flex_debug ) { + if ( yy_act == 0 ) { %if-c++-only - std::cerr << "--scanner backing up\n"; + std::cerr << "--scanner backing up\n"; %endif %if-c-only - fprintf( stderr, "--scanner backing up\n" ); + fprintf( stderr, "--scanner backing up\n" ); %endif - } else if ( yy_act < YY_NUM_RULES ) { + } else if ( yy_act < YY_NUM_RULES ) { %if-c++-only - std::cerr << "--accepting rule at line " << yy_rule_linenum[yy_act] << - "(\"" << yytext << "\")\n"; + std::cerr << "--accepting rule at line " << yy_rule_linenum[yy_act] << + "(\"" << yytext << "\")\n"; %endif %if-c-only - fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n", - (long)yy_rule_linenum[yy_act], yytext ); + fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n", + (long)yy_rule_linenum[yy_act], yytext ); %endif - } else if ( yy_act == YY_NUM_RULES ) { + } else if ( yy_act == YY_NUM_RULES ) { %if-c++-only - std::cerr << "--accepting default rule (\"" << yytext << "\")\n"; + std::cerr << "--accepting default rule (\"" << yytext << "\")\n"; %endif %if-c-only - fprintf( stderr, "--accepting default rule (\"%s\")\n", + fprintf( stderr, "--accepting default rule (\"%s\")\n", yytext ); %endif - } else if ( yy_act == YY_NUM_RULES + 1 ) { + } else if ( yy_act == YY_NUM_RULES + 1 ) { %if-c++-only - std::cerr << "--(end of buffer or a NUL)\n"; + std::cerr << "--(end of buffer or a NUL)\n"; %endif %if-c-only - fprintf( stderr, "--(end of buffer or a NUL)\n" ); + fprintf( stderr, "--(end of buffer or a NUL)\n" ); %endif - } else { + } else { %if-c++-only - std::cerr << "--EOF (start condition " << YY_START << ")\n"; + std::cerr << "--EOF (start condition " << YY_START << ")\n"; %endif %if-c-only - fprintf( stderr, "--EOF (start condition %d)\n", YY_START ); + fprintf( stderr, "--EOF (start condition %d)\n", YY_START ); %endif + } } - } ]]) - switch ( yy_act ) - { /* beginning of action switch */ + switch ( yy_act ) { /* beginning of action switch */ m4_ifdef([[M4_MODE_NO_USES_REJECT]], [[ m4_ifdef([[M4_MODE_HAS_BACKING_UP]], [[ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = YY_G(yy_hold_char); + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = YY_G(yy_hold_char); - /* /\* Backing-up info for compressed tables is taken \after/ */ - /* * yy_cp has been incremented for the next state. */ - /* *\/ */ - yy_cp = YY_G(yy_last_accepting_cpos); - m4_ifdef([[M4_MODE_FULLSPD]], [[yy_cp++;]]) - m4_ifdef([[M4_MODE_FIND_ACTION_FULLTBL]], [[yy_cp++;]]) + /* /\* Backing-up info for compressed tables is taken \after/ */ + /* * yy_cp has been incremented for the next state. */ + /* *\/ */ + yy_cp = YY_G(yy_last_accepting_cpos); + m4_ifdef([[M4_MODE_FULLSPD]], [[yy_cp++;]]) + m4_ifdef([[M4_MODE_FIND_ACTION_FULLTBL]], [[yy_cp++;]]) - yy_current_state = YY_G(yy_last_accepting_state); - goto yy_find_action; + yy_current_state = YY_G(yy_last_accepting_state); + goto yy_find_action; ]]) ]]) %% [5.0] user actions get inserted here - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - YY_G(yytext_ptr)) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = YY_G(yy_hold_char); - YY_RESTORE_YY_MORE_OFFSET - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + case YY_END_OF_BUFFER: { - /* 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_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - YY_G(yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = YY_G(yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed 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_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; %if-c-only - YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; %endif %if-c++-only - YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin.rdbuf(); + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin.rdbuf(); %endif - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( YY_G(yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } - YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + yy_amount_of_matched_text; + /* 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_G(yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] ) { /* This was really a NUL. */ + yy_state_type yy_next_state; - yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG ); + YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + yy_amount_of_matched_text; - /* 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_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG ); - yy_next_state = yy_try_NUL_trans( yy_current_state M4_YY_CALL_LAST_ARG); + /* 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_bp = YY_G(yytext_ptr) + YY_MORE_ADJ; + yy_next_state = yy_try_NUL_trans( yy_current_state M4_YY_CALL_LAST_ARG); - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++YY_G(yy_c_buf_p); - yy_current_state = yy_next_state; - goto yy_match; - } + yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ; - else - { + if ( yy_next_state ) { + /* Consume the NUL. */ + yy_cp = ++YY_G(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } else { %# Disguised case statement on table modes - m4_ifdef([[M4_MODE_FULLSPD]], [[yy_cp = YY_G(yy_c_buf_p);]]) - m4_ifdef([[M4_MODE_FIND_ACTION_FULLTBL]], [[yy_cp = YY_G(yy_c_buf_p);]]) + m4_ifdef([[M4_MODE_FULLSPD]], [[yy_cp = YY_G(yy_c_buf_p);]]) + m4_ifdef([[M4_MODE_FIND_ACTION_FULLTBL]], [[yy_cp = YY_G(yy_c_buf_p);]]) m4_ifdef([[M4_MODE_NO_FULLSPD_OR_FULLTBL]], [[ m4_ifdef([[M4_MODE_NO_USES_REJECT]], [[ m4_ifdef([[M4_NOT_MODE_INTERACTIVE]], [[ - /* Do the guaranteed-needed backing up to figure - * out the match. - */ - yy_cp = YY_G(yy_last_accepting_cpos); - yy_current_state = YY_G(yy_last_accepting_state); + /* Do the guaranteed-needed backing up to figure + * out the match. + */ + yy_cp = YY_G(yy_last_accepting_cpos); + yy_current_state = YY_G(yy_last_accepting_state); ]]) ]]) %# Disguised case statement on table modes ends m4_ifdef([[M4_MODE_FIND_ACTION_REJECT_OR_INTERACTIVE]], [[ - /* Still need to initialize yy_cp, though - * yy_current_state was set up by - * yy_get_previous_state(). - */ - yy_cp = YY_G(yy_c_buf_p); + /* Still need to initialize yy_cp, though + * yy_current_state was set up by + * yy_get_previous_state(). + */ + yy_cp = YY_G(yy_c_buf_p); ]]) ]]) - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer( M4_YY_CALL_ONLY_ARG ) ) - { - case EOB_ACT_END_OF_FILE: - { - YY_G(yy_did_buffer_switch_on_eof) = 0; - - if ( yywrap( M4_YY_CALL_ONLY_ARG ) ) - { - /* 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_G(yy_c_buf_p) = YY_G(yytext_ptr) + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! YY_G(yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; + goto yy_find_action; } + } else { /* not a NUL */ + switch ( yy_get_next_buffer( M4_YY_CALL_ONLY_ARG ) ) { + case EOB_ACT_END_OF_FILE: + YY_G(yy_did_buffer_switch_on_eof) = 0; + + if ( yywrap( M4_YY_CALL_ONLY_ARG ) ) { + /* 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_G(yy_c_buf_p) = YY_G(yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } else { + if ( ! YY_G(yy_did_buffer_switch_on_eof) ) { + YY_NEW_FILE; + } + } + break; + case EOB_ACT_CONTINUE_SCAN: + YY_G(yy_c_buf_p) = + YY_G(yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG ); + + yy_cp = YY_G(yy_c_buf_p); + yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + YY_G(yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)]; + + yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG ); + + yy_cp = YY_G(yy_c_buf_p); + yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } /* end EOB inner switch */ + } /* end if */ break; - } - - case EOB_ACT_CONTINUE_SCAN: - YY_G(yy_c_buf_p) = - YY_G(yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG ); - - yy_cp = YY_G(yy_c_buf_p); - yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - YY_G(yy_c_buf_p) = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)]; - - yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG ); - - yy_cp = YY_G(yy_c_buf_p); - yy_bp = YY_G(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 */ + } /* case YY_END_OF_BUFFER */ + default: + YY_FATAL_ERROR("fatal flex scanner internal error--no action found" ); + } /* end of action switch */ } /* end of scanning one token */ } /* end of user's declarations */ } /* end of yylex */ @@ -1959,8 +1928,7 @@ yyFlexLexer::yyFlexLexer( std::istream& arg_yyin, std::ostream& arg_yyout ): /* The contents of this function are C++ specific, so the YY_G macro is not used. */ -void yyFlexLexer::ctor_common() -{ +void yyFlexLexer::ctor_common() { yy_c_buf_p = 0; yy_init = 0; yy_start = 0; @@ -1993,8 +1961,7 @@ m4_ifdef( [[M4_MODE_USES_REJECT]], /* The contents of this function are C++ specific, so the YY_G macro is not used. */ -yyFlexLexer::~yyFlexLexer() -{ +yyFlexLexer::~yyFlexLexer() { delete [] yy_state_buf; yyfree( yy_start_stack M4_YY_CALL_LAST_ARG ); yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG); @@ -2003,8 +1970,7 @@ yyFlexLexer::~yyFlexLexer() /* The contents of this function are C++ specific, so the YY_G macro is not used. */ -void yyFlexLexer::switch_streams( std::istream& new_in, std::ostream& new_out ) -{ +void yyFlexLexer::switch_streams( std::istream& new_in, std::ostream& new_out ) { // was if( new_in ) yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG); yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE M4_YY_CALL_LAST_ARG) M4_YY_CALL_LAST_ARG); @@ -2034,32 +2000,32 @@ int yyFlexLexer::LexerInput( char* buf, int /* max_size */ ) int yyFlexLexer::LexerInput( char* buf, int max_size ) #endif { - if ( yyin.eof() || yyin.fail() ) + if ( yyin.eof() || yyin.fail() ) { return 0; - + } #ifdef YY_INTERACTIVE yyin.get( buf[0] ); - if ( yyin.eof() ) + if ( yyin.eof() ) { return 0; - - if ( yyin.bad() ) + } + if ( yyin.bad() ) { return -1; - + } return 1; #else (void) yyin.read( buf, max_size ); - if ( yyin.bad() ) + if ( yyin.bad() ) { return -1; - else + } else { return yyin.gcount(); + } #endif } -void yyFlexLexer::LexerOutput( const char* buf, int size ) -{ +void yyFlexLexer::LexerOutput( const char* buf, int size ) { (void) yyout.write( buf, size ); } %ok-for-header @@ -2081,56 +2047,48 @@ static int yy_get_next_buffer (M4_YY_DEF_ONLY_ARG) int yyFlexLexer::yy_get_next_buffer() %endif { - M4_YY_DECL_GUTS_VAR(); + M4_YY_DECL_GUTS_VAR(); char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; char *source = YY_G(yytext_ptr); int number_to_move, i; int ret_val; - if ( YY_G(yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars) + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( YY_G(yy_c_buf_p) - YY_G(yytext_ptr) - YY_MORE_ADJ == 1 ) - { + if ( YY_G(yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars) + 1] ) { + YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); + } + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { + /* Don't try to fill the buffer, so this is an EOF. */ + if ( YY_G(yy_c_buf_p) - YY_G(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 - { + } 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_G(yy_c_buf_p) - YY_G(yytext_ptr) - 1); - for ( i = 0; i < number_to_move; ++i ) + for ( i = 0; i < number_to_move; ++i ) { *(dest++) = *(source++); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + } + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) { /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars) = 0; - - else - { - int num_to_read = + } else { + int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ + while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ m4_ifdef( [[M4_MODE_USES_REJECT]], [[ YY_FATAL_ERROR( @@ -2143,71 +2101,63 @@ m4_ifdef( [[M4_MODE_USES_REJECT]], int yy_c_buf_p_offset = (int) (YY_G(yy_c_buf_p) - b->yy_ch_buf); - if ( b->yy_is_our_buffer ) - { + if ( b->yy_is_our_buffer ) { int new_size = b->yy_buf_size * 2; - if ( new_size <= 0 ) + if ( new_size <= 0 ) { b->yy_buf_size += b->yy_buf_size / 8; - else + } else { b->yy_buf_size *= 2; - + } b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ yyrealloc( (void *) b->yy_ch_buf, (yy_size_t) (b->yy_buf_size + 2) M4_YY_CALL_LAST_ARG ); - } - else + } else { /* Can't grow it, we don't own it. */ b->yy_ch_buf = NULL; - - if ( ! b->yy_ch_buf ) + } + if ( ! b->yy_ch_buf ) { YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); - + } YY_G(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; ]]) - } + } - if ( num_to_read > YY_READ_BUF_SIZE ) + if ( num_to_read > YY_READ_BUF_SIZE ) { num_to_read = YY_READ_BUF_SIZE; - + } /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), YY_G(yy_n_chars), num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars); - } + } - if ( YY_G(yy_n_chars) == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { + if ( YY_G(yy_n_chars) == 0 ) { + if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; yyrestart( yyin M4_YY_CALL_LAST_ARG); - } - - else - { + } else { ret_val = EOB_ACT_LAST_MATCH; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; - } } - - else + } else { ret_val = EOB_ACT_CONTINUE_SCAN; - + } if ((YY_G(yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ int new_size = YY_G(yy_n_chars) + number_to_move + (YY_G(yy_n_chars) >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size M4_YY_CALL_LAST_ARG ); - if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) { YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } /* "- 2" to take care of EOB's */ YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); } @@ -2226,19 +2176,18 @@ m4_ifdef( [[M4_MODE_USES_REJECT]], %if-c-only %not-for-header - static yy_state_type yy_get_previous_state (M4_YY_DEF_ONLY_ARG) +static yy_state_type yy_get_previous_state (M4_YY_DEF_ONLY_ARG) %endif %if-c++-only - yy_state_type yyFlexLexer::yy_get_previous_state() +yy_state_type yyFlexLexer::yy_get_previous_state() %endif { yy_state_type yy_current_state; char *yy_cp; - M4_YY_DECL_GUTS_VAR(); + M4_YY_DECL_GUTS_VAR(); -M4_GEN_START_STATE - for ( yy_cp = YY_G(yytext_ptr) + YY_MORE_ADJ; yy_cp < YY_G(yy_c_buf_p); ++yy_cp ) - { + M4_GEN_START_STATE + for ( yy_cp = YY_G(yytext_ptr) + YY_MORE_ADJ; yy_cp < YY_G(yy_c_buf_p); ++yy_cp ) { /* Generate the code to find the next state. */ m4_ifdef([[M4_MODE_NO_NULTRANS]], [[m4_define([[CHAR_MAP_3]], [[(*yy_cp ? M4_EC(YY_SC_TO_UI(*yy_cp)) : YY_NUL_EC)]])]]) m4_ifdef([[M4_MODE_NULTRANS]], [[m4_define([[CHAR_MAP_3]], [[M4_EC(YY_SC_TO_UI(*yy_cp))]])]]) @@ -2257,16 +2206,16 @@ M4_GEN_START_STATE m4_ifdef([[M4_MODE_FULLSPD]], [[yy_current_state += yy_current_state[CHAR_MAP_3].yy_nxt;]]) m4_ifdef([[M4_MODE_NO_FULLSPD_OR_FULLTBL]], [[M4_GEN_NEXT_COMPRESSED_STATE(CHAR_MAP_3)]]) - m4_ifdef([[M4_MODE_NULTRANS]], [[ - } else { - yy_current_state = yy_NUL_trans[yy_current_state]; - } - ]]) +m4_ifdef([[M4_MODE_NULTRANS]], [[ + } else { + yy_current_state = yy_NUL_trans[yy_current_state]; + } +]]) m4_ifdef([[M4_MODE_FIND_ACTION_FULLTBL]], [[M4_GEN_BACKING_UP]]) m4_ifdef([[M4_MODE_FULLSPD]], [[M4_GEN_BACKING_UP]]) m4_ifdef([[M4_MODE_USES_REJECT]], [[*YY_G(yy_state_ptr)++ = yy_current_state;]]) - } + } return yy_current_state; } @@ -2278,14 +2227,14 @@ M4_GEN_START_STATE * next_state = yy_try_NUL_trans( current_state ); */ %if-c-only - static yy_state_type yy_try_NUL_trans YYFARGS1( yy_state_type, yy_current_state) +static yy_state_type yy_try_NUL_trans YYFARGS1( yy_state_type, yy_current_state) %endif %if-c++-only - yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state ) +yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state ) %endif { int yy_is_jam; - M4_YY_DECL_GUTS_VAR(); /* This var may be unused depending upon options. */ + M4_YY_DECL_GUTS_VAR(); /* This var may be unused depending upon options. */ /* Generate code for handling NUL's, if needed. */ /* First, deal with backing up and setting up yy_cp if the scanner @@ -2299,59 +2248,58 @@ M4_GEN_START_STATE %# Note that this statement block and the following three are %# not executed serially but are an if-then-else cascade %# for different table modes. - m4_ifdef([[M4_MODE_NULTRANS]], [[ +m4_ifdef([[M4_MODE_NULTRANS]], [[ yy_current_state = yy_NUL_trans[yy_current_state]; yy_is_jam = (yy_current_state == 0); - ]]) +]]) - m4_ifdef([[M4_MODE_NO_NULTRANS]], [[ - m4_ifdef([[M4_MODE_NULTRANS_FULLTBL]], [[ - m4_ifdef([[M4_MODE_GENTABLES]], [[yy_current_state = yy_nxt[yy_current_state][YY_NUL_EC];]]) - m4_ifdef([[M4_MODE_NO_GENTABLES]], [[yy_current_state = yy_nxt[yy_current_state*YY_NXT_LOLEN + YY_NUL_EC];]]) +m4_ifdef([[M4_MODE_NO_NULTRANS]], [[ +m4_ifdef([[M4_MODE_NULTRANS_FULLTBL]], [[ +m4_ifdef([[M4_MODE_GENTABLES]], [[yy_current_state = yy_nxt[yy_current_state][YY_NUL_EC];]]) +m4_ifdef([[M4_MODE_NO_GENTABLES]], [[yy_current_state = yy_nxt[yy_current_state*YY_NXT_LOLEN + YY_NUL_EC];]]) yy_is_jam = (yy_current_state <= 0); - ]]) +]]) - m4_ifdef([[M4_MODE_NO_NULTRANS_FULLTBL]], [[ - m4_ifdef([[M4_MODE_NULTRANS_FULLSPD]], [[ - int yy_c = YY_NUL_EC; +m4_ifdef([[M4_MODE_NO_NULTRANS_FULLTBL]], [[ +m4_ifdef([[M4_MODE_NULTRANS_FULLSPD]], [[ + int yy_c = YY_NUL_EC; - const struct yy_trans_info *yy_trans_info; + const struct yy_trans_info *yy_trans_info; - yy_trans_info = &yy_current_state[(unsigned int) yy_c]; - yy_current_state += yy_trans_info->yy_nxt; - yy_is_jam = (yy_trans_info->yy_verify != yy_c); - ]]) + yy_trans_info = &yy_current_state[(unsigned int) yy_c]; + yy_current_state += yy_trans_info->yy_nxt; + yy_is_jam = (yy_trans_info->yy_verify != yy_c); +]]) - m4_ifdef([[M4_MODE_NO_NULTRANS_FULLSPD]], [[ - M4_GEN_NEXT_COMPRESSED_STATE(YY_NUL_EC) - yy_is_jam = (yy_current_state == YY_JAMSTATE); - m4_ifdef([[M4_MODE_USES_REJECT]], [[ - /* Only stack this state if it's a transition we - * actually make. If we stack it on a jam, then - * the state stack and yy_c_buf_p get out of sync. - */ - if ( ! yy_is_jam ) - *YY_G(yy_state_ptr)++ = yy_current_state; - ]]) - ]]) - ]]) +m4_ifdef([[M4_MODE_NO_NULTRANS_FULLSPD]], [[ +M4_GEN_NEXT_COMPRESSED_STATE(YY_NUL_EC) +yy_is_jam = (yy_current_state == YY_JAMSTATE); +m4_ifdef([[M4_MODE_USES_REJECT]], [[ + /* Only stack this state if it's a transition we + * actually make. If we stack it on a jam, then + * the state stack and yy_c_buf_p get out of sync. + */ + if ( ! yy_is_jam ) { + *YY_G(yy_state_ptr)++ = yy_current_state; + } ]]) +]]) +]]) +]]) %# End of if-else cascade +m4_ifdef([[M4_MODE_NULTRANS_WRAP]], [[ /* If we've entered an accepting state, back up; note that * compressed tables have *already* done such backing up, so * we needn't bother with it again. */ - m4_ifdef([[M4_MODE_NULTRANS_WRAP]], [[ - - if ( ! yy_is_jam ) - { - M4_GEN_BACKING_UP - } - ]]) + if ( ! yy_is_jam ) { + M4_GEN_BACKING_UP + } +]]) M4_YY_NOOP_GUTS_VAR(); -return yy_is_jam ? 0 : yy_current_state; + return yy_is_jam ? 0 : yy_current_state; } @@ -2359,22 +2307,22 @@ return yy_is_jam ? 0 : yy_current_state; %if-c-only m4_ifdef( [[M4_YY_NO_UNPUT]],, [[ - static void yyunput YYFARGS2( int,c, char *,yy_bp) +static void yyunput YYFARGS2( int,c, char *,yy_bp) %endif %if-c++-only - void yyFlexLexer::yyunput( int c, char* yy_bp) +void yyFlexLexer::yyunput( int c, char* yy_bp) %endif { char *yy_cp; - M4_YY_DECL_GUTS_VAR(); + M4_YY_DECL_GUTS_VAR(); - yy_cp = YY_G(yy_c_buf_p); + yy_cp = YY_G(yy_c_buf_p); /* undo effects of setting up yytext */ *yy_cp = YY_G(yy_hold_char); - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { + /* need to shift things up to make room */ /* +2 for EOB chars. */ int number_to_move = YY_G(yy_n_chars) + 2; char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ @@ -2382,25 +2330,26 @@ m4_ifdef( [[M4_YY_NO_UNPUT]],, char *source = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) { *--dest = *--source; - + } yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { YY_FATAL_ERROR( "flex scanner push-back overflow" ); } + } *--yy_cp = (char) c; m4_ifdef( [[M4_YY_USE_LINENO]], [[ - if ( c == '\n' ){ - --yylineno; - } + if ( c == '\n' ){ + --yylineno; + } ]]) YY_G(yytext_ptr) = yy_bp; @@ -2415,74 +2364,70 @@ m4_ifdef( [[M4_YY_USE_LINENO]], %if-c-only #ifndef YY_NO_INPUT #ifdef __cplusplus - static int yyinput (M4_YY_DEF_ONLY_ARG) +static int yyinput (M4_YY_DEF_ONLY_ARG) #else - static int input (M4_YY_DEF_ONLY_ARG) +static int input (M4_YY_DEF_ONLY_ARG) #endif %endif %if-c++-only - int yyFlexLexer::yyinput() +int yyFlexLexer::yyinput() %endif { int c; - M4_YY_DECL_GUTS_VAR(); + M4_YY_DECL_GUTS_VAR(); *YY_G(yy_c_buf_p) = YY_G(yy_hold_char); - if ( *YY_G(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) - { + if ( *YY_G(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_G(yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] ) + if ( YY_G(yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] ) { /* This was really a NUL. */ *YY_G(yy_c_buf_p) = '\0'; - - else - { /* need more input */ + } else { + /* need more input */ int offset = (int) (YY_G(yy_c_buf_p) - YY_G(yytext_ptr)); ++YY_G(yy_c_buf_p); - switch ( yy_get_next_buffer( M4_YY_CALL_ONLY_ARG ) ) - { - 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 M4_YY_CALL_LAST_ARG); + switch ( yy_get_next_buffer( M4_YY_CALL_ONLY_ARG ) ) { + 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. + */ - /*FALLTHROUGH*/ + /* Reset buffer status. */ + yyrestart( yyin M4_YY_CALL_LAST_ARG); - case EOB_ACT_END_OF_FILE: - { - if ( yywrap( M4_YY_CALL_ONLY_ARG ) ) - return 0; + /*FALLTHROUGH*/ - if ( ! YY_G(yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; + case EOB_ACT_END_OF_FILE: + if ( yywrap( M4_YY_CALL_ONLY_ARG ) ) { + return 0; + } + if ( ! YY_G(yy_did_buffer_switch_on_eof) ) { + YY_NEW_FILE; + } #ifdef __cplusplus - return yyinput(M4_YY_CALL_ONLY_ARG); + return yyinput(M4_YY_CALL_ONLY_ARG); #else - return input(M4_YY_CALL_ONLY_ARG); + return input(M4_YY_CALL_ONLY_ARG); #endif - } - case EOB_ACT_CONTINUE_SCAN: - YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + offset; - break; - } + case EOB_ACT_CONTINUE_SCAN: + YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + offset; + break; } } + } c = *(unsigned char *) YY_G(yy_c_buf_p); /* cast for 8-bit char's */ *YY_G(yy_c_buf_p) = '\0'; /* preserve yytext */ @@ -2491,15 +2436,17 @@ m4_ifdef( [[M4_YY_USE_LINENO]], m4_ifdef([[M4_MODE_BOL_NEEDED]], [[ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); m4_ifdef([[M4_MODE_YYLINENO]], [[ - if ( YY_CURRENT_BUFFER_LVALUE->yy_at_bol ) + if ( YY_CURRENT_BUFFER_LVALUE->yy_at_bol ) { M4_YY_INCR_LINENO(); + } ]]) ]]) m4_ifdef([[M4_MODE_NO_BOL_NEEDED]], [[ m4_ifdef([[M4_MODE_YYLINENO]], [[ - if ( c == '\n' ) + if ( c == '\n' ) { M4_YY_INCR_LINENO(); -]]) + } + ]]) ]]) return c; @@ -2514,18 +2461,18 @@ m4_ifdef([[M4_MODE_YYLINENO]], [[ * @note This function does not reset the start condition to @c INITIAL . */ %if-c-only - void yyrestart YYFARGS1( FILE *,input_file) +void yyrestart YYFARGS1( FILE *,input_file) %endif %if-c++-only - void yyFlexLexer::yyrestart( std::istream& input_file ) +void yyFlexLexer::yyrestart( std::istream& input_file ) %endif { - M4_YY_DECL_GUTS_VAR(); + M4_YY_DECL_GUTS_VAR(); - if ( ! YY_CURRENT_BUFFER ){ - yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); + if ( ! YY_CURRENT_BUFFER ) { + yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG); + yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG); } yy_init_buffer( YY_CURRENT_BUFFER, input_file M4_YY_CALL_LAST_ARG); @@ -2552,30 +2499,29 @@ void yyFlexLexer::yyrestart( std::istream* input_file ) * M4_YY_DOC_PARAM */ %if-c-only - void yy_switch_to_buffer YYFARGS1( YY_BUFFER_STATE ,new_buffer) +void yy_switch_to_buffer YYFARGS1( YY_BUFFER_STATE ,new_buffer) %endif %if-c++-only - void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) +void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) %endif { - M4_YY_DECL_GUTS_VAR(); + M4_YY_DECL_GUTS_VAR(); /* TODO. We should be able to replace this entire function body * with * yypop_buffer_state(); * yypush_buffer_state(new_buffer); - */ + */ yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); - if ( YY_CURRENT_BUFFER == new_buffer ) + if ( YY_CURRENT_BUFFER == new_buffer ) { return; - - if ( YY_CURRENT_BUFFER ) - { + } + if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *YY_G(yy_c_buf_p) = YY_G(yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = YY_G(yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars); - } + } YY_CURRENT_BUFFER_LVALUE = new_buffer; yy_load_buffer_state( M4_YY_CALL_ONLY_ARG ); @@ -2593,10 +2539,10 @@ void yyFlexLexer::yyrestart( std::istream* input_file ) static void yy_load_buffer_state (M4_YY_DEF_ONLY_ARG) %endif %if-c++-only - void yyFlexLexer::yy_load_buffer_state() +void yyFlexLexer::yy_load_buffer_state() %endif { - M4_YY_DECL_GUTS_VAR(); + M4_YY_DECL_GUTS_VAR(); YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; YY_G(yytext_ptr) = YY_G(yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; %if-c-only @@ -2615,28 +2561,28 @@ static void yy_load_buffer_state (M4_YY_DEF_ONLY_ARG) * @return the allocated buffer state. */ %if-c-only - YY_BUFFER_STATE yy_create_buffer YYFARGS2( FILE *,file, int ,size) +YY_BUFFER_STATE yy_create_buffer YYFARGS2( FILE *,file, int ,size) %endif %if-c++-only - YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream& file, int size ) +YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream& file, int size ) %endif { YY_BUFFER_STATE b; - m4_dnl M4_YY_DECL_GUTS_VAR(); + M4_YY_DECL_GUTS_VAR(); b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) M4_YY_CALL_LAST_ARG ); - if ( ! b ) + 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 *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) M4_YY_CALL_LAST_ARG ); - if ( ! b->yy_ch_buf ) + 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 M4_YY_CALL_LAST_ARG); @@ -2651,7 +2597,7 @@ static void yy_load_buffer_state (M4_YY_DEF_ONLY_ARG) * M4_YY_DOC_PARAM * @return the allocated buffer state. */ - YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size ) +YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size ) { return yy_create_buffer( *file, size ); } @@ -2662,23 +2608,23 @@ static void yy_load_buffer_state (M4_YY_DEF_ONLY_ARG) * M4_YY_DOC_PARAM */ %if-c-only - void yy_delete_buffer YYFARGS1( YY_BUFFER_STATE ,b) +void yy_delete_buffer YYFARGS1( YY_BUFFER_STATE ,b) %endif %if-c++-only - void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b ) +void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b ) %endif { - M4_YY_DECL_GUTS_VAR(); + M4_YY_DECL_GUTS_VAR(); - if ( ! b ) + if ( ! b ) { return; - - if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + } + if ( b == YY_CURRENT_BUFFER ) { /* Not sure if we should pop here. */ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) + } + if ( b->yy_is_our_buffer ) { yyfree( (void *) b->yy_ch_buf M4_YY_CALL_LAST_ARG ); - + } yyfree( (void *) b M4_YY_CALL_LAST_ARG ); } @@ -2688,15 +2634,14 @@ static void yy_load_buffer_state (M4_YY_DEF_ONLY_ARG) * such as during a yyrestart() or at EOF. */ %if-c-only - static void yy_init_buffer YYFARGS2( YY_BUFFER_STATE ,b, FILE *,file) +static void yy_init_buffer YYFARGS2( YY_BUFFER_STATE ,b, FILE *,file) %endif %if-c++-only - void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream& file ) +void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream& file ) %endif - { int oerrno = errno; - M4_YY_DECL_GUTS_VAR(); + M4_YY_DECL_GUTS_VAR(); yy_flush_buffer( b M4_YY_CALL_LAST_ARG); @@ -2708,14 +2653,14 @@ static void yy_load_buffer_state (M4_YY_DEF_ONLY_ARG) %endif b->yy_fill_buffer = 1; - /* If b is the current buffer, then yy_init_buffer was _probably_ - * called from yyrestart() or through yy_get_next_buffer. - * In that case, we don't want to reset the lineno or column. - */ - if (b != YY_CURRENT_BUFFER){ - b->yy_bs_lineno = 1; - b->yy_bs_column = 0; - } + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } %if-c-only m4_ifdef( [[M4_YY_ALWAYS_INTERACTIVE]], @@ -2743,16 +2688,16 @@ m4_ifdef( [[M4_YY_ALWAYS_INTERACTIVE]], * M4_YY_DOC_PARAM */ %if-c-only - void yy_flush_buffer YYFARGS1( YY_BUFFER_STATE ,b) +void yy_flush_buffer YYFARGS1( YY_BUFFER_STATE ,b) %endif %if-c++-only - void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b ) +void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b ) %endif { - M4_YY_DECL_GUTS_VAR(); - if ( ! b ) + M4_YY_DECL_GUTS_VAR(); + if ( ! b ) { return; - + } b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes @@ -2767,8 +2712,9 @@ m4_ifdef( [[M4_YY_ALWAYS_INTERACTIVE]], b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; - if ( b == YY_CURRENT_BUFFER ) + if ( b == YY_CURRENT_BUFFER ) { yy_load_buffer_state( M4_YY_CALL_ONLY_ARG ); + } } %if-c-or-c++ @@ -2785,24 +2731,24 @@ void yypush_buffer_state YYFARGS1(YY_BUFFER_STATE,new_buffer) void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer) %endif { - M4_YY_DECL_GUTS_VAR(); - if (new_buffer == NULL) + M4_YY_DECL_GUTS_VAR(); + if (new_buffer == NULL) { return; - + } yyensure_buffer_stack(M4_YY_CALL_ONLY_ARG); /* This block is copied from yy_switch_to_buffer. */ - if ( YY_CURRENT_BUFFER ) - { + if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *YY_G(yy_c_buf_p) = YY_G(yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = YY_G(yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars); - } + } /* Only push if top exists. Otherwise, replace top. */ - if (YY_CURRENT_BUFFER) + if (YY_CURRENT_BUFFER) { YY_G(yy_buffer_stack_top)++; + } YY_CURRENT_BUFFER_LVALUE = new_buffer; /* copied from yy_switch_to_buffer. */ @@ -2824,15 +2770,15 @@ void yypop_buffer_state (M4_YY_DEF_ONLY_ARG) void yyFlexLexer::yypop_buffer_state (void) %endif { - M4_YY_DECL_GUTS_VAR(); - if (!YY_CURRENT_BUFFER) + M4_YY_DECL_GUTS_VAR(); + if (!YY_CURRENT_BUFFER) { return; - + } yy_delete_buffer(YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG); YY_CURRENT_BUFFER_LVALUE = NULL; - if (YY_G(yy_buffer_stack_top) > 0) + if (YY_G(yy_buffer_stack_top) > 0) { --YY_G(yy_buffer_stack_top); - + } if (YY_CURRENT_BUFFER) { yy_load_buffer_state( M4_YY_CALL_ONLY_ARG ); YY_G(yy_did_buffer_switch_on_eof) = 1; @@ -2853,21 +2799,20 @@ void yyFlexLexer::yyensure_buffer_stack(void) %endif { yy_size_t num_to_alloc; - M4_YY_DECL_GUTS_VAR(); + M4_YY_DECL_GUTS_VAR(); if (!YY_G(yy_buffer_stack)) { - /* First allocation is just for 2 elements, since we don't know if this * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. - */ - num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ + */ + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ YY_G(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) M4_YY_CALL_LAST_ARG); - if ( ! YY_G(yy_buffer_stack) ) + if ( ! YY_G(yy_buffer_stack) ) { YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - + } memset(YY_G(yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); @@ -2876,8 +2821,7 @@ void yyFlexLexer::yyensure_buffer_stack(void) return; } - if (YY_G(yy_buffer_stack_top) >= (YY_G(yy_buffer_stack_max)) - 1){ - + if (YY_G(yy_buffer_stack_top) >= (YY_G(yy_buffer_stack_max)) - 1) { /* Increase the buffer to prepare for a possible push. */ yy_size_t grow_size = 8 /* arbitrary grow size */; @@ -2886,9 +2830,9 @@ void yyFlexLexer::yyensure_buffer_stack(void) (YY_G(yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) M4_YY_CALL_LAST_ARG); - if ( ! YY_G(yy_buffer_stack) ) + if ( ! YY_G(yy_buffer_stack) ) { YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - + } /* zero only the new slots.*/ memset(YY_G(yy_buffer_stack) + YY_G(yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); YY_G(yy_buffer_stack_max) = num_to_alloc; @@ -2911,18 +2855,18 @@ m4_ifdef( [[M4_YY_NO_SCAN_BUFFER]],, YY_BUFFER_STATE yy_scan_buffer YYFARGS2( char *,base, yy_size_t ,size) { YY_BUFFER_STATE b; - m4_dnl M4_YY_DECL_GUTS_VAR(); + m4_dnl M4_YY_DECL_GUTS_VAR(); if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) + base[size-1] != YY_END_OF_BUFFER_CHAR ) { /* They forgot to leave room for the EOB's. */ return NULL; - + } b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) M4_YY_CALL_LAST_ARG ); - if ( ! b ) + if ( ! b ) { YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - + } b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; @@ -2954,7 +2898,7 @@ m4_ifdef( [[M4_YY_NO_SCAN_STRING]],, */ YY_BUFFER_STATE yy_scan_string YYFARGS1( const char *, yystr) { - m4_dnl M4_YY_DECL_GUTS_VAR(); + m4_dnl M4_YY_DECL_GUTS_VAR(); return yy_scan_bytes( yystr, (int) strlen(yystr) M4_YY_CALL_LAST_ARG); } @@ -2972,29 +2916,28 @@ m4_ifdef( [[M4_YY_NO_SCAN_BYTES]],, * M4_YY_DOC_PARAM * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE yy_scan_bytes YYFARGS2( const char *,yybytes, int ,_yybytes_len) -{ +YY_BUFFER_STATE yy_scan_bytes YYFARGS2( const char *,yybytes, int ,_yybytes_len) { YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; - m4_dnl M4_YY_DECL_GUTS_VAR(); + m4_dnl M4_YY_DECL_GUTS_VAR(); /* Get memory for full buffer, including space for trailing EOB's. */ n = (yy_size_t) (_yybytes_len + 2); buf = (char *) yyalloc( n M4_YY_CALL_LAST_ARG ); - if ( ! buf ) + if ( ! buf ) { YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < _yybytes_len; ++i ) + } + for ( i = 0; i < _yybytes_len; ++i ) { buf[i] = yybytes[i]; - + } buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; b = yy_scan_buffer( buf, n M4_YY_CALL_LAST_ARG); - if ( ! b ) + 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. */ @@ -3009,31 +2952,30 @@ YY_BUFFER_STATE yy_scan_bytes YYFARGS2( const char *,yybytes, int ,_yybytes_len m4_ifdef( [[M4_YY_NO_PUSH_STATE]],, [[ %if-c-only - static void yy_push_state YYFARGS1( int ,_new_state) +static void yy_push_state YYFARGS1( int ,_new_state) %endif %if-c++-only - void yyFlexLexer::yy_push_state( int _new_state ) +void yyFlexLexer::yy_push_state( int _new_state ) %endif { - M4_YY_DECL_GUTS_VAR(); - if ( YY_G(yy_start_stack_ptr) >= YY_G(yy_start_stack_depth) ) - { + M4_YY_DECL_GUTS_VAR(); + if ( YY_G(yy_start_stack_ptr) >= YY_G(yy_start_stack_depth) ) { yy_size_t new_size; YY_G(yy_start_stack_depth) += YY_START_STACK_INCR; new_size = (yy_size_t) YY_G(yy_start_stack_depth) * sizeof( int ); - if ( ! YY_G(yy_start_stack) ) + if ( ! YY_G(yy_start_stack) ) { YY_G(yy_start_stack) = (int *) yyalloc( new_size M4_YY_CALL_LAST_ARG ); - else + } else { YY_G(yy_start_stack) = (int *) yyrealloc( (void *) YY_G(yy_start_stack), new_size M4_YY_CALL_LAST_ARG ); - - if ( ! YY_G(yy_start_stack) ) + } + if ( ! YY_G(yy_start_stack) ) { YY_FATAL_ERROR( "out of memory expanding start-condition stack" ); } - + } YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)++] = YY_START; BEGIN(_new_state); @@ -3044,16 +2986,16 @@ m4_ifdef( [[M4_YY_NO_PUSH_STATE]],, m4_ifdef( [[M4_YY_NO_POP_STATE]],, [[ %if-c-only - static void yy_pop_state (M4_YY_DEF_ONLY_ARG) +static void yy_pop_state (M4_YY_DEF_ONLY_ARG) %endif %if-c++-only - void yyFlexLexer::yy_pop_state() +void yyFlexLexer::yy_pop_state() %endif { - M4_YY_DECL_GUTS_VAR(); - if ( --YY_G(yy_start_stack_ptr) < 0 ) + M4_YY_DECL_GUTS_VAR(); + if ( --YY_G(yy_start_stack_ptr) < 0 ) { YY_FATAL_ERROR( "start-condition stack underflow" ); - + } BEGIN(YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)]); } ]]) @@ -3062,13 +3004,13 @@ m4_ifdef( [[M4_YY_NO_POP_STATE]],, m4_ifdef( [[M4_YY_NO_TOP_STATE]],, [[ %if-c-only - static int yy_top_state (M4_YY_DEF_ONLY_ARG) +static int yy_top_state (M4_YY_DEF_ONLY_ARG) %endif %if-c++-only - int yyFlexLexer::yy_top_state() +int yyFlexLexer::yy_top_state() %endif { - M4_YY_DECL_GUTS_VAR(); + M4_YY_DECL_GUTS_VAR(); return YY_G(yy_start_stack_ptr) > 0 ? YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr) - 1] : YY_START; } ]]) @@ -3078,8 +3020,7 @@ m4_ifdef( [[M4_YY_NO_TOP_STATE]],, #endif %if-c-only -static void yynoreturn yy_fatal_error YYFARGS1(const char*, msg) -{ +static void yynoreturn yy_fatal_error YYFARGS1(const char*, msg) { M4_YY_DECL_GUTS_VAR(); M4_YY_NOOP_GUTS_VAR(); fprintf( stderr, "%s\n", msg ); @@ -3087,9 +3028,8 @@ static void yynoreturn yy_fatal_error YYFARGS1(const char*, msg) } %endif %if-c++-only -void yyFlexLexer::LexerError( const char* msg ) -{ - M4_YY_DECL_GUTS_VAR(); +void yyFlexLexer::LexerError( const char* msg ) { + M4_YY_DECL_GUTS_VAR(); std::cerr << msg << std::endl; exit( YY_EXIT_FAILURE ); } @@ -3099,18 +3039,16 @@ void yyFlexLexer::LexerError( const char* msg ) #undef yyless #define yyless(n) \ - do \ - { \ + do { \ /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - yytext[yyleng] = YY_G(yy_hold_char); \ - YY_G(yy_c_buf_p) = yytext + yyless_macro_arg; \ - YY_G(yy_hold_char) = *YY_G(yy_c_buf_p); \ - *YY_G(yy_c_buf_p) = '\0'; \ - yyleng = yyless_macro_arg; \ - } \ - while ( 0 ) + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = YY_G(yy_hold_char); \ + YY_G(yy_c_buf_p) = yytext + yyless_macro_arg; \ + YY_G(yy_hold_char) = *YY_G(yy_c_buf_p); \ + *YY_G(yy_c_buf_p) = '\0'; \ + yyleng = yyless_macro_arg; \ + } while ( 0 ) @@ -3123,10 +3061,9 @@ m4_ifdef( [[M4_YY_NO_GET_EXTRA]],, /** Get the user-defined data for this scanner. * M4_YY_DOC_PARAM */ -YY_EXTRA_TYPE yyget_extra (M4_YY_DEF_ONLY_ARG) -{ - M4_YY_DECL_GUTS_VAR(); - return yyextra; +YY_EXTRA_TYPE yyget_extra (M4_YY_DEF_ONLY_ARG) { + M4_YY_DECL_GUTS_VAR(); + return yyextra; } ]]) %endif @@ -3136,16 +3073,15 @@ m4_ifdef( [[M4_YY_NO_GET_LINENO]],, /** Get the current line number. * M4_YY_DOC_PARAM */ -int yyget_lineno (M4_YY_DEF_ONLY_ARG) -{ - M4_YY_DECL_GUTS_VAR(); +int yyget_lineno (M4_YY_DEF_ONLY_ARG) { + M4_YY_DECL_GUTS_VAR(); - m4_ifdef( [[M4_YY_REENTRANT]], - [[ - if (! YY_CURRENT_BUFFER) - return 0; - ]]) - return yylineno; + m4_ifdef( [[M4_YY_REENTRANT]], + [[ + if (! YY_CURRENT_BUFFER) + return 0; + ]]) + return yylineno; } ]]) @@ -3156,16 +3092,15 @@ m4_ifdef( [[M4_YY_NO_GET_COLUMN]],, /** Get the current column number. * M4_YY_DOC_PARAM */ -int yyget_column (M4_YY_DEF_ONLY_ARG) -{ - M4_YY_DECL_GUTS_VAR(); +int yyget_column (M4_YY_DEF_ONLY_ARG) { + M4_YY_DECL_GUTS_VAR(); - m4_ifdef( [[M4_YY_REENTRANT]], - [[ - if (! YY_CURRENT_BUFFER) - return 0; - ]]) - return yycolumn; +m4_ifdef( [[M4_YY_REENTRANT]], [[ + if (! YY_CURRENT_BUFFER) { + return 0; + } +]]) + return yycolumn; } ]]) ]]) @@ -3175,10 +3110,9 @@ m4_ifdef( [[M4_YY_NO_GET_IN]],, /** Get the input stream. * M4_YY_DOC_PARAM */ -FILE *yyget_in (M4_YY_DEF_ONLY_ARG) -{ - M4_YY_DECL_GUTS_VAR(); - return yyin; +FILE *yyget_in (M4_YY_DEF_ONLY_ARG) { + M4_YY_DECL_GUTS_VAR(); + return yyin; } ]]) @@ -3187,10 +3121,9 @@ m4_ifdef( [[M4_YY_NO_GET_OUT]],, /** Get the output stream. * M4_YY_DOC_PARAM */ -FILE *yyget_out (M4_YY_DEF_ONLY_ARG) -{ - M4_YY_DECL_GUTS_VAR(); - return yyout; +FILE *yyget_out (M4_YY_DEF_ONLY_ARG) { + M4_YY_DECL_GUTS_VAR(); + return yyout; } ]]) @@ -3199,10 +3132,9 @@ m4_ifdef( [[M4_YY_NO_GET_LENG]],, /** Get the length of the current token. * M4_YY_DOC_PARAM */ -int yyget_leng (M4_YY_DEF_ONLY_ARG) -{ - M4_YY_DECL_GUTS_VAR(); - return yyleng; +int yyget_leng (M4_YY_DEF_ONLY_ARG) { + M4_YY_DECL_GUTS_VAR(); + return yyleng; } ]]) @@ -3211,10 +3143,9 @@ int yyget_leng (M4_YY_DEF_ONLY_ARG) */ m4_ifdef( [[M4_YY_NO_GET_TEXT]],, [[ -char *yyget_text (M4_YY_DEF_ONLY_ARG) -{ - M4_YY_DECL_GUTS_VAR(); - return yytext; +char *yyget_text (M4_YY_DEF_ONLY_ARG) { + M4_YY_DECL_GUTS_VAR(); + return yytext; } ]]) @@ -3225,10 +3156,9 @@ m4_ifdef( [[M4_YY_NO_SET_EXTRA]],, * @param user_defined The data to be associated with this scanner. * M4_YY_DOC_PARAM */ -void yyset_extra YYFARGS1( YY_EXTRA_TYPE ,user_defined) -{ - M4_YY_DECL_GUTS_VAR(); - yyextra = user_defined ; +void yyset_extra YYFARGS1( YY_EXTRA_TYPE ,user_defined) { + M4_YY_DECL_GUTS_VAR(); + yyextra = user_defined ; } ]]) %endif @@ -3239,17 +3169,17 @@ m4_ifdef( [[M4_YY_NO_SET_LINENO]],, * @param _line_number line number * M4_YY_DOC_PARAM */ -void yyset_lineno YYFARGS1( int ,_line_number) -{ - M4_YY_DECL_GUTS_VAR(); +void yyset_lineno YYFARGS1( int ,_line_number) { + M4_YY_DECL_GUTS_VAR(); - m4_ifdef( [[M4_YY_REENTRANT]], - [[ - /* lineno is only valid if an input buffer exists. */ - if (! YY_CURRENT_BUFFER ) - YY_FATAL_ERROR( "yyset_lineno called with no buffer" ); - ]]) - yylineno = _line_number; + m4_ifdef( [[M4_YY_REENTRANT]], + [[ + /* lineno is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) { + YY_FATAL_ERROR( "yyset_lineno called with no buffer" ); + } + ]]) + yylineno = _line_number; } ]]) @@ -3261,17 +3191,16 @@ m4_ifdef( [[M4_YY_NO_SET_COLUMN]],, * @param _column_no column number * M4_YY_DOC_PARAM */ -void yyset_column YYFARGS1( int , _column_no) -{ - M4_YY_DECL_GUTS_VAR(); +void yyset_column YYFARGS1( int , _column_no) { + M4_YY_DECL_GUTS_VAR(); - m4_ifdef( [[M4_YY_REENTRANT]], - [[ - /* column is only valid if an input buffer exists. */ - if (! YY_CURRENT_BUFFER ) - YY_FATAL_ERROR( "yyset_column called with no buffer" ); - ]]) - yycolumn = _column_no; +m4_ifdef( [[M4_YY_REENTRANT]], [[ + /* column is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) { + YY_FATAL_ERROR( "yyset_column called with no buffer" ); + } +]]) + yycolumn = _column_no; } ]]) ]]) @@ -3285,38 +3214,34 @@ m4_ifdef( [[M4_YY_NO_SET_IN]],, * M4_YY_DOC_PARAM * @see yy_switch_to_buffer */ -void yyset_in YYFARGS1( FILE * ,_in_str) -{ - M4_YY_DECL_GUTS_VAR(); - yyin = _in_str ; +void yyset_in YYFARGS1( FILE * ,_in_str) { + M4_YY_DECL_GUTS_VAR(); + yyin = _in_str ; } ]]) m4_ifdef( [[M4_YY_NO_SET_OUT]],, [[ -void yyset_out YYFARGS1( FILE * ,_out_str) -{ - M4_YY_DECL_GUTS_VAR(); - yyout = _out_str ; +void yyset_out YYFARGS1( FILE * ,_out_str) { + M4_YY_DECL_GUTS_VAR(); + yyout = _out_str ; } ]]) m4_ifdef( [[M4_YY_NO_GET_DEBUG]],, [[ -int yyget_debug (M4_YY_DEF_ONLY_ARG) -{ - M4_YY_DECL_GUTS_VAR(); - return yy_flex_debug; +int yyget_debug (M4_YY_DEF_ONLY_ARG) { + M4_YY_DECL_GUTS_VAR(); + return yy_flex_debug; } ]]) m4_ifdef( [[M4_YY_NO_SET_DEBUG]],, [[ -void yyset_debug YYFARGS1( int ,_bdebug) -{ - M4_YY_DECL_GUTS_VAR(); - yy_flex_debug = _bdebug ; +void yyset_debug YYFARGS1( int ,_bdebug) { + M4_YY_DECL_GUTS_VAR(); + yy_flex_debug = _bdebug ; } ]]) %endif @@ -3327,41 +3252,37 @@ void yyset_debug YYFARGS1( int ,_bdebug) %if-bison-bridge m4_ifdef( [[M4_YY_NO_GET_LVAL]],, [[ -YYSTYPE * yyget_lval (M4_YY_DEF_ONLY_ARG) -{ - M4_YY_DECL_GUTS_VAR(); - return yylval; +YYSTYPE * yyget_lval (M4_YY_DEF_ONLY_ARG) { + M4_YY_DECL_GUTS_VAR(); + return yylval; } ]]) m4_ifdef( [[M4_YY_NO_SET_LVAL]],, [[ -void yyset_lval YYFARGS1( YYSTYPE * ,yylval_param) -{ - M4_YY_DECL_GUTS_VAR(); - yylval = yylval_param; +void yyset_lval YYFARGS1( YYSTYPE * ,yylval_param) { + M4_YY_DECL_GUTS_VAR(); + yylval = yylval_param; } ]]) m4_ifdef( [[<M4_YY_BISON_LLOC>]], [[ - m4_ifdef( [[M4_YY_NO_GET_LLOC]],, - [[ -YYLTYPE *yyget_lloc (M4_YY_DEF_ONLY_ARG) -{ - M4_YY_DECL_GUTS_VAR(); - return yylloc; +m4_ifdef( [[M4_YY_NO_GET_LLOC]],, +[[ +YYLTYPE *yyget_lloc (M4_YY_DEF_ONLY_ARG) { + M4_YY_DECL_GUTS_VAR(); + return yylloc; } - ]]) +]]) - m4_ifdef( [[M4_YY_NO_SET_LLOC]],, - [[ -void yyset_lloc YYFARGS1( YYLTYPE * ,yylloc_param) -{ - M4_YY_DECL_GUTS_VAR(); - yylloc = yylloc_param; +m4_ifdef( [[M4_YY_NO_SET_LLOC]],, +[[ +void yyset_lloc YYFARGS1( YYLTYPE * ,yylloc_param) { + M4_YY_DECL_GUTS_VAR(); + yylloc = yylloc_param; } - ]]) +]]) ]]) %endif @@ -3373,24 +3294,23 @@ void yyset_lloc YYFARGS1( YYLTYPE * ,yylloc_param) * the ONLY reentrant function that doesn't take the scanner as the last argument. * That's why we explicitly handle the declaration, instead of using our macros. */ -int yylex_init(yyscan_t* ptr_yy_globals) -{ - if (ptr_yy_globals == NULL){ - errno = EINVAL; - return 1; - } +int yylex_init(yyscan_t* ptr_yy_globals) { + if (ptr_yy_globals == NULL) { + errno = EINVAL; + return 1; + } - *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL ); + *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL ); - if (*ptr_yy_globals == NULL){ - errno = ENOMEM; - return 1; - } + if (*ptr_yy_globals == NULL) { + errno = ENOMEM; + return 1; + } - /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ - memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); + /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ + memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); - return yy_init_globals ( *ptr_yy_globals ); + return yy_init_globals ( *ptr_yy_globals ); } @@ -3401,106 +3321,103 @@ int yylex_init(yyscan_t* ptr_yy_globals) * The user defined value in the first argument will be available to yyalloc in * the yyextra field. */ -int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals ) -{ - struct yyguts_t dummy_yyguts; +int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals ) { + struct yyguts_t dummy_yyguts; - yyset_extra (yy_user_defined, &dummy_yyguts); + yyset_extra (yy_user_defined, &dummy_yyguts); - if (ptr_yy_globals == NULL){ - errno = EINVAL; - return 1; - } + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } - *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); + *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); - if (*ptr_yy_globals == NULL){ - errno = ENOMEM; - return 1; - } + if (*ptr_yy_globals == NULL){ + errno = ENOMEM; + return 1; + } - /* By setting to 0xAA, we expose bugs in - yy_init_globals. Leave at 0x00 for releases. */ - memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); + /* By setting to 0xAA, we expose bugs in + yy_init_globals. Leave at 0x00 for releases. */ + memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); - yyset_extra (yy_user_defined, *ptr_yy_globals); + yyset_extra (yy_user_defined, *ptr_yy_globals); - return yy_init_globals ( *ptr_yy_globals ); + return yy_init_globals ( *ptr_yy_globals ); } %endif if-c-only %# Actually, that ended an if-rentrant section %if-c-only -static int yy_init_globals (M4_YY_DEF_ONLY_ARG) -{ - M4_YY_DECL_GUTS_VAR(); - /* Initialization is the same as for the non-reentrant scanner. - * This function is called from yylex_destroy(), so don't allocate here. - */ +static int yy_init_globals (M4_YY_DEF_ONLY_ARG) { + M4_YY_DECL_GUTS_VAR(); + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from yylex_destroy(), so don't allocate here. + */ m4_ifdef( [[M4_YY_USE_LINENO]], [[ m4_ifdef( [[M4_YY_NOT_REENTRANT]], [[ - /* We do not touch yylineno unless the option is enabled. */ - yylineno = 1; + /* We do not touch yylineno unless the option is enabled. */ + yylineno = 1; ]]) ]]) - YY_G(yy_buffer_stack) = NULL; - YY_G(yy_buffer_stack_top) = 0; - YY_G(yy_buffer_stack_max) = 0; - YY_G(yy_c_buf_p) = NULL; - YY_G(yy_init) = 0; - YY_G(yy_start) = 0; + YY_G(yy_buffer_stack) = NULL; + YY_G(yy_buffer_stack_top) = 0; + YY_G(yy_buffer_stack_max) = 0; + YY_G(yy_c_buf_p) = NULL; + YY_G(yy_init) = 0; + YY_G(yy_start) = 0; m4_ifdef( [[M4_YY_HAS_START_STACK_VARS]], [[ - YY_G(yy_start_stack_ptr) = 0; - YY_G(yy_start_stack_depth) = 0; - YY_G(yy_start_stack) = NULL; + YY_G(yy_start_stack_ptr) = 0; + YY_G(yy_start_stack_depth) = 0; + YY_G(yy_start_stack) = NULL; ]]) m4_ifdef( [[M4_MODE_USES_REJECT]], [[ - YY_G(yy_state_buf) = 0; - YY_G(yy_state_ptr) = 0; - YY_G(yy_full_match) = 0; - YY_G(yy_lp) = 0; + YY_G(yy_state_buf) = 0; + YY_G(yy_state_ptr) = 0; + YY_G(yy_full_match) = 0; + YY_G(yy_lp) = 0; ]]) m4_ifdef( [[M4_YY_TEXT_IS_ARRAY]], [[ - YY_G(yytext_ptr) = 0; - YY_G(yy_more_offset) = 0; - YY_G(yy_prev_more_offset) = 0; + YY_G(yytext_ptr) = 0; + YY_G(yy_more_offset) = 0; + YY_G(yy_prev_more_offset) = 0; ]]) /* Defined in main.c */ #ifdef YY_STDINIT - yyin = stdin; - yyout = stdout; + yyin = stdin; + yyout = stdout; #else - yyin = NULL; - yyout = NULL; + yyin = NULL; + yyout = NULL; #endif - /* For future reference: Set errno on error, since we are called by - * yylex_init() - */ - return 0; + /* For future reference: Set errno on error, since we are called by + * yylex_init() + */ + 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 (M4_YY_DEF_ONLY_ARG) -{ - M4_YY_DECL_GUTS_VAR(); +int yylex_destroy (M4_YY_DEF_ONLY_ARG) { + M4_YY_DECL_GUTS_VAR(); - /* Pop the buffer stack, destroying each element. */ - while(YY_CURRENT_BUFFER){ + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER) { yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG ); YY_CURRENT_BUFFER_LVALUE = NULL; yypop_buffer_state(M4_YY_CALL_ONLY_ARG); @@ -3512,27 +3429,27 @@ int yylex_destroy (M4_YY_DEF_ONLY_ARG) m4_ifdef( [[M4_YY_HAS_START_STACK_VARS]], [[ - /* Destroy the start condition stack. */ + /* Destroy the start condition stack. */ yyfree( YY_G(yy_start_stack) M4_YY_CALL_LAST_ARG ); YY_G(yy_start_stack) = NULL; ]]) m4_ifdef( [[M4_MODE_USES_REJECT]], [[ - yyfree ( YY_G(yy_state_buf) M4_YY_CALL_LAST_ARG); - YY_G(yy_state_buf) = NULL; + yyfree ( YY_G(yy_state_buf) M4_YY_CALL_LAST_ARG); + YY_G(yy_state_buf) = NULL; ]]) - /* Reset the globals. This is important in a non-reentrant scanner so the next time - * yylex() is called, initialization will occur. */ - yy_init_globals( M4_YY_CALL_ONLY_ARG); + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * yylex() is called, initialization will occur. */ + yy_init_globals( M4_YY_CALL_ONLY_ARG); %if-reentrant - /* Destroy the main struct (reentrant only). */ - yyfree ( yyscanner M4_YY_CALL_LAST_ARG ); - yyscanner = NULL; + /* Destroy the main struct (reentrant only). */ + yyfree ( yyscanner M4_YY_CALL_LAST_ARG ); + yyscanner = NULL; %endif - return 0; + return 0; } %endif @@ -3547,14 +3464,14 @@ m4_ifdef( [[M4_YY_NOT_IN_HEADER]], m4_ifdef( [[M4_YY_NOT_IN_HEADER]], [[ #ifndef yytext_ptr -static void yy_flex_strncpy YYFARGS3( char*,s1, const char *,s2, int,n) -{ +static void yy_flex_strncpy YYFARGS3( char*,s1, const char *,s2, int,n) { M4_YY_DECL_GUTS_VAR(); M4_YY_NOOP_GUTS_VAR(); int i; - for ( i = 0; i < n; ++i ) + for ( i = 0; i < n; ++i ) { s1[i] = s2[i]; + } } #endif ]]) @@ -3575,8 +3492,7 @@ static int yy_flex_strlen YYFARGS1( const char *,s) m4_ifdef( [[M4_YY_NO_FLEX_ALLOC]],, [[ -void *yyalloc YYFARGS1( yy_size_t ,size) -{ +void *yyalloc YYFARGS1( yy_size_t ,size) { M4_YY_DECL_GUTS_VAR(); M4_YY_NOOP_GUTS_VAR(); return malloc(size); @@ -3585,8 +3501,7 @@ void *yyalloc YYFARGS1( yy_size_t ,size) m4_ifdef( [[M4_YY_NO_FLEX_REALLOC]],, [[ -void *yyrealloc YYFARGS2( void *,ptr, yy_size_t ,size) -{ +void *yyrealloc YYFARGS2( void *,ptr, yy_size_t ,size) { M4_YY_DECL_GUTS_VAR(); M4_YY_NOOP_GUTS_VAR(); @@ -3603,8 +3518,7 @@ void *yyrealloc YYFARGS2( void *,ptr, yy_size_t ,size) m4_ifdef( [[M4_YY_NO_FLEX_FREE]],, [[ -void yyfree YYFARGS1( void *,ptr) -{ +void yyfree YYFARGS1( void *,ptr) { M4_YY_DECL_GUTS_VAR(); M4_YY_NOOP_GUTS_VAR(); free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ @@ -3614,394 +3528,397 @@ void yyfree YYFARGS1( void *,ptr) %if-tables-serialization definitions m4preproc_include(`tables_shared.c') -static int yytbl_read8 (void *v, struct yytbl_reader * rd) -{ - errno = 0; - if (fread (v, sizeof (flex_uint8_t), 1, rd->fp) != 1){ - errno = EIO; - return -1; - } - rd->bread += (flex_uint32_t) sizeof(flex_uint8_t); - return 0; +static int yytbl_read8 (void *v, struct yytbl_reader * rd) { + errno = 0; + if (fread (v, sizeof (flex_uint8_t), 1, rd->fp) != 1){ + errno = EIO; + return -1; + } + rd->bread += (flex_uint32_t) sizeof(flex_uint8_t); + return 0; } -static int yytbl_read16 (void *v, struct yytbl_reader * rd) -{ - errno = 0; - if (fread (v, sizeof (flex_uint16_t), 1, rd->fp) != 1){ - errno = EIO; - return -1; - } - *((flex_uint16_t *) v) = ntohs (*((flex_uint16_t *) v)); - rd->bread += (flex_uint32_t) sizeof(flex_uint16_t); - return 0; +static int yytbl_read16 (void *v, struct yytbl_reader * rd) { + errno = 0; + if (fread (v, sizeof (flex_uint16_t), 1, rd->fp) != 1){ + errno = EIO; + return -1; + } + *((flex_uint16_t *) v) = ntohs (*((flex_uint16_t *) v)); + rd->bread += (flex_uint32_t) sizeof(flex_uint16_t); + return 0; } -static int yytbl_read32 (void *v, struct yytbl_reader * rd) -{ - errno = 0; - if (fread (v, sizeof (flex_uint32_t), 1, rd->fp) != 1){ - errno = EIO; - return -1; - } - *((flex_uint32_t *) v) = ntohl (*((flex_uint32_t *) v)); - rd->bread += (flex_uint32_t) sizeof(flex_uint32_t); - return 0; +static int yytbl_read32 (void *v, struct yytbl_reader * rd) { + errno = 0; + if (fread (v, sizeof (flex_uint32_t), 1, rd->fp) != 1){ + errno = EIO; + return -1; + } + *((flex_uint32_t *) v) = ntohl (*((flex_uint32_t *) v)); + rd->bread += (flex_uint32_t) sizeof(flex_uint32_t); + return 0; } /** Read the header */ -static int yytbl_hdr_read YYFARGS2(struct yytbl_hdr *, th, struct yytbl_reader *, rd) -{ - size_t bytes; - memset (th, 0, sizeof (struct yytbl_hdr)); - - if (yytbl_read32 (&(th->th_magic), rd) != 0) - return -1; - - if (th->th_magic != YYTBL_MAGIC){ - YY_FATAL_ERROR( "bad magic number" ); /* TODO: not fatal. */ - return -1; - } - - if (yytbl_read32 (&(th->th_hsize), rd) != 0 - || yytbl_read32 (&(th->th_ssize), rd) != 0 - || yytbl_read16 (&(th->th_flags), rd) != 0) - return -1; - - /* Sanity check on header size. Greater than 1k suggests some funny business. */ - if (th->th_hsize < 16 || th->th_hsize > 1024){ - YY_FATAL_ERROR( "insane header size detected" ); /* TODO: not fatal. */ - return -1; - } - - /* Allocate enough space for the version and name fields */ - bytes = th->th_hsize - 14; - th->th_version = (char *) yyalloc (bytes M4_YY_CALL_LAST_ARG); - if ( ! th->th_version ) - YY_FATAL_ERROR( "out of dynamic memory in yytbl_hdr_read()" ); - - /* we read it all into th_version, and point th_name into that data */ - if (fread (th->th_version, 1, bytes, rd->fp) != bytes){ - errno = EIO; - yyfree(th->th_version M4_YY_CALL_LAST_ARG); - th->th_version = NULL; - return -1; - } - else - rd->bread += (flex_uint32_t) bytes; - - th->th_name = th->th_version + strlen (th->th_version) + 1; - return 0; +static int yytbl_hdr_read YYFARGS2(struct yytbl_hdr *, th, struct yytbl_reader *, rd) { + size_t bytes; + memset (th, 0, sizeof (struct yytbl_hdr)); + + if (yytbl_read32 (&(th->th_magic), rd) != 0) { + return -1; + } + if (th->th_magic != YYTBL_MAGIC) { + YY_FATAL_ERROR( "bad magic number" ); /* TODO: not fatal. */ + return -1; + } + + if (yytbl_read32 (&(th->th_hsize), rd) != 0 + || yytbl_read32 (&(th->th_ssize), rd) != 0 + || yytbl_read16 (&(th->th_flags), rd) != 0) { + return -1; + } + /* Sanity check on header size. Greater than 1k suggests some funny business. */ + if (th->th_hsize < 16 || th->th_hsize > 1024) { + YY_FATAL_ERROR( "insane header size detected" ); /* TODO: not fatal. */ + return -1; + } + + /* Allocate enough space for the version and name fields */ + bytes = th->th_hsize - 14; + th->th_version = (char *) yyalloc (bytes M4_YY_CALL_LAST_ARG); + if ( ! th->th_version ) { + YY_FATAL_ERROR( "out of dynamic memory in yytbl_hdr_read()" ); + } + /* we read it all into th_version, and point th_name into that data */ + if (fread (th->th_version, 1, bytes, rd->fp) != bytes) { + errno = EIO; + yyfree(th->th_version M4_YY_CALL_LAST_ARG); + th->th_version = NULL; + return -1; + } else { + rd->bread += (flex_uint32_t) bytes; + } + th->th_name = th->th_version + strlen (th->th_version) + 1; + return 0; } /** lookup id in the dmap list. * @param dmap pointer to first element in list * @return NULL if not found. */ -static struct yytbl_dmap *yytbl_dmap_lookup YYFARGS2(struct yytbl_dmap *, dmap, - int, id) -{ - M4_YY_DECL_GUTS_VAR(); - M4_YY_NOOP_GUTS_VAR(); +static struct yytbl_dmap *yytbl_dmap_lookup YYFARGS2(struct yytbl_dmap *, dmap, int, id) { + M4_YY_DECL_GUTS_VAR(); + M4_YY_NOOP_GUTS_VAR(); - while (dmap->dm_id) - if ((int)(dmap->dm_id) == id) - return dmap; - else - dmap++; - return NULL; + while (dmap->dm_id) { + if ((int)(dmap->dm_id) == id) { + return dmap; + } else { + dmap++; + } + } + return NULL; } /** Read a table while mapping its contents to the local array. * @param dmap used to performing mapping * @return 0 on success */ -static int yytbl_data_load YYFARGS2(struct yytbl_dmap *, dmap, struct yytbl_reader*, rd) -{ - struct yytbl_data td; - struct yytbl_dmap *transdmap=0; - int len, i, rv, inner_loop_count; - void *p=0; - - memset (&td, 0, sizeof (struct yytbl_data)); - - if (yytbl_read16 (&td.td_id, rd) != 0 - || yytbl_read16 (&td.td_flags, rd) != 0 - || yytbl_read32 (&td.td_hilen, rd) != 0 - || yytbl_read32 (&td.td_lolen, rd) != 0) - return -1; - - /* Lookup the map for the transition table so we have it in case we need it - * inside the loop below. This scanner might not even have a transition - * table, which is ok. - */ - transdmap = yytbl_dmap_lookup (dmap, YYTD_ID_TRANSITION M4_YY_CALL_LAST_ARG); +static int yytbl_data_load YYFARGS2(struct yytbl_dmap *, dmap, struct yytbl_reader*, rd) { + struct yytbl_data td; + struct yytbl_dmap *transdmap=0; + int len, i, rv, inner_loop_count; + void *p=0; + + memset (&td, 0, sizeof (struct yytbl_data)); + + if (yytbl_read16 (&td.td_id, rd) != 0 + || yytbl_read16 (&td.td_flags, rd) != 0 + || yytbl_read32 (&td.td_hilen, rd) != 0 + || yytbl_read32 (&td.td_lolen, rd) != 0) { + return -1; + } + /* Lookup the map for the transition table so we have it in case we need it + * inside the loop below. This scanner might not even have a transition + * table, which is ok. + */ + transdmap = yytbl_dmap_lookup (dmap, YYTD_ID_TRANSITION M4_YY_CALL_LAST_ARG); - if ((dmap = yytbl_dmap_lookup (dmap, td.td_id M4_YY_CALL_LAST_ARG)) == NULL){ - YY_FATAL_ERROR( "table id not found in map." ); /* TODO: not fatal. */ - return -1; - } + if ((dmap = yytbl_dmap_lookup (dmap, td.td_id M4_YY_CALL_LAST_ARG)) == NULL) { + YY_FATAL_ERROR( "table id not found in map." ); /* TODO: not fatal. */ + return -1; + } - /* Allocate space for table. - * The --full yy_transition table is a special case, since we - * need the dmap.dm_sz entry to tell us the sizeof the individual - * struct members. - */ - { - size_t bytes; - - if ((td.td_flags & YYTD_STRUCT)) - bytes = sizeof(struct yy_trans_info) * td.td_lolen * (td.td_hilen ? td.td_hilen : 1); - else - bytes = td.td_lolen * (td.td_hilen ? td.td_hilen : 1) * dmap->dm_sz; - - if(M4_YY_TABLES_VERIFY) - /* We point to the array itself */ - p = dmap->dm_arr; - else - /* We point to the address of a pointer. */ - *dmap->dm_arr = p = (void *) yyalloc (bytes M4_YY_CALL_LAST_ARG); - if ( ! p ) - YY_FATAL_ERROR( "out of dynamic memory in yytbl_data_load()" ); - } - - /* If it's a struct, we read 2 integers to get one element */ - if ((td.td_flags & YYTD_STRUCT) != 0) - inner_loop_count = 2; - else - inner_loop_count = 1; - - /* read and map each element. - * This loop iterates once for each element of the td_data array. - * Notice that we increment 'i' in the inner loop. - */ - len = yytbl_calc_total_len (&td); - for (i = 0; i < len; ){ - int j; - - - /* This loop really executes exactly 1 or 2 times. - * The second time is to handle the second member of the - * YYTD_STRUCT for the yy_transition array. - */ - for (j = 0; j < inner_loop_count; j++, i++) { - flex_int32_t t32; - - /* read into t32 no matter what the real size is. */ - { - flex_int16_t t16; - flex_int8_t t8; - - switch (YYTDFLAGS2BYTES (td.td_flags)) { - case sizeof (flex_int32_t): - rv = yytbl_read32 (&t32, rd); - break; - case sizeof (flex_int16_t): - rv = yytbl_read16 (&t16, rd); - t32 = t16; - break; - case sizeof (flex_int8_t): - rv = yytbl_read8 (&t8, rd); - t32 = t8; - break; - default: - YY_FATAL_ERROR( "invalid td_flags" ); /* TODO: not fatal. */ - return -1; - } - } - if (rv != 0) - return -1; - - /* copy into the deserialized array... */ - - if ((td.td_flags & YYTD_STRUCT)) { - /* t32 is the j'th member of a two-element struct. */ - void *v; - - v = j == 0 ? &(((struct yy_trans_info *) p)->yy_verify) - : &(((struct yy_trans_info *) p)->yy_nxt); - - switch (dmap->dm_sz) { - case sizeof (flex_int32_t): - if (M4_YY_TABLES_VERIFY){ - if( ((flex_int32_t *) v)[0] != (flex_int32_t) t32) - YY_FATAL_ERROR( "tables verification failed at YYTD_STRUCT flex_int32_t" ); - }else - ((flex_int32_t *) v)[0] = (flex_int32_t) t32; - break; - case sizeof (flex_int16_t): - if (M4_YY_TABLES_VERIFY ){ - if(((flex_int16_t *) v)[0] != (flex_int16_t) t32) - YY_FATAL_ERROR( "tables verification failed at YYTD_STRUCT flex_int16_t" ); - }else - ((flex_int16_t *) v)[0] = (flex_int16_t) t32; - break; - case sizeof(flex_int8_t): - if (M4_YY_TABLES_VERIFY ){ - if( ((flex_int8_t *) v)[0] != (flex_int8_t) t32) - YY_FATAL_ERROR( "tables verification failed at YYTD_STRUCT flex_int8_t" ); - }else - ((flex_int8_t *) v)[0] = (flex_int8_t) t32; - break; - default: - YY_FATAL_ERROR( "invalid dmap->dm_sz for struct" ); /* TODO: not fatal. */ - return -1; - } - - /* if we're done with j, increment p */ - if (j == 1) - p = (struct yy_trans_info *) p + 1; - } - else if ((td.td_flags & YYTD_PTRANS)) { - /* t32 is an index into the transition array. */ - struct yy_trans_info *v; - - - if (!transdmap){ - YY_FATAL_ERROR( "transition table not found" ); /* TODO: not fatal. */ - return -1; - } - - if( M4_YY_TABLES_VERIFY) - v = &(((struct yy_trans_info *) (transdmap->dm_arr))[t32]); - else - v = &((*((struct yy_trans_info **) (transdmap->dm_arr)))[t32]); - - if(M4_YY_TABLES_VERIFY ){ - if( ((struct yy_trans_info **) p)[0] != v) - YY_FATAL_ERROR( "tables verification failed at YYTD_PTRANS" ); - }else - ((struct yy_trans_info **) p)[0] = v; - - /* increment p */ - p = (struct yy_trans_info **) p + 1; - } - else { - /* t32 is a plain int. copy data, then incrememnt p. */ - switch (dmap->dm_sz) { - case sizeof (flex_int32_t): - if(M4_YY_TABLES_VERIFY ){ - if( ((flex_int32_t *) p)[0] != (flex_int32_t) t32) - YY_FATAL_ERROR( "tables verification failed at flex_int32_t" ); - }else - ((flex_int32_t *) p)[0] = (flex_int32_t) t32; - p = ((flex_int32_t *) p) + 1; - break; - case sizeof (flex_int16_t): - if(M4_YY_TABLES_VERIFY ){ - if( ((flex_int16_t *) p)[0] != (flex_int16_t) t32) - YY_FATAL_ERROR( "tables verification failed at flex_int16_t" ); - }else - ((flex_int16_t *) p)[0] = (flex_int16_t) t32; - p = ((flex_int16_t *) p) + 1; - break; - case sizeof (flex_int8_t): - if(M4_YY_TABLES_VERIFY ){ - if( ((flex_int8_t *) p)[0] != (flex_int8_t) t32) - YY_FATAL_ERROR( "tables verification failed at flex_int8_t" ); - }else - ((flex_int8_t *) p)[0] = (flex_int8_t) t32; - p = ((flex_int8_t *) p) + 1; - break; - default: - YY_FATAL_ERROR( "invalid dmap->dm_sz for plain int" ); /* TODO: not fatal. */ - return -1; - } - } - } - - } - - /* Now eat padding. */ - { - while (rd->bread % (8 * sizeof(flex_uint8_t)) > 0) { - flex_int8_t t8; - if(yytbl_read8(&t8,rd) != 0) - return -1; - } - } - - return 0; + /* Allocate space for table. + * The --full yy_transition table is a special case, since we + * need the dmap.dm_sz entry to tell us the sizeof the individual + * struct members. + */ + { + size_t bytes; + + if ((td.td_flags & YYTD_STRUCT)) { + bytes = sizeof(struct yy_trans_info) * td.td_lolen * (td.td_hilen ? td.td_hilen : 1); + } else { + bytes = td.td_lolen * (td.td_hilen ? td.td_hilen : 1) * dmap->dm_sz; + } + if (M4_YY_TABLES_VERIFY) { + /* We point to the array itself */ + p = dmap->dm_arr; + } else { + /* We point to the address of a pointer. */ + *dmap->dm_arr = p = (void *) yyalloc (bytes M4_YY_CALL_LAST_ARG); + } + if ( ! p ) { + YY_FATAL_ERROR( "out of dynamic memory in yytbl_data_load()" ); + } + } + + /* If it's a struct, we read 2 integers to get one element */ + if ((td.td_flags & YYTD_STRUCT) != 0) { + inner_loop_count = 2; + } else { + inner_loop_count = 1; + } + /* read and map each element. + * This loop iterates once for each element of the td_data array. + * Notice that we increment 'i' in the inner loop. + */ + len = yytbl_calc_total_len (&td); + for (i = 0; i < len; ) { + int j; + + /* This loop really executes exactly 1 or 2 times. + * The second time is to handle the second member of the + * YYTD_STRUCT for the yy_transition array. + */ + for (j = 0; j < inner_loop_count; j++, i++) { + flex_int32_t t32; + + /* read into t32 no matter what the real size is. */ + { + flex_int16_t t16; + flex_int8_t t8; + + switch (YYTDFLAGS2BYTES (td.td_flags)) { + case sizeof (flex_int32_t): + rv = yytbl_read32 (&t32, rd); + break; + case sizeof (flex_int16_t): + rv = yytbl_read16 (&t16, rd); + t32 = t16; + break; + case sizeof (flex_int8_t): + rv = yytbl_read8 (&t8, rd); + t32 = t8; + break; + default: + YY_FATAL_ERROR( "invalid td_flags" ); /* TODO: not fatal. */ + return -1; + } + } + if (rv != 0) { + return -1; + } + /* copy into the deserialized array... */ + + if ((td.td_flags & YYTD_STRUCT)) { + /* t32 is the j'th member of a two-element struct. */ + void *v; + + v = j == 0 ? &(((struct yy_trans_info *) p)->yy_verify) + : &(((struct yy_trans_info *) p)->yy_nxt); + + switch (dmap->dm_sz) { + case sizeof (flex_int32_t): + if (M4_YY_TABLES_VERIFY) { + if( ((flex_int32_t *) v)[0] != (flex_int32_t) t32) + YY_FATAL_ERROR( "tables verification failed at YYTD_STRUCT flex_int32_t" ); + } else { + ((flex_int32_t *) v)[0] = (flex_int32_t) t32; + } + break; + case sizeof (flex_int16_t): + if (M4_YY_TABLES_VERIFY ) { + if(((flex_int16_t *) v)[0] != (flex_int16_t) t32) + YY_FATAL_ERROR( "tables verification failed at YYTD_STRUCT flex_int16_t" ); + } else { + ((flex_int16_t *) v)[0] = (flex_int16_t) t32; + } + break; + case sizeof(flex_int8_t): + if (M4_YY_TABLES_VERIFY ) { + if( ((flex_int8_t *) v)[0] != (flex_int8_t) t32) + YY_FATAL_ERROR( "tables verification failed at YYTD_STRUCT flex_int8_t" ); + } else { + ((flex_int8_t *) v)[0] = (flex_int8_t) t32; + } + break; + default: + YY_FATAL_ERROR( "invalid dmap->dm_sz for struct" ); /* TODO: not fatal. */ + return -1; + } + + /* if we're done with j, increment p */ + if (j == 1) { + p = (struct yy_trans_info *) p + 1; + } + } + else if ((td.td_flags & YYTD_PTRANS)) { + /* t32 is an index into the transition array. */ + struct yy_trans_info *v; + + if (!transdmap) { + YY_FATAL_ERROR( "transition table not found" ); /* TODO: not fatal. */ + return -1; + } + + if( M4_YY_TABLES_VERIFY) { + v = &(((struct yy_trans_info *) (transdmap->dm_arr))[t32]); + } else { + v = &((*((struct yy_trans_info **) (transdmap->dm_arr)))[t32]); + } + if(M4_YY_TABLES_VERIFY ) { + if( ((struct yy_trans_info **) p)[0] != v) + YY_FATAL_ERROR( "tables verification failed at YYTD_PTRANS" ); + } else { + ((struct yy_trans_info **) p)[0] = v; + } + /* increment p */ + p = (struct yy_trans_info **) p + 1; + } + else { + /* t32 is a plain int. copy data, then incrememnt p. */ + switch (dmap->dm_sz) { + case sizeof (flex_int32_t): + if(M4_YY_TABLES_VERIFY ) { + if( ((flex_int32_t *) p)[0] != (flex_int32_t) t32) { + YY_FATAL_ERROR( "tables verification failed at flex_int32_t" ); + } + } else { + ((flex_int32_t *) p)[0] = (flex_int32_t) t32; + } + p = ((flex_int32_t *) p) + 1; + break; + case sizeof (flex_int16_t): + if(M4_YY_TABLES_VERIFY ) { + if( ((flex_int16_t *) p)[0] != (flex_int16_t) t32) { + YY_FATAL_ERROR( "tables verification failed at flex_int16_t" ); + } + } else { + ((flex_int16_t *) p)[0] = (flex_int16_t) t32; + } + p = ((flex_int16_t *) p) + 1; + break; + case sizeof (flex_int8_t): + if(M4_YY_TABLES_VERIFY ){ + if( ((flex_int8_t *) p)[0] != (flex_int8_t) t32) { + YY_FATAL_ERROR( "tables verification failed at flex_int8_t" ); + } + } else { + ((flex_int8_t *) p)[0] = (flex_int8_t) t32; + } + p = ((flex_int8_t *) p) + 1; + break; + default: + YY_FATAL_ERROR( "invalid dmap->dm_sz for plain int" ); /* TODO: not fatal. */ + return -1; + } + } + } + + } + + /* Now eat padding. */ + { + while (rd->bread % (8 * sizeof(flex_uint8_t)) > 0) { + flex_int8_t t8; + if(yytbl_read8(&t8,rd) != 0) + return -1; + } + } + + return 0; } %define-yytables The name for this specific scanner's tables. /* Find the key and load the DFA tables from the given stream. */ -static int yytbl_fload YYFARGS2(FILE *, fp, const char *, key) -{ - int rv=0; - struct yytbl_hdr th; - struct yytbl_reader rd; - - rd.fp = fp; - th.th_version = NULL; - - /* Keep trying until we find the right set of tables or end of file. */ - while (!feof(rd.fp)) { - rd.bread = 0; - if (yytbl_hdr_read (&th, &rd M4_YY_CALL_LAST_ARG) != 0){ - rv = -1; - goto return_rv; - } - - /* A NULL key means choose the first set of tables. */ - if (key == NULL) - break; - - if (strcmp(th.th_name,key) != 0){ - /* Skip ahead to next set */ - fseek(rd.fp, th.th_ssize - th.th_hsize, SEEK_CUR); - yyfree(th.th_version M4_YY_CALL_LAST_ARG); - th.th_version = NULL; - } - else - break; - } - - while (rd.bread < th.th_ssize){ - /* Load the data tables */ - if(yytbl_data_load (yydmap,&rd M4_YY_CALL_LAST_ARG) != 0){ - rv = -1; - goto return_rv; - } - } +static int yytbl_fload YYFARGS2(FILE *, fp, const char *, key) { + int rv=0; + struct yytbl_hdr th; + struct yytbl_reader rd; + + rd.fp = fp; + th.th_version = NULL; + + /* Keep trying until we find the right set of tables or end of file. */ + while (!feof(rd.fp)) { + rd.bread = 0; + if (yytbl_hdr_read (&th, &rd M4_YY_CALL_LAST_ARG) != 0){ + rv = -1; + goto return_rv; + } + + /* A NULL key means choose the first set of tables. */ + if (key == NULL) { + break; + } + + if (strcmp(th.th_name,key) != 0) { + /* Skip ahead to next set */ + fseek(rd.fp, th.th_ssize - th.th_hsize, SEEK_CUR); + yyfree(th.th_version M4_YY_CALL_LAST_ARG); + th.th_version = NULL; + } + else { + break; + } + } + + while (rd.bread < th.th_ssize) { + /* Load the data tables */ + if(yytbl_data_load (yydmap,&rd M4_YY_CALL_LAST_ARG) != 0){ + rv = -1; + goto return_rv; + } + } return_rv: - if(th.th_version){ - yyfree(th.th_version M4_YY_CALL_LAST_ARG); - th.th_version = NULL; - } + if(th.th_version) { + yyfree(th.th_version M4_YY_CALL_LAST_ARG); + th.th_version = NULL; + } - return rv; + return rv; } /** Load the DFA tables for this scanner from the given stream. */ -int yytables_fload YYFARGS1(FILE *, fp) -{ - - if( yytbl_fload(fp, YYTABLES_NAME M4_YY_CALL_LAST_ARG) != 0) - return -1; - return 0; +int yytables_fload YYFARGS1(FILE *, fp) { + if( yytbl_fload(fp, YYTABLES_NAME M4_YY_CALL_LAST_ARG) != 0) { + return -1; + } + return 0; } /** Destroy the loaded tables, freeing memory, etc.. */ -int yytables_destroy (M4_YY_DEF_ONLY_ARG) -{ - struct yytbl_dmap *dmap=0; - - if(!M4_YY_TABLES_VERIFY){ - /* Walk the dmap, freeing the pointers */ - for(dmap=yydmap; dmap->dm_id; dmap++) { - void * v; - v = dmap->dm_arr; - if(v && *(char**)v){ - yyfree(*(char**)v M4_YY_CALL_LAST_ARG); - *(char**)v = NULL; - } - } - } +int yytables_destroy (M4_YY_DEF_ONLY_ARG) { + struct yytbl_dmap *dmap=0; + + if(!M4_YY_TABLES_VERIFY){ + /* Walk the dmap, freeing the pointers */ + for(dmap=yydmap; dmap->dm_id; dmap++) { + void * v; + v = dmap->dm_arr; + if(v && *(char**)v){ + yyfree(*(char**)v M4_YY_CALL_LAST_ARG); + *(char**)v = NULL; + } + } + } - return 0; + return 0; } /* end table serialization code definitions */ @@ -4011,14 +3928,12 @@ int yytables_destroy (M4_YY_DEF_ONLY_ARG) m4_ifdef([[M4_YY_MAIN]], [[ int main (void); -int main () -{ - +int main () { %if-reentrant - yyscan_t lexer; - yylex_init(&lexer); - yylex( lexer ); - yylex_destroy( lexer); + yyscan_t lexer; + yylex_init(&lexer); + yylex( lexer ); + yylex_destroy( lexer); %endif %if-not-reentrant @@ -4045,3 +3960,9 @@ m4_ifdef( [[M4_YY_IN_HEADER]], #endif m4preproc_undivert(1) ]]) + +%# Local Variables: +%# mode:c +%# c-file-style:"k&r" +%# c-basic-offset:8 +%# End: |