Package net.emustudio.edigen.passes
Class DetectUnusedRulesVisitor
- java.lang.Object
-
- net.emustudio.edigen.Visitor
-
- net.emustudio.edigen.passes.DetectUnusedRulesVisitor
-
public class DetectUnusedRulesVisitor extends Visitor
A visitor which finds unused rules. Unused rules are treated as errors.
-
-
Constructor Summary
Constructors Constructor Description DetectUnusedRulesVisitor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidvisit(Decoder decoder)voidvisit(Rule rule)In case of the root rule traverses it and saves references to other rules.voidvisit(Subrule subrule)
-
-
-
Method Detail
-
visit
public void visit(Decoder decoder) throws SemanticException
- Overrides:
visitin classVisitor- Throws:
SemanticException
-
visit
public void visit(Rule rule) throws SemanticException
In case of the root rule traverses it and saves references to other rules. Otherwise detects possible unused rule by checking its name(s) in the saved references.- Overrides:
visitin classVisitor- Parameters:
rule- the rule node- Throws:
SemanticException- when unused rule is detected
-
visit
public void visit(Subrule subrule) throws SemanticException
- Overrides:
visitin classVisitor- Throws:
SemanticException
-
-