diff options
author | rizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-04-30 22:56:41 +0000 |
---|---|---|
committer | rizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-04-30 22:56:41 +0000 |
commit | eb6ab4720c4cedc875949a1db619b2bd7c1db133 (patch) | |
tree | dc94f88ed66f4389162476455b6c9d69c093d8d3 /pbx | |
parent | d58d0a1f88faba5ffc6a61aabc68203ede767b14 (diff) |
simplify logic (runtest passed).
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@23758 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx')
-rw-r--r-- | pbx/ael/ael.flex | 45 |
1 files changed, 15 insertions, 30 deletions
diff --git a/pbx/ael/ael.flex b/pbx/ael/ael.flex index 45cd1e0d4..5d360141e 100644 --- a/pbx/ael/ael.flex +++ b/pbx/ael/ael.flex @@ -74,7 +74,6 @@ static void pbcpush(char x); static int pbcpop(char x); static int parencount = 0; -static int commaout = 0; /* * current line, column and filename, updated as we read the input. @@ -290,19 +289,15 @@ includes { STORE_POS; return KW_INCLUDES;} yymore(); } else { STORE_LOC; + /* we have at least 1 char. If it is a single ')', just return it */ + if ( !strcmp(yytext, ")") ) + return RP; yylval->str = strdup(yytext); - if(yyleng > 1 ) - yylval->str[yyleng-1] = '\0'; /* trim trailing ')' */ + yylval->str[yyleng-1] = '\0'; /* trim trailing ')' */ BEGIN(0); - if ( !strcmp(yylval->str,")") ) { - free(yylval->str); - yylval->str = 0; - my_col++; /* XXX why ? */ - return RP; - } else { - unput(')'); - return word; - } + unput(')'); + my_col--; /* XXX not entirely correct, should go 'back' by 1 char */ + return word; } } @@ -311,24 +306,15 @@ includes { STORE_POS; return KW_INCLUDES;} yymore(); } else { STORE_LOC; - if( !commaout ) { - if( !strcmp(yytext,"," ) ) { - commaout = 0; - my_col+=1; - return COMMA; - } - yylval->str = strdup(yytext); - /* printf("Got argg2 word %s\n", yylval->str); */ - unput(','); - commaout = 1; - if (yyleng > 1 ) - *(yylval->str+yyleng-1)=0; - return word; - } else { - commaout = 0; - my_col+=1; + /* we have at least 1 char. If it is a single comma, just return it */ + if (!strcmp(yytext, "," ) ) return COMMA; - } + yylval->str = strdup(yytext); + /* otherwise return the string first, then the comma. */ + unput(','); + my_col--; /* XXX not entirely correct, should go 'back' by 1 char */ + yylval->str[yyleng-1] = '\0'; /* trim the comma off the string */ + return word; } } @@ -530,7 +516,6 @@ void reset_argcount(yyscan_t yyscanner ) struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; parencount = 0; pbcpos = 0; - commaout = 0; pbcpush('('); c_prevword(); BEGIN(argg); |