[antlr-interest] Is it possible to create a custom "channel"?

Liviu U liviu.u at gmail.com
Tue Feb 10 01:28:36 PST 2009


Hi all, i am new to antlr and i have a conceptual problem:

I want to parse delphi pascal source code.
In pascal the preprocessor directive is fast the same as a comment:

directive    { $R *.dfm }

I want to collect the directives also but i dont't want to have them
in the rules. It will be impossible to handle this because
preprocessor directives can appear fast anywhere.

Is there a possibility to create a custom channel and write

COMMENT
    :   '{' WS* '$'  ( options {greedy=false;} : . )* '}' {$channel=CUSTOM;}


Thanks


More information about the antlr-interest mailing list