Skip to content

Commit cf5b59f

Browse files
committed
fix for size regex, streampump edits, additional todo items
1 parent bac102c commit cf5b59f

File tree

3 files changed

+24
-12
lines changed

3 files changed

+24
-12
lines changed

app/src/processing/app/Sketch.java

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,16 @@
4646
public class Sketch {
4747
static private File tempBuildFolder;
4848

49+
/**
50+
* Regular expression for parsing the size() method. This should match
51+
* against any uses of the size() function, whether numbers or variables
52+
* or whatever. This way, no warning is shown if size() isn't actually used
53+
* in the sketch, which is the case especially for anyone who is cutting
54+
* and pasting from the reference.
55+
*/
56+
public static final String SIZE_REGEX =
57+
"(?:^|\\s|;)size\\s*\\(\\s*(\\S+)\\s*,\\s*([^\\s,\\)]+),?\\s*([^\\)]*)\\s*\\)\\s*\\;";
58+
4959
private Editor editor;
5060
private boolean foundMain = false;
5161

@@ -1582,7 +1592,7 @@ protected boolean exportApplet() throws Exception {
15821592
return exportApplet(new File(folder, "applet").getAbsolutePath());
15831593
}
15841594

1585-
1595+
15861596
/**
15871597
* Handle export to applet.
15881598
*/
@@ -1625,15 +1635,8 @@ public boolean exportApplet(String appletPath) throws RunnerException, IOExcepti
16251635
int high = PApplet.DEFAULT_HEIGHT;
16261636
String renderer = "";
16271637

1628-
// This matches against any uses of the size() function, whether numbers
1629-
// or variables or whatever. This way, no warning is shown if size() isn't
1630-
// actually used in the applet, which is the case especially for anyone
1631-
// who is cutting/pasting from the reference.
1632-
String sizeRegex =
1633-
"(?:^|\\s|;)size\\s*\\(\\s*(\\S+)\\s*,\\s*(\\d+),?\\s*([^\\)]*)\\s*\\)";
1634-
16351638
String scrubbed = scrubComments(code[0].getProgram());
1636-
String[] matches = PApplet.match(scrubbed, sizeRegex);
1639+
String[] matches = PApplet.match(scrubbed, SIZE_REGEX);
16371640

16381641
if (matches != null) {
16391642
try {
@@ -1642,6 +1645,7 @@ public boolean exportApplet(String appletPath) throws RunnerException, IOExcepti
16421645

16431646
// Adding back the trim() for 0136 to handle Bug #769
16441647
if (matches.length == 4) renderer = matches[3].trim();
1648+
// Actually, matches.length should always be 4...
16451649

16461650
} catch (NumberFormatException e) {
16471651
// found a reference to size, but it didn't

app/src/processing/app/exec/StreamPump.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import java.util.concurrent.ExecutorService;
1313
import java.util.concurrent.Executors;
1414
import java.util.concurrent.ThreadFactory;
15-
import processing.app.EditorConsole;
1615

1716

1817
/**

todo.txt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
0190
22

3+
_ locations: sketchbook, examples, libraries
4+
_ 'export' and 'export application' titles and/or # of items
5+
_ 'run' and 'present' under sketch, and/or # of items
36

4-
_ disappearing horizontal scroll bar
5-
_ http://code.google.com/p/processing/issues/detail?id=316
67

8+
_ the open button on the toolbar is goofed up
9+
_ http://code.google.com/p/processing/issues/detail?id=323
710
_ launch4j problem
811
_ no crash when double-clicking a sketch and loading it
912
_ http://code.google.com/p/processing/issues/detail?id=231
13+
_ disappearing horizontal scroll bar
14+
_ http://code.google.com/p/processing/issues/detail?id=316
1015

1116
_ fix line endings in revisions.txt for windows
1217

@@ -1222,6 +1227,10 @@ _ http://dev.processing.org/bugs/show_bug.cgi?id=1345
12221227

12231228
LIBRARIES / Serial
12241229

1230+
_ serial ports missing from list
1231+
_ http://code.google.com/p/processing/issues/detail?id=52
1232+
_ Serial.write problem with Bluetooth SPP virtual serial port
1233+
_ http://code.google.com/p/processing/issues/detail?id=318
12251234
_ syslog issues on macosx
12261235
_ http://dev.processing.org/bugs/show_bug.cgi?id=1147
12271236
_ port buffering not working properly

0 commit comments

Comments
 (0)