Exemplo n.º 1
0
 @Override
 public void visitBreak(JCBreak tree) {
   storePositions(tree);
   super.visitBreak(tree);
 }
Exemplo n.º 2
0
 @Override
 public void visitModifiers(JCModifiers mods) {
   storePositions(mods);
   super.visitModifiers(mods);
 }
Exemplo n.º 3
0
 @Override
 public void visitTree(JCTree tree) {
   storePositions(tree);
   super.visitTree(tree);
 }
Exemplo n.º 4
0
 @Override
 public void visitWildcard(JCWildcard tree) {
   storePositions(tree);
   super.visitWildcard(tree);
 }
Exemplo n.º 5
0
 @Override
 public void visitErroneous(JCErroneous tree) {
   storePositions(tree);
   super.visitErroneous(tree);
 }
Exemplo n.º 6
0
 @Override
 public void visitTypeIdent(JCPrimitiveTypeTree tree) {
   storePositions(tree);
   super.visitTypeIdent(tree);
 }
Exemplo n.º 7
0
 @Override
 public void visitTypeApply(JCTypeApply tree) {
   storePositions(tree);
   super.visitTypeApply(tree);
 }
Exemplo n.º 8
0
 @Override
 public void visitNewClass(JCNewClass tree) {
   storePositions(tree);
   super.visitNewClass(tree);
 }
Exemplo n.º 9
0
 @Override
 public void visitNewArray(JCNewArray tree) {
   storePositions(tree);
   super.visitNewArray(tree);
 }
Exemplo n.º 10
0
 @Override
 public void visitAssert(JCAssert tree) {
   storePositions(tree);
   super.visitAssert(tree);
 }
Exemplo n.º 11
0
 @Override
 public void visitApply(JCMethodInvocation tree) {
   storePositions(tree);
   super.visitApply(tree);
 }
Exemplo n.º 12
0
 @Override
 public void visitThrow(JCThrow tree) {
   storePositions(tree);
   super.visitThrow(tree);
 }
Exemplo n.º 13
0
 @Override
 public void visitReturn(JCReturn tree) {
   storePositions(tree);
   super.visitReturn(tree);
 }
Exemplo n.º 14
0
 @Override
 public void visitContinue(JCContinue tree) {
   storePositions(tree);
   super.visitContinue(tree);
 }
Exemplo n.º 15
0
 @Override
 public void visitIdent(JCIdent tree) {
   storePositions(tree);
   super.visitIdent(tree);
 }
Exemplo n.º 16
0
 @Override
 public void visitParens(JCParens tree) {
   storePositions(tree);
   super.visitParens(tree);
 }
Exemplo n.º 17
0
 @Override
 public void visitLiteral(JCLiteral tree) {
   storePositions(tree);
   super.visitLiteral(tree);
 }
Exemplo n.º 18
0
 @Override
 public void visitAssignop(JCAssignOp tree) {
   storePositions(tree);
   super.visitAssignop(tree);
 }
Exemplo n.º 19
0
 @Override
 public void visitTypeArray(JCArrayTypeTree tree) {
   storePositions(tree);
   super.visitTypeArray(tree);
 }
Exemplo n.º 20
0
 @Override
 public void visitBinary(JCBinary tree) {
   storePositions(tree);
   super.visitBinary(tree);
 }
Exemplo n.º 21
0
 @Override
 public void visitTypeParameter(JCTypeParameter tree) {
   storePositions(tree);
   super.visitTypeParameter(tree);
 }
Exemplo n.º 22
0
 @Override
 public void visitTypeCast(JCTypeCast tree) {
   storePositions(tree);
   super.visitTypeCast(tree);
 }
Exemplo n.º 23
0
 @Override
 public void visitTypeBoundKind(TypeBoundKind tree) {
   storePositions(tree);
   super.visitTypeBoundKind(tree);
 }
Exemplo n.º 24
0
 @Override
 public void visitTypeTest(JCInstanceOf tree) {
   storePositions(tree);
   super.visitTypeTest(tree);
 }
Exemplo n.º 25
0
 @Override
 public void visitLetExpr(LetExpr tree) {
   storePositions(tree);
   super.visitLetExpr(tree);
 }
Exemplo n.º 26
0
 @Override
 public void visitIndexed(JCArrayAccess tree) {
   storePositions(tree);
   super.visitIndexed(tree);
 }
