if (context.UESCAPE() != null) { String escapeString = unquote(context.STRING().getText()); check(!escapeString.isEmpty(), "Empty Unicode escape character", context); check(escapeString.length() == 1, "Invalid Unicode escape character: " + escapeString, context); escape = escapeString.charAt(0); check(isValidUnicodeEscape(escape), "Invalid Unicode escape character: " + escapeString, context); check(isHexDigit(ch), "Incomplete escape sequence: " + escapedCharacterBuilder.toString(), context); escapedCharacterBuilder.append(ch); if (charactersNeeded == escapedCharacterBuilder.length()) { escapedCharacterBuilder.setLength(0); int codePoint = Integer.parseInt(currentEscapedCode, 16); check(Character.isValidCodePoint(codePoint), "Invalid escaped character: " + currentEscapedCode, context); if (Character.isSupplementaryCodePoint(codePoint)) { unicodeStringBuilder.appendCodePoint(codePoint); check(!Character.isSurrogate(currentCodePoint), format("Invalid escaped character: %s. Escaped character is a surrogate. Use '\\+123456' instead.", currentEscapedCode), context); unicodeStringBuilder.append(currentCodePoint); check(charactersNeeded > escapedCharacterBuilder.length(), "Unexpected escape sequence length: " + escapedCharacterBuilder.length(), context); check(state == UnicodeDecodeState.EMPTY, "Incomplete escape sequence: " + escapedCharacterBuilder.toString(), context); return unicodeStringBuilder.toString();
if (context.UESCAPE() != null) { String escapeString = unquote(context.STRING().getText()); check(!escapeString.isEmpty(), "Empty Unicode escape character", context); check(escapeString.length() == 1, "Invalid Unicode escape character: " + escapeString, context); escape = escapeString.charAt(0); check(isValidUnicodeEscape(escape), "Invalid Unicode escape character: " + escapeString, context); check(isHexDigit(ch), "Incomplete escape sequence: " + escapedCharacterBuilder.toString(), context); escapedCharacterBuilder.append(ch); if (charactersNeeded == escapedCharacterBuilder.length()) { escapedCharacterBuilder.setLength(0); int codePoint = Integer.parseInt(currentEscapedCode, 16); check(Character.isValidCodePoint(codePoint), "Invalid escaped character: " + currentEscapedCode, context); if (Character.isSupplementaryCodePoint(codePoint)) { unicodeStringBuilder.appendCodePoint(codePoint); check(!Character.isSurrogate(currentCodePoint), format("Invalid escaped character: %s. Escaped character is a surrogate. Use '\\+123456' instead.", currentEscapedCode), context); unicodeStringBuilder.append(currentCodePoint); check(charactersNeeded > escapedCharacterBuilder.length(), "Unexpected escape sequence length: " + escapedCharacterBuilder.length(), context); check(state == UnicodeDecodeState.EMPTY, "Incomplete escape sequence: " + escapedCharacterBuilder.toString(), context); return unicodeStringBuilder.toString();
check(context.expression().size() == 2 || context.expression().size() == 3, "Invalid number of arguments for 'if' function", context); check(!window.isPresent(), "OVER clause not valid for 'if' function", context); check(!distinct, "DISTINCT not valid for 'if' function", context); check(!filter.isPresent(), "FILTER not valid for 'if' function", context); check(context.expression().size() == 2, "Invalid number of arguments for 'nullif' function", context); check(!window.isPresent(), "OVER clause not valid for 'nullif' function", context); check(!distinct, "DISTINCT not valid for 'nullif' function", context); check(!filter.isPresent(), "FILTER not valid for 'nullif' function", context); check(context.expression().size() >= 2, "The 'coalesce' function must have at least two arguments", context); check(!window.isPresent(), "OVER clause not valid for 'coalesce' function", context); check(!distinct, "DISTINCT not valid for 'coalesce' function", context); check(!filter.isPresent(), "FILTER not valid for 'coalesce' function", context); check(context.expression().size() == 1, "The 'try' function must have exactly one argument", context); check(!window.isPresent(), "OVER clause not valid for 'try' function", context); check(!distinct, "DISTINCT not valid for 'try' function", context); check(!filter.isPresent(), "FILTER not valid for 'try' function", context); check(context.expression().size() >= 1, "The '$internal$bind' function must have at least one arguments", context); check(!window.isPresent(), "OVER clause not valid for '$internal$bind' function", context); check(!distinct, "DISTINCT not valid for '$internal$bind' function", context); check(!filter.isPresent(), "FILTER not valid for '$internal$bind' function", context);
check(context.expression().size() == 2 || context.expression().size() == 3, "Invalid number of arguments for 'if' function", context); check(!window.isPresent(), "OVER clause not valid for 'if' function", context); check(!distinct, "DISTINCT not valid for 'if' function", context); check(!filter.isPresent(), "FILTER not valid for 'if' function", context); check(context.expression().size() == 2, "Invalid number of arguments for 'nullif' function", context); check(!window.isPresent(), "OVER clause not valid for 'nullif' function", context); check(!distinct, "DISTINCT not valid for 'nullif' function", context); check(!filter.isPresent(), "FILTER not valid for 'nullif' function", context); check(context.expression().size() >= 2, "The 'coalesce' function must have at least two arguments", context); check(!window.isPresent(), "OVER clause not valid for 'coalesce' function", context); check(!distinct, "DISTINCT not valid for 'coalesce' function", context); check(!filter.isPresent(), "FILTER not valid for 'coalesce' function", context); check(context.expression().size() == 1, "The 'try' function must have exactly one argument", context); check(!window.isPresent(), "OVER clause not valid for 'try' function", context); check(!distinct, "DISTINCT not valid for 'try' function", context); check(!filter.isPresent(), "FILTER not valid for 'try' function", context); check(context.expression().size() >= 1, "The '$internal$bind' function must have at least one arguments", context); check(!window.isPresent(), "OVER clause not valid for '$internal$bind' function", context); check(!distinct, "DISTINCT not valid for '$internal$bind' function", context); check(!filter.isPresent(), "FILTER not valid for '$internal$bind' function", context);