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cesContent":["import { Schema } from \"./schema\";\ninterface LookupIs {\n\t\"enum\": Enum;\n\t\"message\": Message;\n\t\"extends\": Extends;\n}\nexport interface LookupIn<T extends keyof LookupIs> {\n\tname: string;\n\tis: T;\n\tvalue: LookupIs[T];\n}\nexport type Lookup = LookupIn<keyof LookupIs>[];\nconst MAX_RANGE = 0x1F_FF_FF_FF;\nexport type Primitive =\n\t'int64' | 'uint64' | 'sint64' |\n\t'int32' | 'uint32' | 'sint32' |\n\t'bool' |\n\t'fixed64'| 'sfixed64'| 'double' |\n\t'fixed32'| 'sfixed32'| 'float' |\n\t'string' | 'bytes';\nexport const PRIMITIVE_TYPES: ReadonlySet<string> = new Set([\n\t'int32', 'int64',\n\t'uint32', 'uint64',\n\t'sint32', 'sint64',\n\t'bool',\n\t'fixed64', 'sfixed64', 'double',\n\t'fixed32', 'sfixed32', 'float',\n\t'string' , 'bytes']);\n/** \"Only repeated fields of primitive numeric types (types which use the varint, 32-bit, or 64-bit wire types) can be declared \"packed\".\" */\nexport const PACKABLE_TYPES: ReadonlySet<string> = new Set([\n\t// varint wire types\n\t'int32', 'int64', 'uint32', 'uint64', 'sint32', 'sint64', 'bool',\n\t// + ENUMS\n\t// 64-bit wire types\n\t'fixed64', 'sfixed64', 'double',\n\t// 32-bit wire types\n\t'fixed32', 'sfixed32', 'float'\n])\n/** Only integer and string types may be used as map key types */\nexport const MAP_KEY_TYPES: ReadonlySet<string> = new Set([\n\t// varint wire types\n\t'int32', 'int64', 'uint32', 'uint64', 'sint32', 'sint64', 'bool',\n\t// + ENUMS\n\t// 64-bit wire types\n\t'fixed64', 'sfixed64',\n\t// 32-bit wire types\n\t'fixed32', 'sfixed32',\n\t// length-delimited type\n\t'string'\n])\nexport type NameMappedValueMap = Map<string, string>;\nconst opts_wm = new WeakMap<Options, NameMappedValueMap>();\n\nexport interface OptionsJSON {[s: string]: string | OptionsJSON;}\nexport interface ReadonlyOptionsJSON {\n\treadonly [s: string]: string | ReadonlyOptionsJSON;\n}\n\nconst $emptyarray = Object.freeze([]),\n\t$emptyobject: ReadonlyOptionsJSON = Object.freeze({})\n\nfunction freeze_deeply(obj: OptionsJSON) {\n\tfor (const key in obj)\n\t\tif (typeof obj[key] === 'object')\n\t\t\tfreeze_deeply(obj[key] as OptionsJSON)\n\treturn Object.freeze(obj) as ReadonlyOptionsJSON\n}\nexport class Options {\n\tparse_bool(name: string): true | false | null {\n\t\tswitch (this.get_option(name)) {\n\t\t\tcase \"true\": return true;\n\t\t\tcase \"false\": return false;\n\t\t\tcase undefined: return null;\n\t\t}\n\t\treturn null\n\t}\n\tget_option(name: string): string | undefined {\n\t\treturn opts_wm.has(this) ? opts_wm.get(this)!.get(name) : undefined\n\t}\n\tget options(): NameMappedValueMap {\n\t\tlet m = opts_wm.get(this);\n\t\tif (!m) {\n\t\t\tm = new Map;\n\t\t\topts_wm.set(this, m);\n\t\t}\n\t\treturn m\n\t}\n\tstatic intoJSON(opts: NameMappedValueMap) {\n\t\tconst o: OptionsJSON = {}\n\t\tfor (const [k, v] of Array.from(opts).sort())\n\t\t\tif (v === '{}') {\n\t\t\t\tlet c = o as OptionsJSON\n\t\t\t\tfor (const ke of k.split('.')) switch (typeof c[ke]) {\n\t\t\t\t\tcase 'object': c = c[ke] as OptionsJSON; break;\n\t\t\t\t\tcase 'string': throw new SyntaxError('bad key for string');\n\t\t\t\t\tcase 'undefined': c = (c[ke] = {});\n\t\t\t\t}\n\t\t\t} else if (k.includes('.')) {\n\t\t\t\tlet c = o\n\t\t\t\tlet kv = k.split('.')\n\t\t\t\tlet last = kv.pop()!\n\t\t\t\tfor (const ke of kv) switch (typeof c[ke]) {\n\t\t\t\t\tcase 'object': c = c[ke] as OptionsJSON; break;\n\t\t\t\t\tcase 'string': throw new SyntaxError('bad key for string');\n\t\t\t\t\tcase 'undefined': c = (c[ke] = {});\n\t\t\t\t}\n\t\t\t\tc[last] = v\n\t\t\t} else o[k] = v;\n\t\treturn o\n\t}\n\toptions_as_object() {\n\t\tif (opts_wm.has(this))\n\t\t\treturn freeze_deeply(Options.intoJSON(opts_wm.get(this)!))\n\t\treturn $emptyobject\n\t}\n\ttoJSON() {\n\t\tconst j: Exclude<any, 'options'> = {}\n\t\tfor (const k in this) {\n\t\t\tif (Array.isArray(this[k])) {\n\t\t\t\t//@ts-ignore\n\t\t\t\tif (this[k].length && 'object' === typeof this[k][0])\n\t\t\t\t\t//@ts-ignore\n\t\t\t\t\tj[k] = Array.from(this[k], v => v.toJSON ? v.toJSON() : v)\n\t\t\t\telse j[k] = $emptyarray\n\t\t\t} else {\n\t\t\t\tj[k] = this[k] && (\n\t\t\t\t\t'object' === typeof this[k] ? (\n\t\t\t\t\t\t//@ts-ignore\n\t\t\t\t\t\t'function' === typeof this[k].toJSON ? this[k].toJSON() : this[k]\n\t\t\t\t\t) : this[k]\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t\treturn {...j, options: this.options_as_object()}\n\t}\n}\nconst message_types = new WeakMap<MessageField, Enum | Message>()\nexport class MessageField extends Options {\n\tget type_ref() { return message_types.get(this)! }\n\tset type_ref(v: Enum | Message) {\n\t\tif (PRIMITIVE_TYPES.has(this.type)) throw new SyntaxError('May not reference a primitive type on a MessageField')\n\t\tif (message_types.has(this)) throw new ReferenceError('May not reference more than one type on a MessageField')\n\t\tmessage_types.set(this, v)\n\t}\n\tname = '';\n\ttype = '';\n\ttag = -1;\n\tmap: null | {from: string; to: string} = null;\n\toneof = '';\n\trequired = false;\n\trepeated = false;\n\tdeprecated = false;\n\tpacked = false;\n\toptional = false;\n}\ninterface MessageFields {fields: MessageField[]}\nfunction on_field<T extends MessageFields>({fields}: T, c: TokenCount) {\n\tconst field: MessageField = new MessageField;\n\twhile (!c.done) switch (c.peek()) {\n\t\tcase 'repeated':\n\t\tcase 'required':\n\t\tcase 'optional':\n\t\t\t{\n\t\t\t\tlet t = c.next();\n\t\t\t\tfield.required = t === 'required'\n\t\t\t\tfield.repeated = t === 'repeated'\n\t\t\t\tfield.optional = t === 'optional'\n\t\t\t}\n\t\t\tif (c.peek() === 'map') c.syntax_err('map type cannot be prefixed by required or repeated or optional')\n\t\t\tbreak\n\n\t\tcase 'map':\n\t\t\tfield.type = c.assert('map type', 'map', '<') && 'map';\n\t\t\tfield.map = {\n\t\t\t\tfrom: c.next(),\n\t\t\t\tto: c.assert('map type', ',') && c.next()\n\t\t\t};\n\t\t\tfield.name = c.assert('map type', '>') && c.next();\n\t\t\tif (c.peek() !== '=') c.syntax_err('map name must be followed by a tag assignment')\n\t\t\tbreak\n\n\t\t//@ts-ignore\n\t\tdefault:\n\t\t\tfield.type = c.next()\n\t\t\tfield.name = c.next()\n\t\t\tif (c.peek() !== '=') c.syntax_err('tag assignment must follow field name')\n\n\t\t//@ts-ignore\n\t\tcase '=':\n\t\t\tfield.tag = Number.parseInt(c.next(2), 10);\n\t\t\tif (Number.isNaN(field.tag) || field.tag < 0 || field.tag > MAX_RANGE)\n\t\t\t\tc.syntax_err(`Invalid tag number in message field: ${field.name}, got ${field.tag}`)\n\t\t\tif (c.peek() === ';') break\n\t\t\telse if (c.peek() !== '[') c.syntax_err('field tag must be followed by options or end of field')\n\n\t\t//@ts-ignore\n\t\tcase '[':\n\t\t\ton_inline_options(field, c);\n\t\t\tif (field.parse_bool(\"packed\")) field.packed = true\n\t\t\tif (field.parse_bool(\"deprecated\")) field.deprecated = true\n\t\t\tif (c.peek() !== ';') c.syntax_err('field must end with semicolon')\n\n\t\tcase ';':\n\t\t\tif (field.name === '')\n\t\t\t\tc.syntax_err('Missing field name');\n\t\t\tif (field.type === '')\n\t\t\t\tc.syntax_err(`Missing type in message field: ${field.name}`)\n\t\t\tif (field.tag === -1)\n\t\t\t\tc.syntax_err(`Missing tag number in message field: ${field.name}`)\n\t\t\tfield.tag >>>= 0\n\t\t\tfields.push(field)\n\t\t\tc.assert('field ends with semicolon', ';')\n\t\t\treturn field;\n\t}\n\n\tthrow new Error('No ; found to close message field')\n}\nfunction on_inline_options<T extends Options>({options}: T, c: TokenCount) {\n\twhile (!c.done) switch (c.peek()) {\n\t\tcase '[':\n\t\t//@ts-ignore\n\t\tcase ',': {\n\t\t\tlet name = c.next(2);\n\t\t\tif (name === '(') {\n\t\t\t\tname = c.next();\n\t\t\t\tc.assert('parentheses closed name', ')')\n\t\t\t}\n\t\t\tif (c.peek()[0] === '.') name += c.next()\n\t\t\tc.assert('inline options assignment', '=')\n\t\t\tif (c.peek() === ']') c.syntax_err(`Unexpected ] in field option in ${name}`);\n\t\t\tlet value = c.next();\n\t\t\tif (value === '{') {\n\t\t\t\tvalue = '{}'\n\t\t\t\ton_map_options(options, name, c)\n\t\t\t}\n\t\t\toptions.set(name, value);\n\t\t}\n\t\tif (c.peek() === ',') break\n\t\telse if (c.peek() !== ']') c.syntax_err('inline options must close or continue after a value')\n\t\tcase ']':\n\t\t\tc.assert('inline options close', ']')\n\t\t\treturn;\n\t\tdefault:\n\t\t\tc.syntax_err('field options has no closing tag')\n\t}\n\n\tthrow new SyntaxError('No closing tag for field options');\n}\n\n\nexport function on_package_name(schema: Schema, t: TokenCount) {\n\tschema.package = t.next(2);\n\tt.assert('package name closing semicolon', ';')\n\treturn schema.package\n}\n\nexport function on_syntax_version(schema: Schema, n: TokenCount) {\n\tn.assert('syntax version assignment', 'syntax', '=')\n\tswitch (n.next()) {\n\t\tcase '\"proto2\"':\n\t\tcase \"'proto2'\":\n\t\t\tn.assert(\"syntax version closing semicolon\", \";\");\n\t\t\tschema.syntax = 2;\n\t\t\treturn 2;\n\t\tcase '\"proto3\"':\n\t\tcase \"'proto3'\":\n\t\t\tn.assert(\"syntax version closing semicolon\", \";\");\n\t\t\tschema.syntax = 3;\n\t\t\treturn 3;\n\t}\n\tthrow new SyntaxError(`${n.peek(-1)} is not a valid protobuf syntax version`)\n}\nfunction on_map_options(options: NameMappedValueMap, prefix: string, n: TokenCount) {\n\tlet paren = false\n\twhile (!n.done) switch (n.peek()) {\n\t\tcase '}': n.next(); return;\n\t\tcase ';': throw n.syntax_err('Unexpected end of map options')\n\t\t//@ts-ignore\n\t\tcase '(':\n\t\t\tn.next()\n\t\t\tparen = true\n\t\tdefault: {\n\t\t\tlet key = `${prefix}.${n.next()}`\n\t\t\tif (options.has(key)) n.syntax_err(`Duplicate option named ${key} on same options value`)\n\t\t\tif (paren) n.assert('map options paren', ')')\n\t\t\tif (n.peek() === ':') n.next()\n\t\t\tif (n.peek() === '{') {\n\t\t\t\tn.next()\n\t\t\t\ton_map_options(options, key, n)\n\t\t\t\tlet l = key.lastIndexOf('.')\n\t\t\t\twhile (l > -1 && key) {\n\t\t\t\t\tkey = key.slice(0, l)\n\t\t\t\t\tl = key.lastIndexOf('.')\n\t\t\t\t\tif (options.has(key) && options.get(key) !== '{}') n.syntax_err(`Duplicate option named ${key} on same options value`)\n\t\t\t\t\telse options.set(key, '{}')\n\t\t\t\t}\n\t\t\t} else options.set(key, n.next())\n\t\t\tif (n.peek() === ';') n.next()\n\t\t\tparen = false\n\t\t}\n\t}\n}\nexport function on_option<T extends Options>({options}: T, n: TokenCount) {\n\tlet key = '', value = '', paren = false;\n\twhile (!n.done) switch (n.next()) {\n\t\tcase ';':\n\t\t\tif (options.has(key) && options.get(key) !== '{}') n.syntax_err(`Duplicate option named ${key} on same options value`)\n\t\t\tif (key.includes('.')) {\n\t\t\t\toptions.set(key, value)\n\t\t\t\tlet l = key.lastIndexOf('.')\n\t\t\t\twhile (l > -1 && key) {\n\t\t\t\t\tkey = key.slice(0, l)\n\t\t\t\t\tl = key.lastIndexOf('.')\n\t\t\t\t\tif (options.has(key) && options.get(key) !== '{}') n.syntax_err(`Duplicate option named ${key} on same options value`)\n\t\t\t\t\telse options.set(key, '{}')\n\t\t\t\t}\n\t\t\t} else options.set(key, value)\n\t\t\treturn;\n\n\t\tcase 'option':\n\t\t\tparen = n.peek() === '('\n\t\t\tkey = n.next(paren ? 2 : 1);\n\t\t\tif (paren) n.assert('parenthesised options', ')')\n\t\t\tif (n.peek()[0] === '.') key += n.next()\n\t\t\tbreak;\n\n\t\tcase '=':\n\t\t\tif (key === '') n.syntax_err(`Name must be provided for option with value ${n.peek()}`)\n\t\t\tvalue = n.next()\n\t\t\tif (key === 'optimize_for') switch (value) {\n\t\t\t\tdefault: throw new SyntaxError(`Unexpected value for option optimize_for: ${value}`)\n\t\t\t\tcase 'SPEED': case 'CODE_SIZE': case 'LITE_RUNTIME':\n\t\t\t} else if (value === '{') {\n\t\t\t\tvalue = '{}'\n\t\t\t\ton_map_options(options, key, n)\n\t\t\t}\n\t\t\tbreak\n\t}\n}\nexport class EnumValue extends Options {\n\tconstructor(public name: string, public value: number) {super()}\n}\nexport class Enum extends Options {\n\tvalues: EnumValue[] = [];\n\tallow_alias: boolean = false;\n\tconstructor(public name: string) {super()}\n}\nfunction on_enum_value({values}: Enum, n: TokenCount) {\n\twhile (!n.done) switch (n.peek()) {\n\t\tcase 'reserved':\n\t\t\t// nop until we eat through a semicolon\n\t\t\twhile (n.next() !== ';') ;\n\t\t\treturn;\n\t\tdefault: {\n\t\t\tlet name = n.next()\n\t\t\tn.assert('enum value', '=')\n\t\t\tlet value = Number.parseInt(n.next(), 10);\n\t\t\tif (isNaN(value)) n.syntax_err(`Enum value with name ${name} must not parse as NaN, original is ${n.peek(-1)}`)\n\t\t\tif (value > 0x7f_ff_ff_ff) n.syntax_err(`Enum value must not be greater than the 32 bit signed integer limit`)\n\t\t\tvalue |= 0\n\t\t\tif (value < 0) n.syntax_err(`Enum value must be greater than or equal to 0`)\n\t\t\tlet ret = new EnumValue(name, value);\n\t\t\tif (n.peek() === '[') on_inline_options(ret, n);\n\t\t\tn.assert('enum value closing semicolon', ';')\n\n\t\t\tvalues.push(ret)\n\t\t\treturn ret\n\t\t}\n\t}\n\tthrow new SyntaxError(`enum value was not closed before token completion of file`)\n}\nexport interface Enums {enums: Enum[]};\nexport function on_enum<T extends Enums>({enums}: T, n: TokenCount, l: Lookup) {\n\tconst en: Enum = new Enum(n.next(2))\n\tn.assert('next is opening bracket', '{')\n\twhile (!n.done) switch (n.peek()) {\n\t\tcase 'option':\n\t\t\ton_option(en, n);\n\t\t\tif (en.parse_bool(\"allow_alias\")) en.allow_alias = true;\n\t\t\tbreak;\n\t\tcase '}':\n\t\t\tn.next(n.peek(0) === ';' ? 2 : 1)\n\t\t\tenums.push(en)\n\t\t\tl.push({name: en.name, is: 'enum', value: en})\n\t\t\treturn en;\n\t\tdefault:\n\t\t\ton_enum_value(en, n)\n\t}\n\tthrow new SyntaxError(`enum was not closed before completion of file`)\n}\n\nexport class Message extends Options {\n\tenums: Enum[] = [];\n\textends: Extends[] = [];\n\tmessages: Message[] = [];\n\tfields: MessageField[] = [];\n\textensions: null | {from: number; to: number;} = null;\n\tconstructor(public name: string) {super()}\n}\nexport interface Messages {messages: Message[]}\nexport function on_message<T extends Messages>({messages}: T, c: TokenCount, l: Lookup) {\n\tconst m = new Message(c.next(2))\n\tlet lvl = 0\n\twhile (!c.done) switch (c.peek()) {\n\t\tcase '{': ++lvl; c.next(); break;\n\t\tcase 'map': case 'required': case 'optional': case 'repeated':\n\t\t\ton_field(m, c); break;\n\t\tcase 'enum': {\n\t\t\tconst e = on_enum(m, c, l);\n\t\t\tl.push({name: `${m.name}.${e.name}`, is: 'enum', value: e})\n\t\t}\n\t\tbreak;\n\t\tcase 'message': {\n\t\t\tconst me = on_message(m, c, l);\n\t\t\tl.push({name: `${m.name}.${me.name}`, is: 'message', value: me})\n\t\t}\n\t\tbreak;\n\t\tcase 'extensions': on_extensions(m, c); break;\n\t\tcase 'oneof': {\n\t\t\tlet name = c.next(2);\n\t\t\tc.assert('oneof', '{')\n\t\t\twhile (c.peek() !== '}') {\n\t\t\t\tconst field = on_field(m, c);\n\t\t\t\tfield.oneof = name;\n\t\t\t\tfield.optional = true;\n\t\t\t}\n\t\t\tc.next();\n\t\t}\n\t\tbreak\n\t\tcase 'extend': on_extend(m, c, l); break;\n\t\tcase ';': c.next(); break;\n\t\tcase 'reserved':\n\t\t\tdo c.next();\n\t\t\twhile (c.peek() !== ';');\n\t\t\tbreak;\n\t\tcase 'option':\n\t\t\ton_option(m, c)\n\t\t\tbreak\n\n\t\tdefault: on_field(m, c).optional = true; break;\n\t\tcase '}':\n\t\t\tc.next()\n\t\t\tif (!--lvl) {\n\t\t\t\tmessages.push(m);\n\t\t\t\tl.push({name: m.name, is: \"message\", value: m})\n\t\t\t\treturn m\n\t\t\t}\n\t\t\tbreak;\n\t}\n\tthrow new SyntaxError(`message was not closed before token completion of file`)\n}\nfunction on_extensions(m: Message, c: TokenCount) {\n\tconst from = Number.parseInt(c.next(2), 10)\n\tif (isNaN(from))\n\t\tc.syntax_err(`Invalid \"from\" value in extensions definition`)\n\n\tif (c.next() !== 'to') c.syntax_err(\"Expected keyword 'to' in extensions definition\")\n\tlet sto = c.next()\n\tconst to = sto === 'max' ? MAX_RANGE : Number.parseInt(sto, 10)\n\tif (isNaN(to))\n\t\tc.syntax_err(`Invalid \"to\" value in extensions definition`)\n\n\n\tc.assert('extensions definition', ';')\n\tm.extensions = {from, to}\n}\nexport class Extends extends Options {\n\tmessages: Message[] = []\n\tenums: Enum[] = []\n\tfields: MessageField[] = []\n\tconstructor(public name: string) {super()}\n}\ninterface Extendss {extends: Extends[]}\nexport function on_extend<T extends Extendss>({extends: ex}: T, c: TokenCount, l: Lookup) {\n\tlet e = new Extends(c.peek(1))\n\tconst msg = on_message({messages: []}, c, l)\n\tif (msg.extends.length) c.syntax_err(`Cannot use an extends operator inside an extend key`)\n\tif (msg.extensions) c.syntax_err(`Cannot set extensions on an extend key`)\n\te.messages.push(...msg.messages)\n\te.fields.push(...msg.fields)\n\te.enums.push(...msg.enums)\n\tex.push(e)\n\tl.push({name: e.name, is: \"extends\", value: e} as LookupIn<'extends'>)\n\treturn e\n}\nexport function on_import({imports}: Schema, c: TokenCount) {\n\tlet file = c.next(2).replace(/^(?:\"([^\"]+)\"|'([^']+)')$/, '$1$2')\n\tc.assert('after import', ';')\n\n\timports.push(file)\n}\nexport class RPC extends Options {\n\tconstructor(public name: string) {super()}\n\tinput_type = ''\n\toutput_type = ''\n\tclient_streaming = false\n\tserver_streaming = false\n}\nexport class Service extends Options {\n\tconstructor(public name: string) {super()}\n\tmethods: RPC[] = []\n}\nexport function on_service({services}: Schema, c: TokenCount) {\n\tconst serv = new Service(c.next(2))\n\tc.assert('service open', '{')\n\n\twhile (!c.done) switch (c.peek()) {\n\t\tcase 'option':\n\t\t\ton_option(serv, c);\n\t\t\tbreak;\n\n\t\t//@ts-ignore\n\t\tcase 'rpc':\n\t\t\ton_rpc(serv, c);\n\t\t\tif (c.peek() !== '}') break;\n\n\t\tcase '}':\n\t\t\tc.next();\n\t\t\tif (c.peek() === ';') c.next();\n\t\t\tservices.push(serv);\n\t\t\treturn;\n\t}\n}\nfunction on_rpc({methods}: Service, c: TokenCount) {\n\tconst rpc = new RPC(c.next(2))\n\tc.assert(\"RPC\", '(')\n\n\tif (c.peek() === 'stream') {\n\t\trpc.client_streaming = true\n\t\tc.next()\n\t}\n\trpc.input_type = c.next()\n\tc.assert(\"RPC\", ')', 'returns', '(')\n\n\tif (c.peek() === 'stream') {\n\t\trpc.server_streaming = true\n\t\tc.next()\n\t}\n\trpc.output_type = c.next()\n\tc.assert(\"RPC\", ')')\n\twhile (!c.done) switch (c.peek()) {\n\t\t//@ts-ignore fallthroughCaseInSwitch\n\t\tcase '{':\n\t\t\tc.assert('rpc option open', '{')\n\t\t\tif (c.peek() === '}') break\n\t\t\telse if (c.peek() !== 'option') c.syntax_err(`rpc options must be followed by closing or option tag`)\n\t\t//@ts-ignore fallthroughCaseInSwitch\n\t\tcase 'option':\n\t\t\ton_option(rpc, c);\n\t\t\tif (c.peek() === 'option') break\n\t\t//@ts-ignore fallthroughCaseInSwitch\n\t\tcase '}':\n\t\t\tc.assert('rpc options close', '}')\n\t\tcase ';':\n\t\t\tif (c.peek() === ';') c.next()\n\t\t\tmethods.push(rpc);\n\t\t\treturn rpc\n\t}\n\tthrow new Error('No closing tag for rpc')\n}\n\nexport class TokenCount {\n\tt = 0\n\tl: number\n\tdone: boolean\n\tconstructor(private tokens: readonly string[]) {\n\t\tthis.l = tokens.length\n\t\tthis.done = this.l === 0\n\t}\n\tassert(name: string, next: string, ...further: string[]): true {\n\t\tfor (const tk of [next, ...further]) if (tk !== this.next()) this.syntax_err(`Unexpected ${name} token: ${this.peek(-1)} (expected ${tk})`)\n\t\treturn true\n\t}\n\tpeek(n = 0) {\n\t\treturn this.tokens[this.t + n]\n\t}\n\tnext(n = 1) {\n\t\tif (n < 1) throw new RangeError()\n\t\tthis.done = this.l === (this.t += n);\n\t\treturn this.tokens[this.t - 1];\n\t}\n\tsyntax_err(str: string): never {\n\t\tthrow new SyntaxError(str + ` [around token ${this.t} \"${this.peek()}\"]`)\n\t}\n}\n"]}