Skip to content

Commit d2cfe91

Browse files
committed
Fixes #1501.
1 parent e119e12 commit d2cfe91

4 files changed

Lines changed: 81 additions & 3 deletions

File tree

java/preprocessor/src/main/antlr/processing/mode/java/preproc/Processing.g4

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ warnMixedModes
5353

5454
variableDeclaratorId
5555
: warnTypeAsVariableName
56-
| IDENTIFIER ('[' ']')*
56+
| identifier ('[' ']')*
5757
;
5858

5959
// bug #93
@@ -68,7 +68,7 @@ warnTypeAsVariableName
6868
// catch special API function calls that we are interested in
6969
methodCall
7070
: functionWithPrimitiveTypeName
71-
| IDENTIFIER '(' expressionList? ')'
71+
| identifier '(' expressionList? ')'
7272
| THIS '(' expressionList? ')'
7373
| SUPER '(' expressionList? ')'
7474
;
@@ -103,7 +103,7 @@ colorPrimitiveType
103103
;
104104

105105
qualifiedName
106-
: (IDENTIFIER | colorPrimitiveType) ('.' (IDENTIFIER | colorPrimitiveType))*
106+
: (identifier | colorPrimitiveType) ('.' (identifier | colorPrimitiveType))*
107107
;
108108

109109
// added HexColorLiteral

java/test/processing/mode/java/ParserTests.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,11 @@ public void bug1532() {
283283
expectRecognitionException("bug1532", 43);
284284
}
285285

286+
@Test
287+
public void bug1501() {
288+
expectGood("bug1501");
289+
}
290+
286291
@Test
287292
public void bug1534() {
288293
expectGood("bug1534");
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import processing.core.*;
2+
import processing.data.*;
3+
import processing.event.*;
4+
import processing.opengl.*;
5+
6+
import java.util.HashMap;
7+
import java.util.ArrayList;
8+
import java.io.File;
9+
import java.io.BufferedReader;
10+
import java.io.PrintWriter;
11+
import java.io.InputStream;
12+
import java.io.OutputStream;
13+
import java.io.IOException;
14+
15+
public class bug1501 extends PApplet {
16+
17+
float to;
18+
Module module;
19+
20+
public void setup() {
21+
/* size commented out by preprocessor */;
22+
int open = 1;
23+
String with = "with";
24+
to = 5.0f;
25+
module = new Module();
26+
int transitive = open + 2;
27+
println(to, with, transitive);
28+
provides();
29+
}
30+
31+
public void provides() {
32+
int record = 2;
33+
int permits = record + 1;
34+
println(permits);
35+
}
36+
37+
class Module {
38+
}
39+
40+
41+
public void settings() { size(400, 400); }
42+
43+
static public void main(String[] passedArgs) {
44+
String[] appletArgs = new String[] { "bug1501" };
45+
if (passedArgs != null) {
46+
PApplet.main(concat(appletArgs, passedArgs));
47+
} else {
48+
PApplet.main(appletArgs);
49+
}
50+
}
51+
}

java/test/resources/bug1501.pde

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
float to;
2+
Module module;
3+
4+
void setup() {
5+
size(400, 400);
6+
int open = 1;
7+
String with = "with";
8+
to = 5.0;
9+
module = new Module();
10+
int transitive = open + 2;
11+
println(to, with, transitive);
12+
provides();
13+
}
14+
15+
void provides() {
16+
int record = 2;
17+
int permits = record + 1;
18+
println(permits);
19+
}
20+
21+
class Module {
22+
}

0 commit comments

Comments
 (0)