public static String quote(String str, char quote) { return UnicodeUtilities.quote(str, quote); }
public static String unquote(String str) { return UnicodeUtilities.unquote(str); } }
/** * Adds a leading and trailing double quotation mark to the given string. This will escape whatever content is * within the string literal. * * @param str The string to quote. * @param quote The quote character. * @return The quoted string. */ public static String quote(String str, char quote) { StringBuilder ret = new StringBuilder(); ret.append(quote); for (int i = 0; i < str.length(); ++i) { char c = str.charAt(i); if (c == quote) { ret.append("\\").append(c); } else { ret.append(escape(c)); } } ret.append(quote); return ret.toString(); }
final public String literal() throws ParseException { jj_consume_token(LITERAL); {if ("" != null) return UnicodeUtilities.unquote(token.image);} throw new IllegalStateException ("Missing return statement in function"); }
/** * Returns a string representation of an object that can be used in the 'image' constructor argument of {@link * GroupingNode}. This method ensures that strings are quoted, and that all complex characters are escaped. * * @param obj The object to output. * @return The string representation. */ public static String asImage(Object obj) { if (!(obj instanceof String)) { return obj.toString(); } return UnicodeUtilities.quote((String)obj, '"'); }
final public StringValue stringValue() throws ParseException {String str; jj_consume_token(STRING); str = UnicodeUtilities.unquote(token.image); space(); {if ("" != null) return new StringValue(str);} throw new IllegalStateException ("Missing return statement in function"); }
ret = UnicodeUtilities.unquote(token.image); space(); break;