aboutsummaryrefslogtreecommitdiffstats
path: root/pbx/ael
diff options
context:
space:
mode:
authorrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2006-04-30 23:04:58 +0000
committerrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2006-04-30 23:04:58 +0000
commit1559c47a4f39211c747413d9ff817eb40616ac7d (patch)
treef68a3861f4aaa16422d8d200f66bdc4fd1fb0549 /pbx/ael
parent276acd289033c056fb35f3ae5d898e4f569f6c0a (diff)
another small set of simplifications
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@23780 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx/ael')
-rw-r--r--pbx/ael/ael.flex22
1 files changed, 14 insertions, 8 deletions
diff --git a/pbx/ael/ael.flex b/pbx/ael/ael.flex
index 5d360141e..24a621acf 100644
--- a/pbx/ael/ael.flex
+++ b/pbx/ael/ael.flex
@@ -239,10 +239,11 @@ includes { STORE_POS; return KW_INCLUDES;}
} else {
STORE_LOC;
yylval->str = strdup(yytext);
- yylval->str[strlen(yylval->str)-1] = '\0'; /* trim trailing ')' */
+ yylval->str[yyleng - 1] = '\0'; /* trim trailing ')' */
unput(')');
+ /* XXX should do my_col-- as we do in other cases ? */
BEGIN(0);
- return word;
+ return word; /* note it can be an empty string */
}
}
@@ -289,7 +290,10 @@ includes { STORE_POS; return KW_INCLUDES;}
yymore();
} else {
STORE_LOC;
- /* we have at least 1 char. If it is a single ')', just return it */
+ /* 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);
@@ -306,14 +310,17 @@ includes { STORE_POS; return KW_INCLUDES;}
yymore();
} else {
STORE_LOC;
- /* we have at least 1 char. If it is a single comma, just return it */
+ /* 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 COMMA;
- yylval->str = strdup(yytext);
/* 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 */
- yylval->str[yyleng-1] = '\0'; /* trim the comma off the string */
return word;
}
}
@@ -353,8 +360,7 @@ includes { STORE_POS; return KW_INCLUDES;}
<semic>{NOSEMIC}; {
STORE_LOC;
yylval->str = strdup(yytext);
- if(yyleng > 1)
- *(yylval->str+yyleng-1)=0;
+ yylval->str[yyleng-1] = '\0';
unput(';');
BEGIN(0);
return word;