code = digitValue(input.charAt(i)); } else { throw new InvalidEscapeSequence( "Invalid escape sequence: '\\x' with no digits"); throw new InvalidEscapeSequence( "Invalid escape sequence: '\\" + c + "'"); throw new InvalidEscapeSequence( "Invalid escape sequence: '\\' at end of string.");
/** * If the next token is a string, consume it, unescape it as a * {@link Buffer}, and return it. Otherwise, throw a * {@link ParseException}. */ public Buffer consumeBuffer() throws ParseException { char quote = currentToken.length() > 0 ? currentToken.charAt(0) : '\0'; if (quote != '\"' && quote != '\'') { throw parseException("Expected string."); } if (currentToken.length() < 2 || currentToken.charAt(currentToken.length() - 1) != quote) { throw parseException("String missing ending quote."); } try { String escaped = currentToken.substring(1, currentToken.length() - 1); Buffer result = unescapeBytes(escaped); nextToken(); return result; } catch (InvalidEscapeSequence e) { throw parseException(e.getMessage()); } }
code = digitValue(input.charAt(i)); } else { throw new InvalidEscapeSequence( "Invalid escape sequence: '\\x' with no digits"); throw new InvalidEscapeSequence( "Invalid escape sequence: '\\" + c + "'"); throw new InvalidEscapeSequence( "Invalid escape sequence: '\\' at end of string.");
code = digitValue(input.charAt(i)); } else { throw new InvalidEscapeSequence( "Invalid escape sequence: '\\x' with no digits"); throw new InvalidEscapeSequence( "Invalid escape sequence: '\\" + c + "'"); throw new InvalidEscapeSequence( "Invalid escape sequence: '\\' at end of string.");
return TextFormat.unescapeText(token.image.substring(1, token.image.length()-1)); } catch (InvalidEscapeSequence e) { throw new ParseException("Invalid string litteral at line " + token.next.beginLine + ", column " + token.next.beginColumn+": "+e.getMessage());
return TextFormat.unescapeText(token.image.substring(1, token.image.length()-1)); } catch (InvalidEscapeSequence e) { throw new ParseException("Invalid string litteral at line " + token.next.beginLine + ", column " + token.next.beginColumn+": "+e.getMessage());
return TextFormat.unescapeText(token.image.substring(1, token.image.length()-1)); } catch (InvalidEscapeSequence e) { throw new ParseException("Invalid string litteral at line " + token.next.beginLine + ", column " + token.next.beginColumn+": "+e.getMessage());
/** * If the next token is a string, consume it, unescape it as a * {@link Buffer}, and return it. Otherwise, throw a * {@link ParseException}. */ public Buffer consumeBuffer() throws ParseException { char quote = currentToken.length() > 0 ? currentToken.charAt(0) : '\0'; if (quote != '\"' && quote != '\'') { throw parseException("Expected string."); } if (currentToken.length() < 2 || currentToken.charAt(currentToken.length() - 1) != quote) { throw parseException("String missing ending quote."); } try { String escaped = currentToken.substring(1, currentToken.length() - 1); Buffer result = unescapeBytes(escaped); nextToken(); return result; } catch (InvalidEscapeSequence e) { throw parseException(e.getMessage()); } }
/** * If the next token is a string, consume it, unescape it as a * {@link Buffer}, and return it. Otherwise, throw a * {@link ParseException}. */ public Buffer consumeBuffer() throws ParseException { char quote = currentToken.length() > 0 ? currentToken.charAt(0) : '\0'; if (quote != '\"' && quote != '\'') { throw parseException("Expected string."); } if (currentToken.length() < 2 || currentToken.charAt(currentToken.length() - 1) != quote) { throw parseException("String missing ending quote."); } try { String escaped = currentToken.substring(1, currentToken.length() - 1); Buffer result = unescapeBytes(escaped); nextToken(); return result; } catch (InvalidEscapeSequence e) { throw parseException(e.getMessage()); } }