Skip to content

Commit 4b5ceb1

Browse files
author
jdf
committed
Fix a regression on #1515. New tests.
1 parent 3091596 commit 4b5ceb1

6 files changed

Lines changed: 78 additions & 1 deletion

File tree

app/grammars/pde.g

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ pdeProgram
6262
// selected in the previous alternative. static mode programs
6363
// don't have member functions.
6464
//
65-
| ( ( options {greedy=false;}: possiblyEmptyField)* builtInType IDENT LPAREN )
65+
// The typeSpec match causes ANTLR to emit a warning about potentially
66+
// exiting the nongreedy match incorrectly, but I haven't found a case
67+
// of that in practice. Please report such a case!
68+
| ( (options{greedy=false;}: possiblyEmptyField)* typeSpec[false] IDENT LPAREN )
6669
=> activeProgram
6770
{ pp.setProgramType(PdePreprocessor.ProgramType.ACTIVE); }
6871

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import processing.core.*;
2+
import processing.xml.*;
3+
4+
import java.applet.*;
5+
import java.awt.Dimension;
6+
import java.awt.Frame;
7+
import java.awt.event.MouseEvent;
8+
import java.awt.event.KeyEvent;
9+
import java.awt.event.FocusEvent;
10+
import java.awt.Image;
11+
import java.io.*;
12+
import java.net.*;
13+
import java.text.*;
14+
import java.util.*;
15+
import java.util.zip.*;
16+
import java.util.regex.*;
17+
18+
public class bug1512 extends PApplet {
19+
public void setup() {
20+
println("oi/*");
21+
noLoop();
22+
}
23+
static public void main(String args[]) {
24+
PApplet.main(new String[] { "--bgcolor=null", "bug1512" });
25+
}
26+
}

app/test/resources/bug1512.pde

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
println("oi/*");
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import processing.core.*;
2+
import processing.xml.*;
3+
4+
import java.applet.*;
5+
import java.awt.Dimension;
6+
import java.awt.Frame;
7+
import java.awt.event.MouseEvent;
8+
import java.awt.event.KeyEvent;
9+
import java.awt.event.FocusEvent;
10+
import java.awt.Image;
11+
import java.io.*;
12+
import java.net.*;
13+
import java.text.*;
14+
import java.util.*;
15+
import java.util.zip.*;
16+
import java.util.regex.*;
17+
18+
public class bug1515 extends PApplet {
19+
20+
// a class definition that does something with things that extend PApplet
21+
class Heythere<T extends PApplet>{
22+
}
23+
24+
// method definition which can do things with papplet
25+
public <T extends PApplet> void doSomething( T thing ){
26+
}
27+
static public void main(String args[]) {
28+
PApplet.main(new String[] { "--bgcolor=null", "bug1515" });
29+
}
30+
}

app/test/resources/bug1515.pde

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// a class definition that does something with things that extend PApplet
2+
class Heythere<T extends PApplet>{
3+
}
4+
5+
// method definition which can do things with papplet
6+
public <T extends PApplet> void doSomething( T thing ){
7+
}

app/test/src/test/processing/parsing/ParserTests.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,11 @@ public void bug1511() {
255255
expectGood("bug1511");
256256
}
257257

258+
@Test
259+
public void bug1512() {
260+
expectGood("bug1512");
261+
}
262+
258263
@Test
259264
public void bug1514a() {
260265
expectGood("bug1514a");
@@ -265,6 +270,11 @@ public void bug1514b() {
265270
expectGood("bug1514b");
266271
}
267272

273+
@Test
274+
public void bug1515() {
275+
expectGood("bug1515");
276+
}
277+
268278
@Test
269279
public void bug1516() {
270280
expectGood("bug1516");

0 commit comments

Comments
 (0)