mirror of
https://github.com/processing/processing4.git
synced 2026-01-26 09:51:09 +01:00
looking for "extends PApplet", find other things to clean
This commit is contained in:
@@ -13,11 +13,10 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import processing.mode.java.TextTransform.Edit;
|
||||
import processing.mode.java.preproc.PdePreprocessor;
|
||||
|
||||
|
||||
public class SourceUtil {
|
||||
|
||||
|
||||
public static final Pattern IMPORT_REGEX =
|
||||
Pattern.compile("(?:^|;)\\s*(import\\s+(?:(static)\\s+)?((?:\\w+\\s*\\.)*)\\s*(\\S+)\\s*;)",
|
||||
Pattern.MULTILINE | Pattern.DOTALL);
|
||||
@@ -36,6 +35,7 @@ public class SourceUtil {
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
public static List<Edit> parseProgramImports(CharSequence source,
|
||||
List<ImportStatement> outImports) {
|
||||
List<Edit> result = new ArrayList<>();
|
||||
@@ -52,7 +52,7 @@ public class SourceUtil {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
// Positive lookahead and lookbehind are needed to match all type constructors
|
||||
@@ -82,7 +82,6 @@ public class SourceUtil {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static final Pattern HEX_LITERAL_REGEX =
|
||||
Pattern.compile("(?<=^|\\W)(#[A-Fa-f0-9]{6})(?=\\W|$)");
|
||||
|
||||
@@ -101,7 +100,7 @@ public class SourceUtil {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
public static List<Edit> insertImports(List<ImportStatement> imports) {
|
||||
List<Edit> result = new ArrayList<>();
|
||||
for (ImportStatement imp : imports) {
|
||||
@@ -111,9 +110,7 @@ public class SourceUtil {
|
||||
}
|
||||
|
||||
public static List<Edit> wrapSketch(PdePreprocessor.Mode mode, String className, int sourceLength) {
|
||||
|
||||
List<Edit> edits = new ArrayList<>();
|
||||
|
||||
StringBuilder b = new StringBuilder();
|
||||
|
||||
// Header
|
||||
@@ -140,15 +137,17 @@ public class SourceUtil {
|
||||
}
|
||||
|
||||
edits.add(Edit.insert(sourceLength, b.toString()));
|
||||
|
||||
return edits;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// Verifies that whole input String is floating point literal. Can't be used for searching.
|
||||
// https://docs.oracle.com/javase/specs/jls/se8/html/jls-3.html#jls-DecimalFloatingPointLiteral
|
||||
public static final Pattern FLOATING_POINT_LITERAL_VERIFIER;
|
||||
static {
|
||||
// TODO lots of "Unnecessary non-capturing group" sequences here,
|
||||
// but not touching until someone can look more closely.
|
||||
final String DIGITS = "(?:[0-9]|[0-9][0-9_]*[0-9])";
|
||||
final String EXPONENT_PART = "(?:[eE][+-]?" + DIGITS + ")";
|
||||
FLOATING_POINT_LITERAL_VERIFIER = Pattern.compile(
|
||||
@@ -242,11 +241,14 @@ public class SourceUtil {
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
static public String scrubCommentsAndStrings(String p) {
|
||||
StringBuilder sb = new StringBuilder(p);
|
||||
scrubCommentsAndStrings(sb);
|
||||
return sb.toString();
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
static public void scrubCommentsAndStrings(StringBuilder p) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user