package org.nfunk.jep;

public class ParserDumpVisitor implements ParserVisitor {
  private int indent = 0;
  
  private String indentString() {
    StringBuffer stringBuffer = new StringBuffer();
    for (byte b = 0; b < this.indent; b++)
      stringBuffer.append("  "); 
    return stringBuffer.toString();
  }
  
  public Object visit(SimpleNode paramSimpleNode, Object paramObject) throws ParseException {
    System.out.println(indentString() + paramSimpleNode + ": acceptor not unimplemented in subclass?");
    this.indent++;
    paramObject = paramSimpleNode.childrenAccept(this, paramObject);
    this.indent--;
    return paramObject;
  }
  
  public Object visit(ASTStart paramASTStart, Object paramObject) throws ParseException {
    System.out.println(indentString() + paramASTStart);
    this.indent++;
    paramObject = paramASTStart.childrenAccept(this, paramObject);
    this.indent--;
    return paramObject;
  }
  
  public Object visit(ASTFunNode paramASTFunNode, Object paramObject) throws ParseException {
    System.out.println(indentString() + paramASTFunNode);
    this.indent++;
    paramObject = paramASTFunNode.childrenAccept(this, paramObject);
    this.indent--;
    return paramObject;
  }
  
  public Object visit(ASTVarNode paramASTVarNode, Object paramObject) throws ParseException {
    System.out.println(indentString() + paramASTVarNode);
    this.indent++;
    paramObject = paramASTVarNode.childrenAccept(this, paramObject);
    this.indent--;
    return paramObject;
  }
  
  public Object visit(ASTConstant paramASTConstant, Object paramObject) throws ParseException {
    System.out.println(indentString() + paramASTConstant);
    this.indent++;
    paramObject = paramASTConstant.childrenAccept(this, paramObject);
    this.indent--;
    return paramObject;
  }
}