Exemplo n.º 27
0
 @Override
 public void visitAnnotation(JCAnnotation tree) {
   storePositions(tree);
   super.visitAnnotation(tree);
 }
Exemplo n.º 28
0
 @Override
 public void visitSelect(JCFieldAccess tree) {
   storePositions(tree);
   super.visitSelect(tree);
 }
Exemplo n.º 29
0
  public String getJavaSourceCodeWithCeylonPositions() {
    final CharArrayWriter writer = new CharArrayWriter();
    Pretty printer =
        new Pretty(writer, true) {
          int previousCeylonPosition = -1;
          int previousPositionInString = 0;

          private void outputCeylonPosition(JCTree tree) {
            try {
              int currentCeylonPosition = tree.getPreferredPosition();
              int currentPositionInString = writer.size();
              if (previousCeylonPosition != currentCeylonPosition
                  || previousPositionInString != currentPositionInString) {
                if (currentCeylonPosition != -1 && currentCeylonPosition != 0) {
                  writer.write("/* " + formatCeylonPosition(currentCeylonPosition) + " */");
                }
                previousCeylonPosition = currentCeylonPosition;
                previousPositionInString = writer.size();
              }
            } catch (IOException e) {
              e.printStackTrace();
            }
          }

          @Override
          public void visitTopLevel(JCCompilationUnit tree) {
            outputCeylonPosition(tree);
            super.visitTopLevel(tree);
          }

          @Override
          public void visitImport(JCImport tree) {
            outputCeylonPosition(tree);
            super.visitImport(tree);
          }

          @Override
          public void visitClassDef(JCClassDecl tree) {
            outputCeylonPosition(tree);
            super.visitClassDef(tree);
          }

          @Override
          public void visitMethodDef(JCMethodDecl tree) {
            outputCeylonPosition(tree);
            super.visitMethodDef(tree);
          }

          @Override
          public void visitVarDef(JCVariableDecl tree) {
            outputCeylonPosition(tree);
            super.visitVarDef(tree);
          }

          @Override
          public void visitSkip(JCSkip tree) {
            outputCeylonPosition(tree);
            super.visitSkip(tree);
          }

          @Override
          public void visitBlock(JCBlock tree) {
            outputCeylonPosition(tree);
            super.visitBlock(tree);
            tree.endpos = currentPosition - 1;
          }

          @Override
          public void visitDoLoop(JCDoWhileLoop tree) {
            outputCeylonPosition(tree);
            super.visitDoLoop(tree);
          }

          @Override
          public void visitWhileLoop(JCWhileLoop tree) {
            outputCeylonPosition(tree);
            super.visitWhileLoop(tree);
          }

          @Override
          public void visitForLoop(JCForLoop tree) {
            outputCeylonPosition(tree);
            super.visitForLoop(tree);
          }

          @Override
          public void visitForeachLoop(JCEnhancedForLoop tree) {
            outputCeylonPosition(tree);
            super.visitForeachLoop(tree);
          }

          @Override
          public void visitLabelled(JCLabeledStatement tree) {
            outputCeylonPosition(tree);
            super.visitLabelled(tree);
          }

          @Override
          public void visitSwitch(JCSwitch tree) {
            outputCeylonPosition(tree);
            super.visitSwitch(tree);
          }

          @Override
          public void visitCase(JCCase tree) {
            outputCeylonPosition(tree);
            super.visitCase(tree);
          }

          @Override
          public void visitSynchronized(JCSynchronized tree) {
            outputCeylonPosition(tree);
            super.visitSynchronized(tree);
          }

          @Override
          public void visitTry(JCTry tree) {
            outputCeylonPosition(tree);
            super.visitTry(tree);
          }

          @Override
          public void visitCatch(JCCatch tree) {
            outputCeylonPosition(tree);
            super.visitCatch(tree);
          }

          @Override
          public void visitConditional(JCConditional tree) {
            outputCeylonPosition(tree);
            super.visitConditional(tree);
          }

          @Override
          public void visitIf(JCIf tree) {
            outputCeylonPosition(tree);
            super.visitIf(tree);
          }

          @Override
          public void visitExec(JCExpressionStatement tree) {
            outputCeylonPosition(tree);
            super.visitExec(tree);
          }

          @Override
          public void visitBreak(JCBreak tree) {
            outputCeylonPosition(tree);
            super.visitBreak(tree);
          }

          @Override
          public void visitContinue(JCContinue tree) {
            outputCeylonPosition(tree);
            super.visitContinue(tree);
          }

          @Override
          public void visitReturn(JCReturn tree) {
            outputCeylonPosition(tree);
            super.visitReturn(tree);
          }

          @Override
          public void visitThrow(JCThrow tree) {
            outputCeylonPosition(tree);
            super.visitThrow(tree);
          }

          @Override
          public void visitAssert(JCAssert tree) {
            outputCeylonPosition(tree);
            super.visitAssert(tree);
          }

          @Override
          public void visitApply(JCMethodInvocation tree) {
            outputCeylonPosition(tree);
            super.visitApply(tree);
          }

          @Override
          public void visitNewClass(JCNewClass tree) {
            outputCeylonPosition(tree);
            super.visitNewClass(tree);
          }

          @Override
          public void visitNewArray(JCNewArray tree) {
            outputCeylonPosition(tree);
            super.visitNewArray(tree);
          }

          @Override
          public void visitParens(JCParens tree) {
            outputCeylonPosition(tree);
            super.visitParens(tree);
          }

          @Override
          public void visitAssign(JCAssign tree) {
            outputCeylonPosition(tree);
            super.visitAssign(tree);
          }

          @Override
          public void visitAssignop(JCAssignOp tree) {
            outputCeylonPosition(tree);
            super.visitAssignop(tree);
          }

          @Override
          public void visitUnary(JCUnary tree) {
            outputCeylonPosition(tree);
            super.visitUnary(tree);
          }

          @Override
          public void visitBinary(JCBinary tree) {
            outputCeylonPosition(tree);
            super.visitBinary(tree);
          }

          @Override
          public void visitTypeCast(JCTypeCast tree) {
            outputCeylonPosition(tree);
            super.visitTypeCast(tree);
          }

          @Override
          public void visitTypeTest(JCInstanceOf tree) {
            outputCeylonPosition(tree);
            super.visitTypeTest(tree);
          }

          @Override
          public void visitIndexed(JCArrayAccess tree) {
            outputCeylonPosition(tree);
            super.visitIndexed(tree);
          }

          @Override
          public void visitSelect(JCFieldAccess tree) {
            outputCeylonPosition(tree);
            super.visitSelect(tree);
          }

          @Override
          public void visitIdent(JCIdent tree) {
            outputCeylonPosition(tree);
            super.visitIdent(tree);
          }

          @Override
          public void visitLiteral(JCLiteral tree) {
            outputCeylonPosition(tree);
            super.visitLiteral(tree);
          }

          @Override
          public void visitTypeIdent(JCPrimitiveTypeTree tree) {
            outputCeylonPosition(tree);
            super.visitTypeIdent(tree);
          }

          @Override
          public void visitTypeArray(JCArrayTypeTree tree) {
            outputCeylonPosition(tree);
            super.visitTypeArray(tree);
          }

          @Override
          public void visitTypeApply(JCTypeApply tree) {
            outputCeylonPosition(tree);
            super.visitTypeApply(tree);
          }

          @Override
          public void visitTypeParameter(JCTypeParameter tree) {
            outputCeylonPosition(tree);
            super.visitTypeParameter(tree);
          }

          @Override
          public void visitWildcard(JCWildcard tree) {
            outputCeylonPosition(tree);
            super.visitWildcard(tree);
          }

          @Override
          public void visitTypeBoundKind(TypeBoundKind tree) {
            outputCeylonPosition(tree);
            super.visitTypeBoundKind(tree);
          }

          @Override
          public void visitErroneous(JCErroneous tree) {
            outputCeylonPosition(tree);
            super.visitErroneous(tree);
          }

          @Override
          public void visitLetExpr(LetExpr tree) {
            outputCeylonPosition(tree);
            super.visitLetExpr(tree);
          }

          @Override
          public void visitModifiers(JCModifiers mods) {
            outputCeylonPosition(mods);
            super.visitModifiers(mods);
          }

          @Override
          public void visitAnnotation(JCAnnotation tree) {
            outputCeylonPosition(tree);
            super.visitAnnotation(tree);
          }

          @Override
          public void visitTree(JCTree tree) {
            outputCeylonPosition(tree);
            super.visitTree(tree);
          }
        };
    printer.visitTopLevel(unit);
    return writer.toString();
  }
Exemplo n.º 30
0
 @Override
 public void visitExec(JCExpressionStatement tree) {
   storePositions(tree);
   super.visitExec(tree);
 }