From f9597836f10b69ebd8a6e28cc6314936eb5ebadb Mon Sep 17 00:00:00 2001 From: jdf Date: Fri, 12 Mar 2010 20:52:15 +0000 Subject: [PATCH] Support static import. --- app/src/processing/app/preproc/PdeEmitter.java | 6 ++++++ .../processing/app/preproc/PdePreprocessor.java | 14 +++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/app/src/processing/app/preproc/PdeEmitter.java b/app/src/processing/app/preproc/PdeEmitter.java index 62c809b30..8f70646b6 100644 --- a/app/src/processing/app/preproc/PdeEmitter.java +++ b/app/src/processing/app/preproc/PdeEmitter.java @@ -284,6 +284,12 @@ public class PdeEmitter implements PdeTokenTypes print(ast.getFirstChild()); break; + case STATIC_IMPORT: + out.print("import static"); + dumpHiddenAfter(ast); + print(ast.getFirstChild()); + break; + case CLASS_DEF: case INTERFACE_DEF: print(getChild(ast, MODIFIERS)); diff --git a/app/src/processing/app/preproc/PdePreprocessor.java b/app/src/processing/app/preproc/PdePreprocessor.java index ea06bb820..52e955d07 100644 --- a/app/src/processing/app/preproc/PdePreprocessor.java +++ b/app/src/processing/app/preproc/PdePreprocessor.java @@ -197,7 +197,7 @@ public class PdePreprocessor { } //String importRegexp = "(?:^|\\s|;)(import\\s+)(\\S+)(\\s*;)"; - String importRegexp = "(?:^|;)\\s*(import\\s+)(\\S+)(\\s*;)"; + String importRegexp = "(?:^|;)\\s*(import\\s+)((?:static\\s+)?\\S+)(\\s*;)"; programImports = new ArrayList(); do { @@ -379,12 +379,12 @@ public class PdePreprocessor { emitter.setOut(stream); emitter.print(rootNode); - // debugAST(rootNode, false); - // final ByteArrayOutputStream buf = new ByteArrayOutputStream(); - // final PrintStream bufout = new PrintStream(buf); - // emitter.setOut(bufout); - // emitter.print(rootNode); - // System.err.println(new String(buf.toByteArray())); + debugAST(rootNode, false); + final ByteArrayOutputStream buf = new ByteArrayOutputStream(); + final PrintStream bufout = new PrintStream(buf); + emitter.setOut(bufout); + emitter.print(rootNode); + System.err.println(new String(buf.toByteArray())); writeFooter(stream, name); stream.close();