mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Add support for @annotations in PDE
This commit is contained in:
@@ -738,6 +738,22 @@ public class PdeEmitter implements PdeTokenTypes {
|
||||
printChildren(ast);
|
||||
break;
|
||||
|
||||
case ANNOTATION:
|
||||
out.print("@");
|
||||
printChildren(ast);
|
||||
break;
|
||||
|
||||
case ANNOTATION_ARRAY_INIT:
|
||||
printChildren(ast);
|
||||
break;
|
||||
|
||||
case ANNOTATION_MEMBER_VALUE_PAIR:
|
||||
print(ast.getFirstChild());
|
||||
out.print("=");
|
||||
dumpHiddenBefore(getBestPrintableNode(ast.getFirstChild().getNextSibling(), false));
|
||||
print(ast.getFirstChild().getNextSibling());
|
||||
break;
|
||||
|
||||
default:
|
||||
debug.println("Unrecognized type:" + ast.getType() + " ("
|
||||
+ TokenUtil.nameOf(ast) + ")");
|
||||
|
||||
Executable
+47
@@ -0,0 +1,47 @@
|
||||
import processing.core.*;
|
||||
import processing.xml.*;
|
||||
|
||||
import java.applet.*;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Frame;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.Image;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
import java.util.zip.*;
|
||||
import java.util.regex.*;
|
||||
|
||||
public class annotations extends PApplet {
|
||||
|
||||
public void setup() {
|
||||
size(200,200);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void banana() {
|
||||
println("hey");
|
||||
}
|
||||
|
||||
@SuppressWarnings({"serial", "rawtypes"})
|
||||
class Banana implements Serializable {
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
class Apple implements Serializable {
|
||||
|
||||
}
|
||||
|
||||
@javax.annotation.Generated(value = {"com.mrfeinberg.ImmortalAroma"
|
||||
},
|
||||
comments="Shazam!",
|
||||
date="2001-07-04T12:08:56.235-0700")
|
||||
class Pear {}
|
||||
static public void main(String args[]) {
|
||||
PApplet.main(new String[] { "--bgcolor=null", "annotations" });
|
||||
}
|
||||
}
|
||||
Executable
+24
@@ -0,0 +1,24 @@
|
||||
void setup() {
|
||||
size(200,200);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void banana() {
|
||||
println("hey");
|
||||
}
|
||||
|
||||
@SuppressWarnings({"serial", "rawtypes"})
|
||||
class Banana implements Serializable {
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
class Apple implements Serializable {
|
||||
|
||||
}
|
||||
|
||||
@javax.annotation.Generated(value = {"com.mrfeinberg.ImmortalAroma"
|
||||
},
|
||||
comments="Shazam!",
|
||||
date="2001-07-04T12:08:56.235-0700")
|
||||
class Pear {}
|
||||
@@ -2,6 +2,9 @@ package test.processing.parsing;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.fail;
|
||||
import static test.processing.parsing.ProcessingTestUtil.COMPILER;
|
||||
import static test.processing.parsing.ProcessingTestUtil.preprocess;
|
||||
import static test.processing.parsing.ProcessingTestUtil.res;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.util.regex.Matcher;
|
||||
@@ -11,9 +14,6 @@ import org.junit.Test;
|
||||
import processing.app.debug.RunnerException;
|
||||
import processing.app.exec.ProcessResult;
|
||||
import antlr.RecognitionException;
|
||||
import static test.processing.parsing.ProcessingTestUtil.res;
|
||||
import static test.processing.parsing.ProcessingTestUtil.COMPILER;
|
||||
import static test.processing.parsing.ProcessingTestUtil.preprocess;
|
||||
|
||||
public class ParserTests {
|
||||
|
||||
@@ -279,4 +279,9 @@ public class ParserTests {
|
||||
public void bug400g() {
|
||||
expectGood("bug400g");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void annotations() {
|
||||
expectGood("annotations");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public class ProcessingTestUtil {
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
System.err.println("ProcessingTestUtil initialized.");
|
||||
//System.err.println("ProcessingTestUtil initialized.");
|
||||
}
|
||||
|
||||
static String normalize(final Object s) {
|
||||
|
||||
Reference in New Issue
Block a user