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

📄 scan-skel.c

📁 GNU的词法/语法分析器bison源码
💻 C
📖 第 1 页 / 共 4 页
字号:
        4,    4,    4,    8,   57,    8,   30,   30,   30,   32,       32,   32,    3,   57,   57,   57,   57,   57,   57,   57,       57,   57,   57,   57,   57,   57,   57,   57,   57,   57,       57,   57,   57,   57,   57    } ;static yyconst flex_int16_t yy_chk[146] =    {   0,       59,    1,    2,    1,    2,    6,   22,    8,   32,    0,       15,   16,   16,   22,   17,   18,    6,   17,   15,   21,       18,   14,    6,    6,    8,    8,   10,   19,   21,   20,       19,   10,   20,   23,   10,   49,    3,   49,   24,   27,       23,   27,   10,   10,   10,   13,   24,   27,   29,   29,       33,   34,   13,   33,   29,   35,   34,   37,    0,   36,       35,   37,   13,   13,   28,   36,   28,   38,   39,   40,       41,   39,   40,   42,   38,   43,   41,   47,    0,   42,       44,   43,   47,   28,   28,   30,   44,   30,   45,   46,       48,   45,   46,    0,   50,   48,   50,   51,   52,   53,       51,   52,   54,    0,   30,   30,   53,    0,    0,   54,       58,   58,   58,   60,    0,   60,   61,   61,   61,   62,       62,   62,   57,   57,   57,   57,   57,   57,   57,   57,       57,   57,   57,   57,   57,   57,   57,   57,   57,   57,       57,   57,   57,   57,   57    } ;static yy_state_type yy_last_accepting_state;static char *yy_last_accepting_cpos;extern int skel__flex_debug;int skel__flex_debug = 1;static yyconst flex_int16_t yy_rule_linenum[12] =    {   0,       47,   71,   72,   73,   75,   76,   77,   78,   81,   82,       83    } ;/* 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 *skel_text;#line 1 "scan-skel.l"/* Scan Bison Skeletons.                                       -*- C -*-   Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.   This file is part of Bison, the GNU Compiler Compiler.   Bison is free software; you can redistribute it and/or modify it   under the terms of the GNU General Public License as published by   the Free Software Foundation; either version 2, or (at your option)   any later version.   Bison is distributed in the hope that it will be useful, but   WITHOUT ANY WARRANTY; without even the implied warranty of   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU   General Public License for more details.   You should have received a copy of the GNU General Public License   along with Bison; see the file COPYING.  If not, write to the Free   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA   02110-1301, USA.  */#line 26 "scan-skel.l"#include "system.h"#include <error.h>#include <quotearg.h>#include "complain.h"#include "getargs.h"#include "files.h"#include "scan-skel.h"#define QPUTS(String) \   fputs (quotearg_style (c_quoting_style, (String)), skel_out)#line 608 "scan-skel.c"#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 skel_wrap (void );#elseextern int skel_wrap (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( skel_text, skel_leng, 1, skel_out )/* %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( skel_in )) != EOF && c != '\n'; ++n ) \			buf[n] = (char) c; \		if ( c == '\n' ) \			buf[n++] = (char) c; \		if ( c == EOF && ferror( skel_in ) ) \			YY_FATAL_ERROR( "input in flex scanner failed" ); \		result = n; \		} \	else \		{ \		errno=0; \		while ( (result = fread(buf, 1, max_size, skel_in))==0 && ferror(skel_in)) \			{ \			if( errno != EINTR) \				{ \				YY_FATAL_ERROR( "input in flex scanner failed" ); \				break; \				} \			errno=0; \			clearerr(skel_in); \			} \		}\\/* %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 skel_lex (void);#define YY_DECL int skel_lex (void)/* %endif *//* %if-c++-only C++ definition *//* %endif */#endif /* !YY_DECL *//* Code executed at the beginning of each rule, after skel_text and skel_leng * 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 40 "scan-skel.l"  int lineno IF_LINT (= 0);  char *outname = NULL;#line 821 "scan-skel.c"	if ( (yy_init) )		{		(yy_init) = 0;#ifdef YY_USER_INIT		YY_USER_INIT;#endif		if ( ! (yy_start) )			(yy_start) = 1;	/* first start state */		if ( ! skel_in )/* %if-c-only */			skel_in = stdin;/* %endif *//* %if-c++-only *//* %endif */		if ( ! skel_out )/* %if-c-only */			skel_out = stdout;/* %endif *//* %if-c++-only *//* %endif */		if ( ! YY_CURRENT_BUFFER ) {			skel_ensure_buffer_stack ();			YY_CURRENT_BUFFER_LVALUE =				skel__create_buffer(skel_in,YY_BUF_SIZE );		}		skel__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 skel_text. */		*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 >= 58 )					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 != 57 );		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 skel_lineno update goes here */do_action:	/* This label is used only to access EOF actions. *//* %% [12.0] debug code goes here */		if ( skel__flex_debug )			{			if ( yy_act == 0 )				fprintf( stderr, "--scanner backing up\n" );			else if ( yy_act < 12 )				fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n",				         (long)yy_rule_linenum[yy_act], skel_text );			else if ( yy_act == 12 )				fprintf( stderr, "--accepting default rule (\"%s\")\n",				         skel_text );			else if ( yy_act == 13 )				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:/* rule 1 can match eol */YY_RULE_SETUP#line 47 "scan-skel.l"{  char const *file_name = skel_text + sizeof "@output " - 1;  skel_text[skel_leng - 1] = '\0';  if (*file_name == '@')    {      if (strcmp (file_name, "@output_header_name@") == 0)	file_name = spec_defines_file;      else if (strcmp (file_name, "@output_parser_name@") == 0)	file_name = parser_file_name;      else	fatal ("invalid token in skeleton: %s", skel_text);    }  if (outname)    {      free (outname);      xfclose (skel_out);    }  outname = xstrdup (file_name);  skel_out = xfopen (outname, "w");  lineno = 1;}	YY_BREAKcase 2:YY_RULE_SETUP#line 71 "scan-skel.l"fputc ('@', skel_out);	YY_BREAKcase 3:YY_RULE_SETUP#line 72 "scan-skel.l"fputc ('[', skel_out);	YY_BREAKcase 4:YY_RULE_SETUP#line 73 "scan-skel.l"fputc (']', skel_out);	YY_BREAKcase 5:YY_RULE_SETUP#line 75 "scan-skel.l"fprintf (skel_out, "%d", lineno + 1);	YY_BREAKcase 6:YY_RULE_SETUP#line 76 "scan-skel.l"QPUTS (outname);	YY_BREAKcase 7:YY_RULE_SETUP#line 77 "scan-skel.l"QPUTS (parser_file_name);	YY_BREAKcase 8:YY_RULE_SETUP#line 78 "scan-skel.l"QPUTS (spec_defines_file);	YY_BREAK/* This pattern must not match more than the previous @ patterns. */case 9:YY_RULE_SETUP#line 81 "scan-skel.l"fatal ("invalid @ in skeleton: %s", skel_text);	YY_BREAKcase 10:/* rule 10 can match eol */YY_RULE_SETUP#line 82 "scan-skel.l"lineno++; ECHO;	YY_BREAKcase 11:YY_RULE_SETUP#line 83 "scan-skel.l"ECHO;	YY_BREAKcase YY_STATE_EOF(INITIAL):#line 85 "scan-skel.l"{  if (outname)    {      free (outname);      xfclose (skel_out);    }  return EOF;}	YY_BREAKcase 12:YY_RULE_SETUP#line 93 "scan-skel.l"YY_FATAL_ERROR( "flex scanner jammed" );	YY_BREAK#line 1027 "scan-skel.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_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 skel_in at a new source and called			 * skel_lex().  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 = skel_in;			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;

⌨️ 快捷键说明

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