[antlr-interest] Lexer rule SL_COMMENT (any java grammar)

Thomas N. thn-d at gmx.de
Wed Nov 16 05:40:38 PST 2005


Hi,

the lexer rule (found in any java grammar)

SL_COMMENT
    :    "//"
        (~('\n'|'\r'))* ('\n'|'\r'('\n')?)
        { $setType(Token.SKIP); newline(); }
    ;

loops if the single line comment is at the end of the .java file and does
not end with a newline. Unfortunately, the java compiler allows such
comments. How can this bug be fixed (by consifering EOF)?

Regards,
Thomas N.

-- 
10 GB Mailbox, 100 FreeSMS/Monat http://www.gmx.net/de/go/topmail
+++ GMX - die erste Adresse für Mail, Message, More +++


More information about the antlr-interest mailing list