export const IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*'; const KEYWORDS = [ "as", // for exports "in", "of", "if", "for", "while", "finally", "var", "new", "function", "do", "return", "void", "else", "break", "catch", "instanceof", "with", "throw", "case", "default", "try", "switch", "continue", "typeof", "delete", "let", "yield", "const", "class", // JS handles these with a special rule // "get", // "set", "debugger", "async", "await", "static", "import", "from", "export", "extends" ]; const LITERALS = [ "true", "false", "null", "undefined", "NaN", "Infinity" ]; // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects export const TYPES = [ // Fundamental objects "Object", "Function", "Boolean", "Symbol", // numbers and dates "Math", "Date", "Number", "BigInt", // text "String", "RegExp", // Indexed collections "Array", "Float32Array", "Float64Array", "Int8Array", "Uint8Array", "Uint8ClampedArray", "Int16Array", "Int32Array", "Uint16Array", "Uint32Array", "BigInt64Array", "BigUint64Array", // Keyed collections "Set", "Map", "WeakSet", "WeakMap", // Structured data "ArrayBuffer", "SharedArrayBuffer", "Atomics", "DataView", "JSON", // Control abstraction objects "Promise", "Generator", "GeneratorFunction", "AsyncFunction", // Reflection "Reflect", "Proxy", // Internationalization "Intl", // WebAssembly "WebAssembly" ]; export const ERROR_TYPES = [ "Error", "EvalError", "InternalError", "RangeError", "ReferenceError", "SyntaxError", "TypeError", "URIError" ]; export const BUILT_IN_GLOBALS = [ "setInterval", "setTimeout", "clearInterval", "clearTimeout", "require", "exports", "eval", "isFinite", "isNaN", "parseFloat", "parseInt", "decodeURI", "decodeURIComponent", "encodeURI", "encodeURIComponent", "escape", "unescape" ]; export const BUILT_IN_VARIABLES = [ "arguments", "this", "super", "console", "window", "document", "localStorage", "sessionStorage", "module", "global" // Node.js ]; const BUILT_INS = [].concat( BUILT_IN_GLOBALS, TYPES, ERROR_TYPES ); export { LITERALS, BUILT_INS, KEYWORDS };