How to get the correct line number of parsing error?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Angela_Kwok
Posted On:   Monday, June 11, 2001 02:04 PM

I have genHashLines=true in options, and when there is a parsing error(e.g unexpected token)I get error message like this: Unexpected Token: line 44: unexpected token: a
But I found out the line number is incorrect sometimes because it doesn't count the empty line in. So for example, if the line which has error is line 39, but there are 5 empty lines before it, the error message will say it's line 34 having the unexpected token. Is there anyway to include the empty line too?

Re: How to get the correct line number of parsing error?

Posted By:   Ric_Klaren  
Posted On:   Wednesday, June 13, 2001 03:07 AM

Do the rules in your lexer that process
empty newlines call the newline() method?

Like for instance:


/// skip whitespace
WS: ( ' ' | ' ' { tab(); } | '
' { newline(); } | '
' )+
{
// Skip whitespace...
$setType(antlr::Token::SKIP);
}
;
About | Sitemap | Contact