Skip to content

Commit bb69728

Browse files
committed
Finished restoring tests under updated grammer.
1 parent 5c1aa19 commit bb69728

5 files changed

Lines changed: 172 additions & 153 deletions

File tree

java/src/processing/mode/java/preproc/PdeParseTreeListener.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,12 @@ public void exitProcessingSketch(ProcessingParser.ProcessingSketchContext ctx) {
253253
}
254254
}
255255

256+
public void exitSpecialMethodDeclaration(ProcessingParser.SpecialMethodDeclarationContext ctx) {
257+
if (!ctx.getChild(0).getText().equals("public")) {
258+
rewriter.insertBefore(ctx.start, "public ");
259+
}
260+
}
261+
256262
protected void incLineOffset() {
257263
lineOffset++;
258264
}

java/src/processing/mode/java/preproc/Processing.g4

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,19 @@ warnTypeAsVariableName
6262
}
6363
;
6464

65+
// Catch setup, draw, and settings method declarations
66+
methodDeclaration
67+
: specialMethodDeclaration
68+
| methodModifier* methodHeader methodBody
69+
;
70+
71+
specialMethodDeclaration
72+
: 'public'? 'void' ( 'setup'
73+
| 'draw'
74+
| 'settings'
75+
) '(' ')' methodBody
76+
;
77+
6578
// catch special API function calls that we are interested in
6679
methodInvocation
6780
: apiFunction

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

