|
|
|
@ -395,11 +395,18 @@ public abstract class ValueNode {
|
|
|
|
|
|
|
|
|
|
public static class StringNode extends ValueNode { |
|
|
|
|
private final String string; |
|
|
|
|
private boolean useSingleQuote = true; |
|
|
|
|
|
|
|
|
|
private StringNode(CharSequence charSequence, boolean escape) { |
|
|
|
|
if(charSequence.length() > 1){ |
|
|
|
|
if(charSequence.charAt(0) == '\'' && charSequence.charAt(charSequence.length()-1) == '\''){ |
|
|
|
|
char open = charSequence.charAt(0); |
|
|
|
|
char close = charSequence.charAt(charSequence.length()-1); |
|
|
|
|
|
|
|
|
|
if(open == '\'' && close == '\''){ |
|
|
|
|
charSequence = charSequence.subSequence(1, charSequence.length()-1); |
|
|
|
|
} else if(open == '"' && close == '"'){ |
|
|
|
|
charSequence = charSequence.subSequence(1, charSequence.length()-1); |
|
|
|
|
useSingleQuote = false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
string = escape ? Utils.unescape(charSequence.toString()) : charSequence.toString(); |
|
|
|
@ -436,7 +443,8 @@ public abstract class ValueNode {
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public String toString() { |
|
|
|
|
return "'" + Utils.escape(string, true) + "'"; |
|
|
|
|
String quote = useSingleQuote ? "'" : "\""; |
|
|
|
|
return quote + Utils.escape(string, true) + quote; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|