add escapes to ADM parser
remove unused parameter from ADMDataParser.checkType
diff --git a/asterix-maven-plugins/lexer-generator-maven-plugin/src/main/java/edu/uci/ics/asterix/lexergenerator/rules/RuleAnythingUntil.java b/asterix-maven-plugins/lexer-generator-maven-plugin/src/main/java/edu/uci/ics/asterix/lexergenerator/rules/RuleAnythingUntil.java
index 3476a40..83d6ed7 100644
--- a/asterix-maven-plugins/lexer-generator-maven-plugin/src/main/java/edu/uci/ics/asterix/lexergenerator/rules/RuleAnythingUntil.java
+++ b/asterix-maven-plugins/lexer-generator-maven-plugin/src/main/java/edu/uci/ics/asterix/lexergenerator/rules/RuleAnythingUntil.java
@@ -55,14 +55,10 @@
@Override
public String javaMatch(String action) {
- StringBuilder result = new StringBuilder();
- result.append("boolean escaped = false;");
- result.append("while (currentChar!='").append(expected).append("' || escaped)");
- result.append("{\nif(!escaped && currentChar=='\\\\\\\\'){escaped=true;}\nelse {escaped=false;}\ncurrentChar = readNextChar();\n}");
- result.append("\nif (currentChar=='").append(expected).append("'){");
- result.append(action);
- result.append("}\n");
- return result.toString();
+ return "boolean escaped = false;\n" + "while (currentChar != '" + expected + "' || escaped) {\n"
+ + "if(!escaped && currentChar == '\\\\\\\\') {\n" + "escaped = true;\n" + "containsEscapes = true;\n"
+ + "} else {\n" + "escaped = false;\n" + "}\n" + "currentChar = readNextChar();\n" + "}\n"
+ + "if (currentChar == '" + expected + "') {" + action + "}\n";
}
}
diff --git a/asterix-maven-plugins/lexer-generator-maven-plugin/src/main/resources/Lexer.java b/asterix-maven-plugins/lexer-generator-maven-plugin/src/main/resources/Lexer.java
index 4ce840d..e34bde4 100644
--- a/asterix-maven-plugins/lexer-generator-maven-plugin/src/main/resources/Lexer.java
+++ b/asterix-maven-plugins/lexer-generator-maven-plugin/src/main/resources/Lexer.java
@@ -35,6 +35,7 @@
protected int line;
protected boolean prevCharIsCR;
protected boolean prevCharIsLF;
+ protected boolean containsEscapes;
protected char[] buffer;
protected int bufsize;
protected int bufpos;
@@ -53,11 +54,12 @@
// Main method. Return a TOKEN_CONSTANT
// ================================================================================
- public int next() throws [LEXER_NAME]Exception, IOException{
+ public int next() throws [LEXER_NAME]Exception, IOException {
char currentChar = buffer[bufpos];
while (currentChar == ' ' || currentChar=='\t' || currentChar == '\n' || currentChar=='\r')
currentChar = readNextChar();
tokenBegin = bufpos;
+ containsEscapes = false;
if (currentChar==EOF_CHAR) return TOKEN_EOF;
[LEXER_LOGIC]
@@ -104,6 +106,10 @@
return line;
}
+ public boolean containsEscapes() {
+ return containsEscapes;
+ }
+
public static String tokenKindToString(int token) {
return tokenImage[token];
}