summaryrefslogtreecommitdiff
path: root/pbx/ael
diff options
context:
space:
mode:
authorLuigi Rizzo <rizzo@icir.org>2006-04-30 23:21:49 +0000
committerLuigi Rizzo <rizzo@icir.org>2006-04-30 23:21:49 +0000
commitdb14f6b1077df28061c5b9041bcda5ba8e49a863 (patch)
treedd5b2693ced4cffa593e1db452d5e3fb254e6e8f /pbx/ael
parent44f43f9eb18cf96635f8a529beb958ddd623991b (diff)
revert ael.flex to the last correct version.
For some reason the makefile did not regenerate the ael_lex.c file correctly so i was not testing the changes. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@23781 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'pbx/ael')
-rw-r--r--pbx/ael/ael.flex59
1 files changed, 34 insertions, 25 deletions
diff --git a/pbx/ael/ael.flex b/pbx/ael/ael.flex
index 24a621acf..45cd1e0d4 100644
--- a/pbx/ael/ael.flex
+++ b/pbx/ael/ael.flex
@@ -74,6 +74,7 @@ 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.
@@ -239,11 +240,10 @@ includes { STORE_POS; return KW_INCLUDES;}
} else {
STORE_LOC;
yylval->str = strdup(yytext);
- yylval->str[yyleng - 1] = '\0'; /* trim trailing ')' */
+ yylval->str[strlen(yylval->str)-1] = '\0'; /* trim trailing ')' */
unput(')');
- /* XXX should do my_col-- as we do in other cases ? */
BEGIN(0);
- return word; /* note it can be an empty string */
+ return word;
}
}
@@ -290,18 +290,19 @@ includes { STORE_POS; return KW_INCLUDES;}
yymore();
} else {
STORE_LOC;
- /* we have at least 1 char.
- * If it is a single ')', just return it.
- * XXX this means we never return an empty 'word' in this context
- */
- if ( !strcmp(yytext, ")") )
- return RP;
yylval->str = strdup(yytext);
- yylval->str[yyleng-1] = '\0'; /* trim trailing ')' */
+ if(yyleng > 1 )
+ yylval->str[yyleng-1] = '\0'; /* trim trailing ')' */
BEGIN(0);
- unput(')');
- my_col--; /* XXX not entirely correct, should go 'back' by 1 char */
- return word;
+ if ( !strcmp(yylval->str,")") ) {
+ free(yylval->str);
+ yylval->str = 0;
+ my_col++; /* XXX why ? */
+ return RP;
+ } else {
+ unput(')');
+ return word;
+ }
}
}
@@ -310,18 +311,24 @@ includes { STORE_POS; return KW_INCLUDES;}
yymore();
} else {
STORE_LOC;
- /* we have at least 1 char.
- * If it is a single ',', just return it.
- * XXX this means we never return an empty 'word' in this context
- */
- if (!strcmp(yytext, "," ) )
+ 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;
return COMMA;
- /* otherwise return the string first, then the comma. */
- yylval->str = strdup(yytext);
- yylval->str[yyleng-1] = '\0'; /* trim the comma off the string */
- unput(',');
- my_col--; /* XXX not entirely correct, should go 'back' by 1 char */
- return word;
+ }
}
}
@@ -360,7 +367,8 @@ includes { STORE_POS; return KW_INCLUDES;}
<semic>{NOSEMIC}; {
STORE_LOC;
yylval->str = strdup(yytext);
- yylval->str[yyleng-1] = '\0';
+ if(yyleng > 1)
+ *(yylval->str+yyleng-1)=0;
unput(';');
BEGIN(0);
return word;
@@ -522,6 +530,7 @@ 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);