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
This commit is contained in:
Luigi Rizzo
2006-04-30 23:21:49 +00:00
parent 44f43f9eb1
commit db14f6b107

View File

@@ -74,6 +74,7 @@ static void pbcpush(char x);
static int pbcpop(char x); static int pbcpop(char x);
static int parencount = 0; static int parencount = 0;
static int commaout = 0;
/* /*
* current line, column and filename, updated as we read the input. * current line, column and filename, updated as we read the input.
@@ -239,11 +240,10 @@ includes { STORE_POS; return KW_INCLUDES;}
} else { } else {
STORE_LOC; STORE_LOC;
yylval->str = strdup(yytext); yylval->str = strdup(yytext);
yylval->str[yyleng - 1] = '\0'; /* trim trailing ')' */ yylval->str[strlen(yylval->str)-1] = '\0'; /* trim trailing ')' */
unput(')'); unput(')');
/* XXX should do my_col-- as we do in other cases ? */
BEGIN(0); BEGIN(0);
return word; /* note it can be an empty string */ return word;
} }
} }
@@ -290,38 +290,45 @@ includes { STORE_POS; return KW_INCLUDES;}
yymore(); yymore();
} else { } else {
STORE_LOC; 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 = strdup(yytext);
if(yyleng > 1 )
yylval->str[yyleng-1] = '\0'; /* trim trailing ')' */ yylval->str[yyleng-1] = '\0'; /* trim trailing ')' */
BEGIN(0); BEGIN(0);
if ( !strcmp(yylval->str,")") ) {
free(yylval->str);
yylval->str = 0;
my_col++; /* XXX why ? */
return RP;
} else {
unput(')'); unput(')');
my_col--; /* XXX not entirely correct, should go 'back' by 1 char */
return word; return word;
} }
} }
}
<argg>{NOARGG}\, { <argg>{NOARGG}\, {
if( parencount != 0) { /* printf("Folding in a comma!\n"); */ if( parencount != 0) { /* printf("Folding in a comma!\n"); */
yymore(); yymore();
} else { } else {
STORE_LOC; STORE_LOC;
/* we have at least 1 char. if( !commaout ) {
* If it is a single ',', just return it. if( !strcmp(yytext,"," ) ) {
* XXX this means we never return an empty 'word' in this context commaout = 0;
*/ my_col+=1;
if (!strcmp(yytext, "," ) )
return COMMA; return COMMA;
/* otherwise return the string first, then the comma. */ }
yylval->str = strdup(yytext); yylval->str = strdup(yytext);
yylval->str[yyleng-1] = '\0'; /* trim the comma off the string */ /* printf("Got argg2 word %s\n", yylval->str); */
unput(','); unput(',');
my_col--; /* XXX not entirely correct, should go 'back' by 1 char */ commaout = 1;
if (yyleng > 1 )
*(yylval->str+yyleng-1)=0;
return word; return word;
} else {
commaout = 0;
my_col+=1;
return COMMA;
}
} }
} }
@@ -360,7 +367,8 @@ includes { STORE_POS; return KW_INCLUDES;}
<semic>{NOSEMIC}; { <semic>{NOSEMIC}; {
STORE_LOC; STORE_LOC;
yylval->str = strdup(yytext); yylval->str = strdup(yytext);
yylval->str[yyleng-1] = '\0'; if(yyleng > 1)
*(yylval->str+yyleng-1)=0;
unput(';'); unput(';');
BEGIN(0); BEGIN(0);
return word; return word;
@@ -522,6 +530,7 @@ void reset_argcount(yyscan_t yyscanner )
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
parencount = 0; parencount = 0;
pbcpos = 0; pbcpos = 0;
commaout = 0;
pbcpush('('); pbcpush('(');
c_prevword(); c_prevword();
BEGIN(argg); BEGIN(argg);