diff options
author | Luigi Rizzo <rizzo@icir.org> | 2006-04-27 11:20:26 +0000 |
---|---|---|
committer | Luigi Rizzo <rizzo@icir.org> | 2006-04-27 11:20:26 +0000 |
commit | ef8f9a28a3ef222c45814e8efaa9a22e6b1b8c69 (patch) | |
tree | a1b6b04bca223511c768734a0a5ada7a1dd91651 /pbx/ael/ael.flex | |
parent | 53715e59cfbda9d3d244793716e787cc63e9f5ab (diff) |
remove duplicated code
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@22842 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'pbx/ael/ael.flex')
-rw-r--r-- | pbx/ael/ael.flex | 74 |
1 files changed, 24 insertions, 50 deletions
diff --git a/pbx/ael/ael.flex b/pbx/ael/ael.flex index a217652e2..7e8110156 100644 --- a/pbx/ael/ael.flex +++ b/pbx/ael/ael.flex @@ -167,51 +167,24 @@ includes { STORE_POS; return KW_INCLUDES;} } } -<paren>{NOPARENS}\( { +<paren>{NOPARENS}[\(\[\{] { + char c = yytext[yyleng-1]; yylloc->first_line = my_lineno; yylloc->first_column=my_col; - parencount++; - pbcpush('('); - yymore(); - } - -<paren>{NOPARENS}\[ { - yylloc->first_line = my_lineno; - yylloc->first_column=my_col; - pbcpush('['); - yymore(); - } - -<paren>{NOPARENS}\] { - yylloc->first_line = my_lineno; - yylloc->first_column=my_col; - if ( pbcpop(']') ) { /* error */ - pbcwhere(yytext, &my_lineno, &my_col); - ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ']' in expression!\n", - my_file, my_lineno, my_col); - BEGIN(0); - yylloc->last_line = my_lineno; - yylloc->last_column = my_col; - yylval->str = strdup(yytext); - return word; - } - yymore(); - } - -<paren>{NOPARENS}\{ { - yylloc->first_line = my_lineno; - yylloc->first_column=my_col; - pbcpush('{'); + if (c == '(') + parencount++; + pbcpush(c); yymore(); } -<paren>{NOPARENS}\} { +<paren>{NOPARENS}[\]\}] { + char c = yytext[yyleng-1]; yylloc->first_line = my_lineno; yylloc->first_column=my_col; - if ( pbcpop('}') ) { /* error */ + if ( pbcpop(c)) { /* error */ pbcwhere(yytext, &my_lineno, &my_col); - ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '}' in expression!\n", - my_file, my_lineno, my_col); + ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '%c' in expression!\n", + my_file, my_lineno, my_col, c); BEGIN(0); yylloc->last_line = my_lineno; yylloc->last_column = my_col; @@ -221,9 +194,6 @@ includes { STORE_POS; return KW_INCLUDES;} yymore(); } - - - <argg>{NOARGG}\( { /* printf("ARGG:%s\n",yytext); */ /* printf("GOT AN LP!!!\n"); */ @@ -539,18 +509,22 @@ static int pbcpop(char x) static int c_prevword(void) { char *c = prev_word; - int ret = 0; - while ( c && *c ) { + if (c == NULL) + return 0; + while ( *c ) { switch (*c) { - case '{': pbcpush('{');break; - case '}': ret = pbcpop('}');break; - case '[':pbcpush('[');break; - case ']':ret = pbcpop(']');break; - case '(':pbcpush('(');break; - case ')':ret = pbcpop(')'); break; + case '{': + case '[': + case '(': + pbcpush(*c); + break; + case '}': + case ']': + case ')': + if (pbcpop(*c)) + return 1; + break; } - if( ret ) - return 1; c++; } return 0; |