[antlr-interest] Need help for SL_Comment in Java Grammar

Shaoting Cai caishaoting at gmail.com
Sun Apr 19 15:45:07 PDT 2009


Hi Vasanthi,

You can try using
SL_COMMENT : "//" (~('\r'|'\n'))*{$channel=HIDDEN;};
instead of skip() the token.

Shaoting


On Thu, Apr 16, 2009 at 10:10 AM, vasanthi a <vasanthi.ak at gmail.com> wrote:
> HI ALL
>
> I am facing a problem in SL_Comment..
> My code has //[FEATURE_PDL_START]//
>
> but when it finds //, it ignores the line or rather skip it.
>
> It should not skip the line  //[FEATURE_PDL_START]//, when it finds such
> syntax like //[id]//
> Can you please let me know how to modify the single line comment
> so that when ever it finds syntax like  //[FEATURE_PDL_START]// it should
> not ignore it. I am using the below single line comment
>
> // Single-line comments
>
> SL_COMMENT
>
> : "//" (~('\r'|'\n'))* {$setType(Token.SKIP);}
>
> //:"//" (~('\r'|'\n'))*
>
> ;
>
> Please help me..
>
> Its very urgent.
>
>
>
> Vasanthi.
>
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
>


More information about the antlr-interest mailing list