UNPKG

react-code-canvas

Version:

React component for running and previewing code with live editing capabilities

971 lines (916 loc) 516 kB
import React, { useRef, useState, createElement, useEffect, Component, isValidElement, useContext, useReducer, useMemo, useCallback } from 'react'; import { AreaChart, BarChart, LineChart, ComposedChart, PieChart, RadarChart, RadialBarChart, ScatterChart, FunnelChart, Treemap, ResponsiveContainer, Legend, Tooltip, Cell, Text, Label, LabelList, Customized, Area, Bar, Line, Scatter, XAxis, YAxis, ZAxis, Brush, CartesianAxis, CartesianGrid, ReferenceLine, ReferenceDot, ReferenceArea, ErrorBar, Funnel, Cross, Curve, Dot, Polygon, Rectangle, Sector, Pie, Radar, RadialBar, PolarAngleAxis, PolarGrid, PolarRadiusAxis } from 'recharts'; import { LiveProvider, LivePreview, LiveError, LiveEditor } from 'react-live-runner'; /****************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */ var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { var e = new Error(message); return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; }; var ContextualKeyword; (function (ContextualKeyword) { const NONE = 0; ContextualKeyword[ContextualKeyword["NONE"] = NONE] = "NONE"; const _abstract = NONE + 1; ContextualKeyword[ContextualKeyword["_abstract"] = _abstract] = "_abstract"; const _accessor = _abstract + 1; ContextualKeyword[ContextualKeyword["_accessor"] = _accessor] = "_accessor"; const _as = _accessor + 1; ContextualKeyword[ContextualKeyword["_as"] = _as] = "_as"; const _assert = _as + 1; ContextualKeyword[ContextualKeyword["_assert"] = _assert] = "_assert"; const _asserts = _assert + 1; ContextualKeyword[ContextualKeyword["_asserts"] = _asserts] = "_asserts"; const _async = _asserts + 1; ContextualKeyword[ContextualKeyword["_async"] = _async] = "_async"; const _await = _async + 1; ContextualKeyword[ContextualKeyword["_await"] = _await] = "_await"; const _checks = _await + 1; ContextualKeyword[ContextualKeyword["_checks"] = _checks] = "_checks"; const _constructor = _checks + 1; ContextualKeyword[ContextualKeyword["_constructor"] = _constructor] = "_constructor"; const _declare = _constructor + 1; ContextualKeyword[ContextualKeyword["_declare"] = _declare] = "_declare"; const _enum = _declare + 1; ContextualKeyword[ContextualKeyword["_enum"] = _enum] = "_enum"; const _exports = _enum + 1; ContextualKeyword[ContextualKeyword["_exports"] = _exports] = "_exports"; const _from = _exports + 1; ContextualKeyword[ContextualKeyword["_from"] = _from] = "_from"; const _get = _from + 1; ContextualKeyword[ContextualKeyword["_get"] = _get] = "_get"; const _global = _get + 1; ContextualKeyword[ContextualKeyword["_global"] = _global] = "_global"; const _implements = _global + 1; ContextualKeyword[ContextualKeyword["_implements"] = _implements] = "_implements"; const _infer = _implements + 1; ContextualKeyword[ContextualKeyword["_infer"] = _infer] = "_infer"; const _interface = _infer + 1; ContextualKeyword[ContextualKeyword["_interface"] = _interface] = "_interface"; const _is = _interface + 1; ContextualKeyword[ContextualKeyword["_is"] = _is] = "_is"; const _keyof = _is + 1; ContextualKeyword[ContextualKeyword["_keyof"] = _keyof] = "_keyof"; const _mixins = _keyof + 1; ContextualKeyword[ContextualKeyword["_mixins"] = _mixins] = "_mixins"; const _module = _mixins + 1; ContextualKeyword[ContextualKeyword["_module"] = _module] = "_module"; const _namespace = _module + 1; ContextualKeyword[ContextualKeyword["_namespace"] = _namespace] = "_namespace"; const _of = _namespace + 1; ContextualKeyword[ContextualKeyword["_of"] = _of] = "_of"; const _opaque = _of + 1; ContextualKeyword[ContextualKeyword["_opaque"] = _opaque] = "_opaque"; const _out = _opaque + 1; ContextualKeyword[ContextualKeyword["_out"] = _out] = "_out"; const _override = _out + 1; ContextualKeyword[ContextualKeyword["_override"] = _override] = "_override"; const _private = _override + 1; ContextualKeyword[ContextualKeyword["_private"] = _private] = "_private"; const _protected = _private + 1; ContextualKeyword[ContextualKeyword["_protected"] = _protected] = "_protected"; const _proto = _protected + 1; ContextualKeyword[ContextualKeyword["_proto"] = _proto] = "_proto"; const _public = _proto + 1; ContextualKeyword[ContextualKeyword["_public"] = _public] = "_public"; const _readonly = _public + 1; ContextualKeyword[ContextualKeyword["_readonly"] = _readonly] = "_readonly"; const _require = _readonly + 1; ContextualKeyword[ContextualKeyword["_require"] = _require] = "_require"; const _satisfies = _require + 1; ContextualKeyword[ContextualKeyword["_satisfies"] = _satisfies] = "_satisfies"; const _set = _satisfies + 1; ContextualKeyword[ContextualKeyword["_set"] = _set] = "_set"; const _static = _set + 1; ContextualKeyword[ContextualKeyword["_static"] = _static] = "_static"; const _symbol = _static + 1; ContextualKeyword[ContextualKeyword["_symbol"] = _symbol] = "_symbol"; const _type = _symbol + 1; ContextualKeyword[ContextualKeyword["_type"] = _type] = "_type"; const _unique = _type + 1; ContextualKeyword[ContextualKeyword["_unique"] = _unique] = "_unique"; const _using = _unique + 1; ContextualKeyword[ContextualKeyword["_using"] = _using] = "_using"; })(ContextualKeyword || (ContextualKeyword = {})); // Generated file, do not edit! Run "yarn generate" to re-generate this file. /* istanbul ignore file */ /** * Enum of all token types, with bit fields to signify meaningful properties. */ var TokenType; (function (TokenType) { // Precedence 0 means not an operator; otherwise it is a positive number up to 12. const PRECEDENCE_MASK = 0xf; TokenType[TokenType["PRECEDENCE_MASK"] = PRECEDENCE_MASK] = "PRECEDENCE_MASK"; const IS_KEYWORD = 1 << 4; TokenType[TokenType["IS_KEYWORD"] = IS_KEYWORD] = "IS_KEYWORD"; const IS_ASSIGN = 1 << 5; TokenType[TokenType["IS_ASSIGN"] = IS_ASSIGN] = "IS_ASSIGN"; const IS_RIGHT_ASSOCIATIVE = 1 << 6; TokenType[TokenType["IS_RIGHT_ASSOCIATIVE"] = IS_RIGHT_ASSOCIATIVE] = "IS_RIGHT_ASSOCIATIVE"; const IS_PREFIX = 1 << 7; TokenType[TokenType["IS_PREFIX"] = IS_PREFIX] = "IS_PREFIX"; const IS_POSTFIX = 1 << 8; TokenType[TokenType["IS_POSTFIX"] = IS_POSTFIX] = "IS_POSTFIX"; const IS_EXPRESSION_START = 1 << 9; TokenType[TokenType["IS_EXPRESSION_START"] = IS_EXPRESSION_START] = "IS_EXPRESSION_START"; const num = 512; TokenType[TokenType["num"] = num] = "num"; // num startsExpr const bigint = 1536; TokenType[TokenType["bigint"] = bigint] = "bigint"; // bigint startsExpr const decimal = 2560; TokenType[TokenType["decimal"] = decimal] = "decimal"; // decimal startsExpr const regexp = 3584; TokenType[TokenType["regexp"] = regexp] = "regexp"; // regexp startsExpr const string = 4608; TokenType[TokenType["string"] = string] = "string"; // string startsExpr const name = 5632; TokenType[TokenType["name"] = name] = "name"; // name startsExpr const eof = 6144; TokenType[TokenType["eof"] = eof] = "eof"; // eof const bracketL = 7680; TokenType[TokenType["bracketL"] = bracketL] = "bracketL"; // [ startsExpr const bracketR = 8192; TokenType[TokenType["bracketR"] = bracketR] = "bracketR"; // ] const braceL = 9728; TokenType[TokenType["braceL"] = braceL] = "braceL"; // { startsExpr const braceBarL = 10752; TokenType[TokenType["braceBarL"] = braceBarL] = "braceBarL"; // {| startsExpr const braceR = 11264; TokenType[TokenType["braceR"] = braceR] = "braceR"; // } const braceBarR = 12288; TokenType[TokenType["braceBarR"] = braceBarR] = "braceBarR"; // |} const parenL = 13824; TokenType[TokenType["parenL"] = parenL] = "parenL"; // ( startsExpr const parenR = 14336; TokenType[TokenType["parenR"] = parenR] = "parenR"; // ) const comma = 15360; TokenType[TokenType["comma"] = comma] = "comma"; // , const semi = 16384; TokenType[TokenType["semi"] = semi] = "semi"; // ; const colon = 17408; TokenType[TokenType["colon"] = colon] = "colon"; // : const doubleColon = 18432; TokenType[TokenType["doubleColon"] = doubleColon] = "doubleColon"; // :: const dot = 19456; TokenType[TokenType["dot"] = dot] = "dot"; // . const question = 20480; TokenType[TokenType["question"] = question] = "question"; // ? const questionDot = 21504; TokenType[TokenType["questionDot"] = questionDot] = "questionDot"; // ?. const arrow = 22528; TokenType[TokenType["arrow"] = arrow] = "arrow"; // => const template = 23552; TokenType[TokenType["template"] = template] = "template"; // template const ellipsis = 24576; TokenType[TokenType["ellipsis"] = ellipsis] = "ellipsis"; // ... const backQuote = 25600; TokenType[TokenType["backQuote"] = backQuote] = "backQuote"; // ` const dollarBraceL = 27136; TokenType[TokenType["dollarBraceL"] = dollarBraceL] = "dollarBraceL"; // ${ startsExpr const at = 27648; TokenType[TokenType["at"] = at] = "at"; // @ const hash = 29184; TokenType[TokenType["hash"] = hash] = "hash"; // # startsExpr const eq = 29728; TokenType[TokenType["eq"] = eq] = "eq"; // = isAssign const assign = 30752; TokenType[TokenType["assign"] = assign] = "assign"; // _= isAssign const preIncDec = 32640; TokenType[TokenType["preIncDec"] = preIncDec] = "preIncDec"; // ++/-- prefix postfix startsExpr const postIncDec = 33664; TokenType[TokenType["postIncDec"] = postIncDec] = "postIncDec"; // ++/-- prefix postfix startsExpr const bang = 34432; TokenType[TokenType["bang"] = bang] = "bang"; // ! prefix startsExpr const tilde = 35456; TokenType[TokenType["tilde"] = tilde] = "tilde"; // ~ prefix startsExpr const pipeline = 35841; TokenType[TokenType["pipeline"] = pipeline] = "pipeline"; // |> prec:1 const nullishCoalescing = 36866; TokenType[TokenType["nullishCoalescing"] = nullishCoalescing] = "nullishCoalescing"; // ?? prec:2 const logicalOR = 37890; TokenType[TokenType["logicalOR"] = logicalOR] = "logicalOR"; // || prec:2 const logicalAND = 38915; TokenType[TokenType["logicalAND"] = logicalAND] = "logicalAND"; // && prec:3 const bitwiseOR = 39940; TokenType[TokenType["bitwiseOR"] = bitwiseOR] = "bitwiseOR"; // | prec:4 const bitwiseXOR = 40965; TokenType[TokenType["bitwiseXOR"] = bitwiseXOR] = "bitwiseXOR"; // ^ prec:5 const bitwiseAND = 41990; TokenType[TokenType["bitwiseAND"] = bitwiseAND] = "bitwiseAND"; // & prec:6 const equality = 43015; TokenType[TokenType["equality"] = equality] = "equality"; // ==/!= prec:7 const lessThan = 44040; TokenType[TokenType["lessThan"] = lessThan] = "lessThan"; // < prec:8 const greaterThan = 45064; TokenType[TokenType["greaterThan"] = greaterThan] = "greaterThan"; // > prec:8 const relationalOrEqual = 46088; TokenType[TokenType["relationalOrEqual"] = relationalOrEqual] = "relationalOrEqual"; // <=/>= prec:8 const bitShiftL = 47113; TokenType[TokenType["bitShiftL"] = bitShiftL] = "bitShiftL"; // << prec:9 const bitShiftR = 48137; TokenType[TokenType["bitShiftR"] = bitShiftR] = "bitShiftR"; // >>/>>> prec:9 const plus = 49802; TokenType[TokenType["plus"] = plus] = "plus"; // + prec:10 prefix startsExpr const minus = 50826; TokenType[TokenType["minus"] = minus] = "minus"; // - prec:10 prefix startsExpr const modulo = 51723; TokenType[TokenType["modulo"] = modulo] = "modulo"; // % prec:11 startsExpr const star = 52235; TokenType[TokenType["star"] = star] = "star"; // * prec:11 const slash = 53259; TokenType[TokenType["slash"] = slash] = "slash"; // / prec:11 const exponent = 54348; TokenType[TokenType["exponent"] = exponent] = "exponent"; // ** prec:12 rightAssociative const jsxName = 55296; TokenType[TokenType["jsxName"] = jsxName] = "jsxName"; // jsxName const jsxText = 56320; TokenType[TokenType["jsxText"] = jsxText] = "jsxText"; // jsxText const jsxEmptyText = 57344; TokenType[TokenType["jsxEmptyText"] = jsxEmptyText] = "jsxEmptyText"; // jsxEmptyText const jsxTagStart = 58880; TokenType[TokenType["jsxTagStart"] = jsxTagStart] = "jsxTagStart"; // jsxTagStart startsExpr const jsxTagEnd = 59392; TokenType[TokenType["jsxTagEnd"] = jsxTagEnd] = "jsxTagEnd"; // jsxTagEnd const typeParameterStart = 60928; TokenType[TokenType["typeParameterStart"] = typeParameterStart] = "typeParameterStart"; // typeParameterStart startsExpr const nonNullAssertion = 61440; TokenType[TokenType["nonNullAssertion"] = nonNullAssertion] = "nonNullAssertion"; // nonNullAssertion const _break = 62480; TokenType[TokenType["_break"] = _break] = "_break"; // break keyword const _case = 63504; TokenType[TokenType["_case"] = _case] = "_case"; // case keyword const _catch = 64528; TokenType[TokenType["_catch"] = _catch] = "_catch"; // catch keyword const _continue = 65552; TokenType[TokenType["_continue"] = _continue] = "_continue"; // continue keyword const _debugger = 66576; TokenType[TokenType["_debugger"] = _debugger] = "_debugger"; // debugger keyword const _default = 67600; TokenType[TokenType["_default"] = _default] = "_default"; // default keyword const _do = 68624; TokenType[TokenType["_do"] = _do] = "_do"; // do keyword const _else = 69648; TokenType[TokenType["_else"] = _else] = "_else"; // else keyword const _finally = 70672; TokenType[TokenType["_finally"] = _finally] = "_finally"; // finally keyword const _for = 71696; TokenType[TokenType["_for"] = _for] = "_for"; // for keyword const _function = 73232; TokenType[TokenType["_function"] = _function] = "_function"; // function keyword startsExpr const _if = 73744; TokenType[TokenType["_if"] = _if] = "_if"; // if keyword const _return = 74768; TokenType[TokenType["_return"] = _return] = "_return"; // return keyword const _switch = 75792; TokenType[TokenType["_switch"] = _switch] = "_switch"; // switch keyword const _throw = 77456; TokenType[TokenType["_throw"] = _throw] = "_throw"; // throw keyword prefix startsExpr const _try = 77840; TokenType[TokenType["_try"] = _try] = "_try"; // try keyword const _var = 78864; TokenType[TokenType["_var"] = _var] = "_var"; // var keyword const _let = 79888; TokenType[TokenType["_let"] = _let] = "_let"; // let keyword const _const = 80912; TokenType[TokenType["_const"] = _const] = "_const"; // const keyword const _while = 81936; TokenType[TokenType["_while"] = _while] = "_while"; // while keyword const _with = 82960; TokenType[TokenType["_with"] = _with] = "_with"; // with keyword const _new = 84496; TokenType[TokenType["_new"] = _new] = "_new"; // new keyword startsExpr const _this = 85520; TokenType[TokenType["_this"] = _this] = "_this"; // this keyword startsExpr const _super = 86544; TokenType[TokenType["_super"] = _super] = "_super"; // super keyword startsExpr const _class = 87568; TokenType[TokenType["_class"] = _class] = "_class"; // class keyword startsExpr const _extends = 88080; TokenType[TokenType["_extends"] = _extends] = "_extends"; // extends keyword const _export = 89104; TokenType[TokenType["_export"] = _export] = "_export"; // export keyword const _import = 90640; TokenType[TokenType["_import"] = _import] = "_import"; // import keyword startsExpr const _yield = 91664; TokenType[TokenType["_yield"] = _yield] = "_yield"; // yield keyword startsExpr const _null = 92688; TokenType[TokenType["_null"] = _null] = "_null"; // null keyword startsExpr const _true = 93712; TokenType[TokenType["_true"] = _true] = "_true"; // true keyword startsExpr const _false = 94736; TokenType[TokenType["_false"] = _false] = "_false"; // false keyword startsExpr const _in = 95256; TokenType[TokenType["_in"] = _in] = "_in"; // in prec:8 keyword const _instanceof = 96280; TokenType[TokenType["_instanceof"] = _instanceof] = "_instanceof"; // instanceof prec:8 keyword const _typeof = 97936; TokenType[TokenType["_typeof"] = _typeof] = "_typeof"; // typeof keyword prefix startsExpr const _void = 98960; TokenType[TokenType["_void"] = _void] = "_void"; // void keyword prefix startsExpr const _delete = 99984; TokenType[TokenType["_delete"] = _delete] = "_delete"; // delete keyword prefix startsExpr const _async = 100880; TokenType[TokenType["_async"] = _async] = "_async"; // async keyword startsExpr const _get = 101904; TokenType[TokenType["_get"] = _get] = "_get"; // get keyword startsExpr const _set = 102928; TokenType[TokenType["_set"] = _set] = "_set"; // set keyword startsExpr const _declare = 103952; TokenType[TokenType["_declare"] = _declare] = "_declare"; // declare keyword startsExpr const _readonly = 104976; TokenType[TokenType["_readonly"] = _readonly] = "_readonly"; // readonly keyword startsExpr const _abstract = 106000; TokenType[TokenType["_abstract"] = _abstract] = "_abstract"; // abstract keyword startsExpr const _static = 107024; TokenType[TokenType["_static"] = _static] = "_static"; // static keyword startsExpr const _public = 107536; TokenType[TokenType["_public"] = _public] = "_public"; // public keyword const _private = 108560; TokenType[TokenType["_private"] = _private] = "_private"; // private keyword const _protected = 109584; TokenType[TokenType["_protected"] = _protected] = "_protected"; // protected keyword const _override = 110608; TokenType[TokenType["_override"] = _override] = "_override"; // override keyword const _as = 112144; TokenType[TokenType["_as"] = _as] = "_as"; // as keyword startsExpr const _enum = 113168; TokenType[TokenType["_enum"] = _enum] = "_enum"; // enum keyword startsExpr const _type = 114192; TokenType[TokenType["_type"] = _type] = "_type"; // type keyword startsExpr const _implements = 115216; TokenType[TokenType["_implements"] = _implements] = "_implements"; // implements keyword startsExpr })(TokenType || (TokenType = {})); function formatTokenType(tokenType) { switch (tokenType) { case TokenType.num: return "num"; case TokenType.bigint: return "bigint"; case TokenType.decimal: return "decimal"; case TokenType.regexp: return "regexp"; case TokenType.string: return "string"; case TokenType.name: return "name"; case TokenType.eof: return "eof"; case TokenType.bracketL: return "["; case TokenType.bracketR: return "]"; case TokenType.braceL: return "{"; case TokenType.braceBarL: return "{|"; case TokenType.braceR: return "}"; case TokenType.braceBarR: return "|}"; case TokenType.parenL: return "("; case TokenType.parenR: return ")"; case TokenType.comma: return ","; case TokenType.semi: return ";"; case TokenType.colon: return ":"; case TokenType.doubleColon: return "::"; case TokenType.dot: return "."; case TokenType.question: return "?"; case TokenType.questionDot: return "?."; case TokenType.arrow: return "=>"; case TokenType.template: return "template"; case TokenType.ellipsis: return "..."; case TokenType.backQuote: return "`"; case TokenType.dollarBraceL: return "${"; case TokenType.at: return "@"; case TokenType.hash: return "#"; case TokenType.eq: return "="; case TokenType.assign: return "_="; case TokenType.preIncDec: return "++/--"; case TokenType.postIncDec: return "++/--"; case TokenType.bang: return "!"; case TokenType.tilde: return "~"; case TokenType.pipeline: return "|>"; case TokenType.nullishCoalescing: return "??"; case TokenType.logicalOR: return "||"; case TokenType.logicalAND: return "&&"; case TokenType.bitwiseOR: return "|"; case TokenType.bitwiseXOR: return "^"; case TokenType.bitwiseAND: return "&"; case TokenType.equality: return "==/!="; case TokenType.lessThan: return "<"; case TokenType.greaterThan: return ">"; case TokenType.relationalOrEqual: return "<=/>="; case TokenType.bitShiftL: return "<<"; case TokenType.bitShiftR: return ">>/>>>"; case TokenType.plus: return "+"; case TokenType.minus: return "-"; case TokenType.modulo: return "%"; case TokenType.star: return "*"; case TokenType.slash: return "/"; case TokenType.exponent: return "**"; case TokenType.jsxName: return "jsxName"; case TokenType.jsxText: return "jsxText"; case TokenType.jsxEmptyText: return "jsxEmptyText"; case TokenType.jsxTagStart: return "jsxTagStart"; case TokenType.jsxTagEnd: return "jsxTagEnd"; case TokenType.typeParameterStart: return "typeParameterStart"; case TokenType.nonNullAssertion: return "nonNullAssertion"; case TokenType._break: return "break"; case TokenType._case: return "case"; case TokenType._catch: return "catch"; case TokenType._continue: return "continue"; case TokenType._debugger: return "debugger"; case TokenType._default: return "default"; case TokenType._do: return "do"; case TokenType._else: return "else"; case TokenType._finally: return "finally"; case TokenType._for: return "for"; case TokenType._function: return "function"; case TokenType._if: return "if"; case TokenType._return: return "return"; case TokenType._switch: return "switch"; case TokenType._throw: return "throw"; case TokenType._try: return "try"; case TokenType._var: return "var"; case TokenType._let: return "let"; case TokenType._const: return "const"; case TokenType._while: return "while"; case TokenType._with: return "with"; case TokenType._new: return "new"; case TokenType._this: return "this"; case TokenType._super: return "super"; case TokenType._class: return "class"; case TokenType._extends: return "extends"; case TokenType._export: return "export"; case TokenType._import: return "import"; case TokenType._yield: return "yield"; case TokenType._null: return "null"; case TokenType._true: return "true"; case TokenType._false: return "false"; case TokenType._in: return "in"; case TokenType._instanceof: return "instanceof"; case TokenType._typeof: return "typeof"; case TokenType._void: return "void"; case TokenType._delete: return "delete"; case TokenType._async: return "async"; case TokenType._get: return "get"; case TokenType._set: return "set"; case TokenType._declare: return "declare"; case TokenType._readonly: return "readonly"; case TokenType._abstract: return "abstract"; case TokenType._static: return "static"; case TokenType._public: return "public"; case TokenType._private: return "private"; case TokenType._protected: return "protected"; case TokenType._override: return "override"; case TokenType._as: return "as"; case TokenType._enum: return "enum"; case TokenType._type: return "type"; case TokenType._implements: return "implements"; default: return ""; } } class Scope { constructor(startTokenIndex, endTokenIndex, isFunctionScope) { this.startTokenIndex = startTokenIndex; this.endTokenIndex = endTokenIndex; this.isFunctionScope = isFunctionScope; } } class StateSnapshot { constructor( potentialArrowAt, noAnonFunctionType, inDisallowConditionalTypesContext, tokensLength, scopesLength, pos, type, contextualKeyword, start, end, isType, scopeDepth, error, ) {this.potentialArrowAt = potentialArrowAt;this.noAnonFunctionType = noAnonFunctionType;this.inDisallowConditionalTypesContext = inDisallowConditionalTypesContext;this.tokensLength = tokensLength;this.scopesLength = scopesLength;this.pos = pos;this.type = type;this.contextualKeyword = contextualKeyword;this.start = start;this.end = end;this.isType = isType;this.scopeDepth = scopeDepth;this.error = error;} } class State {constructor() { State.prototype.__init.call(this);State.prototype.__init2.call(this);State.prototype.__init3.call(this);State.prototype.__init4.call(this);State.prototype.__init5.call(this);State.prototype.__init6.call(this);State.prototype.__init7.call(this);State.prototype.__init8.call(this);State.prototype.__init9.call(this);State.prototype.__init10.call(this);State.prototype.__init11.call(this);State.prototype.__init12.call(this);State.prototype.__init13.call(this); } // Used to signify the start of a potential arrow function __init() {this.potentialArrowAt = -1;} // Used by Flow to handle an edge case involving function type parsing. __init2() {this.noAnonFunctionType = false;} // Used by TypeScript to handle ambiguities when parsing conditional types. __init3() {this.inDisallowConditionalTypesContext = false;} // Token store. __init4() {this.tokens = [];} // Array of all observed scopes, ordered by their ending position. __init5() {this.scopes = [];} // The current position of the tokenizer in the input. __init6() {this.pos = 0;} // Information about the current token. __init7() {this.type = TokenType.eof;} __init8() {this.contextualKeyword = ContextualKeyword.NONE;} __init9() {this.start = 0;} __init10() {this.end = 0;} __init11() {this.isType = false;} __init12() {this.scopeDepth = 0;} /** * If the parser is in an error state, then the token is always tt.eof and all functions can * keep executing but should be written so they don't get into an infinite loop in this situation. * * This approach, combined with the ability to snapshot and restore state, allows us to implement * backtracking without exceptions and without needing to explicitly propagate error states * everywhere. */ __init13() {this.error = null;} snapshot() { return new StateSnapshot( this.potentialArrowAt, this.noAnonFunctionType, this.inDisallowConditionalTypesContext, this.tokens.length, this.scopes.length, this.pos, this.type, this.contextualKeyword, this.start, this.end, this.isType, this.scopeDepth, this.error, ); } restoreFromSnapshot(snapshot) { this.potentialArrowAt = snapshot.potentialArrowAt; this.noAnonFunctionType = snapshot.noAnonFunctionType; this.inDisallowConditionalTypesContext = snapshot.inDisallowConditionalTypesContext; this.tokens.length = snapshot.tokensLength; this.scopes.length = snapshot.scopesLength; this.pos = snapshot.pos; this.type = snapshot.type; this.contextualKeyword = snapshot.contextualKeyword; this.start = snapshot.start; this.end = snapshot.end; this.isType = snapshot.isType; this.scopeDepth = snapshot.scopeDepth; this.error = snapshot.error; } } var charCodes; (function (charCodes) { const backSpace = 8; charCodes[charCodes["backSpace"] = backSpace] = "backSpace"; const lineFeed = 10; charCodes[charCodes["lineFeed"] = lineFeed] = "lineFeed"; // '\n' const tab = 9; charCodes[charCodes["tab"] = tab] = "tab"; // '\t' const carriageReturn = 13; charCodes[charCodes["carriageReturn"] = carriageReturn] = "carriageReturn"; // '\r' const shiftOut = 14; charCodes[charCodes["shiftOut"] = shiftOut] = "shiftOut"; const space = 32; charCodes[charCodes["space"] = space] = "space"; const exclamationMark = 33; charCodes[charCodes["exclamationMark"] = exclamationMark] = "exclamationMark"; // '!' const quotationMark = 34; charCodes[charCodes["quotationMark"] = quotationMark] = "quotationMark"; // '"' const numberSign = 35; charCodes[charCodes["numberSign"] = numberSign] = "numberSign"; // '#' const dollarSign = 36; charCodes[charCodes["dollarSign"] = dollarSign] = "dollarSign"; // '$' const percentSign = 37; charCodes[charCodes["percentSign"] = percentSign] = "percentSign"; // '%' const ampersand = 38; charCodes[charCodes["ampersand"] = ampersand] = "ampersand"; // '&' const apostrophe = 39; charCodes[charCodes["apostrophe"] = apostrophe] = "apostrophe"; // ''' const leftParenthesis = 40; charCodes[charCodes["leftParenthesis"] = leftParenthesis] = "leftParenthesis"; // '(' const rightParenthesis = 41; charCodes[charCodes["rightParenthesis"] = rightParenthesis] = "rightParenthesis"; // ')' const asterisk = 42; charCodes[charCodes["asterisk"] = asterisk] = "asterisk"; // '*' const plusSign = 43; charCodes[charCodes["plusSign"] = plusSign] = "plusSign"; // '+' const comma = 44; charCodes[charCodes["comma"] = comma] = "comma"; // ',' const dash = 45; charCodes[charCodes["dash"] = dash] = "dash"; // '-' const dot = 46; charCodes[charCodes["dot"] = dot] = "dot"; // '.' const slash = 47; charCodes[charCodes["slash"] = slash] = "slash"; // '/' const digit0 = 48; charCodes[charCodes["digit0"] = digit0] = "digit0"; // '0' const digit1 = 49; charCodes[charCodes["digit1"] = digit1] = "digit1"; // '1' const digit2 = 50; charCodes[charCodes["digit2"] = digit2] = "digit2"; // '2' const digit3 = 51; charCodes[charCodes["digit3"] = digit3] = "digit3"; // '3' const digit4 = 52; charCodes[charCodes["digit4"] = digit4] = "digit4"; // '4' const digit5 = 53; charCodes[charCodes["digit5"] = digit5] = "digit5"; // '5' const digit6 = 54; charCodes[charCodes["digit6"] = digit6] = "digit6"; // '6' const digit7 = 55; charCodes[charCodes["digit7"] = digit7] = "digit7"; // '7' const digit8 = 56; charCodes[charCodes["digit8"] = digit8] = "digit8"; // '8' const digit9 = 57; charCodes[charCodes["digit9"] = digit9] = "digit9"; // '9' const colon = 58; charCodes[charCodes["colon"] = colon] = "colon"; // ':' const semicolon = 59; charCodes[charCodes["semicolon"] = semicolon] = "semicolon"; // ';' const lessThan = 60; charCodes[charCodes["lessThan"] = lessThan] = "lessThan"; // '<' const equalsTo = 61; charCodes[charCodes["equalsTo"] = equalsTo] = "equalsTo"; // '=' const greaterThan = 62; charCodes[charCodes["greaterThan"] = greaterThan] = "greaterThan"; // '>' const questionMark = 63; charCodes[charCodes["questionMark"] = questionMark] = "questionMark"; // '?' const atSign = 64; charCodes[charCodes["atSign"] = atSign] = "atSign"; // '@' const uppercaseA = 65; charCodes[charCodes["uppercaseA"] = uppercaseA] = "uppercaseA"; // 'A' const uppercaseB = 66; charCodes[charCodes["uppercaseB"] = uppercaseB] = "uppercaseB"; // 'B' const uppercaseC = 67; charCodes[charCodes["uppercaseC"] = uppercaseC] = "uppercaseC"; // 'C' const uppercaseD = 68; charCodes[charCodes["uppercaseD"] = uppercaseD] = "uppercaseD"; // 'D' const uppercaseE = 69; charCodes[charCodes["uppercaseE"] = uppercaseE] = "uppercaseE"; // 'E' const uppercaseF = 70; charCodes[charCodes["uppercaseF"] = uppercaseF] = "uppercaseF"; // 'F' const uppercaseG = 71; charCodes[charCodes["uppercaseG"] = uppercaseG] = "uppercaseG"; // 'G' const uppercaseH = 72; charCodes[charCodes["uppercaseH"] = uppercaseH] = "uppercaseH"; // 'H' const uppercaseI = 73; charCodes[charCodes["uppercaseI"] = uppercaseI] = "uppercaseI"; // 'I' const uppercaseJ = 74; charCodes[charCodes["uppercaseJ"] = uppercaseJ] = "uppercaseJ"; // 'J' const uppercaseK = 75; charCodes[charCodes["uppercaseK"] = uppercaseK] = "uppercaseK"; // 'K' const uppercaseL = 76; charCodes[charCodes["uppercaseL"] = uppercaseL] = "uppercaseL"; // 'L' const uppercaseM = 77; charCodes[charCodes["uppercaseM"] = uppercaseM] = "uppercaseM"; // 'M' const uppercaseN = 78; charCodes[charCodes["uppercaseN"] = uppercaseN] = "uppercaseN"; // 'N' const uppercaseO = 79; charCodes[charCodes["uppercaseO"] = uppercaseO] = "uppercaseO"; // 'O' const uppercaseP = 80; charCodes[charCodes["uppercaseP"] = uppercaseP] = "uppercaseP"; // 'P' const uppercaseQ = 81; charCodes[charCodes["uppercaseQ"] = uppercaseQ] = "uppercaseQ"; // 'Q' const uppercaseR = 82; charCodes[charCodes["uppercaseR"] = uppercaseR] = "uppercaseR"; // 'R' const uppercaseS = 83; charCodes[charCodes["uppercaseS"] = uppercaseS] = "uppercaseS"; // 'S' const uppercaseT = 84; charCodes[charCodes["uppercaseT"] = uppercaseT] = "uppercaseT"; // 'T' const uppercaseU = 85; charCodes[charCodes["uppercaseU"] = uppercaseU] = "uppercaseU"; // 'U' const uppercaseV = 86; charCodes[charCodes["uppercaseV"] = uppercaseV] = "uppercaseV"; // 'V' const uppercaseW = 87; charCodes[charCodes["uppercaseW"] = uppercaseW] = "uppercaseW"; // 'W' const uppercaseX = 88; charCodes[charCodes["uppercaseX"] = uppercaseX] = "uppercaseX"; // 'X' const uppercaseY = 89; charCodes[charCodes["uppercaseY"] = uppercaseY] = "uppercaseY"; // 'Y' const uppercaseZ = 90; charCodes[charCodes["uppercaseZ"] = uppercaseZ] = "uppercaseZ"; // 'Z' const leftSquareBracket = 91; charCodes[charCodes["leftSquareBracket"] = leftSquareBracket] = "leftSquareBracket"; // '[' const backslash = 92; charCodes[charCodes["backslash"] = backslash] = "backslash"; // '\ ' const rightSquareBracket = 93; charCodes[charCodes["rightSquareBracket"] = rightSquareBracket] = "rightSquareBracket"; // ']' const caret = 94; charCodes[charCodes["caret"] = caret] = "caret"; // '^' const underscore = 95; charCodes[charCodes["underscore"] = underscore] = "underscore"; // '_' const graveAccent = 96; charCodes[charCodes["graveAccent"] = graveAccent] = "graveAccent"; // '`' const lowercaseA = 97; charCodes[charCodes["lowercaseA"] = lowercaseA] = "lowercaseA"; // 'a' const lowercaseB = 98; charCodes[charCodes["lowercaseB"] = lowercaseB] = "lowercaseB"; // 'b' const lowercaseC = 99; charCodes[charCodes["lowercaseC"] = lowercaseC] = "lowercaseC"; // 'c' const lowercaseD = 100; charCodes[charCodes["lowercaseD"] = lowercaseD] = "lowercaseD"; // 'd' const lowercaseE = 101; charCodes[charCodes["lowercaseE"] = lowercaseE] = "lowercaseE"; // 'e' const lowercaseF = 102; charCodes[charCodes["lowercaseF"] = lowercaseF] = "lowercaseF"; // 'f' const lowercaseG = 103; charCodes[charCodes["lowercaseG"] = lowercaseG] = "lowercaseG"; // 'g' const lowercaseH = 104; charCodes[charCodes["lowercaseH"] = lowercaseH] = "lowercaseH"; // 'h' const lowercaseI = 105; charCodes[charCodes["lowercaseI"] = lowercaseI] = "lowercaseI"; // 'i' const lowercaseJ = 106; charCodes[charCodes["lowercaseJ"] = lowercaseJ] = "lowercaseJ"; // 'j' const lowercaseK = 107; charCodes[charCodes["lowercaseK"] = lowercaseK] = "lowercaseK"; // 'k' const lowercaseL = 108; charCodes[charCodes["lowercaseL"] = lowercaseL] = "lowercaseL"; // 'l' const lowercaseM = 109; charCodes[charCodes["lowercaseM"] = lowercaseM] = "lowercaseM"; // 'm' const lowercaseN = 110; charCodes[charCodes["lowercaseN"] = lowercaseN] = "lowercaseN"; // 'n' const lowercaseO = 111; charCodes[charCodes["lowercaseO"] = lowercaseO] = "lowercaseO"; // 'o' const lowercaseP = 112; charCodes[charCodes["lowercaseP"] = lowercaseP] = "lowercaseP"; // 'p' const lowercaseQ = 113; charCodes[charCodes["lowercaseQ"] = lowercaseQ] = "lowercaseQ"; // 'q' const lowercaseR = 114; charCodes[charCodes["lowercaseR"] = lowercaseR] = "lowercaseR"; // 'r' const lowercaseS = 115; charCodes[charCodes["lowercaseS"] = lowercaseS] = "lowercaseS"; // 's' const lowercaseT = 116; charCodes[charCodes["lowercaseT"] = lowercaseT] = "lowercaseT"; // 't' const lowercaseU = 117; charCodes[charCodes["lowercaseU"] = lowercaseU] = "lowercaseU"; // 'u' const lowercaseV = 118; charCodes[charCodes["lowercaseV"] = lowercaseV] = "lowercaseV"; // 'v' const lowercaseW = 119; charCodes[charCodes["lowercaseW"] = lowercaseW] = "lowercaseW"; // 'w' const lowercaseX = 120; charCodes[charCodes["lowercaseX"] = lowercaseX] = "lowercaseX"; // 'x' const lowercaseY = 121; charCodes[charCodes["lowercaseY"] = lowercaseY] = "lowercaseY"; // 'y' const lowercaseZ = 122; charCodes[charCodes["lowercaseZ"] = lowercaseZ] = "lowercaseZ"; // 'z' const leftCurlyBrace = 123; charCodes[charCodes["leftCurlyBrace"] = leftCurlyBrace] = "leftCurlyBrace"; // '{' const verticalBar = 124; charCodes[charCodes["verticalBar"] = verticalBar] = "verticalBar"; // '|' const rightCurlyBrace = 125; charCodes[charCodes["rightCurlyBrace"] = rightCurlyBrace] = "rightCurlyBrace"; // '}' const tilde = 126; charCodes[charCodes["tilde"] = tilde] = "tilde"; // '~' const nonBreakingSpace = 160; charCodes[charCodes["nonBreakingSpace"] = nonBreakingSpace] = "nonBreakingSpace"; // eslint-disable-next-line no-irregular-whitespace const oghamSpaceMark = 5760; charCodes[charCodes["oghamSpaceMark"] = oghamSpaceMark] = "oghamSpaceMark"; // ' ' const lineSeparator = 8232; charCodes[charCodes["lineSeparator"] = lineSeparator] = "lineSeparator"; const paragraphSeparator = 8233; charCodes[charCodes["paragraphSeparator"] = paragraphSeparator] = "paragraphSeparator"; })(charCodes || (charCodes = {})); let isJSXEnabled; let isTypeScriptEnabled; let isFlowEnabled; let state; let input; let nextContextId; function getNextContextId() { return nextContextId++; } // eslint-disable-next-line @typescript-eslint/no-explicit-any function augmentError(error) { if ("pos" in error) { const loc = locationForIndex(error.pos); error.message += ` (${loc.line}:${loc.column})`; error.loc = loc; } return error; } class Loc { constructor(line, column) { this.line = line; this.column = column; } } function locationForIndex(pos) { let line = 1; let column = 1; for (let i = 0; i < pos; i++) { if (input.charCodeAt(i) === charCodes.lineFeed) { line++; column = 1; } else { column++; } } return new Loc(line, column); } function initParser( inputCode, isJSXEnabledArg, isTypeScriptEnabledArg, isFlowEnabledArg, ) { input = inputCode; state = new State(); nextContextId = 1; isJSXEnabled = isJSXEnabledArg; isTypeScriptEnabled = isTypeScriptEnabledArg; isFlowEnabled = isFlowEnabledArg; } // ## Parser utilities // Tests whether parsed token is a contextual keyword. function isContextual(contextualKeyword) { return state.contextualKeyword === contextualKeyword; } function isLookaheadContextual(contextualKeyword) { const l = lookaheadTypeAndKeyword(); return l.type === TokenType.name && l.contextualKeyword === contextualKeyword; } // Consumes contextual keyword if possible. function eatContextual(contextualKeyword) { return state.contextualKeyword === contextualKeyword && eat(TokenType.name); } // Asserts that following token is given contextual keyword. function expectContextual(contextualKeyword) { if (!eatContextual(contextualKeyword)) { unexpected(); } } // Test whether a semicolon can be inserted at the current position. function canInsertSemicolon() { return match(TokenType.eof) || match(TokenType.braceR) || hasPrecedingLineBreak(); } function hasPrecedingLineBreak() { const prevToken = state.tokens[state.tokens.length - 1]; const lastTokEnd = prevToken ? prevToken.end : 0; for (let i = lastTokEnd; i < state.start; i++) { const code = input.charCodeAt(i); if ( code === charCodes.lineFeed || code === charCodes.carriageReturn || code === 0x2028 || code === 0x2029 ) { return true; } } return false; } function hasFollowingLineBreak() { const nextStart = nextTokenStart(); for (let i = state.end; i < nextStart; i++) { const code = input.charCodeAt(i); if ( code === charCodes.lineFeed || code === charCodes.carriageReturn || code === 0x2028 || code === 0x2029 ) { return true; } } return false; } function isLineTerminator() { return eat(TokenType.semi) || canInsertSemicolon(); } // Consume a semicolon, or, failing that, see if we are allowed to // pretend that there is a semicolon at this position. function semicolon$1() { if (!isLineTerminator()) { unexpected('Unexpected token, expected ";"'); } } // Expect a token of a given type. If found, consume it, otherwise, // raise an unexpected token error at given pos. function expect(type) { const matched = eat(type); if (!matched) { unexpected(`Unexpected token, expected "${formatTokenType(type)}"`); } } /** * Transition the parser to an error state. All code needs to be written to naturally unwind in this * state, which allows us to backtrack without exceptions and without error plumbing everywhere. */ function unexpected(message = "Unexpected token", pos = state.start) { if (state.error) { return; } // eslint-disable-next-line @typescript-eslint/no-explicit-any const err = new SyntaxError(message); err.pos = pos; state.error = err; state.pos = input.length; finishToken(TokenType.eof); } // https://tc39.github.io/ecma262/#sec-white-space const WHITESPACE_CHARS = [ 0x0009, 0x000b, 0x000c, charCodes.space, charCodes.nonBreakingSpace, charCodes.oghamSpaceMark, 0x2000, // EN QUAD 0x2001, // EM QUAD 0x2002, // EN SPACE 0x2003, // EM SPACE 0x2004, // THREE-PER-EM SPACE 0x2005, // FOUR-PER-EM SPACE 0x2006, // SIX-PER-EM SPACE 0x2007, // FIGURE SPACE 0x2008, // PUNCTUATION SPACE 0x2009, // THIN SPACE 0x200a, // HAIR SPACE 0x202f, // NARROW NO-BREAK SPACE 0x205f, // MEDIUM MATHEMATICAL SPACE 0x3000, // IDEOGRAPHIC SPACE 0xfeff, // ZERO WIDTH NO-BREAK SPACE ]; const skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g; const IS_WHITESPACE = new Uint8Array(65536); for (const char of WHITESPACE_CHARS) { IS_WHITESPACE[char] = 1; } function computeIsIdentifierChar(code) { if (code < 48) return code === 36; if (code < 58) return true; if (code < 65) return false; if (code < 91) return true; if (code < 97) return code === 95; if (code < 123) return true; if (code < 128) return false; throw new Error("Should not be called with non-ASCII char code."); } const IS_IDENTIFIER_CHAR = new Uint8Array(65536); for (let i = 0; i < 128; i++) { IS_IDENTIFIER_CHAR[i] = computeIsIdentifierChar(i) ? 1 : 0; } for (let i = 128; i < 65536; i++) { IS_IDENTIFIER_CHAR[i] = 1; } // Aside from whitespace and newlines, all characters outside the ASCII space are either // identifier characters or invalid. Since we're not performing code validation, we can just // treat all invalid characters as identifier characters. for (const whitespaceChar of WHITESPACE_CHARS) { IS_IDENTIFIER_CHAR[whitespaceChar] = 0; } IS_IDENTIFIER_CHAR[0x2028] = 0; IS_IDENTIFIER_CHAR[0x2029] = 0; const IS_IDENTIFIER_START = IS_IDENTIFIER_CHAR.slice(); for (let numChar = charCodes.digit0; numChar <= charCodes.digit9; numChar++) { IS_IDENTIFIER_START[numChar] = 0; } // Generated file, do not edit! Run "yarn generate" to re-generate this file. // prettier-ignore const READ_WORD_TREE = new Int32Array([ // "" -1, 27, 783, 918, 1755, 2376, 2862, 3483, -1, 3699, -1, 4617, 4752, 4833, 5130, 5508, 5940, -1, 6480, 6939, 7749, 8181, 8451, 8613, -1, 8829, -1, // "a" -1, -1, 54, 243, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 432, -1, -1, -1, 675, -1, -1, -1, // "ab" -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 81, -1, -1, -1, -1, -1, -1, -1, // "abs" -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 108, -1, -1, -1, -1, -1, -1, // "abst" -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 135, -1, -1, -1, -1, -1, -1, -1, -1, // "abstr" -1, 162, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // "abstra" -1, -1, -1, 189, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // "abstrac" -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 216, -1, -1, -1, -1, -1, -1, // "abstract" ContextualKeyword._abstract << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // "ac" -1, -1, -1, 270, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // "acc" -1, -1, -1, -1, -1, 297, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // "acce" -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 324, -1, -1, -1, -1, -1, -1, -1, // "acces" -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 351, -1, -1, -1, -1, -1, -1, -1, // "access" -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 378, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // "accesso" -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 405, -1, -1, -1, -1, -1, -1, -1, -1, // "accessor" ContextualKeyword._accessor << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // "as" ContextualKeyword._as << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 459, -1, -1, -1, -1, -1, 594, -1, // "ass" -1, -1, -1, -1, -1, 486, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // "asse" -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 513, -1, -1, -1, -1, -1, -1, -1, -1, // "asser" -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 540, -1, -1, -1, -1, -1, -1, // "assert" ContextualKeyword._assert << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 567, -1, -1, -1, -1, -1, -1, -1, // "asserts" ContextualKeyword._asserts << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // "asy" -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 621, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // "asyn" -1, -1, -1, 648, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // "async" ContextualKeyword._async << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // "aw" -1, 702, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // "awa" -1, -1, -1, -1, -1, -1, -1, -1, -1, 729, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // "awai" -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 756, -1, -1, -1, -1, -1, -1, // "await" ContextualKeyword._await << 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // "b" -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 810, -1, -1, -1, -1, -1, -1, -1, -1, // "br" -1, -1, -1, -1, -1, 837, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // "bre" -1, 864, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // "brea" -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 891, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // "break" (TokenType._break << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // "c" -1, 945, -1, -1, -1, -1, -1, -1, 1107, -1, -1, -1, 1242, -1, -1, 1350, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // "ca" -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 972, 1026, -1, -1, -1, -1, -1, -1, // "cas" -1, -1, -1, -1, -1, 999, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // "case" (TokenType._case << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // "cat" -1, -1, -1, 1053, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // "catc" -1, -1, -1, -1, -1, -1, -1, -1, 1080, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // "catch" (TokenType._catch << 1) + 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // "ch" -1, -1, -1, -1, -1, 1134, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // "che" -1, -1, -1, 1161, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // "chec" -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1188, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // "check" -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1215, -1, -1, -1, -1, -1, -1, -1, // "checks" Conte