[antlr-interest] newbie grammar question

Bruce Bauman bruce.bauman at andesaservices.com
Mon Jun 8 12:41:09 PDT 2009


I am trying to automate the translation of a huge base of Pascal source
code from one dialect (MetaWare) to another (FreePascal).

One change I need to make is to modify comments like this:

-- This is a comment 

To this

// This is a comment

My current rule looks like this:

SL_COMMENT_2
    :   '--' (options {greedy=false;} : . )* '\n'
        {$channel=HIDDEN;}
    ;

What's the easiest way to modify the rule so that '--' is replaced by
'//'?

I have RTFM but a working solution still eludes me.

Thanks.

-- Bruce
CONFIDENTIALITY NOTICE: This e-mail is confidential and intended
solely for the use of the individual or entity to which it is addressed.  If
you are not the intended recipient, be advised that you have received 
this email in error and that any use, dissemination, forwarding, printing 
or copying of this e-mail is strictly prohibited. If you received this e-mail
in error, please delete it from your computer and contact the sender.



More information about the antlr-interest mailing list