📄 ael_lex.c
字号:
YY_BREAKcase 16:YY_RULE_SETUP#line 190 "ael.flex"{ STORE_POS; return KW_MACRO;}; YY_BREAKcase 17:YY_RULE_SETUP#line 191 "ael.flex"{ STORE_POS; return KW_GLOBALS;} YY_BREAKcase 18:YY_RULE_SETUP#line 192 "ael.flex"{ STORE_POS; return KW_IGNOREPAT;} YY_BREAKcase 19:YY_RULE_SETUP#line 193 "ael.flex"{ STORE_POS; return KW_SWITCH;} YY_BREAKcase 20:YY_RULE_SETUP#line 194 "ael.flex"{ STORE_POS; return KW_IF;} YY_BREAKcase 21:YY_RULE_SETUP#line 195 "ael.flex"{ STORE_POS; return KW_IFTIME;} YY_BREAKcase 22:YY_RULE_SETUP#line 196 "ael.flex"{ STORE_POS; return KW_RANDOM;} YY_BREAKcase 23:YY_RULE_SETUP#line 197 "ael.flex"{ STORE_POS; return KW_REGEXTEN;} YY_BREAKcase 24:YY_RULE_SETUP#line 198 "ael.flex"{ STORE_POS; return KW_HINT;} YY_BREAKcase 25:YY_RULE_SETUP#line 199 "ael.flex"{ STORE_POS; return KW_ELSE;} YY_BREAKcase 26:YY_RULE_SETUP#line 200 "ael.flex"{ STORE_POS; return KW_GOTO;} YY_BREAKcase 27:YY_RULE_SETUP#line 201 "ael.flex"{ STORE_POS; return KW_JUMP;} YY_BREAKcase 28:YY_RULE_SETUP#line 202 "ael.flex"{ STORE_POS; return KW_RETURN;} YY_BREAKcase 29:YY_RULE_SETUP#line 203 "ael.flex"{ STORE_POS; return KW_BREAK;} YY_BREAKcase 30:YY_RULE_SETUP#line 204 "ael.flex"{ STORE_POS; return KW_CONTINUE;} YY_BREAKcase 31:YY_RULE_SETUP#line 205 "ael.flex"{ STORE_POS; return KW_FOR;} YY_BREAKcase 32:YY_RULE_SETUP#line 206 "ael.flex"{ STORE_POS; return KW_WHILE;} YY_BREAKcase 33:YY_RULE_SETUP#line 207 "ael.flex"{ STORE_POS; return KW_CASE;} YY_BREAKcase 34:YY_RULE_SETUP#line 208 "ael.flex"{ STORE_POS; return KW_DEFAULT;} YY_BREAKcase 35:YY_RULE_SETUP#line 209 "ael.flex"{ STORE_POS; return KW_PATTERN;} YY_BREAKcase 36:YY_RULE_SETUP#line 210 "ael.flex"{ STORE_POS; return KW_CATCH;} YY_BREAKcase 37:YY_RULE_SETUP#line 211 "ael.flex"{ STORE_POS; return KW_SWITCHES;} YY_BREAKcase 38:YY_RULE_SETUP#line 212 "ael.flex"{ STORE_POS; return KW_ESWITCHES;} YY_BREAKcase 39:YY_RULE_SETUP#line 213 "ael.flex"{ STORE_POS; return KW_INCLUDES;} YY_BREAKcase 40:YY_RULE_SETUP#line 214 "ael.flex"{ BEGIN(comment); my_col += 2; } YY_BREAKcase 41:YY_RULE_SETUP#line 216 "ael.flex"{ my_col += yyleng; } YY_BREAKcase 42:/* rule 42 can match eol */YY_RULE_SETUP#line 217 "ael.flex"{ ++my_lineno; my_col=1;} YY_BREAKcase 43:YY_RULE_SETUP#line 218 "ael.flex"{ my_col += yyleng; } YY_BREAKcase 44:/* rule 44 can match eol */YY_RULE_SETUP#line 219 "ael.flex"{ ++my_lineno; my_col=1;} YY_BREAKcase 45:YY_RULE_SETUP#line 220 "ael.flex"{ my_col += 2; BEGIN(INITIAL); } YY_BREAKcase 46:/* rule 46 can match eol */YY_RULE_SETUP#line 222 "ael.flex"{ my_lineno++; my_col = 1; } YY_BREAKcase 47:YY_RULE_SETUP#line 223 "ael.flex"{ my_col += yyleng; } YY_BREAKcase 48:YY_RULE_SETUP#line 224 "ael.flex"{ my_col += (yyleng*8)-(my_col%8); } YY_BREAKcase 49:YY_RULE_SETUP#line 226 "ael.flex"{ STORE_POS; yylval->str = strdup(yytext); prev_word = yylval->str; return word; } YY_BREAK/* * context used for arguments of if_head, random_head, switch_head, * for (last statement), while (XXX why not iftime_head ?). * End with the matching parentheses. * A comma at the top level is valid here, unlike in argg where it * is an argument separator so it must be returned as a token. */case 50:/* rule 50 can match eol */YY_RULE_SETUP#line 242 "ael.flex"{ if ( pbcpop(')') ) { /* error */ STORE_LOC; ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression: %s !\n", my_file, my_lineno, my_col, yytext); BEGIN(0); yylval->str = strdup(yytext); prev_word = 0; return word; } parencount--; if ( parencount >= 0) { yymore(); } else { STORE_LOC; yylval->str = strdup(yytext); yylval->str[yyleng-1] = '\0'; /* trim trailing ')' */ unput(')'); BEGIN(0); return word; } } YY_BREAKcase 51:/* rule 51 can match eol */YY_RULE_SETUP#line 264 "ael.flex"{ char c = yytext[yyleng-1]; if (c == '(') parencount++; pbcpush(c); yymore(); } YY_BREAKcase 52:/* rule 52 can match eol */YY_RULE_SETUP#line 272 "ael.flex"{ char c = yytext[yyleng-1]; if ( pbcpop(c)) { /* error */ STORE_LOC; ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '%c' in expression!\n", my_file, my_lineno, my_col, c); BEGIN(0); yylval->str = strdup(yytext); return word; } yymore(); } YY_BREAK/* * handlers for arguments to a macro or application calls. * We enter this context when we find the initial '(' and * stay here until we close all matching parentheses, * and find the comma (argument separator) or the closing ')' * of the (external) call, which happens when parencount == 0 * before the decrement. */case 53:/* rule 53 can match eol */YY_RULE_SETUP#line 294 "ael.flex"{ char c = yytext[yyleng-1]; if (c == '(') parencount++; pbcpush(c); yymore(); } YY_BREAKcase 54:/* rule 54 can match eol */YY_RULE_SETUP#line 302 "ael.flex"{ if ( pbcpop(')') ) { /* error */ STORE_LOC; ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression!\n", my_file, my_lineno, my_col); BEGIN(0); yylval->str = strdup(yytext); return word; } parencount--; if( parencount >= 0){ yymore(); } else { STORE_LOC; BEGIN(0); if ( !strcmp(yytext, ")") ) return RP; yylval->str = strdup(yytext); yylval->str[yyleng-1] = '\0'; /* trim trailing ')' */ unput(')'); return word; } } YY_BREAKcase 55:/* rule 55 can match eol */YY_RULE_SETUP#line 326 "ael.flex"{ if( parencount != 0) { /* printf("Folding in a comma!\n"); */ yymore(); } else { STORE_LOC; if( !strcmp(yytext,"," ) ) return COMMA; yylval->str = strdup(yytext); yylval->str[yyleng-1] = '\0'; unput(','); return word; } } YY_BREAKcase 56:/* rule 56 can match eol */YY_RULE_SETUP#line 340 "ael.flex"{ char c = yytext[yyleng-1]; if ( pbcpop(c) ) { /* error */ STORE_LOC; ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '%c' in expression!\n", my_file, my_lineno, my_col, c); BEGIN(0); yylval->str = strdup(yytext); return word; } yymore(); } YY_BREAK/* * context used to find tokens in the right hand side of assignments, * or in the first and second operand of a 'for'. As above, match * commas and use ';' as a separator (hence return it as a separate token). */case 57:/* rule 57 can match eol */YY_RULE_SETUP#line 357 "ael.flex"{ char c = yytext[yyleng-1]; yymore(); pbcpush(c); } YY_BREAKcase 58:/* rule 58 can match eol */YY_RULE_SETUP#line 363 "ael.flex"{ char c = yytext[yyleng-1]; if ( pbcpop(c) ) { /* error */ STORE_LOC; ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '%c' in expression!\n", my_file, my_lineno, my_col, c); BEGIN(0); yylval->str = strdup(yytext); return word; } yymore(); } YY_BREAKcase 59:/* rule 59 can match eol */YY_RULE_SETUP#line 375 "ael.flex"{ STORE_LOC; yylval->str = strdup(yytext); yylval->str[yyleng-1] = '\0'; unput(';'); BEGIN(0); return word; } YY_BREAKcase 60:/* rule 60 can match eol */YY_RULE_SETUP#line 384 "ael.flex"{ FILE *in1; char fnamebuf[1024],*p1,*p2; int error = 1; /* don't use the file if set */ p1 = strchr(yytext,'"'); p2 = strrchr(yytext,'"'); if ( include_stack_index >= MAX_INCLUDE_DEPTH ) { ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Includes nested too deeply! Wow!!! How did you do that?\n", my_file, my_lineno, my_col); } else if ( (int)(p2-p1) > sizeof(fnamebuf) - 1 ) { ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Filename is incredibly way too long (%d chars!). Inclusion ignored!\n", my_file, my_lineno, my_col, yyleng - 10); } else { int i; strncpy(fnamebuf, p1, p2-p1); fnamebuf[p2-p1] = 0; for (i=0; i<include_stack_index; i++) { if ( !strcmp(fnamebuf,include_stack[i].fname )) { ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Nice Try!!! But %s has already been included (perhaps by another file), and would cause an infinite loop of file inclusions!!! Include directive ignored\n", my_file, my_lineno, my_col, fnamebuf); break; } } if (i == include_stack_index) error = 0; /* we can use this file */ } if ( !error ) { /* valid file name */ *p2 = 0; /* relative vs. absolute */ if (*(p1+1) != '/') snprintf(fnamebuf, sizeof(fnamebuf), "%s/%s", ast_config_AST_CONFIG_DIR, p1 + 1); else#if defined(STANDALONE) || defined(LOW_MEMORY) || defined(STANDALONE_AEL) strncpy(fnamebuf, p1 + 1, sizeof(fnamebuf) - 1);#else ast_copy_string(fnamebuf, p1 + 1, sizeof(fnamebuf));#endif in1 = fopen( fnamebuf, "r" ); if ( ! in1 ) { ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Couldn't find the include file: %s; ignoring the Include directive!\n", my_file, my_lineno, my_col, fnamebuf); } else { char *buffer; struct stat stats; stat(fnamebuf, &stats); buffer = (char*)malloc(stats.st_size+1); fread(buffer, 1, stats.st_size, in1); buffer[stats.st_size] = 0; ast_log(LOG_NOTICE," --Read in included file %s, %d chars\n",fnamebuf, (int)stats.st_size); fclose(in1); include_stack[include_stack_index].fname = my_file; my_file = strdup(fnamebuf); include_stack[include_stack_index].lineno = my_lineno; include_stack[include_stack_index].colno = my_col+yyleng; include_stack[include_stack_index++].bufstate = YY_CURRENT_BUFFER; ael_yy_switch_to_buffer(ael_yy_scan_string (buffer ,yyscanner),yyscanner); free(buffer); my_lineno = 1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -