[asterisk-commits] trunk r23758 - /trunk/pbx/ael/ael.flex
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Sun Apr 30 15:56:42 MST 2006
Author: rizzo
Date: Sun Apr 30 17:56:41 2006
New Revision: 23758
URL: http://svn.digium.com/view/asterisk?rev=23758&view=rev
Log:
simplify logic (runtest passed).
Modified:
trunk/pbx/ael/ael.flex
Modified: trunk/pbx/ael/ael.flex
URL: http://svn.digium.com/view/asterisk/trunk/pbx/ael/ael.flex?rev=23758&r1=23757&r2=23758&view=diff
==============================================================================
--- trunk/pbx/ael/ael.flex (original)
+++ trunk/pbx/ael/ael.flex Sun Apr 30 17:56:41 2006
@@ -74,7 +74,6 @@
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 @@
yymore();
} else {
STORE_LOC;
- yylval->str = strdup(yytext);
- if(yyleng > 1 )
- yylval->str[yyleng-1] = '\0'; /* trim trailing ')' */
- BEGIN(0);
- if ( !strcmp(yylval->str,")") ) {
- free(yylval->str);
- yylval->str = 0;
- my_col++; /* XXX why ? */
+ /* we have at least 1 char. If it is a single ')', just return it */
+ if ( !strcmp(yytext, ")") )
return RP;
- } else {
- unput(')');
- return word;
- }
+ yylval->str = strdup(yytext);
+ yylval->str[yyleng-1] = '\0'; /* trim trailing ')' */
+ BEGIN(0);
+ unput(')');
+ my_col--; /* XXX not entirely correct, should go 'back' by 1 char */
+ return word;
}
}
@@ -311,24 +306,15 @@
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 @@
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
parencount = 0;
pbcpos = 0;
- commaout = 0;
pbcpush('(');
c_prevword();
BEGIN(argg);
More information about the asterisk-commits
mailing list