📄 calc++-scanner.cc
字号:
4, 5, 6, 7, 8, 9, 4, 10, 4, 15, 13, 12, 11, 14, 13, 12, 11, 16, 3, 16, 16, 16, 16, 16, 16, 16, 16, 16 } ;static yyconst flex_int16_t yy_chk[29] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 17, 13, 12, 11, 9, 8, 6, 5, 3, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 } ;static yy_state_type yy_last_accepting_state;static char *yy_last_accepting_cpos;extern int yy_flex_debug;int yy_flex_debug = 1;static yyconst flex_int16_t yy_rule_linenum[8] = { 0, 23, 24, 26, 27, 28, 36, 37 } ;/* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */#define REJECT reject_used_but_not_detected#define yymore() yymore_used_but_not_detected#define YY_MORE_ADJ 0#define YY_RESTORE_YY_MORE_OFFSETchar *yytext;#line 1 "./calc++-scanner.ll"#line 2 "./calc++-scanner.ll"# include <cstdlib># include <errno.h># include <limits.h># include <string># include "calc++-driver.hh"# include "calc++-parser.hh"#line 17 "./calc++-scanner.ll"# define YY_USER_ACTION yylloc->columns (yyleng);#line 539 "calc++-scanner.cc"#define INITIAL 0#ifndef YY_NO_UNISTD_H/* Special case for "unistd.h", since it is non-ANSI. We include it way * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. *//* %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 *//* %if-reentrant *//* %endif *//* %if-bison-bridge *//* %endif *//* %endif End reentrant structures and macros. *//* Macros after this point can all be overridden by user definitions in * section 1. */#ifndef YY_SKIP_YYWRAP#ifdef __cplusplusextern "C" int yywrap (void );#elseextern int yywrap (void );#endif#endif/* %not-for-header *//* %ok-for-header *//* %endif */#ifndef yytext_ptrstatic void yy_flex_strncpy (char *,yyconst char *,int );#endif#ifdef YY_NEED_STRLENstatic int yy_flex_strlen (yyconst char * );#endif#ifndef YY_NO_INPUT/* %if-c-only Standard (non-C++) definition *//* %not-for-header */#ifdef __cplusplusstatic int yyinput (void );#elsestatic int input (void );#endif/* %ok-for-header *//* %endif */#endif/* %if-c-only *//* %endif *//* Amount of stuff to slurp up with each read. */#ifndef YY_READ_BUF_SIZE#define YY_READ_BUF_SIZE 8192#endif/* Copy whatever the last rule matched to the standard output. */#ifndef ECHO/* %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, * is returned in "result". */#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 = '*'; \ size_t n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ } \ errno=0; \ clearerr(yyin); \ } \ }\\/* %if-c++-only C++ definition \ */\/* %endif */#endif/* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */#ifndef yyterminate#define yyterminate() return YY_NULL#endif/* Number of entries by which start-condition stack grows. */#ifndef YY_START_STACK_INCR#define YY_START_STACK_INCR 25#endif/* Report a fatal error. */#ifndef YY_FATAL_ERROR/* %if-c-only */#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )/* %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 (void);#define YY_DECL int yylex (void)/* %endif *//* %if-c++-only C++ definition *//* %endif */#endif /* !YY_DECL *//* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */#ifndef YY_USER_ACTION#define YY_USER_ACTION#endif/* Code executed at the end of each rule. */#ifndef YY_BREAK#define YY_BREAK break;#endif/* %% [6.0] YY_RULE_SETUP definition goes here */#define YY_RULE_SETUP \ YY_USER_ACTION/* %not-for-header *//** The main scanner function which does all the work. */YY_DECL{ register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; /* %% [7.0] user's declarations go here */#line 19 "./calc++-scanner.ll" yylloc->step ();#line 749 "calc++-scanner.cc" if ( (yy_init) ) { (yy_init) = 0;#ifdef YY_USER_INIT YY_USER_INIT;#endif if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ if ( ! yyin )/* %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 (); YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin,YY_BUF_SIZE ); } yy_load_buffer_state( ); } while ( 1 ) /* loops until end-of-file is reached */ {/* %% [8.0] yymore()-related code goes here */ yy_cp = (yy_c_buf_p); /* Support of yytext. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp;/* %% [9.0] code to set up and find next match goes here */ yy_current_state = (yy_start);yy_match: do { register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 17 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } while ( yy_current_state != 16 ); yy_cp = (yy_last_accepting_cpos); yy_current_state = (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 < 8 ) fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n", (long)yy_rule_linenum[yy_act], yytext ); else if ( yy_act == 8 ) fprintf( stderr, "--accepting default rule (\"%s\")\n", yytext ); else if ( yy_act == 9 ) 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 = (yy_hold_char); yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); goto yy_find_action;case 1:YY_RULE_SETUP#line 23 "./calc++-scanner.ll"yylloc->step (); YY_BREAKcase 2:/* rule 2 can match eol */YY_RULE_SETUP#line 24 "./calc++-scanner.ll"yylloc->lines (yyleng); yylloc->step (); YY_BREAKcase 3:YY_RULE_SETUP#line 26 "./calc++-scanner.ll"return yytext[0]; YY_BREAKcase 4:YY_RULE_SETUP#line 27 "./calc++-scanner.ll"return TOKEN_ASSIGN; YY_BREAKcase 5:YY_RULE_SETUP#line 28 "./calc++-scanner.ll"{ errno = 0; long n = strtol (yytext, NULL, 10); if (! (INT_MIN <= n && n <= INT_MAX && errno != ERANGE)) driver.error (*yylloc, "integer is out of range"); yylval->ival = n; return TOKEN_NUMBER;} YY_BREAKcase 6:YY_RULE_SETUP#line 36 "./calc++-scanner.ll"yylval->sval = new std::string (yytext); return TOKEN_IDENTIFIER; YY_BREAKcase 7:YY_RULE_SETUP#line 37 "./calc++-scanner.ll"driver.error (*yylloc, "invalid character"); YY_BREAKcase 8:YY_RULE_SETUP#line 38 "./calc++-scanner.ll"ECHO; YY_BREAK#line 907 "calc++-scanner.cc"case YY_STATE_EOF(INITIAL): yyterminate(); case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = (yy_hold_char); YY_RESTORE_YY_MORE_OFFSET if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called * yylex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) { /* This was really a NUL. */ yy_state_type yy_next_state; (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = (yytext_ptr) + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++(yy_c_buf_p); yy_current_state = yy_next_state; goto yy_match; } else {/* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */ yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); goto yy_find_action; } } else switch ( yy_get_next_buffer( ) ) { case EOB_ACT_END_OF_FILE: { (yy_did_buffer_switch_on_eof) = 0; if ( yywrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * yytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -