dect
/
asterisk
Archived
13
0
Fork 0

normalize and simplify the code for keeping track of line and column number.

git-svn-id: http://svn.digium.com/svn/asterisk/trunk@22726 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
rizzo 2006-04-27 01:27:07 +00:00
parent 1808e784cb
commit e1712dc54e
2 changed files with 168 additions and 322 deletions

View File

@ -138,16 +138,12 @@ includes { STORE_POS; return KW_INCLUDES;}
<paren>{NOPARENS}\) { <paren>{NOPARENS}\) {
yylloc->first_line = my_lineno; yylloc->first_line = my_lineno;
yylloc->first_column=my_col; yylloc->first_column=my_col;
if ( pbcpop(')') ) { if ( pbcpop(')') ) { /* error */
/* error */ pbcwhere(yytext, &my_lineno, &my_col);
int l4,c4; ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression: %s !\n", my_file, my_lineno, my_col, yytext);
pbcwhere(yytext, &l4, &c4);
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression: %s !\n", my_file, my_lineno+l4, c4, yytext);
BEGIN(0); BEGIN(0);
yylloc->last_line = my_lineno+l4; yylloc->last_line = my_lineno;
yylloc->last_column=c4; yylloc->last_column = my_col;
my_col=c4;
my_lineno += l4;
yylval->str = strdup(yytext); yylval->str = strdup(yytext);
prev_word = 0; prev_word = 0;
return word; return word;
@ -156,16 +152,13 @@ includes { STORE_POS; return KW_INCLUDES;}
if ( parencount >= 0) { if ( parencount >= 0) {
yymore(); yymore();
} else { } else {
int l4,c4; pbcwhere(yytext, &my_lineno, &my_col);
pbcwhere(yytext, &l4, &c4); yylloc->last_line = my_lineno;
yylloc->last_line = my_lineno+l4; yylloc->last_column = my_col;
yylloc->last_column=c4;
yylval->str = strdup(yytext); yylval->str = strdup(yytext);
*(yylval->str+strlen(yylval->str)-1)=0; *(yylval->str+strlen(yylval->str)-1)=0;
/* printf("Got paren word %s\n", yylval->str); */ /* printf("Got paren word %s\n", yylval->str); */
unput(')'); unput(')');
my_col=c4;
my_lineno += l4;
BEGIN(0); BEGIN(0);
return word; return word;
} }
@ -189,17 +182,13 @@ includes { STORE_POS; return KW_INCLUDES;}
<paren>{NOPARENS}\] { <paren>{NOPARENS}\] {
yylloc->first_line = my_lineno; yylloc->first_line = my_lineno;
yylloc->first_column=my_col; yylloc->first_column=my_col;
if ( pbcpop(']') ) { if ( pbcpop(']') ) { /* error */
/* error */ pbcwhere(yytext, &my_lineno, &my_col);
int l4,c4;
pbcwhere(yytext, &l4, &c4);
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ']' in expression!\n", ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ']' in expression!\n",
my_file, my_lineno+l4, c4); my_file, my_lineno, my_col);
BEGIN(0); BEGIN(0);
yylloc->last_line = my_lineno+l4; yylloc->last_line = my_lineno;
yylloc->last_column=c4; yylloc->last_column = my_col;
my_col=c4;
my_lineno += l4;
yylval->str = strdup(yytext); yylval->str = strdup(yytext);
return word; return word;
} }
@ -216,17 +205,13 @@ includes { STORE_POS; return KW_INCLUDES;}
<paren>{NOPARENS}\} { <paren>{NOPARENS}\} {
yylloc->first_line = my_lineno; yylloc->first_line = my_lineno;
yylloc->first_column=my_col; yylloc->first_column=my_col;
if ( pbcpop('}') ) { if ( pbcpop('}') ) { /* error */
/* error */ pbcwhere(yytext, &my_lineno, &my_col);
int l4,c4;
pbcwhere(yytext, &l4, &c4);
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '}' in expression!\n", ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '}' in expression!\n",
my_file, my_lineno+l4, c4); my_file, my_lineno, my_col);
BEGIN(0); BEGIN(0);
yylloc->last_line = my_lineno+l4; yylloc->last_line = my_lineno;
yylloc->last_column=c4; yylloc->last_column = my_col;
my_col=c4;
my_lineno += l4;
yylval->str = strdup(yytext); yylval->str = strdup(yytext);
return word; return word;
} }
@ -235,37 +220,21 @@ includes { STORE_POS; return KW_INCLUDES;}
<argg>{NOARGG}\) { <argg>{NOARGG}\) {
/* printf("ARGG:%s\n",yytext); */ /* printf("ARGG:%s\n",yytext); */
int linecount = 0;
int colcount = my_col;
char *pt = yytext;
yylloc->first_line = my_lineno; yylloc->first_line = my_lineno;
yylloc->first_column=my_col; yylloc->first_column=my_col;
if ( pbcpop(')') ) { if ( pbcpop(')') ) { /* error */
/* error */ pbcwhere(yytext, &my_lineno, &my_col);
int l4,c4; ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression!\n", my_file, my_lineno, my_col);
pbcwhere(yytext, &l4, &c4);
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression!\n", my_file, my_lineno+l4, c4);
BEGIN(0); BEGIN(0);
yylloc->last_line = my_lineno+l4; yylloc->last_line = my_lineno;
yylloc->last_column=c4; yylloc->last_column = my_col;
my_col=c4;
my_lineno += l4;
yylval->str = strdup(yytext); yylval->str = strdup(yytext);
return word; return word;
} }
pbcwhere(yytext, &my_lineno, &my_col);
while (*pt) { yylloc->last_line = my_lineno;
if (*pt == '\n') { yylloc->last_column = my_col;
linecount++;
colcount=0;
}
pt++;
colcount++;
}
yylloc->last_line = my_lineno+linecount;
yylloc->last_column=colcount;
parencount--; parencount--;
if( parencount >= 0){ if( parencount >= 0){
yymore(); yymore();
@ -278,12 +247,10 @@ includes { STORE_POS; return KW_INCLUDES;}
if ( !strcmp(yylval->str,")") ) { if ( !strcmp(yylval->str,")") ) {
free(yylval->str); free(yylval->str);
yylval->str = 0; yylval->str = 0;
my_col+=1; my_col++; /* XXX why ? */
return RP; return RP;
} else { } else {
unput(')'); unput(')');
my_col=colcount;
my_lineno+=linecount;
return word; return word;
} }
} }
@ -306,36 +273,23 @@ includes { STORE_POS; return KW_INCLUDES;}
yymore(); yymore();
} else { } else {
/* printf("got a comma!\n\n"); */ /* printf("got a comma!\n\n"); */
int linecount = 0;
int colcount = my_col;
char *pt;
pt = yytext;
while (*pt) {
if ( *pt == '\n' ) {
linecount++;
colcount=0;
}
pt++;
colcount++;
}
yylloc->first_line = my_lineno; yylloc->first_line = my_lineno;
yylloc->last_line = my_lineno+linecount;
yylloc->last_column=colcount;
yylloc->first_column=my_col; yylloc->first_column=my_col;
pbcwhere(yytext, &my_lineno, &my_col);
yylloc->last_line = my_lineno;
yylloc->last_column = my_col;
if( !commaout ) { if( !commaout ) {
if( !strcmp(yytext,"," ) ) { if( !strcmp(yytext,"," ) ) {
commaout = 0; commaout = 0;
my_col+=1; my_col+=1;
return COMMA; return COMMA;
} }
yylval->str = strdup(yytext); /* printf("Got argg2 word %s\n", yylval->str); */ yylval->str = strdup(yytext);
/* printf("Got argg2 word %s\n", yylval->str); */
unput(','); unput(',');
commaout = 1; commaout = 1;
if(yyleng > 1 ) if (yyleng > 1 )
*(yylval->str+yyleng-1)=0; *(yylval->str+yyleng-1)=0;
my_lineno+=linecount;
my_col=colcount;
return word; return word;
} else { } else {
commaout = 0; commaout = 0;
@ -354,17 +308,15 @@ includes { STORE_POS; return KW_INCLUDES;}
} }
<argg>{NOARGG}\} { <argg>{NOARGG}\} {
/*printf("ARGG:%s\n",yytext);*/yylloc->first_line = my_lineno;yylloc->first_column=my_col; /*printf("ARGG:%s\n",yytext);*/
if ( pbcpop('}') ) { yylloc->first_line = my_lineno;
/* error */ yylloc->first_column=my_col;
int l4,c4; if ( pbcpop('}') ) { /* error */
pbcwhere(yytext, &l4, &c4); pbcwhere(yytext, &my_lineno, &my_col);
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '}' in expression!\n", my_file, my_lineno+l4, my_col+c4); ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '}' in expression!\n", my_file, my_lineno, my_col);
BEGIN(0); BEGIN(0);
yylloc->last_line = my_lineno+l4; yylloc->last_line = my_lineno;
yylloc->last_column=my_col+c4; yylloc->last_column = my_col;
my_col=c4;
my_lineno += l4;
yylval->str = strdup(yytext); yylval->str = strdup(yytext);
return word; return word;
} }
@ -383,16 +335,12 @@ includes { STORE_POS; return KW_INCLUDES;}
/*printf("ARGG:%s\n",yytext);*/ /*printf("ARGG:%s\n",yytext);*/
yylloc->first_line = my_lineno; yylloc->first_line = my_lineno;
yylloc->first_column=my_col; yylloc->first_column=my_col;
if ( pbcpop(']') ) { if ( pbcpop(']') ) { /* error */
/* error */ pbcwhere(yytext, &my_lineno, &my_col);
int l4,c4; ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ']' in expression!\n", my_file, my_lineno, my_col);
pbcwhere(yytext, &l4, &c4);
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ']' in expression!\n", my_file, my_lineno+l4, c4);
BEGIN(0); BEGIN(0);
yylloc->last_line = my_lineno+l4; yylloc->last_line = my_lineno;
yylloc->last_column=c4; yylloc->last_column = my_col;
my_col=c4;
my_lineno += l4;
yylval->str = strdup(yytext); yylval->str = strdup(yytext);
return word; return word;
} }
@ -411,16 +359,12 @@ includes { STORE_POS; return KW_INCLUDES;}
/*printf("SEMIC:%s\n",yytext);*/ /*printf("SEMIC:%s\n",yytext);*/
yylloc->first_line = my_lineno; yylloc->first_line = my_lineno;
yylloc->first_column=my_col; yylloc->first_column=my_col;
if ( pbcpop(']') ) { if ( pbcpop(']') ) { /* error */
/* error */ pbcwhere(yytext, &my_lineno, &my_col);
int l4,c4; ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ']' in expression!\n", my_file, my_lineno, my_col);
pbcwhere(yytext, &l4, &c4);
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ']' in expression!\n", my_file, my_lineno+l4, c4);
BEGIN(0); BEGIN(0);
yylloc->last_line = my_lineno+l4; yylloc->last_line = my_lineno;
yylloc->last_column=c4; yylloc->last_column= my_col;
my_col=c4;
my_lineno += l4;
yylval->str = strdup(yytext); yylval->str = strdup(yytext);
return word; return word;
} }
@ -439,16 +383,12 @@ includes { STORE_POS; return KW_INCLUDES;}
/*printf("SEMIC:%s\n",yytext);*/ /*printf("SEMIC:%s\n",yytext);*/
yylloc->first_line = my_lineno; yylloc->first_line = my_lineno;
yylloc->first_column=my_col; yylloc->first_column=my_col;
if ( pbcpop('}') ) { if ( pbcpop('}') ) { /* error */
/* error */ pbcwhere(yytext, &my_lineno, &my_col);
int l4,c4; ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '}' in expression!\n", my_file, my_lineno, my_col);
pbcwhere(yytext, &l4, &c4);
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '}' in expression!\n", my_file, my_lineno+l4, my_col+c4);
BEGIN(0); BEGIN(0);
yylloc->last_line = my_lineno+l4; yylloc->last_line = my_lineno;
yylloc->last_column=my_col+c4; yylloc->last_column=my_col;
my_col=c4;
my_lineno += l4;
yylval->str = strdup(yytext); yylval->str = strdup(yytext);
return word; return word;
} }
@ -467,16 +407,12 @@ includes { STORE_POS; return KW_INCLUDES;}
/*printf("SEMIC:%s\n",yytext);*/ /*printf("SEMIC:%s\n",yytext);*/
yylloc->first_line = my_lineno; yylloc->first_line = my_lineno;
yylloc->first_column=my_col; yylloc->first_column=my_col;
if ( pbcpop(')') ) { if ( pbcpop(')') ) { /* error */
/* error */ pbcwhere(yytext, &my_lineno, &my_col);
int l4,c4; ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression!\n", my_file, my_lineno, my_col);
pbcwhere(yytext, &l4, &c4);
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression!\n", my_file, my_lineno+l4, my_col+c4);
BEGIN(0); BEGIN(0);
yylloc->last_line = my_lineno+l4; yylloc->last_line = my_lineno;
yylloc->last_column=my_col+c4; yylloc->last_column=my_col;
my_col=c4;
my_lineno += l4;
yylval->str = strdup(yytext); yylval->str = strdup(yytext);
return word; return word;
} }
@ -484,29 +420,17 @@ includes { STORE_POS; return KW_INCLUDES;}
} }
<semic>{NOSEMIC}; { <semic>{NOSEMIC}; {
int linecount = 0;
int colcount = my_col;
char *pt = yytext;
while (*pt) {
if ( *pt == '\n' ) {
linecount++;
colcount=0;
}
pt++;
colcount++;
}
yylloc->first_line = my_lineno; yylloc->first_line = my_lineno;
yylloc->last_line = my_lineno+linecount;
yylloc->last_column=colcount;
yylloc->first_column=my_col; yylloc->first_column=my_col;
pbcwhere(yytext, &my_lineno, &my_col);
yylloc->last_line = my_lineno;
yylloc->last_column=my_col;;
yylval->str = strdup(yytext); yylval->str = strdup(yytext);
if(yyleng > 1) if(yyleng > 1)
*(yylval->str+yyleng-1)=0; *(yylval->str+yyleng-1)=0;
/* printf("Got semic word %s\n", yylval->str); */ /* printf("Got semic word %s\n", yylval->str); */
unput(';'); unput(';');
BEGIN(0); BEGIN(0);
my_col=colcount;
my_lineno += linecount;
return word; return word;
} }
@ -630,16 +554,15 @@ int c_prevword(void)
*/ */
static void pbcwhere(const char *text, int *line, int *col ) static void pbcwhere(const char *text, int *line, int *col )
{ {
int loc_line = 0; int loc_line = *line;
int loc_col = 0; int loc_col = *col;
while ( *text ) { char c;
if ( *text == '\n' ) { while ( (c = *text++) ) {
if ( c == '\n' ) {
loc_line++; loc_line++;
loc_col = 1; loc_col = 0;
} else {
loc_col++;
} }
text++; loc_col++;
} }
*line = loc_line; *line = loc_line;
*col = loc_col; *col = loc_col;

View File

@ -1261,16 +1261,12 @@ YY_RULE_SETUP
{ {
yylloc->first_line = my_lineno; yylloc->first_line = my_lineno;
yylloc->first_column=my_col; yylloc->first_column=my_col;
if ( pbcpop(')') ) { if ( pbcpop(')') ) { /* error */
/* error */ pbcwhere(yytext, &my_lineno, &my_col);
int l4,c4; ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression: %s !\n", my_file, my_lineno, my_col, yytext);
pbcwhere(yytext, &l4, &c4);
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression: %s !\n", my_file, my_lineno+l4, c4, yytext);
BEGIN(0); BEGIN(0);
yylloc->last_line = my_lineno+l4; yylloc->last_line = my_lineno;
yylloc->last_column=c4; yylloc->last_column = my_col;
my_col=c4;
my_lineno += l4;
yylval->str = strdup(yytext); yylval->str = strdup(yytext);
prev_word = 0; prev_word = 0;
return word; return word;
@ -1279,16 +1275,13 @@ YY_RULE_SETUP
if ( parencount >= 0) { if ( parencount >= 0) {
yymore(); yymore();
} else { } else {
int l4,c4; pbcwhere(yytext, &my_lineno, &my_col);
pbcwhere(yytext, &l4, &c4); yylloc->last_line = my_lineno;
yylloc->last_line = my_lineno+l4; yylloc->last_column = my_col;
yylloc->last_column=c4;
yylval->str = strdup(yytext); yylval->str = strdup(yytext);
*(yylval->str+strlen(yylval->str)-1)=0; *(yylval->str+strlen(yylval->str)-1)=0;
/* printf("Got paren word %s\n", yylval->str); */ /* printf("Got paren word %s\n", yylval->str); */
unput(')'); unput(')');
my_col=c4;
my_lineno += l4;
BEGIN(0); BEGIN(0);
return word; return word;
} }
@ -1297,7 +1290,7 @@ YY_RULE_SETUP
case 45: case 45:
/* rule 45 can match eol */ /* rule 45 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 174 "ael.flex" #line 167 "ael.flex"
{ {
yylloc->first_line = my_lineno; yylloc->first_line = my_lineno;
yylloc->first_column=my_col; yylloc->first_column=my_col;
@ -1309,7 +1302,7 @@ YY_RULE_SETUP
case 46: case 46:
/* rule 46 can match eol */ /* rule 46 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 182 "ael.flex" #line 175 "ael.flex"
{ {
yylloc->first_line = my_lineno; yylloc->first_line = my_lineno;
yylloc->first_column=my_col; yylloc->first_column=my_col;
@ -1320,21 +1313,17 @@ YY_RULE_SETUP
case 47: case 47:
/* rule 47 can match eol */ /* rule 47 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 189 "ael.flex" #line 182 "ael.flex"
{ {
yylloc->first_line = my_lineno; yylloc->first_line = my_lineno;
yylloc->first_column=my_col; yylloc->first_column=my_col;
if ( pbcpop(']') ) { if ( pbcpop(']') ) { /* error */
/* error */ pbcwhere(yytext, &my_lineno, &my_col);
int l4,c4;
pbcwhere(yytext, &l4, &c4);
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ']' in expression!\n", ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ']' in expression!\n",
my_file, my_lineno+l4, c4); my_file, my_lineno, my_col);
BEGIN(0); BEGIN(0);
yylloc->last_line = my_lineno+l4; yylloc->last_line = my_lineno;
yylloc->last_column=c4; yylloc->last_column = my_col;
my_col=c4;
my_lineno += l4;
yylval->str = strdup(yytext); yylval->str = strdup(yytext);
return word; return word;
} }
@ -1344,7 +1333,7 @@ YY_RULE_SETUP
case 48: case 48:
/* rule 48 can match eol */ /* rule 48 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 209 "ael.flex" #line 198 "ael.flex"
{ {
yylloc->first_line = my_lineno; yylloc->first_line = my_lineno;
yylloc->first_column=my_col; yylloc->first_column=my_col;
@ -1355,21 +1344,17 @@ YY_RULE_SETUP
case 49: case 49:
/* rule 49 can match eol */ /* rule 49 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 216 "ael.flex" #line 205 "ael.flex"
{ {
yylloc->first_line = my_lineno; yylloc->first_line = my_lineno;
yylloc->first_column=my_col; yylloc->first_column=my_col;
if ( pbcpop('}') ) { if ( pbcpop('}') ) { /* error */
/* error */ pbcwhere(yytext, &my_lineno, &my_col);
int l4,c4;
pbcwhere(yytext, &l4, &c4);
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '}' in expression!\n", ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '}' in expression!\n",
my_file, my_lineno+l4, c4); my_file, my_lineno, my_col);
BEGIN(0); BEGIN(0);
yylloc->last_line = my_lineno+l4; yylloc->last_line = my_lineno;
yylloc->last_column=c4; yylloc->last_column = my_col;
my_col=c4;
my_lineno += l4;
yylval->str = strdup(yytext); yylval->str = strdup(yytext);
return word; return word;
} }
@ -1379,40 +1364,24 @@ YY_RULE_SETUP
case 50: case 50:
/* rule 50 can match eol */ /* rule 50 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 236 "ael.flex" #line 221 "ael.flex"
{ {
/* printf("ARGG:%s\n",yytext); */ /* printf("ARGG:%s\n",yytext); */
int linecount = 0;
int colcount = my_col;
char *pt = yytext;
yylloc->first_line = my_lineno; yylloc->first_line = my_lineno;
yylloc->first_column=my_col; yylloc->first_column=my_col;
if ( pbcpop(')') ) { if ( pbcpop(')') ) { /* error */
/* error */ pbcwhere(yytext, &my_lineno, &my_col);
int l4,c4; ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression!\n", my_file, my_lineno, my_col);
pbcwhere(yytext, &l4, &c4);
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression!\n", my_file, my_lineno+l4, c4);
BEGIN(0); BEGIN(0);
yylloc->last_line = my_lineno+l4; yylloc->last_line = my_lineno;
yylloc->last_column=c4; yylloc->last_column = my_col;
my_col=c4;
my_lineno += l4;
yylval->str = strdup(yytext); yylval->str = strdup(yytext);
return word; return word;
} }
pbcwhere(yytext, &my_lineno, &my_col);
while (*pt) { yylloc->last_line = my_lineno;
if (*pt == '\n') { yylloc->last_column = my_col;
linecount++;
colcount=0;
}
pt++;
colcount++;
}
yylloc->last_line = my_lineno+linecount;
yylloc->last_column=colcount;
parencount--; parencount--;
if( parencount >= 0){ if( parencount >= 0){
yymore(); yymore();
@ -1425,12 +1394,10 @@ YY_RULE_SETUP
if ( !strcmp(yylval->str,")") ) { if ( !strcmp(yylval->str,")") ) {
free(yylval->str); free(yylval->str);
yylval->str = 0; yylval->str = 0;
my_col+=1; my_col++; /* XXX why ? */
return RP; return RP;
} else { } else {
unput(')'); unput(')');
my_col=colcount;
my_lineno+=linecount;
return word; return word;
} }
} }
@ -1439,7 +1406,7 @@ YY_RULE_SETUP
case 51: case 51:
/* rule 51 can match eol */ /* rule 51 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 292 "ael.flex" #line 259 "ael.flex"
{ {
/* printf("ARGG:%s\n",yytext); */ /* printf("ARGG:%s\n",yytext); */
/* printf("GOT AN LP!!!\n"); */ /* printf("GOT AN LP!!!\n"); */
@ -1453,7 +1420,7 @@ YY_RULE_SETUP
case 52: case 52:
/* rule 52 can match eol */ /* rule 52 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 302 "ael.flex" #line 269 "ael.flex"
{ {
/* printf("ARGG:%s\n",yytext); */ /* printf("ARGG:%s\n",yytext); */
if( parencount != 0) { if( parencount != 0) {
@ -1461,36 +1428,23 @@ YY_RULE_SETUP
yymore(); yymore();
} else { } else {
/* printf("got a comma!\n\n"); */ /* printf("got a comma!\n\n"); */
int linecount = 0;
int colcount = my_col;
char *pt;
pt = yytext;
while (*pt) {
if ( *pt == '\n' ) {
linecount++;
colcount=0;
}
pt++;
colcount++;
}
yylloc->first_line = my_lineno; yylloc->first_line = my_lineno;
yylloc->last_line = my_lineno+linecount;
yylloc->last_column=colcount;
yylloc->first_column=my_col; yylloc->first_column=my_col;
pbcwhere(yytext, &my_lineno, &my_col);
yylloc->last_line = my_lineno;
yylloc->last_column = my_col;
if( !commaout ) { if( !commaout ) {
if( !strcmp(yytext,"," ) ) { if( !strcmp(yytext,"," ) ) {
commaout = 0; commaout = 0;
my_col+=1; my_col+=1;
return COMMA; return COMMA;
} }
yylval->str = strdup(yytext); /* printf("Got argg2 word %s\n", yylval->str); */ yylval->str = strdup(yytext);
/* printf("Got argg2 word %s\n", yylval->str); */
unput(','); unput(',');
commaout = 1; commaout = 1;
if(yyleng > 1 ) if (yyleng > 1 )
*(yylval->str+yyleng-1)=0; *(yylval->str+yyleng-1)=0;
my_lineno+=linecount;
my_col=colcount;
return word; return word;
} else { } else {
commaout = 0; commaout = 0;
@ -1503,7 +1457,7 @@ YY_RULE_SETUP
case 53: case 53:
/* rule 53 can match eol */ /* rule 53 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 348 "ael.flex" #line 302 "ael.flex"
{ {
/*printf("ARGG:%s\n",yytext);*/ /*printf("ARGG:%s\n",yytext);*/
yylloc->first_line = my_lineno; yylloc->first_line = my_lineno;
@ -1515,19 +1469,17 @@ YY_RULE_SETUP
case 54: case 54:
/* rule 54 can match eol */ /* rule 54 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 356 "ael.flex" #line 310 "ael.flex"
{ {
/*printf("ARGG:%s\n",yytext);*/yylloc->first_line = my_lineno;yylloc->first_column=my_col; /*printf("ARGG:%s\n",yytext);*/
if ( pbcpop('}') ) { yylloc->first_line = my_lineno;
/* error */ yylloc->first_column=my_col;
int l4,c4; if ( pbcpop('}') ) { /* error */
pbcwhere(yytext, &l4, &c4); pbcwhere(yytext, &my_lineno, &my_col);
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '}' in expression!\n", my_file, my_lineno+l4, my_col+c4); ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '}' in expression!\n", my_file, my_lineno, my_col);
BEGIN(0); BEGIN(0);
yylloc->last_line = my_lineno+l4; yylloc->last_line = my_lineno;
yylloc->last_column=my_col+c4; yylloc->last_column = my_col;
my_col=c4;
my_lineno += l4;
yylval->str = strdup(yytext); yylval->str = strdup(yytext);
return word; return word;
} }
@ -1537,7 +1489,7 @@ YY_RULE_SETUP
case 55: case 55:
/* rule 55 can match eol */ /* rule 55 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 374 "ael.flex" #line 326 "ael.flex"
{ {
/*printf("ARGG:%s\n",yytext);*/ /*printf("ARGG:%s\n",yytext);*/
yylloc->first_line = my_lineno; yylloc->first_line = my_lineno;
@ -1549,21 +1501,17 @@ YY_RULE_SETUP
case 56: case 56:
/* rule 56 can match eol */ /* rule 56 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 382 "ael.flex" #line 334 "ael.flex"
{ {
/*printf("ARGG:%s\n",yytext);*/ /*printf("ARGG:%s\n",yytext);*/
yylloc->first_line = my_lineno; yylloc->first_line = my_lineno;
yylloc->first_column=my_col; yylloc->first_column=my_col;
if ( pbcpop(']') ) { if ( pbcpop(']') ) { /* error */
/* error */ pbcwhere(yytext, &my_lineno, &my_col);
int l4,c4; ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ']' in expression!\n", my_file, my_lineno, my_col);
pbcwhere(yytext, &l4, &c4);
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ']' in expression!\n", my_file, my_lineno+l4, c4);
BEGIN(0); BEGIN(0);
yylloc->last_line = my_lineno+l4; yylloc->last_line = my_lineno;
yylloc->last_column=c4; yylloc->last_column = my_col;
my_col=c4;
my_lineno += l4;
yylval->str = strdup(yytext); yylval->str = strdup(yytext);
return word; return word;
} }
@ -1573,7 +1521,7 @@ YY_RULE_SETUP
case 57: case 57:
/* rule 57 can match eol */ /* rule 57 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 402 "ael.flex" #line 350 "ael.flex"
{ {
/*printf("SEMIC:%s\n",yytext);*/ /*printf("SEMIC:%s\n",yytext);*/
yylloc->first_line = my_lineno; yylloc->first_line = my_lineno;
@ -1585,21 +1533,17 @@ YY_RULE_SETUP
case 58: case 58:
/* rule 58 can match eol */ /* rule 58 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 410 "ael.flex" #line 358 "ael.flex"
{ {
/*printf("SEMIC:%s\n",yytext);*/ /*printf("SEMIC:%s\n",yytext);*/
yylloc->first_line = my_lineno; yylloc->first_line = my_lineno;
yylloc->first_column=my_col; yylloc->first_column=my_col;
if ( pbcpop(']') ) { if ( pbcpop(']') ) { /* error */
/* error */ pbcwhere(yytext, &my_lineno, &my_col);
int l4,c4; ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ']' in expression!\n", my_file, my_lineno, my_col);
pbcwhere(yytext, &l4, &c4);
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ']' in expression!\n", my_file, my_lineno+l4, c4);
BEGIN(0); BEGIN(0);
yylloc->last_line = my_lineno+l4; yylloc->last_line = my_lineno;
yylloc->last_column=c4; yylloc->last_column= my_col;
my_col=c4;
my_lineno += l4;
yylval->str = strdup(yytext); yylval->str = strdup(yytext);
return word; return word;
} }
@ -1609,7 +1553,7 @@ YY_RULE_SETUP
case 59: case 59:
/* rule 59 can match eol */ /* rule 59 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 430 "ael.flex" #line 374 "ael.flex"
{ {
/*printf("SEMIC:%s\n",yytext);*/ /*printf("SEMIC:%s\n",yytext);*/
yylloc->first_line = my_lineno; yylloc->first_line = my_lineno;
@ -1621,21 +1565,17 @@ YY_RULE_SETUP
case 60: case 60:
/* rule 60 can match eol */ /* rule 60 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 438 "ael.flex" #line 382 "ael.flex"
{ {
/*printf("SEMIC:%s\n",yytext);*/ /*printf("SEMIC:%s\n",yytext);*/
yylloc->first_line = my_lineno; yylloc->first_line = my_lineno;
yylloc->first_column=my_col; yylloc->first_column=my_col;
if ( pbcpop('}') ) { if ( pbcpop('}') ) { /* error */
/* error */ pbcwhere(yytext, &my_lineno, &my_col);
int l4,c4; ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '}' in expression!\n", my_file, my_lineno, my_col);
pbcwhere(yytext, &l4, &c4);
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '}' in expression!\n", my_file, my_lineno+l4, my_col+c4);
BEGIN(0); BEGIN(0);
yylloc->last_line = my_lineno+l4; yylloc->last_line = my_lineno;
yylloc->last_column=my_col+c4; yylloc->last_column=my_col;
my_col=c4;
my_lineno += l4;
yylval->str = strdup(yytext); yylval->str = strdup(yytext);
return word; return word;
} }
@ -1645,7 +1585,7 @@ YY_RULE_SETUP
case 61: case 61:
/* rule 61 can match eol */ /* rule 61 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 458 "ael.flex" #line 398 "ael.flex"
{ {
/*printf("SEMIC:%s\n",yytext);*/ /*printf("SEMIC:%s\n",yytext);*/
yylloc->first_line = my_lineno; yylloc->first_line = my_lineno;
@ -1657,21 +1597,17 @@ YY_RULE_SETUP
case 62: case 62:
/* rule 62 can match eol */ /* rule 62 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 466 "ael.flex" #line 406 "ael.flex"
{ {
/*printf("SEMIC:%s\n",yytext);*/ /*printf("SEMIC:%s\n",yytext);*/
yylloc->first_line = my_lineno; yylloc->first_line = my_lineno;
yylloc->first_column=my_col; yylloc->first_column=my_col;
if ( pbcpop(')') ) { if ( pbcpop(')') ) { /* error */
/* error */ pbcwhere(yytext, &my_lineno, &my_col);
int l4,c4; ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression!\n", my_file, my_lineno, my_col);
pbcwhere(yytext, &l4, &c4);
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression!\n", my_file, my_lineno+l4, my_col+c4);
BEGIN(0); BEGIN(0);
yylloc->last_line = my_lineno+l4; yylloc->last_line = my_lineno;
yylloc->last_column=my_col+c4; yylloc->last_column=my_col;
my_col=c4;
my_lineno += l4;
yylval->str = strdup(yytext); yylval->str = strdup(yytext);
return word; return word;
} }
@ -1681,38 +1617,26 @@ YY_RULE_SETUP
case 63: case 63:
/* rule 63 can match eol */ /* rule 63 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 486 "ael.flex" #line 422 "ael.flex"
{ {
int linecount = 0;
int colcount = my_col;
char *pt = yytext;
while (*pt) {
if ( *pt == '\n' ) {
linecount++;
colcount=0;
}
pt++;
colcount++;
}
yylloc->first_line = my_lineno; yylloc->first_line = my_lineno;
yylloc->last_line = my_lineno+linecount;
yylloc->last_column=colcount;
yylloc->first_column=my_col; yylloc->first_column=my_col;
pbcwhere(yytext, &my_lineno, &my_col);
yylloc->last_line = my_lineno;
yylloc->last_column=my_col;;
yylval->str = strdup(yytext); yylval->str = strdup(yytext);
if(yyleng > 1) if(yyleng > 1)
*(yylval->str+yyleng-1)=0; *(yylval->str+yyleng-1)=0;
/* printf("Got semic word %s\n", yylval->str); */ /* printf("Got semic word %s\n", yylval->str); */
unput(';'); unput(';');
BEGIN(0); BEGIN(0);
my_col=colcount;
my_lineno += linecount;
return word; return word;
} }
YY_BREAK YY_BREAK
case 64: case 64:
/* rule 64 can match eol */ /* rule 64 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 513 "ael.flex" #line 437 "ael.flex"
{ {
FILE *in1; FILE *in1;
char fnamebuf[1024],*p1,*p2; char fnamebuf[1024],*p1,*p2;
@ -1779,7 +1703,7 @@ case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(paren): case YY_STATE_EOF(paren):
case YY_STATE_EOF(semic): case YY_STATE_EOF(semic):
case YY_STATE_EOF(argg): case YY_STATE_EOF(argg):
#line 575 "ael.flex" #line 499 "ael.flex"
{ {
if ( --include_stack_index < 0 ) { if ( --include_stack_index < 0 ) {
yyterminate(); yyterminate();
@ -1795,10 +1719,10 @@ case YY_STATE_EOF(argg):
YY_BREAK YY_BREAK
case 65: case 65:
YY_RULE_SETUP YY_RULE_SETUP
#line 588 "ael.flex" #line 512 "ael.flex"
ECHO; ECHO;
YY_BREAK YY_BREAK
#line 1802 "ael_lex.c" #line 1726 "ael_lex.c"
case YY_END_OF_BUFFER: case YY_END_OF_BUFFER:
{ {
@ -2928,7 +2852,7 @@ void ael_yyfree (void * ptr , yyscan_t yyscanner)
#define YYTABLES_NAME "yytables" #define YYTABLES_NAME "yytables"
#line 588 "ael.flex" #line 512 "ael.flex"
@ -2975,16 +2899,15 @@ int c_prevword(void)
*/ */
static void pbcwhere(const char *text, int *line, int *col ) static void pbcwhere(const char *text, int *line, int *col )
{ {
int loc_line = 0; int loc_line = *line;
int loc_col = 0; int loc_col = *col;
while ( *text ) { char c;
if ( *text == '\n' ) { while ( (c = *text++) ) {
if ( c == '\n' ) {
loc_line++; loc_line++;
loc_col = 1; loc_col = 0;
} else {
loc_col++;
} }
text++; loc_col++;
} }
*line = loc_line; *line = loc_line;
*col = loc_col; *col = loc_col;