From ce7d93d711cbd210e046534b84eab4416bf9b2f3 Mon Sep 17 00:00:00 2001 From: Jakub Valtar Date: Fri, 25 Mar 2016 23:24:28 +0100 Subject: [PATCH] Minor changes to PdePreprocessor - Remove redundant static modifier in front of Mode - Let some methods accept CharSequence instead of String (can be used with both String and StringBuilder) --- .../mode/java/preproc/PdePreprocessor.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/java/src/processing/mode/java/preproc/PdePreprocessor.java b/java/src/processing/mode/java/preproc/PdePreprocessor.java index f456cfa07..074a3c6c7 100644 --- a/java/src/processing/mode/java/preproc/PdePreprocessor.java +++ b/java/src/processing/mode/java/preproc/PdePreprocessor.java @@ -141,7 +141,7 @@ public class PdePreprocessor { protected final String indent; private final String name; - public static enum Mode { + public enum Mode { STATIC, ACTIVE, JAVA } @@ -492,7 +492,7 @@ public class PdePreprocessor { * @param code code without comments * @return determined mode */ - static public Mode parseMode(String code) { + static public Mode parseMode(CharSequence code) { // See if we can find any function in the global scope if (findInCurrentScope(FUNCTION_DECL, code) != null) { @@ -512,7 +512,7 @@ public class PdePreprocessor { * Calls {@link #findInScope(Pattern, String, int, int, int, int) findInScope} * on the whole string with min and max target scopes set to zero. */ - static protected MatchResult findInCurrentScope(Pattern pattern, String code) { + static protected MatchResult findInCurrentScope(Pattern pattern, CharSequence code) { return findInScope(pattern, code, 0, code.length(), 0, 0); } @@ -521,7 +521,7 @@ public class PdePreprocessor { * Calls {@link #findInScope(Pattern, String, int, int, int, int) findInScope} * starting at start char with min and max target scopes set to zero. */ - static protected MatchResult findInCurrentScope(Pattern pattern, String code, + static protected MatchResult findInCurrentScope(Pattern pattern, CharSequence code, int start) { return findInScope(pattern, code, start, code.length(), 0, 0); } @@ -550,7 +550,7 @@ public class PdePreprocessor { * @return first match at a desired relative scope depth, * null if there isn't one */ - static protected MatchResult findInScope(Pattern pattern, String code, + static protected MatchResult findInScope(Pattern pattern, CharSequence code, int start, int stop, int minTargetScopeDepth, int maxTargetScopeDepth) { @@ -601,7 +601,7 @@ public class PdePreprocessor { * Integer.MAX_VALUE if end is in string literal, * char literal or second char of escaped sequence */ - static protected int scopeDepthDiff(String code, int start, int stop) { + static protected int scopeDepthDiff(CharSequence code, int start, int stop) { boolean insideString = false; boolean insideChar = false; boolean escapedChar = false;