[antlr-interest] Nested Comments

Gavin Lambert antlr at mirality.co.nz
Wed May 28 01:57:08 PDT 2008


At 19:51 28/05/2008, mark.k.widdowson at jpmorgan.com wrote:
>I've been developing a Sybase SQL stored proc parser using 
>ANTLR3, and have run into the problem of dealing with nested 
>comments
>
>e.g.
>
>/*
>select  *
>from hello  /* table*/
>where
>field1 = 'world' /* field*/
>
>*/
>
>Ideally, I need to retain the line numbers whilst removing any 
>nested comments,

This is just air code, but:

MultiLineComment
   :  '/*'
      ( ('/*') => MultiLineComment
      | ~'*'
      | '*' ~'/'
      )*
      '*/'
   ;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080528/2d1e1fb2/attachment.html 


More information about the antlr-interest mailing list