Class AbstractCodeGenVisitor

java.lang.Object
de.monticore.codegen.AbstractCodeGenVisitor
All Implemented Interfaces:
CodeGenerator, de.monticore.visitor.IHandler
Direct Known Subclasses:
AbstractJavaGenVisitor

public abstract class AbstractCodeGenVisitor extends Object implements CodeGenerator, de.monticore.visitor.IHandler
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected boolean
     
    protected static final String
     
    protected de.monticore.prettyprint.IndentPrinter
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    AbstractCodeGenVisitor(de.monticore.prettyprint.IndentPrinter printer)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    generateCode(de.monticore.ast.ASTNode node)
    Generates code for the given ASTNode.
    de.monticore.prettyprint.IndentPrinter
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface de.monticore.visitor.IHandler

    getTraverser, handle, handle, handle, handle, handle, traverse, traverse
  • Field Details

    • LOG_NAME

      protected static final String LOG_NAME
      See Also:
    • isWithinGenerateCode

      protected boolean isWithinGenerateCode
    • printer

      protected de.monticore.prettyprint.IndentPrinter printer
  • Constructor Details

    • AbstractCodeGenVisitor

      protected AbstractCodeGenVisitor(de.monticore.prettyprint.IndentPrinter printer)
  • Method Details

    • generateCode

      public String generateCode(de.monticore.ast.ASTNode node)
      Generates code for the given ASTNode.

      This method may not be called recursively, as the buffer is cleared.

      Specified by:
      generateCode in interface CodeGenerator
      Parameters:
      node - The node to generate code for.
      Returns:
      the generated code
    • getPrinter

      public de.monticore.prettyprint.IndentPrinter getPrinter()
      Specified by:
      getPrinter in interface CodeGenerator
      Returns:
      the printer storing the (intermediate/final results)