📄 pgc.c
字号:
break; } } if (ptr == NULL) { yylval.str = mm_strdup((char*)yytext); return IDENT; } } } YY_BREAKcase 50:YY_RULE_SETUP#line 580 "pgc.l"{ return(';'); } YY_BREAKcase 51:YY_RULE_SETUP#line 581 "pgc.l"{ return(','); } YY_BREAKcase 52:YY_RULE_SETUP#line 582 "pgc.l"{ return('*'); } YY_BREAKcase 53:YY_RULE_SETUP#line 583 "pgc.l"{ return('%'); } YY_BREAKcase 54:YY_RULE_SETUP#line 584 "pgc.l"{ return('/'); } YY_BREAKcase 55:YY_RULE_SETUP#line 585 "pgc.l"{ return('+'); } YY_BREAKcase 56:YY_RULE_SETUP#line 586 "pgc.l"{ return('-'); } YY_BREAKcase 57:YY_RULE_SETUP#line 587 "pgc.l"{ return('('); } YY_BREAKcase 58:YY_RULE_SETUP#line 588 "pgc.l"{ return(')'); } YY_BREAKcase 59:YY_RULE_SETUP#line 589 "pgc.l"{ ECHO; } YY_BREAKcase 60:YY_RULE_SETUP#line 590 "pgc.l"{ return('{'); } YY_BREAKcase 61:YY_RULE_SETUP#line 591 "pgc.l"{ return('}'); } YY_BREAKcase 62:YY_RULE_SETUP#line 592 "pgc.l"{ return('['); } YY_BREAKcase 63:YY_RULE_SETUP#line 593 "pgc.l"{ return(']'); } YY_BREAKcase 64:YY_RULE_SETUP#line 594 "pgc.l"{ return('='); } YY_BREAKcase 65:YY_RULE_SETUP#line 595 "pgc.l"{ return S_ANYTHING; } YY_BREAKcase 66:YY_RULE_SETUP#line 596 "pgc.l"{BEGIN(def_ident);} YY_BREAKcase 67:YY_RULE_SETUP#line 597 "pgc.l"{} YY_BREAKcase 68:YY_RULE_SETUP#line 598 "pgc.l"{ old = mm_strdup(yytext); BEGIN(def); llen = 0; *literal = '\0'; } YY_BREAKcase 69:YY_RULE_SETUP#line 604 "pgc.l"/* eat the whitespace */ YY_BREAKcase 70:YY_RULE_SETUP#line 605 "pgc.l"{ struct _defines *ptr, *this; for (ptr = defines; ptr != NULL; ptr = ptr->next) { if (strcmp(old, ptr->old) == 0) { free(ptr->new); /* ptr->new = mm_strdup(scanstr(literal));*/ ptr->new = mm_strdup(literal); } } if (ptr == NULL) { this = (struct _defines *) mm_alloc(sizeof(struct _defines)); /* initial definition */ this->old = old; /* this->new = mm_strdup(scanstr(literal));*/ this->new = mm_strdup(literal); this->next = defines; defines = this; } BEGIN(C); } YY_BREAKcase 71:YY_RULE_SETUP#line 631 "pgc.l"{ if ((llen+yyleng) > (MAX_PARSE_BUFFER - 1)) yyerror("ERROR: define statement parse buffer exceeded"); memcpy(literal+llen, yytext, yyleng+1); llen += yyleng; } YY_BREAKcase 72:YY_RULE_SETUP#line 637 "pgc.l"{ BEGIN(incl); } YY_BREAKcase 73:YY_RULE_SETUP#line 638 "pgc.l"/* eat the whitespace */ YY_BREAKcase 74:YY_RULE_SETUP#line 639 "pgc.l"{ /* got the include file name */ struct _yy_buffer *yb; struct _include_path *ip; char inc_file[PATH_MAX]; yb = mm_alloc(sizeof(struct _yy_buffer)); yb->buffer = YY_CURRENT_BUFFER; yb->lineno = yylineno; yb->filename = input_filename; yb->next = yy_buffer; yy_buffer = yb; if (yytext[strlen(yytext) - 1] == ';') yytext[strlen(yytext) - 1] = '\0'; yyin = NULL; for (ip = include_paths; yyin == NULL && ip != NULL; ip = ip->next) { if (strlen(ip->path) + strlen(yytext) + 3 > PATH_MAX) { fprintf(stderr, "Error: Path %s/%s is too long in line %d, skipping.\n", ip->path, yytext, yylineno); continue; } sprintf (inc_file, "%s/%s", ip->path, yytext); yyin = fopen( inc_file, "r" ); if (!yyin) { if (strcmp(inc_file + strlen(inc_file) - 2, ".h")) { strcat(inc_file, ".h"); yyin = fopen( inc_file, "r" ); } } } if (!yyin) { fprintf(stderr, "Error: Cannot open include file %s in line %d\n", yytext, yylineno); exit(NO_INCLUDE_FILE); } input_filename = mm_strdup(inc_file); yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE )); yylineno = 0; output_line_number(); BEGIN C; } YY_BREAKcase 75:YY_RULE_SETUP#line 689 "pgc.l"{ BEGIN C; } YY_BREAKcase YY_STATE_EOF(INITIAL):case YY_STATE_EOF(C):case YY_STATE_EOF(SQL):case YY_STATE_EOF(incl):case YY_STATE_EOF(def):case YY_STATE_EOF(def_ident):case YY_STATE_EOF(xb):case YY_STATE_EOF(xc):case YY_STATE_EOF(xd):case YY_STATE_EOF(xdc):case YY_STATE_EOF(xh):case YY_STATE_EOF(xm):case YY_STATE_EOF(xq):#line 690 "pgc.l"{ if (yy_buffer == NULL) yyterminate(); else { struct _yy_buffer *yb = yy_buffer; if (yyin != NULL) fclose(yyin); yy_delete_buffer( YY_CURRENT_BUFFER ); yy_switch_to_buffer(yy_buffer->buffer); yylineno = yy_buffer->lineno; free(input_filename); input_filename = yy_buffer->filename; yy_buffer = yy_buffer->next; free(yb); output_line_number(); } } YY_BREAKcase 76:YY_RULE_SETUP#line 712 "pgc.l"ECHO; YY_BREAK#line 1997 "lex.yy.c" 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->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->yy_n_chars; yy_current_buffer->yy_input_file = yyin; yy_current_buffer->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->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 { yy_cp = yy_c_buf_p; 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 * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! yy_did_buffer_switch_on_eof ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state(); yy_cp = yy_c_buf_p; yy_bp = yytext_ptr + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: yy_c_buf_p = &yy_current_buffer->yy_ch_buf[yy_n_chars]; yy_current_state = yy_get_previous_state(); yy_cp = yy_c_buf_p; yy_bp = 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 */ } /* end of scanning one token */ } /* end of yylex *//* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */static int yy_get_next_buffer() { register char *dest = yy_current_buffer->yy_ch_buf; register char *source = yytext_ptr; register int number_to_move, i; int ret_val; if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( yy_current_buffer->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( yy_c_buf_p - 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 { /* We matched some text prior to the
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -