[antlr-interest] CPP COMMENTS
Peggy Fieland
madcapmaggie at yahoo.com
Wed Nov 9 07:59:07 PST 2005
Henry,
Here is a lexer declaration that works for me.
What OS are you working on? Have you verified
that the newline characters in your file are
OK?
Other
than that, maybe you should get another copy of the
distribution, rebuild from scratch and reinstall
antlr.
Peggy
class SqlLexer extends Lexer;
options {
k=2; // lookahead
testLiterals=false;
caseSensitiveLiterals=false;
charVocabulary='\3'..'\377';
codeGenMakeSwitchThreshold = 4;
codeGenBitsetTestThreshold= 4;
defaultErrorHandler=false;
--- Henry Butowsky <henryb at ntlworld.com> wrote:
> Hi Peggy,
> Thx for your quick response
> I tried the code. Its not now crashing out -- But
> now everything from the
> start of the comment to the end of the file is now
> ignored !!
> Is there some option that I'm missing ?
>
>
> Peggy Fieland wrote:
>
> >Here's what I use for SL comments -- it's for SQL
> but
> >should work for c++.
> >
> >I'm generating c++ code on LINUX and I built
> >antlr-2.7.5
> >from scratch.
> >
> >// Single-line comments
> >SL_COMMENT
> > : ('-' '-' (~('\n'|'\r'))* ('\n'|'\r'('\n')?) ) =>
>
> > '-' '-'
> > (~('\n'|'\r'))* ('\n'|'\r'('\n')?)
> > { newline(); _ttype =
> >ANTLR_USE_NAMESPACE(antlr)Token::SKIP; }
> > | '-' '-'(~('\n'|'\r'))*
> > {_ttype =
> >ANTLR_USE_NAMESPACE(antlr)Token::SKIP; }
> > ;
> >
> >
> >
> >
> >
>
>
>
More information about the antlr-interest
mailing list