dk.brics.servletvalidator
Class SingleProductionNonTerminalRemovalVisitor
java.lang.Object
dk.brics.servletvalidator.grammar.AbstractGrammarEntityVisitor
dk.brics.servletvalidator.SingleProductionNonTerminalRemovalVisitor
- All Implemented Interfaces:
- GrammarEntityVisitor
public class SingleProductionNonTerminalRemovalVisitor
- extends AbstractGrammarEntityVisitor
Removes all non terminals that have only 1 production that is only used in 1 place
by inlining its production everywhere where it is used. Especially when the grammar
is first created this helps readability a lot and improves analysis performance.
| Methods inherited from class dk.brics.servletvalidator.grammar.AbstractGrammarEntityVisitor |
apply, apply, apply, getPath, in, in, in, isMarked, mark, out, out, print |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SingleProductionNonTerminalRemovalVisitor
public SingleProductionNonTerminalRemovalVisitor()
apply
public void apply(Grammar g)
- Specified by:
apply in interface GrammarEntityVisitor- Overrides:
apply in class AbstractGrammarEntityVisitor
out
public void out(NonTerminal nonTerminal)
- Specified by:
out in interface GrammarEntityVisitor- Overrides:
out in class AbstractGrammarEntityVisitor
shouldPrettyPrint
public boolean shouldPrettyPrint()
- Description copied from class:
AbstractGrammarEntityVisitor
- If this method returns true the grammar will be printed to debug after the visitor has run
- Specified by:
shouldPrettyPrint in interface GrammarEntityVisitor- Overrides:
shouldPrettyPrint in class AbstractGrammarEntityVisitor
Copyright © 2008 Mathias Schwarz.