⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 scan-gram.c

📁 bison 2.0 主要可以用来做语法分析用的
💻 C
📖 第 1 页 / 共 5 页
字号:
#line 454 "scan-gram.l"{    complain_at (*loc, _("unrecognized escape sequence: %s"), quote (yytext));    STRING_GROW;  }	YY_BREAK/*--------------------------------------------.  | Scanning user-code characters and strings.  |  `--------------------------------------------*/case 83:YY_RULE_SETUP#line 466 "scan-gram.l"STRING_GROW;	YY_BREAKcase 84:YY_RULE_SETUP#line 471 "scan-gram.l"STRING_GROW; BEGIN context_state;	YY_BREAKcase 85:YY_RULE_SETUP#line 472 "scan-gram.l"unexpected_newline (token_start, "'"); BEGIN context_state;	YY_BREAKcase YY_STATE_EOF(SC_CHARACTER):#line 473 "scan-gram.l"unexpected_eof (token_start, "'"); BEGIN context_state;	YY_BREAKcase 86:YY_RULE_SETUP#line 478 "scan-gram.l"STRING_GROW; BEGIN context_state;	YY_BREAKcase 87:YY_RULE_SETUP#line 479 "scan-gram.l"unexpected_newline (token_start, "\""); BEGIN context_state;	YY_BREAKcase YY_STATE_EOF(SC_STRING):#line 480 "scan-gram.l"unexpected_eof (token_start, "\""); BEGIN context_state;	YY_BREAK/*---------------------------------------------------.  | Strings, comments etc. can be found in user code.  |  `---------------------------------------------------*/case 88:YY_RULE_SETUP#line 490 "scan-gram.l"{    STRING_GROW;    context_state = YY_START;    token_start = loc->start;    BEGIN SC_CHARACTER;  }	YY_BREAKcase 89:YY_RULE_SETUP#line 496 "scan-gram.l"{    STRING_GROW;    context_state = YY_START;    token_start = loc->start;    BEGIN SC_STRING;  }	YY_BREAKcase 90:YY_RULE_SETUP#line 502 "scan-gram.l"{    STRING_GROW;    context_state = YY_START;    token_start = loc->start;    BEGIN SC_COMMENT;  }	YY_BREAKcase 91:YY_RULE_SETUP#line 508 "scan-gram.l"{    STRING_GROW;    context_state = YY_START;    BEGIN SC_LINE_COMMENT;  }	YY_BREAK/*---------------------------------------------------------------.  | Scanning after %union etc., possibly followed by white space.  |  | For %union only, allow arbitrary C code to appear before the   |  | following brace, as an extension to POSIX.			   |  `---------------------------------------------------------------*/case 92:YY_RULE_SETUP#line 524 "scan-gram.l"{    bool valid = yytext[0] == '{' || token_type == PERCENT_UNION;    scanner_cursor.column -= mbsnwidth (yytext, yyleng, 0);    yyless (0);    if (valid)      {	braces_level = -1;	code_start = loc->start;	BEGIN SC_BRACED_CODE;      }    else      {	complain_at (*loc, _("missing `{' in `%s'"),		     token_name (token_type));	obstack_sgrow (&obstack_for_string, "{}");	STRING_FINISH;	val->chars = last_string;	BEGIN INITIAL;	return token_type;      }  }	YY_BREAKcase YY_STATE_EOF(SC_PRE_CODE):#line 547 "scan-gram.l"unexpected_eof (scanner_cursor, "{}"); BEGIN INITIAL;	YY_BREAK/*---------------------------------------------------------------.  | Scanning some code in braces (%union and actions). The initial |  | "{" is already eaten.                                          |  `---------------------------------------------------------------*/case 93:YY_RULE_SETUP#line 558 "scan-gram.l"STRING_GROW; braces_level++;	YY_BREAKcase 94:YY_RULE_SETUP#line 559 "scan-gram.l"STRING_GROW; braces_level--;	YY_BREAKcase 95:YY_RULE_SETUP#line 560 "scan-gram.l"{    bool outer_brace = --braces_level < 0;    /* As an undocumented Bison extension, append `;' before the last       brace in braced code, so that the user code can omit trailing       `;'.  But do not append `;' if emulating Yacc, since Yacc does       not append one.       FIXME: Bison should warn if a semicolon seems to be necessary       here, and should omit the semicolon if it seems unnecessary       (e.g., after ';', '{', or '}', each followed by comments or       white space).  Such a warning shouldn't depend on --yacc; it       should depend on a new --pedantic option, which would cause       Bison to warn if it detects an extension to POSIX.  --pedantic       should also diagnose other Bison extensions like %yacc.       Perhaps there should also be a GCC-style --pedantic-errors       option, so that such warnings are diagnosed as errors.  */    if (outer_brace && token_type == BRACED_CODE && ! yacc_flag)      obstack_1grow (&obstack_for_string, ';');    obstack_1grow (&obstack_for_string, '}');    if (outer_brace)      {	STRING_FINISH;	rule_length++;	loc->start = code_start;	val->chars = last_string;	BEGIN INITIAL;	return token_type;      }  }	YY_BREAK/* Tokenize `<<%' correctly (as `<<' `%') rather than incorrrectly     (as `<' `<%').  */case 96:YY_RULE_SETUP#line 595 "scan-gram.l"STRING_GROW;	YY_BREAKcase 97:YY_RULE_SETUP#line 597 "scan-gram.l"handle_dollar (token_type, yytext, *loc);	YY_BREAKcase 98:YY_RULE_SETUP#line 598 "scan-gram.l"handle_at (token_type, yytext, *loc);	YY_BREAKcase YY_STATE_EOF(SC_BRACED_CODE):#line 600 "scan-gram.l"unexpected_eof (code_start, "}"); BEGIN INITIAL;	YY_BREAK/*--------------------------------------------------------------.  | Scanning some prologue: from "%{" (already scanned) to "%}".  |  `--------------------------------------------------------------*/case 99:YY_RULE_SETUP#line 610 "scan-gram.l"{    STRING_FINISH;    loc->start = code_start;    val->chars = last_string;    BEGIN INITIAL;    return PROLOGUE;  }	YY_BREAKcase YY_STATE_EOF(SC_PROLOGUE):#line 618 "scan-gram.l"unexpected_eof (code_start, "%}"); BEGIN INITIAL;	YY_BREAK/*---------------------------------------------------------------.  | Scanning the epilogue (everything after the second "%%", which |  | has already been eaten).                                       |  `---------------------------------------------------------------*/case YY_STATE_EOF(SC_EPILOGUE):#line 629 "scan-gram.l"{    STRING_FINISH;    loc->start = code_start;    val->chars = last_string;    BEGIN INITIAL;    return EPILOGUE;  }	YY_BREAK/*-----------------------------------------.  | Escape M4 quoting characters in C code.  |  `-----------------------------------------*/case 100:YY_RULE_SETUP#line 645 "scan-gram.l"obstack_sgrow (&obstack_for_string, "$][");	YY_BREAKcase 101:YY_RULE_SETUP#line 646 "scan-gram.l"obstack_sgrow (&obstack_for_string, "@@");	YY_BREAKcase 102:YY_RULE_SETUP#line 647 "scan-gram.l"obstack_sgrow (&obstack_for_string, "@{");	YY_BREAKcase 103:YY_RULE_SETUP#line 648 "scan-gram.l"obstack_sgrow (&obstack_for_string, "@}");	YY_BREAK/*-----------------------------------------------------.  | By default, grow the string obstack with the input.  |  `-----------------------------------------------------*/case 104:#line 657 "scan-gram.l"case 105:YY_RULE_SETUP#line 657 "scan-gram.l"STRING_GROW;	YY_BREAKcase 106:YY_RULE_SETUP#line 659 "scan-gram.l"YY_FATAL_ERROR( "flex scanner jammed" );	YY_BREAK#line 2050 "scan-gram.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 (

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -