goomsl_lex.c
来自「linux下的MPEG1」· C语言 代码 · 共 2,109 行 · 第 1/4 页
C
2,109 行
89, 63, 92, 86, 64, 96, 96, 67, 147, 146, 65, 86, 66, 66, 84, 85, 84, 89, 85, 89, 141, 141, 145, 144, 143, 142, 141, 86, 139, 138, 86, 39, 39, 39, 39, 47, 47, 47, 47, 53, 137, 53, 53, 56, 56, 57, 136, 57, 57, 110, 110, 110, 110, 140, 135, 140, 140, 134, 133, 132, 131, 130, 129, 128, 127, 126, 125, 124, 123, 111, 122, 121, 118, 117, 116, 115, 114, 113, 112, 111, 111, 90, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 95, 94, 93, 90, 88, 83, 82, 81, 80, 79, 78, 74, 71, 70, 60, 59, 58, 52, 150, 45, 9, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150 } ;static yyconst flex_int16_t yy_chk[276] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 156, 4, 4, 4, 6, 6, 6, 3, 7, 2, 4, 7, 8, 148, 4, 8, 11, 6, 11, 15, 21, 22, 50, 15, 21, 23, 146, 22, 21, 22, 22, 23, 29, 23, 23, 7, 24, 24, 27, 8, 51, 29, 51, 29, 107, 27, 36, 36, 36, 38, 65, 65, 107, 38, 42, 42, 42, 38, 50, 36, 66, 96, 96, 22, 145, 142, 66, 42, 66, 66, 84, 84, 84, 89, 89, 89, 141, 140, 137, 136, 135, 134, 133, 84, 131, 130, 89, 151, 151, 151, 151, 152, 152, 152, 152, 153, 127, 153, 153, 154, 154, 155, 126, 155, 155, 157, 157, 157, 157, 158, 125, 158, 158, 124, 123, 122, 120, 119, 118, 117, 116, 115, 114, 113, 112, 110, 109, 108, 102, 101, 100, 99, 98, 94, 93, 90, 87, 86, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 72, 71, 57, 55, 54, 44, 41, 35, 34, 33, 32, 31, 30, 28, 26, 25, 20, 19, 18, 13, 9, 5, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150 } ;/* Table of booleans, true if rule could match eol. */static yyconst flex_int32_t yy_rule_can_match_eol[50] = { 0,1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, };extern int yy_flex_debug;int yy_flex_debug = 0;static yy_state_type *yy_state_buf=0, *yy_state_ptr=0;static char *yy_full_match;static int yy_lp;#define REJECT \{ \*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ \yy_cp = (yy_full_match); /* restore poss. backed-over text */ \++(yy_lp); \goto find_rule; \}static int yy_more_offset = 0;static int yy_prev_more_offset = 0;#define yymore() ((yy_more_offset) = yy_flex_strlen( yytext ))#define YY_NEED_STRLEN#define YY_MORE_ADJ 0#define YY_RESTORE_YY_MORE_OFFSET \ { \ (yy_more_offset) = (yy_prev_more_offset); \ yyleng -= (yy_more_offset); \ }#ifndef YYLMAX#define YYLMAX 8192#endifchar yytext[YYLMAX];char *yytext_ptr;#line 1 "goomsl_lex.l"#line 2 "goomsl_lex.l"#include <math.h>#include <stdlib.h>#include <string.h>#include "goomsl.h"#include "goomsl_private.h"#include "goomsl_yacc.h"void yyerror(char *);void yyparse(void);GoomSL *currentGoomSL;static int string_size;static char string[1024];#line 639 "goomsl_lex.c"#define INITIAL 0#define C_COMMENT 1#define LINE_COMMENT 2#define STRING 3/* 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. */#include <unistd.h>#ifndef YY_EXTRA_TYPE#define YY_EXTRA_TYPE void *#endif/* 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 static void yyunput (int c,char *buf_ptr ); #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#ifdef __cplusplusstatic int yyinput (void );#elsestatic int input (void );#endif#endif/* Amount of stuff to slurp up with each read. */#ifndef YY_READ_BUF_SIZE#define YY_READ_BUF_SIZE 8192#endif/* Copy whatever the last rule matched to the standard output. */#ifndef ECHO/* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )#endif/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */#ifndef YY_INPUT#define YY_INPUT(buf,result,max_size) \ if ( YY_CURRENT_BUFFER_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); \ } \ }\\#endif/* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */#ifndef yyterminate#define yyterminate() return YY_NULL#endif/* Number of entries by which start-condition stack grows. */#ifndef YY_START_STACK_INCR#define YY_START_STACK_INCR 25#endif/* Report a fatal error. */#ifndef YY_FATAL_ERROR#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )#endif/* end tables serialization structures and prototypes *//* Default declaration of generated scanner - a define so the user can * easily add parameters. */#ifndef YY_DECL#define YY_DECL_IS_OURS 1extern int yylex (void);#define YY_DECL int yylex (void)#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#define YY_RULE_SETUP \ if ( yyleng > 0 ) \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ (yytext[yyleng - 1] == '\n'); \ YY_USER_ACTION/** 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; #line 25 "goomsl_lex.l"#line 797 "goomsl_lex.c" if ( (yy_init) ) { (yy_init) = 0;#ifdef YY_USER_INIT YY_USER_INIT;#endif if ( ! (yy_state_buf) ) (yy_state_buf) = (yy_state_type *)yyalloc(YY_BUF_SIZE + 2 ); if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ if ( ! yyin ) yyin = stdin; if ( ! yyout ) yyout = stdout; 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 */ { yy_cp = (yy_c_buf_p); /* Support of yytext. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); (yy_state_ptr) = (yy_state_buf); *(yy_state_ptr)++ = yy_current_state;yy_match: do { register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*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 >= 151 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; *(yy_state_ptr)++ = yy_current_state; ++yy_cp; } while ( yy_base[yy_current_state] != 225 );yy_find_action: yy_current_state = *--(yy_state_ptr); (yy_lp) = yy_accept[yy_current_state];find_rule: /* we branch to this label when backing up */ for ( ; ; ) /* until we find what rule we matched */ { if ( (yy_lp) && (yy_lp) < yy_accept[yy_current_state + 1] ) { yy_act = yy_acclist[(yy_lp)]; { (yy_full_match) = yy_cp; break; } } --yy_cp; yy_current_state = *--(yy_state_ptr); (yy_lp) = yy_accept[yy_current_state]; } YY_DO_BEFORE_ACTION; if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) { int yyl; for ( yyl = (yy_prev_more_offset); yyl < yyleng; ++yyl ) if ( yytext[yyl] == '\n' ) yylineno++;; }do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */case 1:/* rule 1 can match eol */YY_RULE_SETUP#line 27 "goomsl_lex.l"{ ++currentGoomSL->num_lines; /* Ignore empty lines */ } YY_BREAKcase 2:/* rule 2 can match eol */YY_RULE_SETUP#line 28 "goomsl_lex.l"{ ++currentGoomSL->num_lines; /* Ignore empty lines */ } YY_BREAKcase 3:/* rule 3 can match eol */YY_RULE_SETUP#line 30 "goomsl_lex.l"{ ++currentGoomSL->num_lines; yylval.charValue=*yytext; BEGIN INITIAL; return '\n'; } YY_BREAKcase 4:/* rule 4 can match eol */YY_RULE_SETUP#line 31 "goomsl_lex.l"{ ++currentGoomSL->num_lines; yylval.charValue=*yytext; return '\n'; } YY_BREAKcase 5:YY_RULE_SETUP#line 33 "goomsl_lex.l"{ BEGIN INITIAL; } YY_BREAKcase 6:/* rule 6 can match eol */YY_RULE_SETUP#line 34 "goomsl_lex.l"{ ++currentGoomSL->num_lines; } YY_BREAKcase 7:YY_RULE_SETUP#line 35 "goomsl_lex.l"{ /* eat up comment */ } YY_BREAKcase 8:YY_RULE_SETUP#line 37 "goomsl_lex.l"{ currentGoomSL->num_lines = 0; } YY_BREAKcase 9:YY_RULE_SETUP#line 38 "goomsl_lex.l"{ currentGoomSL->num_lines = 0; printf("%s\n", yytext); } YY_BREAKcase 10:YY_RULE_SETUP#line 39 "goomsl_lex.l"{ /* ignore preprocessor lines */ } YY_BREAKcase 11:YY_RULE_SETUP#line 41 "goomsl_lex.l"{ BEGIN C_COMMENT; } YY_BREAKcase 12:YY_RULE_SETUP#line 42 "goomsl_lex.l"{ BEGIN LINE_COMMENT; } YY_BREAKcase 13:YY_RULE_SETUP#line 43 "goomsl_lex.l"{ BEGIN STRING; string_size=0; } YY_BREAKcase 14:YY_RULE_SETUP#line 45 "goomsl_lex.l"{ string[string_size++] = '\n'; } YY_BREAKcase 15:YY_RULE_SETUP#line 46 "goomsl_lex.l"{ string[string_size++] = '\"'; } YY_BREAKcase 16:YY_RULE_SETUP#line 47 "goomsl_lex.l"{ /* fin de la chaine: on cree le pointeur qui va bien */ unsigned int tmp; BEGIN INITIAL; string[string_size]=0; tmp = gsl_malloc(currentGoomSL, string_size+1); strcpy((char*)currentGoomSL->ptrArray[tmp],string); sprintf(yylval.strValue, "0x%08x", tmp); return LTYPE_PTR; } YY_BREAKcase 17:YY_RULE_SETUP#line 56 "goomsl_lex.l"{ string[string_size++] = *yytext; } YY_BREAKcase 18:YY_RULE_SETUP#line 58 "goomsl_lex.l"{ return FLOAT_TK; } YY_BREAKcase 19:YY_RULE_SETUP#line 59 "goomsl_lex.l"{ return INT_TK; } YY_BREAKcase 20:YY_RULE_SETUP#line 60 "goomsl_lex.l"{ return INT_TK; } YY_BREAKcase 21:YY_RULE_SETUP#line 61 "goomsl_lex.l"{ return PTR_TK; } YY_BREAKcase 22:YY_RULE_SETUP#line 62 "goomsl_lex.l"{ return PTR_TK; } YY_BREAKcase 23:YY_RULE_SETUP#line 63 "goomsl_lex.l"{ return DECLARE; } YY_BREAKcase 24:YY_RULE_SETUP#line 64 "goomsl_lex.l"{ return EXTERNAL; } YY_BREAKcase 25:YY_RULE_SETUP#line 65 "goomsl_lex.l"{ return STRUCT; } YY_BREAKcase 26:YY_RULE_SETUP#line 66 "goomsl_lex.l"{ return NOT; } YY_BREAKcase 27:YY_RULE_SETUP#line 67 "goomsl_lex.l"{ return WHILE; } YY_BREAKcase 28:YY_RULE_SETUP#line 68 "goomsl_lex.l"{ return DO; } YY_BREAKcase 29:YY_RULE_SETUP#line 69 "goomsl_lex.l"{ return FOR; } YY_BREAKcase 30:YY_RULE_SETUP#line 70 "goomsl_lex.l"
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?