Usage:
java org.antlr.morph.Tool [args] file.morph
Option |
description |
|---|---|
-detect-loop |
detect/prevent infinite morphing loops |
ANTLRMorph grammar cleaner
ANTLRMorph also provides a tool which helps you clean up a grammar. By default, it strips off all options, actions, scopes, arguments, return values and exceptions from the grammar, but keeps rewrite alternatives and rule reference labels. The tool simply prints out the result to standard output, so you can redirect standard output to a file by using the > sign after the command and before a file name. If you want to clean up everything or keep any element of the grammar, please use the argument options defined below in the command line. Also note that this tool only works on parser rules, and doesn't affect lexer rules.
Usage:
java org.antlr.morph.Strip [args] file.g
Option |
description |
|---|---|
-strip-rewrite |
strip off rewrites and rule/token reference labels |
-strip-label |
strip off rule/token reference labels |
-grammar-option |
keep grammar options |
-grammar-action |
keep grammar actions, e.g. header, members |
-globalscope |
keep global scopes |
-rule-argument |
keep rule arguments |
-rule-returnvalue |
keep rule return values |
-rule-throws |
keep rule throws specification |
-rule-option |
keep rule options |
-rule-scope |
keep rule scope |
-rule-action |
keep rule actions, e.g. @init, @after |
-rule-exception |
keep rule exception group |
-alt-action |
keep alternative actions |
-alt-ruleargument |
keep alternative rule reference arguments |
-alt-tokenargument |
keep alternative token reference arguments |
-label |
keep rule/token reference labels |
2 Comments
Hide/Show CommentsDec 03, 2008
Lonnie VanZandt
Is this perhaps what I should run to "purify" the examples which are cluttered with Java code?
Dec 04, 2008
Jim Idle
Type:
java org.antlr.Tool
You will see a list of command line options (see wiki docs for them all):