diff --git a/app/grammars/pde.g b/app/grammars/pde.g index 666909941..2946635b9 100644 --- a/app/grammars/pde.g +++ b/app/grammars/pde.g @@ -62,7 +62,10 @@ pdeProgram // selected in the previous alternative. static mode programs // don't have member functions. // - | ( ( options {greedy=false;}: possiblyEmptyField)* builtInType IDENT LPAREN ) + // The typeSpec match causes ANTLR to emit a warning about potentially + // exiting the nongreedy match incorrectly, but I haven't found a case + // of that in practice. Please report such a case! + | ( (options{greedy=false;}: possiblyEmptyField)* typeSpec[false] IDENT LPAREN ) => activeProgram { pp.setProgramType(PdePreprocessor.ProgramType.ACTIVE); } diff --git a/app/test/resources/bug1512.expected b/app/test/resources/bug1512.expected new file mode 100644 index 000000000..b6c281c60 --- /dev/null +++ b/app/test/resources/bug1512.expected @@ -0,0 +1,26 @@ +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 bug1512 extends PApplet { + public void setup() { +println("oi/*"); + noLoop(); +} + static public void main(String args[]) { + PApplet.main(new String[] { "--bgcolor=null", "bug1512" }); + } +} diff --git a/app/test/resources/bug1512.pde b/app/test/resources/bug1512.pde new file mode 100644 index 000000000..6889db72d --- /dev/null +++ b/app/test/resources/bug1512.pde @@ -0,0 +1 @@ +println("oi/*"); \ No newline at end of file diff --git a/app/test/resources/bug1515.expected b/app/test/resources/bug1515.expected new file mode 100644 index 000000000..7e7e6bedd --- /dev/null +++ b/app/test/resources/bug1515.expected @@ -0,0 +1,30 @@ +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 bug1515 extends PApplet { + +// a class definition that does something with things that extend PApplet +class Heythere{ +} + +// method definition which can do things with papplet +public void doSomething( T thing ){ +} + static public void main(String args[]) { + PApplet.main(new String[] { "--bgcolor=null", "bug1515" }); + } +} diff --git a/app/test/resources/bug1515.pde b/app/test/resources/bug1515.pde new file mode 100644 index 000000000..14ae97ca0 --- /dev/null +++ b/app/test/resources/bug1515.pde @@ -0,0 +1,7 @@ +// a class definition that does something with things that extend PApplet +class Heythere{ +} + +// method definition which can do things with papplet +public void doSomething( T thing ){ +} \ No newline at end of file diff --git a/app/test/src/test/processing/parsing/ParserTests.java b/app/test/src/test/processing/parsing/ParserTests.java index 27eb2c323..0af404a82 100644 --- a/app/test/src/test/processing/parsing/ParserTests.java +++ b/app/test/src/test/processing/parsing/ParserTests.java @@ -255,6 +255,11 @@ public class ParserTests { expectGood("bug1511"); } + @Test + public void bug1512() { + expectGood("bug1512"); + } + @Test public void bug1514a() { expectGood("bug1514a"); @@ -265,6 +270,11 @@ public class ParserTests { expectGood("bug1514b"); } + @Test + public void bug1515() { + expectGood("bug1515"); + } + @Test public void bug1516() { expectGood("bug1516");