Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Compiler Tools Pccts > ANTLR charVocab...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 55 of 133
Post > Topic >>

ANTLR charVocabulary and line number error messages

by "asjf" <asjf@[EMAIL PROTECTED] > Jun 3, 2004 at 10:36 AM

hi,

 I've been working through some simple Lexer examples in ANTLR (java) and
have come across a problem with my grammer (included below). It gets as
far
as I'd expect it to but when complaining about the unknown character
sequence refers to the problem being at "Line 1:293" - when its actually
something like "Line 14:2"

is there some way to get it to recognize lines again? (what in my grammar
has stopped it doing this - charVocabulary??)

any help appreciated,
thanks,
asjf

{
im****t java.io.*;
}

class TestLexer extends Lexer;

options { charVocabulary='\3'..'\377'; }

COMMENT : ';' (~('\r'|'\n'))+
 { System.out.print("COMMENT "); }
 ;

NEWLINE : ('\r''\n')=> '\r''\n' //DOS
        | '\r'                  //MAC
        | '\n'                  //UNIX
        { System.out.println("NEWLINE"); }
        ;

WS      : (' '|'\t')
   { System.out.print("WS ");
    $setType(Token.SKIP); } ;
 




 1 Posts in Topic:
ANTLR charVocabulary and line number error messages
"asjf" <asjf  2004-06-03 10:36:33 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Jul 6 19:04:04 CDT 2008.