Skip to content

Commit 4998ad2

Browse files
committed
more cleanups and notes
1 parent 04fe46c commit 4998ad2

2 files changed

Lines changed: 17 additions & 7 deletions

File tree

java/src/processing/mode/java/tweak/SketchParser.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ public SketchParser(String[] codeTabs, boolean requiresComment) {
6060

6161
// add 'settings' and 'setup' to ignore list (to ignore all numbers there)
6262
ignoreFunctions = new ArrayList<>();
63-
ignoreFunctions.add(Arrays.asList(new Range(getVoidFunctionStart(codeTabs[0], "settings"),
64-
getVoidFunctionEnd(codeTabs[0], "settings")),
65-
new Range(getVoidFunctionStart(codeTabs[0], "setup"),
66-
getVoidFunctionEnd(codeTabs[0], "setup"))));
67-
63+
Range settingsRange = getVoidFunctionRange(codeTabs[0], "settings");
64+
Range setupRange = getVoidFunctionRange(codeTabs[0], "setup");
65+
ignoreFunctions.add(Arrays.asList(settingsRange, setupRange));
66+
6867
//Add empty lists for the other tabs so we do not get an index out of bounds error later
69-
for(int i = 0; i < codeTabs.length-1; i++)
70-
ignoreFunctions.add(Collections.EMPTY_LIST);
68+
for (int i = 0; i < codeTabs.length-1; i++) {
69+
ignoreFunctions.add(new ArrayList<SketchParser.Range>());
70+
}
7171

7272
// build curly scope for every character in the code
7373
curlyScopes = new ArrayList<>();
@@ -839,6 +839,11 @@ else if (readObject) {
839839
return obj;
840840
}
841841

842+
static public Range getVoidFunctionRange(String code, String functionName) {
843+
return new Range(getVoidFunctionStart(code, functionName),
844+
getVoidFunctionEnd(code, functionName));
845+
}
846+
842847
static public int getVoidFunctionStart(String code, String functionName) {
843848
Pattern p = Pattern.compile("void[\\s\\t\\r\\n]*"+functionName+"[\\s\\t]*\\(\\)[\\s\\t\\r\\n]*\\{");
844849
Matcher m = p.matcher(code);

todo.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ X updates for serial
2121
X https://github.com/processing/processing/pull/4015
2222
_ Saving sketch with the same name as a class
2323
_ https://github.com/processing/processing/pull/4033
24+
_ infinite "file changed" popups
25+
_ https://github.com/processing/processing/issues/3965
26+
_ https://github.com/processing/processing/pull/4037
27+
_ Pasting text into PDE results in "Clipboard does not contain a string
28+
_ https://github.com/processing/processing/pull/4040
2429

2530
jakub
2631
X Include Example packs into update count

0 commit comments

Comments
 (0)