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

📄 ael_lex.c

📁 asterisk 是一个很有知名度开源软件
💻 C
📖 第 1 页 / 共 5 页
字号:
#include "ael/ael.tab.h"#include "asterisk/ael_structs.h"/* * A stack to keep track of matching brackets ( [ { } ] ) */static char pbcstack[400];	/* XXX missing size checks */static int pbcpos = 0;static void pbcpush(char x);static int pbcpop(char x);static int parencount = 0;/* * A similar stack to keep track of matching brackets ( [ { } ] ) in word tokens surrounded by ${ ... } */static char pbcstack2[400];	/* XXX missing size checks */static int pbcpos2 = 0;static void pbcpush2(char x);static int pbcpop2(char x);static int parencount2 = 0;/* * A similar stack to keep track of matching brackets ( [ { } ] ) in word tokens surrounded by $[ ... ] */static char pbcstack3[400];	/* XXX missing size checks */static int pbcpos3 = 0;static void pbcpush3(char x);static int pbcpop3(char x);static int parencount3 = 0;/* * current line, column and filename, updated as we read the input. */static int my_lineno = 1;	/* current line in the source */static int my_col = 1;		/* current column in the source */char *my_file = 0;		/* used also in the bison code */char *prev_word;		/* XXX document it */#define MAX_INCLUDE_DEPTH 50/* * flex is not too smart, and generates global functions * without prototypes so the compiler may complain. * To avoid that, we declare the prototypes here, * even though these functions are not used. */int ael_yyget_column  (yyscan_t yyscanner);void ael_yyset_column (int  column_no , yyscan_t yyscanner);int ael_yyparse (struct parse_io *);/* * A stack to process include files. * As we switch into the new file we need to store the previous * state to restore it later. */struct stackelement {	char *fname;	int lineno;	int colno;	glob_t globbuf;        /* the current globbuf */	int globbuf_pos;   /* where we are in the current globbuf */	YY_BUFFER_STATE bufstate;};static struct stackelement  include_stack[MAX_INCLUDE_DEPTH];static int include_stack_index = 0;static void setup_filestack(char *fnamebuf, int fnamebuf_siz, glob_t *globbuf, int globpos, yyscan_t xscan, int create);/* * if we use the @n feature of bison, we must supply the start/end * location of tokens in the structure pointed by yylloc. * Simple tokens are just assumed to be on the same line, so * the line number is constant, and the column is incremented * by the length of the token. */#ifdef FLEX_BETA	/* set for 2.5.33 *//* compute the total number of lines and columns in the text * passed as argument. */static void pbcwhere(const char *text, int *line, int *col ){	int loc_line = *line;	int loc_col = *col;	char c;	while ( (c = *text++) ) {		if ( c == '\t' ) {			loc_col += 8 - (loc_col % 8);		} else if ( c == '\n' ) {			loc_line++;			loc_col = 1;		} else			loc_col++;	}	*line = loc_line;	*col = loc_col;}#define	STORE_POS do {							\		yylloc->first_line = yylloc->last_line = my_lineno;	\		yylloc->first_column=my_col;				\		yylloc->last_column=my_col+yyleng-1;			\		my_col+=yyleng;						\	} while (0)#define	STORE_LOC do {					\		yylloc->first_line = my_lineno;		\		yylloc->first_column=my_col;		\		pbcwhere(yytext, &my_lineno, &my_col);	\		yylloc->last_line = my_lineno;		\		yylloc->last_column = my_col - 1;	\	} while (0)#else#define	STORE_POS#define	STORE_LOC#endif#line 955 "ael_lex.c"#define INITIAL 0#define paren 1#define semic 2#define argg 3#define comment 4#define curlystate 5#define wordstate 6#define brackstate 7#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. */#include <unistd.h>#endif#ifndef YY_EXTRA_TYPE#define YY_EXTRA_TYPE void *#endif/* Holds the entire state of the reentrant scanner. */struct yyguts_t    {    /* User-defined. Not touched by flex. */    YY_EXTRA_TYPE yyextra_r;    /* The rest are the same as the globals declared in the non-reentrant scanner. */    FILE *yyin_r, *yyout_r;    size_t yy_buffer_stack_top; /**< index of top of stack. */    size_t yy_buffer_stack_max; /**< capacity of stack. */    YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */    char yy_hold_char;    int yy_n_chars;    int yyleng_r;    char *yy_c_buf_p;    int yy_init;    int yy_start;    int yy_did_buffer_switch_on_eof;    int yy_start_stack_ptr;    int yy_start_stack_depth;    int *yy_start_stack;    yy_state_type yy_last_accepting_state;    char* yy_last_accepting_cpos;    int yylineno_r;    int yy_flex_debug_r;    char *yytext_r;    int yy_more_flag;    int yy_more_len;    YYSTYPE * yylval_r;    YYLTYPE * yylloc_r;    }; /* end struct yyguts_t */static int yy_init_globals (yyscan_t yyscanner );    /* This must go here because YYSTYPE and YYLTYPE are included     * from bison output in section 1.*/    #    define yylval yyg->yylval_r        #    define yylloc yyg->yylloc_r    int ael_yylex_init (yyscan_t* scanner);int ael_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);/* Accessor methods to globals.   These are made visible to non-reentrant scanners for convenience. */int ael_yylex_destroy (yyscan_t yyscanner );int ael_yyget_debug (yyscan_t yyscanner );void ael_yyset_debug (int debug_flag ,yyscan_t yyscanner );YY_EXTRA_TYPE ael_yyget_extra (yyscan_t yyscanner );void ael_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );FILE *ael_yyget_in (yyscan_t yyscanner );void ael_yyset_in  (FILE * in_str ,yyscan_t yyscanner );FILE *ael_yyget_out (yyscan_t yyscanner );void ael_yyset_out  (FILE * out_str ,yyscan_t yyscanner );int ael_yyget_leng (yyscan_t yyscanner );char *ael_yyget_text (yyscan_t yyscanner );int ael_yyget_lineno (yyscan_t yyscanner );void ael_yyset_lineno (int line_number ,yyscan_t yyscanner );YYSTYPE * ael_yyget_lval (yyscan_t yyscanner );void ael_yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );       YYLTYPE *ael_yyget_lloc (yyscan_t yyscanner );            void ael_yyset_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner );    /* Macros after this point can all be overridden by user definitions in * section 1. */#ifndef YY_SKIP_YYWRAP#ifdef __cplusplusextern "C" int ael_yywrap (yyscan_t yyscanner );#elseextern int ael_yywrap (yyscan_t yyscanner );#endif#endif    static void yyunput (int c,char *buf_ptr  ,yyscan_t yyscanner);    #ifndef yytext_ptrstatic void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);#endif#ifdef YY_NEED_STRLENstatic int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);#endif#ifndef YY_NO_INPUT#ifdef __cplusplusstatic int yyinput (yyscan_t yyscanner );#elsestatic int input (yyscan_t yyscanner );#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 do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)#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 , yyscanner)#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 ael_yylex \               (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner);#define YY_DECL int ael_yylex \               (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)#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 \	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;    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;#line 217 "ael.flex"#line 1206 "ael_lex.c"    yylval = yylval_param;    yylloc = yylloc_param;	if ( !yyg->yy_init )		{		yyg->yy_init = 1;#ifdef YY_USER_INIT		YY_USER_INIT;#endif		if ( ! yyg->yy_start )			yyg->yy_start = 1;	/* first start state */		if ( ! yyin )			yyin = stdin;		if ( ! yyout )			yyout = stdout;		if ( ! YY_CURRENT_BUFFER ) {			ael_yyensure_buffer_stack (yyscanner);			YY_CURRENT_BUFFER_LVALUE =				ael_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);		}		ael_yy_load_buffer_state(yyscanner );		}	while ( 1 )		/* loops until end-of-file is reached */		{		yyg->yy_more_len = 0;		if ( yyg->yy_more_flag )			{			yyg->yy_more_len = yyg->yy_c_buf_p - yyg->yytext_ptr;			yyg->yy_more_flag = 0;			}		yy_cp = yyg->yy_c_buf_p;		/* Support of yytext. */		*yy_cp = yyg->yy_hold_char;		/* yy_bp points to the position in yy_ch_buf of the start of		 * the current run.		 */		yy_bp = yy_cp;

⌨️ 快捷键说明

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