fix last known bug in computing columb numbers in error messages

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@23152 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Luigi Rizzo
2006-04-28 15:33:05 +00:00
parent c1366df3d5
commit dad2812867
2 changed files with 77 additions and 69 deletions

View File

@@ -130,11 +130,13 @@ static void pbcwhere(const char *text, int *line, int *col )
int loc_col = *col;
char c;
while ( (c = *text++) ) {
if ( c == '\n' ) {
if ( c == '\t' ) {
loc_col += 8 - (loc_col % 8);
} else if ( c == '\n' ) {
loc_line++;
loc_col = 0;
}
loc_col++;
loc_col = 1;
} else
loc_col++;
}
*line = loc_line;
*col = loc_col;
@@ -157,10 +159,12 @@ static void pbcwhere(const char *text, int *line, int *col )
yylloc->last_line = my_lineno; \
yylloc->last_column = my_col - 1; \
} while (0)
#define STORE_LOC do { STORE_START; STORE_END } while (0)
#else
#define STORE_POS
#define STORE_START
#define STORE_END
#define STORE_LOC
#endif
%}

View File

@@ -746,11 +746,13 @@ static void pbcwhere(const char *text, int *line, int *col )
int loc_col = *col;
char c;
while ( (c = *text++) ) {
if ( c == '\n' ) {
if ( c == '\t' ) {
loc_col += 8 - (loc_col % 8);
} else if ( c == '\n' ) {
loc_line++;
loc_col = 0;
}
loc_col++;
loc_col = 1;
} else
loc_col++;
}
*line = loc_line;
*col = loc_col;
@@ -773,12 +775,14 @@ static void pbcwhere(const char *text, int *line, int *col )
yylloc->last_line = my_lineno; \
yylloc->last_column = my_col - 1; \
} while (0)
#define STORE_LOC do { STORE_START; STORE_END } while (0)
#else
#define STORE_POS
#define STORE_START
#define STORE_END
#define STORE_LOC
#endif
#line 782 "ael_lex.c"
#line 786 "ael_lex.c"
#define INITIAL 0
#define paren 1
@@ -1018,10 +1022,10 @@ YY_DECL
register int yy_act;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
#line 174 "ael.flex"
#line 178 "ael.flex"
#line 1025 "ael_lex.c"
#line 1029 "ael_lex.c"
yylval = yylval_param;
@@ -1112,218 +1116,218 @@ do_action: /* This label is used only to access EOF actions. */
case 1:
YY_RULE_SETUP
#line 176 "ael.flex"
#line 180 "ael.flex"
{ STORE_POS; return LC;}
YY_BREAK
case 2:
YY_RULE_SETUP
#line 177 "ael.flex"
#line 181 "ael.flex"
{ STORE_POS; return RC;}
YY_BREAK
case 3:
YY_RULE_SETUP
#line 178 "ael.flex"
#line 182 "ael.flex"
{ STORE_POS; return LP;}
YY_BREAK
case 4:
YY_RULE_SETUP
#line 179 "ael.flex"
#line 183 "ael.flex"
{ STORE_POS; return RP;}
YY_BREAK
case 5:
YY_RULE_SETUP
#line 180 "ael.flex"
#line 184 "ael.flex"
{ STORE_POS; return SEMI;}
YY_BREAK
case 6:
YY_RULE_SETUP
#line 181 "ael.flex"
#line 185 "ael.flex"
{ STORE_POS; return EQ;}
YY_BREAK
case 7:
YY_RULE_SETUP
#line 182 "ael.flex"
#line 186 "ael.flex"
{ STORE_POS; return COMMA;}
YY_BREAK
case 8:
YY_RULE_SETUP
#line 183 "ael.flex"
#line 187 "ael.flex"
{ STORE_POS; return COLON;}
YY_BREAK
case 9:
YY_RULE_SETUP
#line 184 "ael.flex"
#line 188 "ael.flex"
{ STORE_POS; return AMPER;}
YY_BREAK
case 10:
YY_RULE_SETUP
#line 185 "ael.flex"
#line 189 "ael.flex"
{ STORE_POS; return BAR;}
YY_BREAK
case 11:
YY_RULE_SETUP
#line 186 "ael.flex"
#line 190 "ael.flex"
{ STORE_POS; return EXTENMARK;}
YY_BREAK
case 12:
YY_RULE_SETUP
#line 187 "ael.flex"
#line 191 "ael.flex"
{ STORE_POS; return AT;}
YY_BREAK
case 13:
YY_RULE_SETUP
#line 188 "ael.flex"
#line 192 "ael.flex"
{/*comment*/}
YY_BREAK
case 14:
YY_RULE_SETUP
#line 189 "ael.flex"
#line 193 "ael.flex"
{ STORE_POS; return KW_CONTEXT;}
YY_BREAK
case 15:
YY_RULE_SETUP
#line 190 "ael.flex"
#line 194 "ael.flex"
{ STORE_POS; return KW_ABSTRACT;}
YY_BREAK
case 16:
YY_RULE_SETUP
#line 191 "ael.flex"
#line 195 "ael.flex"
{ STORE_POS; return KW_MACRO;};
YY_BREAK
case 17:
YY_RULE_SETUP
#line 192 "ael.flex"
#line 196 "ael.flex"
{ STORE_POS; return KW_GLOBALS;}
YY_BREAK
case 18:
YY_RULE_SETUP
#line 193 "ael.flex"
#line 197 "ael.flex"
{ STORE_POS; return KW_IGNOREPAT;}
YY_BREAK
case 19:
YY_RULE_SETUP
#line 194 "ael.flex"
#line 198 "ael.flex"
{ STORE_POS; return KW_SWITCH;}
YY_BREAK
case 20:
YY_RULE_SETUP
#line 195 "ael.flex"
#line 199 "ael.flex"
{ STORE_POS; return KW_IF;}
YY_BREAK
case 21:
YY_RULE_SETUP
#line 196 "ael.flex"
#line 200 "ael.flex"
{ STORE_POS; return KW_IFTIME;}
YY_BREAK
case 22:
YY_RULE_SETUP
#line 197 "ael.flex"
#line 201 "ael.flex"
{ STORE_POS; return KW_RANDOM;}
YY_BREAK
case 23:
YY_RULE_SETUP
#line 198 "ael.flex"
#line 202 "ael.flex"
{ STORE_POS; return KW_REGEXTEN;}
YY_BREAK
case 24:
YY_RULE_SETUP
#line 199 "ael.flex"
#line 203 "ael.flex"
{ STORE_POS; return KW_HINT;}
YY_BREAK
case 25:
YY_RULE_SETUP
#line 200 "ael.flex"
#line 204 "ael.flex"
{ STORE_POS; return KW_ELSE;}
YY_BREAK
case 26:
YY_RULE_SETUP
#line 201 "ael.flex"
#line 205 "ael.flex"
{ STORE_POS; return KW_GOTO;}
YY_BREAK
case 27:
YY_RULE_SETUP
#line 202 "ael.flex"
#line 206 "ael.flex"
{ STORE_POS; return KW_JUMP;}
YY_BREAK
case 28:
YY_RULE_SETUP
#line 203 "ael.flex"
#line 207 "ael.flex"
{ STORE_POS; return KW_RETURN;}
YY_BREAK
case 29:
YY_RULE_SETUP
#line 204 "ael.flex"
#line 208 "ael.flex"
{ STORE_POS; return KW_BREAK;}
YY_BREAK
case 30:
YY_RULE_SETUP
#line 205 "ael.flex"
#line 209 "ael.flex"
{ STORE_POS; return KW_CONTINUE;}
YY_BREAK
case 31:
YY_RULE_SETUP
#line 206 "ael.flex"
#line 210 "ael.flex"
{ STORE_POS; return KW_FOR;}
YY_BREAK
case 32:
YY_RULE_SETUP
#line 207 "ael.flex"
#line 211 "ael.flex"
{ STORE_POS; return KW_WHILE;}
YY_BREAK
case 33:
YY_RULE_SETUP
#line 208 "ael.flex"
#line 212 "ael.flex"
{ STORE_POS; return KW_CASE;}
YY_BREAK
case 34:
YY_RULE_SETUP
#line 209 "ael.flex"
#line 213 "ael.flex"
{ STORE_POS; return KW_DEFAULT;}
YY_BREAK
case 35:
YY_RULE_SETUP
#line 210 "ael.flex"
#line 214 "ael.flex"
{ STORE_POS; return KW_PATTERN;}
YY_BREAK
case 36:
YY_RULE_SETUP
#line 211 "ael.flex"
#line 215 "ael.flex"
{ STORE_POS; return KW_CATCH;}
YY_BREAK
case 37:
YY_RULE_SETUP
#line 212 "ael.flex"
#line 216 "ael.flex"
{ STORE_POS; return KW_SWITCHES;}
YY_BREAK
case 38:
YY_RULE_SETUP
#line 213 "ael.flex"
#line 217 "ael.flex"
{ STORE_POS; return KW_ESWITCHES;}
YY_BREAK
case 39:
YY_RULE_SETUP
#line 214 "ael.flex"
#line 218 "ael.flex"
{ STORE_POS; return KW_INCLUDES;}
YY_BREAK
case 40:
/* rule 40 can match eol */
YY_RULE_SETUP
#line 216 "ael.flex"
#line 220 "ael.flex"
{ my_lineno++; my_col = 1; }
YY_BREAK
case 41:
YY_RULE_SETUP
#line 217 "ael.flex"
#line 221 "ael.flex"
{ my_col += yyleng; }
YY_BREAK
case 42:
YY_RULE_SETUP
#line 218 "ael.flex"
#line 222 "ael.flex"
{ my_col += (yyleng*8)-(my_col%8); }
YY_BREAK
case 43:
YY_RULE_SETUP
#line 220 "ael.flex"
#line 224 "ael.flex"
{
STORE_POS;
yylval->str = strdup(yytext);
@@ -1334,7 +1338,7 @@ YY_RULE_SETUP
case 44:
/* rule 44 can match eol */
YY_RULE_SETUP
#line 230 "ael.flex"
#line 234 "ael.flex"
{
STORE_START;
if ( pbcpop(')') ) { /* error */
@@ -1362,7 +1366,7 @@ YY_RULE_SETUP
case 45:
/* rule 45 can match eol */
YY_RULE_SETUP
#line 254 "ael.flex"
#line 258 "ael.flex"
{
char c = yytext[yyleng-1];
// STORE_START;
@@ -1375,7 +1379,7 @@ YY_RULE_SETUP
case 46:
/* rule 46 can match eol */
YY_RULE_SETUP
#line 263 "ael.flex"
#line 267 "ael.flex"
{
char c = yytext[yyleng-1];
STORE_START;
@@ -1393,7 +1397,7 @@ YY_RULE_SETUP
case 47:
/* rule 47 can match eol */
YY_RULE_SETUP
#line 277 "ael.flex"
#line 281 "ael.flex"
{
char c = yytext[yyleng-1];
STORE_START;
@@ -1406,7 +1410,7 @@ YY_RULE_SETUP
case 48:
/* rule 48 can match eol */
YY_RULE_SETUP
#line 286 "ael.flex"
#line 290 "ael.flex"
{
STORE_START;
if ( pbcpop(')') ) { /* error */
@@ -1441,7 +1445,7 @@ YY_RULE_SETUP
case 49:
/* rule 49 can match eol */
YY_RULE_SETUP
#line 317 "ael.flex"
#line 321 "ael.flex"
{
if( parencount != 0) {
/* printf("Folding in a comma!\n"); */
@@ -1473,7 +1477,7 @@ YY_RULE_SETUP
case 50:
/* rule 50 can match eol */
YY_RULE_SETUP
#line 345 "ael.flex"
#line 349 "ael.flex"
{
char c = yytext[yyleng-1];
STORE_START;
@@ -1490,7 +1494,7 @@ YY_RULE_SETUP
case 51:
/* rule 51 can match eol */
YY_RULE_SETUP
#line 360 "ael.flex"
#line 364 "ael.flex"
{
char c = yytext[yyleng-1];
STORE_START;
@@ -1501,7 +1505,7 @@ YY_RULE_SETUP
case 52:
/* rule 52 can match eol */
YY_RULE_SETUP
#line 367 "ael.flex"
#line 371 "ael.flex"
{
char c = yytext[yyleng-1];
STORE_START;
@@ -1518,7 +1522,7 @@ YY_RULE_SETUP
case 53:
/* rule 53 can match eol */
YY_RULE_SETUP
#line 380 "ael.flex"
#line 384 "ael.flex"
{
STORE_START;
STORE_END;
@@ -1533,7 +1537,7 @@ YY_RULE_SETUP
case 54:
/* rule 54 can match eol */
YY_RULE_SETUP
#line 391 "ael.flex"
#line 395 "ael.flex"
{
FILE *in1;
char fnamebuf[1024],*p1,*p2;
@@ -1600,7 +1604,7 @@ case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(paren):
case YY_STATE_EOF(semic):
case YY_STATE_EOF(argg):
#line 453 "ael.flex"
#line 457 "ael.flex"
{
if ( --include_stack_index < 0 ) {
yyterminate();
@@ -1616,10 +1620,10 @@ case YY_STATE_EOF(argg):
YY_BREAK
case 55:
YY_RULE_SETUP
#line 466 "ael.flex"
#line 470 "ael.flex"
ECHO;
YY_BREAK
#line 1623 "ael_lex.c"
#line 1627 "ael_lex.c"
case YY_END_OF_BUFFER:
{
@@ -2749,7 +2753,7 @@ void ael_yyfree (void * ptr , yyscan_t yyscanner)
#define YYTABLES_NAME "yytables"
#line 466 "ael.flex"
#line 470 "ael.flex"