Lines changed: 151 additions & 151 deletions
Original file line numberDiff line numberDiff line change
@@ -165,159 +165,159 @@ public void bug136() {
165165
public void bug196() {
166166
expectRecognitionException("bug196", 5);
167167
}
168-
//
169-
// @Test
170-
// public void bug281() {
171-
// expectGood("bug281");
172-
// }
173-
//
174-
// @Test
175-
// public void bug481() {
176-
// expectGood("bug481");
177-
// }
178-
//
179-
// @Test
180-
// public void bug507() {
181-
// expectRecognitionException("bug507", 5);
182-
// }
183-
//
184-
// @Test
185-
// public void bug598() {
186-
// expectGood("bug598");
187-
// }
188-
//
189-
// @Test
190-
// public void bug631() {
191-
// expectGood("bug631");
192-
// }
193-
//
194-
// @Test
195-
// public void bug763() {
196-
// expectRunnerException("bug763", 8);
197-
// }
198-
//
199-
// @Test
200-
// public void bug820() {
201-
// expectCompilerException("bug820", 19);
202-
// }
203-
//
204-
// @Test
205-
// public void bug1064() {
206-
// expectGood("bug1064");
207-
// }
208-
//
209-
// @Test
210-
// public void bug1145() {
211-
// expectCompilerException("bug1145", 6);
212-
// }
213-
//
214-
// @Test
215-
// public void bug1362() {
216-
// expectGood("bug1362");
217-
// }
218-
//
219-
// @Test
220-
// public void bug1390() {
221-
// expectGood("bug1390");
222-
// }
223-
//
224-
// @Test
225-
// public void bug1442() {
226-
// expectGood("bug1442");
227-
// }
228-
//
229-
// @Test
230-
// public void bug1511() {
231-
// expectGood("bug1511");
232-
// }
233-
//
234-
// @Test
235-
// public void bug1512() {
236-
// expectGood("bug1512");
237-
// }
238-
//
239-
// @Test
240-
// public void bug1514a() {
241-
// expectGood("bug1514a");
242-
// }
243-
//
244-
// @Test
245-
// public void bug1514b() {
246-
// expectGood("bug1514b");
247-
// }
248-
//
249-
// @Test
250-
// public void bug1515() {
251-
// expectGood("bug1515");
252-
// }
253-
//
254-
// @Test
255-
// public void bug1516() {
256-
// expectGood("bug1516");
257-
// }
258-
//
259-
// @Test
260-
// public void bug1517() {
261-
// expectGood("bug1517");
262-
// }
263-
//
264-
// @Test
265-
// public void bug1518a() {
266-
// expectGood("bug1518a");
267-
// }
268-
//
269-
// @Test
270-
// public void bug1518b() {
271-
// expectGood("bug1518b");
272-
// }
273-
//
274-
// @Test
275-
// public void bug1525() {
276-
// expectGood("bug1525");
277-
// }
278-
//
279-
// @Test
280-
// public void bug1532() {
281-
// expectRecognitionException("bug1532", 50);
282-
// }
283-
//
284-
// @Test
285-
// public void bug1534() {
286-
// expectGood("bug1534");
287-
// }
288-
//
289-
// @Test
290-
// public void bug1936() {
291-
// expectGood("bug1936");
292-
// }
293-
//
168+
169+
@Test
170+
public void bug281() {
171+
expectGood("bug281");
172+
}
173+
174+
@Test
175+
public void bug481() {
176+
expectGood("bug481");
177+
}
178+
179+
@Test
180+
public void bug507() {
181+
expectRecognitionException("bug507", 5);
182+
}
183+
184+
@Test
185+
public void bug598() {
186+
expectGood("bug598");
187+
}
188+
189+
@Test
190+
public void bug631() {
191+
expectGood("bug631");
192+
}
193+
194+
@Test
195+
public void bug763() {
196+
expectRunnerException("bug763", 8);
197+
}
198+
199+
@Test
200+
public void bug820() {
201+
expectCompilerException("bug820", 19);
202+
}
203+
204+
@Test
205+
public void bug1064() {
206+
expectGood("bug1064");
207+
}
208+
209+
@Test
210+
public void bug1145() {
211+
expectCompilerException("bug1145", 6);
212+
}
213+
214+
@Test
215+
public void bug1362() {
216+
expectGood("bug1362");
217+
}
218+
219+
@Test
220+
public void bug1390() {
221+
expectGood("bug1390");
222+
}
223+
224+
@Test
225+
public void bug1442() {
226+
expectGood("bug1442");
227+
}
228+
229+
@Test
230+
public void bug1511() {
231+
expectGood("bug1511");
232+
}
233+
234+
@Test
235+
public void bug1512() {
236+
expectGood("bug1512");
237+
}
238+
239+
@Test
240+
public void bug1514a() {
241+
expectGood("bug1514a");
242+
}
243+
244+
@Test
245+
public void bug1514b() {
246+
expectGood("bug1514b");
247+
}
248+
249+
@Test
250+
public void bug1515() {
251+
expectGood("bug1515");
252+
}
253+
254+
@Test
255+
public void bug1516() {
256+
expectGood("bug1516");
257+
}
258+
259+
@Test
260+
public void bug1517() {
261+
expectGood("bug1517");
262+
}
263+
264+
@Test
265+
public void bug1518a() {
266+
expectGood("bug1518a");
267+
}
268+
269+
@Test
270+
public void bug1518b() {
271+
expectGood("bug1518b");
272+
}
273+
274+
@Test
275+
public void bug1525() {
276+
expectGood("bug1525");
277+
}
278+
279+
@Test
280+
public void bug1532() {
281+
expectRecognitionException("bug1532", 46);
282+
}
283+
284+
@Test
285+
public void bug1534() {
286+
expectGood("bug1534");
287+
}
288+
289+
@Test
290+
public void bug1936() {
291+
expectGood("bug1936");
292+
}
293+
294294
@Test
295295
public void bug315g() {
296296
expectGood("bug315g");
297297
}
298-
//
299-
// @Test
300-
// public void bug400g() {
301-
// expectGood("bug400g", true);
302-
// }
303-
//
304-
// @Test
305-
// public void bug427g() {
306-
// expectGood("bug427g");
307-
// }
308-
//
309-
// @Test
310-
// public void annotations() {
311-
// expectGood("annotations", true);
312-
// }
313-
//
314-
// @Test
315-
// public void generics() {
316-
// expectGood("generics", true);
317-
// }
318-
//
319-
// @Test
320-
// public void lambda() {
321-
// expectGood("lambda", true);
322-
// }
298+
299+
@Test
300+
public void bug400g() {
301+
expectGood("bug400g", true);
302+
}
303+
304+
@Test
305+
public void bug427g() {
306+
expectGood("bug427g");
307+
}
308+
309+
@Test
310+
public void annotations() {
311+
expectGood("annotations", true);
312+
}
313+
314+
@Test
315+
public void generics() {
316+
expectGood("generics", true);
317+
}
318+
319+
@Test
320+
public void lambda() {
321+
expectGood("lambdaexample", true);
322+
}
323323
}

java/test/resources/lambda.expected renamed to java/test/resources/lambdaexample.expected

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import java.io.InputStream;
1313
import java.io.OutputStream;
1414
import java.io.IOException;
1515

16-
public class generics extends PApplet {
16+
public class lambdaexample extends PApplet {
1717

1818
public void setup() {
1919
List<String> test = new ArrayList<>();
@@ -24,7 +24,7 @@ test.forEach((x) -> { println(x); });
2424
}
2525

2626
static public void main(String[] passedArgs) {
27-
String[] appletArgs = new String[] { "generics" };
27+
String[] appletArgs = new String[] { "lambdaexample" };
2828
if (passedArgs != null) {
2929
PApplet.main(concat(appletArgs, passedArgs));
3030
} else {

0 commit comments

Comments
 (0)