Class GenerateMethodsVisitor


  • public class GenerateMethodsVisitor
    extends Visitor
    A visitor which generates Java source code of the instruction decoder methods for all rules.
    • Constructor Summary

      Constructors 
      Constructor Description
      GenerateMethodsVisitor​(java.io.Writer output)
      Constructs the visitor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void visit​(Decoder decoder)
      Finds out which root rules are available.
      void visit​(Mask mask)
      Writes the unit reading code and if the mask is not zero-only, also writes the switch statement.
      void visit​(Pattern pattern)
      Writes the case / default statement.
      void visit​(Rule rule)
      Writes the method definition.
      void visit​(Subrule subrule)
      Writes the method invocation.
      void visit​(Variant variant)
      Writes the code for the recognized variant.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GenerateMethodsVisitor

        public GenerateMethodsVisitor​(java.io.Writer output)
        Constructs the visitor.
        Parameters:
        output - the output stream to write the code to
    • Method Detail

      • visit

        public void visit​(Mask mask)
                   throws SemanticException
        Writes the unit reading code and if the mask is not zero-only, also writes the switch statement.
        Overrides:
        visit in class Visitor
        Parameters:
        mask - the mask node
        Throws:
        SemanticException - never
      • visit

        public void visit​(Subrule subrule)
        Writes the method invocation. If the rule has multiple names, one method is associated with multiple rule names. So the particular field (rule name) must be passed as an argument.
        Overrides:
        visit in class Visitor
        Parameters:
        subrule - the subrule node