antlr-ng
Version:
Next generation ANTLR Tool
125 lines (124 loc) • 2.2 kB
JavaScript
var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
import { format } from "../../support/helpers.js";
import { Target } from "../Target.js";
class SwiftTarget extends Target {
static {
__name(this, "SwiftTarget");
}
// https://docs.swift.org/swift-book/documentation/the-swift-programming-language/stringsandcharacters/
static targetCharValueEscape = /* @__PURE__ */ new Map([
[0, "0"]
]);
static reservedWords = /* @__PURE__ */ new Set([
"associatedtype",
"class",
"deinit",
"enum",
"extension",
"func",
"import",
"init",
"inout",
"internal",
"let",
"operator",
"private",
"protocol",
"public",
"static",
"struct",
"subscript",
"typealias",
"var",
"break",
"case",
"continue",
"default",
"defer",
"do",
"else",
"fallthrough",
"for",
"guard",
"if",
"in",
"repeat",
"return",
"switch",
"where",
"while",
"as",
"catch",
"dynamicType",
"false",
"is",
"nil",
"rethrows",
"super",
"self",
"Self",
"throw",
"throws",
"true",
"try",
"__COLUMN__",
"__FILE__",
"__FUNCTION__",
"__LINE__",
"#column",
"#file",
"#function",
"#line",
"_",
"#available",
"#else",
"#elseif",
"#endif",
"#if",
"#selector",
"associativity",
"convenience",
"dynamic",
"didSet",
"final",
"get",
"infix",
"indirect",
"lazy",
"left",
"mutating",
"none",
"nonmutating",
"optional",
"override",
"postfix",
"precedence",
"prefix",
"Protocol",
"required",
"right",
"set",
"Type",
"unowned",
"weak",
"willSet",
"rule",
"parserRule"
]);
getTargetCharValueEscape() {
return new Map([...Target.defaultCharValueEscape, ...SwiftTarget.targetCharValueEscape]);
}
get reservedWords() {
return SwiftTarget.reservedWords;
}
escapeWord(word) {
return "`" + word + "`";
}
escapeChar(v) {
return format("\\u{%X}", v);
}
}
export {
SwiftTarget
};