📄 initscan.c
字号:
static int yy_start = 0; /* start state number *//* flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... */static int yy_did_buffer_switch_on_eof;static yy_state_type yy_get_previous_state YY_PROTO(( void ));static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));static int yy_get_next_buffer YY_PROTO(( void ));static void yyunput YY_PROTO(( YY_CHAR c, YY_CHAR *buf_ptr ));void yyrestart YY_PROTO(( FILE *input_file ));void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));void yy_load_buffer_state YY_PROTO(( void ));YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));#define yy_new_buffer yy_create_buffer#ifdef __cplusplusstatic int yyinput YY_PROTO(( void ));#elsestatic int input YY_PROTO(( void ));#endifYY_DECL { register yy_state_type yy_current_state; register YY_CHAR *yy_cp, *yy_bp; register int yy_act; static int bracelevel, didadef; int i, indented_code, checking_used, new_xlation; int doing_codeblock = false; Char nmdef[MAXLINE], myesc(); if ( yy_init ) { YY_USER_INIT; if ( ! yy_start ) yy_start = 1; /* first start state */ if ( ! yyin ) yyin = stdin; if ( ! yyout ) yyout = stdout; if ( yy_current_buffer ) yy_init_buffer( yy_current_buffer, yyin ); else yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); yy_load_buffer_state(); yy_init = 0; } while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = yy_c_buf_p; /* support of yytext */ *yy_cp = yy_hold_char; /* yy_bp points to the position in yy_ch_buf of the start of the * current run. */ yy_bp = yy_cp; yy_current_state = yy_start; if ( yy_bp[-1] == '\n' ) ++yy_current_state;yy_match: do { register YY_CHAR yy_c = yy_ec[*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 = yy_def[yy_current_state]; if ( yy_current_state >= 341 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; ++yy_cp; } while ( yy_current_state != 340 ); yy_cp = yy_last_accepting_cpos; yy_current_state = yy_last_accepting_state;yy_find_action: yy_act = yy_accept[yy_current_state]; YY_DO_BEFORE_ACTION; YY_USER_ACTION;do_action: /* this label is used only to access EOF actions */ switch ( yy_act ) { case 0: /* must backtrack */ /* 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:# line 90 "scan.l"indented_code = true; BEGIN(CODEBLOCK); YY_BREAKcase 2:# line 91 "scan.l"++linenum; /* treat as a comment */ YY_BREAKcase 3:# line 92 "scan.l"ECHO; BEGIN(C_COMMENT); YY_BREAKcase 4:# line 93 "scan.l"return ( SCDECL ); YY_BREAKcase 5:# line 94 "scan.l"return ( XSCDECL ); YY_BREAKcase 6:# line 95 "scan.l"{ ++linenum; line_directive_out( stdout ); indented_code = false; BEGIN(CODEBLOCK); } YY_BREAKcase 7:# line 102 "scan.l"return ( WHITESPACE ); YY_BREAKcase 8:# line 104 "scan.l"{ sectnum = 2; line_directive_out( stdout ); BEGIN(SECT2PROLOG); return ( SECTEND ); } YY_BREAKcase 9:# line 111 "scan.l"{ pinpoint_message( "warning - %%used/%%unused have been deprecated" ); checking_used = REALLY_USED; BEGIN(USED_LIST); } YY_BREAKcase 10:# line 115 "scan.l"{ checking_used = REALLY_NOT_USED; BEGIN(USED_LIST); pinpoint_message( "warning - %%used/%%unused have been deprecated" ); checking_used = REALLY_NOT_USED; BEGIN(USED_LIST); } YY_BREAKcase 11:# line 122 "scan.l"{#ifdef NOTDEF fprintf( stderr, "old-style lex command at line %d ignored:\n\t%s", linenum, yytext );#endif ++linenum; } YY_BREAKcase 12:# line 131 "scan.l"/* ignore old lex directive */ YY_BREAKcase 13:# line 133 "scan.l"{ ++linenum; xlation = (int *) malloc( sizeof( int ) * (unsigned) csize ); if ( ! xlation ) flexfatal( "dynamic memory failure building %t table" ); for ( i = 0; i < csize; ++i ) xlation[i] = 0; num_xlations = 0; BEGIN(XLATION); } YY_BREAKcase 14:# line 150 "scan.l"synerr( "unrecognized '%' directive" ); YY_BREAKcase 15:# line 152 "scan.l"{ (void) strcpy( nmstr, (char *) yytext ); didadef = false; BEGIN(PICKUPDEF); } YY_BREAKcase 16:# line 158 "scan.l"RETURNNAME; YY_BREAKcase 17:# line 159 "scan.l"++linenum; /* allows blank lines in section 1 */ YY_BREAKcase 18:# line 160 "scan.l"++linenum; return ( '\n' ); YY_BREAKcase 19:# line 161 "scan.l"synerr( "illegal character" ); BEGIN(RECOVER); YY_BREAKcase 20:# line 164 "scan.l"ECHO; BEGIN(INITIAL); YY_BREAKcase 21:# line 165 "scan.l"++linenum; ECHO; BEGIN(INITIAL); YY_BREAKcase 22:# line 166 "scan.l"ECHO; YY_BREAKcase 23:# line 167 "scan.l"ECHO; YY_BREAKcase 24:# line 168 "scan.l"++linenum; ECHO; YY_BREAKcase 25:# line 171 "scan.l"++linenum; BEGIN(INITIAL); YY_BREAKcase 26:# line 172 "scan.l"ECHO; CHECK_REJECT(yytext); YY_BREAKcase 27:# line 173 "scan.l"ECHO; CHECK_YYMORE(yytext); YY_BREAKcase 28:# line 174 "scan.l"ECHO; YY_BREAKcase 29:# line 175 "scan.l"{ ++linenum; ECHO; if ( indented_code ) BEGIN(INITIAL); } YY_BREAKcase 30:# line 183 "scan.l"/* separates name and definition */ YY_BREAKcase 31:# line 185 "scan.l"{ (void) strcpy( (char *) nmdef, (char *) yytext ); for ( i = strlen( (char *) nmdef ) - 1; i >= 0 && nmdef[i] == ' ' || nmdef[i] == '\t'; --i ) ; nmdef[i + 1] = '\0'; ndinstal( nmstr, nmdef ); didadef = true; } YY_BREAKcase 32:# line 200 "scan.l"{ if ( ! didadef ) synerr( "incomplete name definition" ); BEGIN(INITIAL); ++linenum; } YY_BREAKcase 33:# line 207 "scan.l"++linenum; BEGIN(INITIAL); RETURNNAME; YY_BREAKcase 34:# line 210 "scan.l"++linenum; BEGIN(INITIAL); YY_BREAKcase 35:# line 211 "scan.l" YY_BREAKcase 36:# line 212 "scan.l"{ if ( all_upper( yytext ) ) reject_really_used = checking_used; else synerr( "unrecognized %used/%unused construct" ); } YY_BREAKcase 37:# line 218 "scan.l"{ if ( all_lower( yytext ) ) yymore_really_used = checking_used; else synerr( "unrecognized %used/%unused construct" ); } YY_BREAKcase 38:# line 224 "scan.l"synerr( "unrecognized %used/%unused construct" ); YY_BREAKcase 39:# line 227 "scan.l"++linenum; BEGIN(INITIAL); YY_BREAKcase 40:# line 228 "scan.l"++num_xlations; new_xlation = true; YY_BREAKcase 41:# line 229 "scan.l"synerr( "bad row in translation table" ); YY_BREAKcase 42:# line 230 "scan.l"/* ignore whitespace */ YY_BREAKcase 43:# line 232 "scan.l"{ xlation[myesc( yytext )] = (new_xlation ? num_xlations : -num_xlations); new_xlation = false; } YY_BREAKcase 44:# line 237 "scan.l"{ xlation[yytext[0]] = (new_xlation ? num_xlations : -num_xlations); new_xlation = false; } YY_BREAKcase 45:# line 243 "scan.l"++linenum; YY_BREAKcase 46:*yy_cp = yy_hold_char; /* undo effects of setting up yytext */yy_c_buf_p = yy_cp -= 1;YY_DO_BEFORE_ACTION; /* set up yytext again */# line 246 "scan.l"{ ++linenum; ACTION_ECHO; MARK_END_OF_PROLOG; BEGIN(SECT2); } YY_BREAKcase 47:# line 253 "scan.l"++linenum; ACTION_ECHO; YY_BREAKcase YY_STATE_EOF(SECT2PROLOG):# line 255 "scan.l"MARK_END_OF_PROLOG; yyterminate(); YY_BREAKcase 49:# line 257 "scan.l"++linenum; /* allow blank lines in section 2 */ YY_BREAKcase 50:# line 259 "scan.l"{ indented_code = (yytext[0] != '%'); doing_codeblock = true; bracelevel = 1; if ( indented_code ) ACTION_ECHO; BEGIN(CODEBLOCK_2); } YY_BREAKcase 51:# line 270 "scan.l"BEGIN(SC); return ( '<' ); YY_BREAKcase 52:# line 271 "scan.l"return ( '^' ); YY_BREAKcase 53:# line 272 "scan.l"BEGIN(QUOTE); return ( '"' ); YY_BREAKcase 54:*yy_cp = yy_hold_char; /* undo effects of setting up yytext */yy_c_buf_p = yy_cp = yy_bp + 1;YY_DO_BEFORE_ACTION; /* set up yytext again */# line 273 "scan.l"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -