Class 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 Detail

      • DetectRootRulesVisitor

        public DetectRootRulesVisitor()
    • Method Detail

      • 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:
        visit in class Visitor
        Parameters:
        rule - rule object
        Throws:
        SemanticException - if the rule was already declared as root