package org.antlr.v4.codegen;
public abstract class UnicodeEscapes {
static public void appendJavaStyleEscapedCodePoint(int codePoint, StringBuilder sb) {
if (Character.isSupplementaryCodePoint(codePoint)) {
sb.append(String.format("\\u%04X", (int)Character.highSurrogate(codePoint)));
sb.append(String.format("\\u%04X", (int)Character.lowSurrogate(codePoint)));
}
else {
sb.append(String.format("\\u%04X", codePoint));
}
}
static public void appendPythonStyleEscapedCodePoint(int codePoint, StringBuilder sb) {
if (Character.isSupplementaryCodePoint(codePoint)) {
sb.append(String.format("\\U%08X", codePoint));
}
else {
sb.append(String.format("\\u%04X", codePoint));
}
}
static public void appendSwiftStyleEscapedCodePoint(int codePoint, StringBuilder sb) {
sb.append(String.format("\\u{%04X}", codePoint));
}
}