Package net.emustudio.edigen.generation
Class GenerateMethodsVisitor
- java.lang.Object
-
- net.emustudio.edigen.Visitor
-
- net.emustudio.edigen.generation.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 voidvisit(Decoder decoder)Finds out which root rules are available.voidvisit(Mask mask)Writes the unit reading code and if the mask is not zero-only, also writes theswitchstatement.voidvisit(Pattern pattern)Writes thecase/defaultstatement.voidvisit(Rule rule)Writes the method definition.voidvisit(Subrule subrule)Writes the method invocation.voidvisit(Variant variant)Writes the code for the recognized variant.
-
-
-
Method Detail
-
visit
public void visit(Decoder decoder) throws SemanticException
Finds out which root rules are available.- Overrides:
visitin classVisitor- Parameters:
decoder- decoder node- Throws:
SemanticException- never
-
visit
public void visit(Rule rule) throws SemanticException
Writes the method definition.- Overrides:
visitin classVisitor- Parameters:
rule- the rule node- Throws:
SemanticException- never
-
visit
public void visit(Mask mask) throws SemanticException
Writes the unit reading code and if the mask is not zero-only, also writes theswitchstatement.- Overrides:
visitin classVisitor- Parameters:
mask- the mask node- Throws:
SemanticException- never
-
visit
public void visit(Pattern pattern) throws SemanticException
Writes thecase/defaultstatement.- Overrides:
visitin classVisitor- Parameters:
pattern- the pattern node- Throws:
SemanticException- never
-
visit
public void visit(Variant variant) throws SemanticException
Writes the code for the recognized variant.- Overrides:
visitin classVisitor- Parameters:
variant- the variant node- Throws:
SemanticException- never
-
-