[antlr-interest] "Balanced Matching" and ANTLR

A Z asicaddress at gmail.com
Fri Apr 29 15:42:25 PDT 2011


Is this what you mean?

module_body :
  (~(K_MODULE | K_ENDMODULE) | (K_MODULE module_body K_ENDMODULE))+;

module_declaration :
  key=K_MODULE lifetime? var=identifier module_body post=K_ENDMODULE (COLON
pident=identifier)?;

In the code below, the rule module_declaration will match only the outermost
module 'outside'.

module outside;

  module inside1;
  endmodule : inside1

  module inside2;
  endmodule

endmodule




On Thu, Apr 28, 2011 at 1:03 PM, Udo Weik <WeikEngOff at aol.com> wrote:

> Hello,
>
> I'm just looking for common approaches for "Balanced Matching" with ANTLR,
> e. g. the typical problem for extracting methods/functions/procedures
> in source files. Any hints are highly appreciated.
>
>
> Many thanks and greetings
> Udo
>
> 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