Bruce Bauman wrote:
> 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
> '//'?
>
Easiest:
{ $text = '//' + $text.substring(2); }
But, you could also just do that when you come to actually sending out
the tokens as a rewritten stream.
Jim
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---