fix a bug in computing line numbers

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@23151 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Luigi Rizzo
2006-04-28 15:24:30 +00:00
parent 799126216e
commit c1366df3d5
2 changed files with 8 additions and 8 deletions

View File

@@ -78,7 +78,7 @@ 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.
*/ */
static int my_lineno = 1; /* current line in the source */ static int my_lineno = 1; /* current line in the source */
static int my_col = 0; /* current column in the source */ static int my_col = 1; /* current column in the source */
char *my_file = 0; /* used also in the bison code */ char *my_file = 0; /* used also in the bison code */
char *prev_word; /* XXX document it */ char *prev_word; /* XXX document it */
@@ -155,7 +155,7 @@ static void pbcwhere(const char *text, int *line, int *col )
#define STORE_END do { \ #define STORE_END do { \
pbcwhere(yytext, &my_lineno, &my_col); \ pbcwhere(yytext, &my_lineno, &my_col); \
yylloc->last_line = my_lineno; \ yylloc->last_line = my_lineno; \
yylloc->last_column = my_col; \ yylloc->last_column = my_col - 1; \
} while (0) } while (0)
#else #else
#define STORE_POS #define STORE_POS
@@ -253,7 +253,7 @@ includes { STORE_POS; return KW_INCLUDES;}
<paren>{NOPARENS}[\(\[\{] { <paren>{NOPARENS}[\(\[\{] {
char c = yytext[yyleng-1]; char c = yytext[yyleng-1];
STORE_START; // STORE_START;
if (c == '(') if (c == '(')
parencount++; parencount++;
pbcpush(c); pbcpush(c);
@@ -293,11 +293,11 @@ includes { STORE_POS; return KW_INCLUDES;}
return word; return word;
} }
STORE_END;
parencount--; parencount--;
if( parencount >= 0){ if( parencount >= 0){
yymore(); yymore();
} else { } else {
STORE_END;
yylval->str = strdup(yytext); yylval->str = strdup(yytext);
if(yyleng > 1 ) if(yyleng > 1 )
*(yylval->str+yyleng-1)=0; *(yylval->str+yyleng-1)=0;

View File

@@ -694,7 +694,7 @@ 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.
*/ */
static int my_lineno = 1; /* current line in the source */ static int my_lineno = 1; /* current line in the source */
static int my_col = 0; /* current column in the source */ static int my_col = 1; /* current column in the source */
char *my_file = 0; /* used also in the bison code */ char *my_file = 0; /* used also in the bison code */
char *prev_word; /* XXX document it */ char *prev_word; /* XXX document it */
@@ -771,7 +771,7 @@ static void pbcwhere(const char *text, int *line, int *col )
#define STORE_END do { \ #define STORE_END do { \
pbcwhere(yytext, &my_lineno, &my_col); \ pbcwhere(yytext, &my_lineno, &my_col); \
yylloc->last_line = my_lineno; \ yylloc->last_line = my_lineno; \
yylloc->last_column = my_col; \ yylloc->last_column = my_col - 1; \
} while (0) } while (0)
#else #else
#define STORE_POS #define STORE_POS
@@ -1365,7 +1365,7 @@ YY_RULE_SETUP
#line 254 "ael.flex" #line 254 "ael.flex"
{ {
char c = yytext[yyleng-1]; char c = yytext[yyleng-1];
STORE_START; // STORE_START;
if (c == '(') if (c == '(')
parencount++; parencount++;
pbcpush(c); pbcpush(c);
@@ -1417,11 +1417,11 @@ YY_RULE_SETUP
return word; return word;
} }
STORE_END;
parencount--; parencount--;
if( parencount >= 0){ if( parencount >= 0){
yymore(); yymore();
} else { } else {
STORE_END;
yylval->str = strdup(yytext); yylval->str = strdup(yytext);
if(yyleng > 1 ) if(yyleng > 1 )
*(yylval->str+yyleng-1)=0; *(yylval->str+yyleng-1)=0;