Package net.emustudio.edigen.passes
Class DetectRootRulesVisitor
- java.lang.Object
-
- net.emustudio.edigen.Visitor
-
- net.emustudio.edigen.passes.DetectRootRulesVisitor
-
public class DetectRootRulesVisitor extends Visitor
Detects root rules, including undefined root rules. If one or more undefined root rules are found, an exception is thrown.
-
-
Constructor Summary
Constructors Constructor Description DetectRootRulesVisitor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidvisit(Decoder decoder)voidvisit(Rule rule)Assigns rule objects to the mapping of names to objects.
-
-
-
Method Detail
-
visit
public void visit(Decoder decoder) throws SemanticException
- Overrides:
visitin classVisitor- Throws:
SemanticException
-
visit
public void visit(Rule rule) throws SemanticException
Assigns rule objects to the mapping of names to objects. Also checks if some declared root rule name points to already declared rule with another name. If this case isn't catched, there will be practically multiple tries of decoding the same thing - if it failed once, it certainly fails second time (we assume reading memory is idempotent).- Overrides:
visitin classVisitor- Parameters:
rule- rule object- Throws:
SemanticException- if the rule was already declared as root
-
-