antlr-ng
Version:
Next generation ANTLR Tool
151 lines (150 loc) • 2.41 kB
JavaScript
var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
import { Target } from "../Target.js";
class Python3Target extends Target {
static {
__name(this, "Python3Target");
}
static reservedWords = /* @__PURE__ */ new Set([
"abs",
"all",
"and",
"any",
"apply",
"as",
"assert",
"bin",
"bool",
"break",
"buffer",
"bytearray",
"callable",
"chr",
"class",
"classmethod",
"coerce",
"compile",
"complex",
"continue",
"def",
"del",
"delattr",
"dict",
"dir",
"divmod",
"elif",
"else",
"enumerate",
"eval",
"execfile",
"except",
"file",
"filter",
"finally",
"float",
"for",
"format",
"from",
"frozenset",
"getattr",
"global",
"globals",
"hasattr",
"hash",
"help",
"hex",
"id",
"if",
"import",
"in",
"input",
"int",
"intern",
"is",
"isinstance",
"issubclass",
"iter",
"lambda",
"len",
"list",
"locals",
"map",
"max",
"min",
"memoryview",
"next",
"nonlocal",
"not",
"object",
"oct",
"open",
"or",
"ord",
"pass",
"pow",
"print",
"property",
"raise",
"range",
"raw_input",
"reduce",
"reload",
"repr",
"return",
"reversed",
"round",
"set",
"setattr",
"slice",
"sorted",
"staticmethod",
"str",
"sum",
"super",
"try",
"tuple",
"type",
"unichr",
"unicode",
"vars",
"with",
"while",
"yield",
"zip",
"__import__",
"True",
"False",
"None",
// misc
"rule",
"parserRule"
]);
static targetCharValueEscape = /* @__PURE__ */ new Map([
// https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals
[7, "a"],
[8, "b"],
[13, "r"],
[11, "v"]
]);
constructor(gen) {
super(gen);
}
getTargetCharValueEscape() {
return new Map([...Target.defaultCharValueEscape, ...Python3Target.targetCharValueEscape]);
}
wantsBaseListener() {
return false;
}
wantsBaseVisitor() {
return false;
}
supportsOverloadedMethods() {
return false;
}
get reservedWords() {
return Python3Target.reservedWords;
}
}
export {
Python3Target
};