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
1 changed files with 34 additions and 25 deletions

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,18 +290,19 @@ 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);
yylval->str[yyleng-1] = '\0'; /* trim trailing ')' */ if(yyleng > 1 )
yylval->str[yyleng-1] = '\0'; /* trim trailing ')' */
BEGIN(0); BEGIN(0);
unput(')'); if ( !strcmp(yylval->str,")") ) {
my_col--; /* XXX not entirely correct, should go 'back' by 1 char */ free(yylval->str);
return word; yylval->str = 0;
my_col++; /* XXX why ? */
return RP;
} else {
unput(')');
return word;
}
} }
} }
@ -310,18 +311,24 @@ includes { STORE_POS; return KW_INCLUDES;}
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;
}
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; 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}; { <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);