From bb985b0e4a9c7d93228bc91d4ede04371d4d9079 Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Mon, 21 Sep 2015 23:43:07 -0400 Subject: [PATCH] cleaning and todo notes --- .../mode/java/pdex/ErrorCheckerService.java | 2 +- .../mode/java/pdex/JavaTextAreaPainter.java | 1 - .../mode/java/pdex/XQPreprocessor.java | 27 +++++++++---------- todo.txt | 11 ++++---- 4 files changed, 18 insertions(+), 23 deletions(-) diff --git a/java/src/processing/mode/java/pdex/ErrorCheckerService.java b/java/src/processing/mode/java/pdex/ErrorCheckerService.java index 0d2e0f84f..a8ae51607 100644 --- a/java/src/processing/mode/java/pdex/ErrorCheckerService.java +++ b/java/src/processing/mode/java/pdex/ErrorCheckerService.java @@ -494,7 +494,7 @@ public class ErrorCheckerService implements Runnable { if (problems.length == 0 && !editor.hasJavaTabs()) { //mainClassOffset++; // just a hack. - sourceCode = xqpreproc.doYourThing(sourceCode, programImports); + sourceCode = xqpreproc.handle(sourceCode, programImports); prepareCompilerClasspath(); // mainClassOffset = xqpreproc.mainClassOffset; // tiny, but // // significant diff --git a/java/src/processing/mode/java/pdex/JavaTextAreaPainter.java b/java/src/processing/mode/java/pdex/JavaTextAreaPainter.java index bc9620eb0..2a71c8dd4 100644 --- a/java/src/processing/mode/java/pdex/JavaTextAreaPainter.java +++ b/java/src/processing/mode/java/pdex/JavaTextAreaPainter.java @@ -39,7 +39,6 @@ import java.awt.event.MouseMotionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.image.BufferedImage; -import java.util.ArrayList; import java.util.List; import javax.swing.text.BadLocationException; diff --git a/java/src/processing/mode/java/pdex/XQPreprocessor.java b/java/src/processing/mode/java/pdex/XQPreprocessor.java index 5c027185e..556296055 100644 --- a/java/src/processing/mode/java/pdex/XQPreprocessor.java +++ b/java/src/processing/mode/java/pdex/XQPreprocessor.java @@ -31,7 +31,6 @@ import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jdt.core.dom.MethodDeclaration; import org.eclipse.jdt.core.dom.Modifier; import org.eclipse.jdt.core.dom.NumberLiteral; -import org.eclipse.jdt.core.dom.SimpleType; import org.eclipse.jdt.core.dom.rewrite.ASTRewrite; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.Document; @@ -44,9 +43,8 @@ import processing.mode.java.preproc.PdePreprocessor; /** - * Implementation of P5 preprocessor that uses Eclipse JDT features instead - * of ANTLR. Performance gains mostly and full control over debug output, - * but needs lots and lots of testing. + * Implementation of PdePreprocessor that uses Eclipse JDT features + * instead of ANTLR. */ public class XQPreprocessor { private ASTRewrite rewrite = null; @@ -56,8 +54,10 @@ public class XQPreprocessor { private String[] defaultImports; - public XQPreprocessor(ErrorCheckerService errorCheckerService) { - ecs = errorCheckerService; + public XQPreprocessor(ErrorCheckerService ecs) { + this.ecs = ecs; + + // get parameters from the main preproc PdePreprocessor p = new PdePreprocessor(null); defaultImports = p.getDefaultImports(); coreImports = p.getCoreImports(); @@ -67,8 +67,8 @@ public class XQPreprocessor { /** * The main preprocessing method that converts code into compilable Java. */ - public String doYourThing(String source, - List programImports) { + protected String handle(String source, + List programImports) { this.extraImports = programImports; Document doc = new Document(source); @@ -77,7 +77,7 @@ public class XQPreprocessor { parser.setKind(ASTParser.K_COMPILATION_UNIT); @SuppressWarnings("unchecked") - Map options = JavaCore.getOptions(); + Map options = JavaCore.getOptions(); JavaCore.setComplianceOptions(JavaCore.VERSION_1_8, options); options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_8); @@ -85,7 +85,7 @@ public class XQPreprocessor { CompilationUnit cu = (CompilationUnit) parser.createAST(null); cu.recordModifications(); rewrite = ASTRewrite.create(cu.getAST()); - cu.accept(new XQASTVisitor()); + cu.accept(new XQVisitor()); TextEdit edits = cu.rewrite(doc, null); try { @@ -99,7 +99,7 @@ public class XQPreprocessor { } - String prepareImports(List programImports) { + protected String prepareImports(List programImports) { this.extraImports = programImports; StringList imports = new StringList(); @@ -139,11 +139,8 @@ public class XQPreprocessor { *
  • Converts doubles into floats, i.e. 12.3 becomes 12.3f so that people * don't have to add f after their numbers all the time since it's confusing * for beginners. Also, most functions of p5 core deal with floats only. - * - * @author Manindra Moharana - * */ - private class XQASTVisitor extends ASTVisitor { + private class XQVisitor extends ASTVisitor { @SuppressWarnings({ "unchecked", "rawtypes" }) public boolean visit(MethodDeclaration node) { if (node.getReturnType2() != null) { diff --git a/todo.txt b/todo.txt index dbdc8ee57..ea133e202 100644 --- a/todo.txt +++ b/todo.txt @@ -101,7 +101,7 @@ X https://github.com/processing/processing/issues/3608 X "update all" button appears to do nothing in library manager X https://github.com/processing/processing/issues/3837 X https://github.com/processing/processing/pull/3842 -_ All contributions listed after install button is clicked +_ contributions filter is ignored after clicking Install _ https://github.com/processing/processing/issues/3826 jakub @@ -114,6 +114,10 @@ X https://github.com/processing/processing/pull/3845 X Red error underline is sometimes at wrong location X https://github.com/processing/processing/issues/3759 X https://github.com/processing/processing/pull/3848 +X using "new color()" instead of "color()" results in "color type detected" +X happens when user does 'new color' instead of 'color' +X https://github.com/processing/processing/issues/3739 +X https://github.com/processing/processing/pull/3850 known issues @@ -554,11 +558,6 @@ _ http://i.msdn.microsoft.com/Aa511273.Confirmations03(en-us,MSDN.10).png PDE / Compiler & Preprocessor -live error checker -_ using "new color()" instead of "color()" results in "color type detected" -_ happens when user does 'new color' instead of 'color' -_ https://github.com/processing/processing/issues/3739 - medium (bugs/features) _ preprocessor throws error when calling color() on a PGraphics _ https://github.com/processing/processing/issues/3762