fix for size regex, streampump edits, additional todo items

This commit is contained in:
benfry
2010-07-17 20:19:31 +00:00
parent bac102ce33
commit cf5b59fd39
3 changed files with 24 additions and 12 deletions

View File

@@ -46,6 +46,16 @@ import javax.swing.border.TitledBorder;
public class Sketch {
static private File tempBuildFolder;
/**
* Regular expression for parsing the size() method. This should match
* against any uses of the size() function, whether numbers or variables
* or whatever. This way, no warning is shown if size() isn't actually used
* in the sketch, which is the case especially for anyone who is cutting
* and pasting from the reference.
*/
public static final String SIZE_REGEX =
"(?:^|\\s|;)size\\s*\\(\\s*(\\S+)\\s*,\\s*([^\\s,\\)]+),?\\s*([^\\)]*)\\s*\\)\\s*\\;";
private Editor editor;
private boolean foundMain = false;
@@ -1582,7 +1592,7 @@ public class Sketch {
return exportApplet(new File(folder, "applet").getAbsolutePath());
}
/**
* Handle export to applet.
*/
@@ -1625,15 +1635,8 @@ public class Sketch {
int high = PApplet.DEFAULT_HEIGHT;
String renderer = "";
// This matches against any uses of the size() function, whether numbers
// or variables or whatever. This way, no warning is shown if size() isn't
// actually used in the applet, which is the case especially for anyone
// who is cutting/pasting from the reference.
String sizeRegex =
"(?:^|\\s|;)size\\s*\\(\\s*(\\S+)\\s*,\\s*(\\d+),?\\s*([^\\)]*)\\s*\\)";
String scrubbed = scrubComments(code[0].getProgram());
String[] matches = PApplet.match(scrubbed, sizeRegex);
String[] matches = PApplet.match(scrubbed, SIZE_REGEX);
if (matches != null) {
try {
@@ -1642,6 +1645,7 @@ public class Sketch {
// Adding back the trim() for 0136 to handle Bug #769
if (matches.length == 4) renderer = matches[3].trim();
// Actually, matches.length should always be 4...
} catch (NumberFormatException e) {
// found a reference to size, but it didn't

View File

@@ -12,7 +12,6 @@ import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import processing.app.EditorConsole;
/**

View File

@@ -1,12 +1,17 @@
0190
_ locations: sketchbook, examples, libraries
_ 'export' and 'export application' titles and/or # of items
_ 'run' and 'present' under sketch, and/or # of items
_ disappearing horizontal scroll bar
_ http://code.google.com/p/processing/issues/detail?id=316
_ the open button on the toolbar is goofed up
_ http://code.google.com/p/processing/issues/detail?id=323
_ launch4j problem
_ no crash when double-clicking a sketch and loading it
_ http://code.google.com/p/processing/issues/detail?id=231
_ disappearing horizontal scroll bar
_ http://code.google.com/p/processing/issues/detail?id=316
_ fix line endings in revisions.txt for windows
@@ -1222,6 +1227,10 @@ _ http://dev.processing.org/bugs/show_bug.cgi?id=1345
LIBRARIES / Serial
_ serial ports missing from list
_ http://code.google.com/p/processing/issues/detail?id=52
_ Serial.write problem with Bluetooth SPP virtual serial port
_ http://code.google.com/p/processing/issues/detail?id=318
_ syslog issues on macosx
_ http://dev.processing.org/bugs/show_bug.cgi?id=1147
_ port buffering not working properly