Class TemplateDebugger

All Implemented Interfaces:
JexlInfo.Detail

public class TemplateDebugger extends Debugger
A visitor for templates.

A friend (ala C++) of template engine.

  • Field Details

  • Constructor Details

    • TemplateDebugger

      public TemplateDebugger()
      Default ctor.
  • Method Details

    • reset

      public void reset()
      Description copied from class: Debugger
      Resets this debugger state.
      Overrides:
      reset in class Debugger
    • debug

      public boolean debug(JxltEngine.Expression je)
      Position the debugger on the root of a template expression.
      Parameters:
      je - the expression
      Returns:
      true if the expression was a TemplateEngine.TemplateExpression instance, false otherwise
    • debug

      public boolean debug(JxltEngine.Template jt)
      Position the debugger on the root of a template script.
      Parameters:
      jt - the template
      Returns:
      true if the template was a TemplateScript instance, false otherwise
    • visit

      protected Object visit(ASTBlock node, Object data)
      Overrides:
      visit in class Debugger
    • acceptStatement

      protected Object acceptStatement(JexlNode child, Object data)
      Description copied from class: Debugger
      Adds a statement node to the rebuilt expression.
      Overrides:
      acceptStatement in class Debugger
      Parameters:
      child - the child node
      data - visitor pattern argument
      Returns:
      visitor pattern value
    • getPrintStatement

      private TemplateEngine.TemplateExpression getPrintStatement(JexlNode child)
      In a template, any statement that is not 'jexl:print(n)' must be prefixed by "$$".
      Parameters:
      child - the node to check
      Returns:
      the expression number or -1 if the node is not a jexl:print
    • newJexlLine

      private void newJexlLine()
      Insert $$ and \n when needed.
    • newJxltLine

      private void newJxltLine()
      Insert \n when needed.
    • visit

      private Object visit(TemplateEngine.TemplateExpression expr, Object data)
      Visit a template expression.
      Parameters:
      expr - the constant expression
      data - the visitor argument
      Returns:
      the visitor argument
    • visit

      private Object visit(TemplateEngine.ConstantExpression expr, Object data)
      Visit a constant expression.
      Parameters:
      expr - the constant expression
      data - the visitor argument
      Returns:
      the visitor argument
    • visit

      private Object visit(TemplateEngine.ImmediateExpression expr, Object data)
      Visit an immediate expression.
      Parameters:
      expr - the immediate expression
      data - the visitor argument
      Returns:
      the visitor argument
    • visit

      private Object visit(TemplateEngine.DeferredExpression expr, Object data)
      Visit a deferred expression.
      Parameters:
      expr - the deferred expression
      data - the visitor argument
      Returns:
      the visitor argument
    • visit

      private Object visit(TemplateEngine.NestedExpression expr, Object data)
      Visit a nested expression.
      Parameters:
      expr - the nested expression
      data - the visitor argument
      Returns:
      the visitor argument
    • visit

      private Object visit(TemplateEngine.CompositeExpression expr, Object data)
      Visit a composite expression.
      Parameters:
      expr - the composite expression
      data - the visitor argument
      Returns:
      the visitor argument