-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathListTokenSource.js.map
1 lines (1 loc) · 20.8 KB
/
ListTokenSource.js.map
1
{"version":3,"sources":["ListTokenSource.js","../src/ListTokenSource.ts"],"names":["__decorate","decorators","target","key","desc","c","arguments","length","r","Object","getOwnPropertyDescriptor","d","Reflect","decorate","i","defineProperty","__param","paramIndex","decorator","exports","value","CommonTokenFactory_1","require","Decorators_1","Token_1","ListTokenSource","tokens","sourceName","_factory","CommonTokenFactory","DEFAULT","Error","_sourceName","eofToken","start","previousStop","stopIndex","stop","Math","max","create","source","stream","inputStream","Token","EOF","DEFAULT_CHANNEL","line","charPositionInLine","t","type","lastToken","tokenText","text","lastNewLine","lastIndexOf","startIndex","charAt","undefined","factory","Override","prototype","NotNull"],"mappings":"AAAA;ACAA;;;;;;;;;;;;;ADKA,IAAIA,UAAU,GAAI,UAAQ,SAAKA,UAAd,IAA6B,UAAUC,UAAV,EAAsBC,MAAtB,EAA8BC,GAA9B,EAAmCC,IAAnC,EAAyC;AACnF,MAAIC,CAAC,GAAGC,SAAS,CAACC,MAAlB;AAAA,MAA0BC,CAAC,GAAGH,CAAC,GAAG,CAAJ,GAAQH,MAAR,GAAiBE,IAAI,KAAK,IAAT,GAAgBA,IAAI,GAAGK,MAAM,CAACC,wBAAP,CAAgCR,MAAhC,EAAwCC,GAAxC,CAAvB,GAAsEC,IAArH;AAAA,MAA2HO,CAA3H;AACA,MAAI,QAAOC,OAAP,0DAAOA,OAAP,OAAmB,QAAnB,IAA+B,OAAOA,OAAO,CAACC,QAAf,KAA4B,UAA/D,EAA2EL,CAAC,GAAGI,OAAO,CAACC,QAAR,CAAiBZ,UAAjB,EAA6BC,MAA7B,EAAqCC,GAArC,EAA0CC,IAA1C,CAAJ,CAA3E,KACK,KAAK,IAAIU,CAAC,GAAGb,UAAU,CAACM,MAAX,GAAoB,CAAjC,EAAoCO,CAAC,IAAI,CAAzC,EAA4CA,CAAC,EAA7C;AAAiD,QAAIH,CAA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f;AAAAN,OAAA,CAAAM,eAAA,GAAAA,eAAA","file":"ListTokenSource.js","sourcesContent":["\"use strict\";\n/*!\n * Copyright 2016 The ANTLR Project. All rights reserved.\n * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.\n */\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst CommonTokenFactory_1 = require(\"./CommonTokenFactory\");\nconst Decorators_1 = require(\"./Decorators\");\nconst Token_1 = require(\"./Token\");\n/**\n * Provides an implementation of {@link TokenSource} as a wrapper around a list\n * of {@link Token} objects.\n *\n * If the final token in the list is an {@link Token#EOF} token, it will be used\n * as the EOF token for every call to {@link #nextToken} after the end of the\n * list is reached. Otherwise, an EOF token will be created.\n */\nlet ListTokenSource = class ListTokenSource {\n /**\n * Constructs a new {@link ListTokenSource} instance from the specified\n * collection of {@link Token} objects and source name.\n *\n * @param tokens The collection of {@link Token} objects to provide as a\n * {@link TokenSource}.\n * @param sourceName The name of the {@link TokenSource}. If this value is\n * `undefined`, {@link #getSourceName} will attempt to infer the name from\n * the next {@link Token} (or the previous token if the end of the input has\n * been reached).\n *\n * @exception NullPointerException if `tokens` is `undefined`\n */\n constructor(tokens, sourceName) {\n /**\n * The index into {@link #tokens} of token to return by the next call to\n * {@link #nextToken}. The end of the input is indicated by this value\n * being greater than or equal to the number of items in {@link #tokens}.\n */\n this.i = 0;\n /**\n * This is the backing field for {@link #getTokenFactory} and\n * {@link setTokenFactory}.\n */\n this._factory = CommonTokenFactory_1.CommonTokenFactory.DEFAULT;\n if (tokens == null) {\n throw new Error(\"tokens cannot be null\");\n }\n this.tokens = tokens;\n this._sourceName = sourceName;\n }\n /**\n * {@inheritDoc}\n */\n get charPositionInLine() {\n if (this.i < this.tokens.length) {\n return this.tokens[this.i].charPositionInLine;\n }\n else if (this.eofToken != null) {\n return this.eofToken.charPositionInLine;\n }\n else if (this.tokens.length > 0) {\n // have to calculate the result from the line/column of the previous\n // token, along with the text of the token.\n let lastToken = this.tokens[this.tokens.length - 1];\n let tokenText = lastToken.text;\n if (tokenText != null) {\n let lastNewLine = tokenText.lastIndexOf(\"\\n\");\n if (lastNewLine >= 0) {\n return tokenText.length - lastNewLine - 1;\n }\n }\n return lastToken.charPositionInLine + lastToken.stopIndex - lastToken.startIndex + 1;\n }\n // only reach this if tokens is empty, meaning EOF occurs at the first\n // position in the input\n return 0;\n }\n /**\n * {@inheritDoc}\n */\n nextToken() {\n if (this.i >= this.tokens.length) {\n if (this.eofToken == null) {\n let start = -1;\n if (this.tokens.length > 0) {\n let previousStop = this.tokens[this.tokens.length - 1].stopIndex;\n if (previousStop !== -1) {\n start = previousStop + 1;\n }\n }\n let stop = Math.max(-1, start - 1);\n this.eofToken = this._factory.create({ source: this, stream: this.inputStream }, Token_1.Token.EOF, \"EOF\", Token_1.Token.DEFAULT_CHANNEL, start, stop, this.line, this.charPositionInLine);\n }\n return this.eofToken;\n }\n let t = this.tokens[this.i];\n if (this.i === this.tokens.length - 1 && t.type === Token_1.Token.EOF) {\n this.eofToken = t;\n }\n this.i++;\n return t;\n }\n /**\n * {@inheritDoc}\n */\n get line() {\n if (this.i < this.tokens.length) {\n return this.tokens[this.i].line;\n }\n else if (this.eofToken != null) {\n return this.eofToken.line;\n }\n else if (this.tokens.length > 0) {\n // have to calculate the result from the line/column of the previous\n // token, along with the text of the token.\n let lastToken = this.tokens[this.tokens.length - 1];\n let line = lastToken.line;\n let tokenText = lastToken.text;\n if (tokenText != null) {\n for (let i = 0; i < tokenText.length; i++) {\n if (tokenText.charAt(i) === \"\\n\") {\n line++;\n }\n }\n }\n // if no text is available, assume the token did not contain any newline characters.\n return line;\n }\n // only reach this if tokens is empty, meaning EOF occurs at the first\n // position in the input\n return 1;\n }\n /**\n * {@inheritDoc}\n */\n get inputStream() {\n if (this.i < this.tokens.length) {\n return this.tokens[this.i].inputStream;\n }\n else if (this.eofToken != null) {\n return this.eofToken.inputStream;\n }\n else if (this.tokens.length > 0) {\n return this.tokens[this.tokens.length - 1].inputStream;\n }\n // no input stream information is available\n return undefined;\n }\n /**\n * {@inheritDoc}\n */\n get sourceName() {\n if (this._sourceName) {\n return this._sourceName;\n }\n let inputStream = this.inputStream;\n if (inputStream != null) {\n return inputStream.sourceName;\n }\n return \"List\";\n }\n /**\n * {@inheritDoc}\n */\n // @Override\n set tokenFactory(factory) {\n this._factory = factory;\n }\n /**\n * {@inheritDoc}\n */\n get tokenFactory() {\n return this._factory;\n }\n};\n__decorate([\n Decorators_1.Override\n], ListTokenSource.prototype, \"charPositionInLine\", null);\n__decorate([\n Decorators_1.Override\n], ListTokenSource.prototype, \"nextToken\", null);\n__decorate([\n Decorators_1.Override\n], ListTokenSource.prototype, \"line\", null);\n__decorate([\n Decorators_1.Override\n], ListTokenSource.prototype, \"inputStream\", null);\n__decorate([\n Decorators_1.Override\n], ListTokenSource.prototype, \"sourceName\", null);\n__decorate([\n Decorators_1.Override,\n Decorators_1.NotNull,\n __param(0, Decorators_1.NotNull)\n], ListTokenSource.prototype, \"tokenFactory\", null);\nListTokenSource = __decorate([\n __param(0, Decorators_1.NotNull)\n], ListTokenSource);\nexports.ListTokenSource = ListTokenSource;\n","/*!\n * Copyright 2016 The ANTLR Project. All rights reserved.\n * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.\n */\n\n// ConvertTo-TS run at 2016-10-04T11:26:52.1916955-07:00\n\nimport { CharStream } from \"./CharStream\";\nimport { CommonTokenFactory } from \"./CommonTokenFactory\";\nimport { NotNull, Override } from \"./Decorators\";\nimport { Token } from \"./Token\";\nimport { TokenFactory } from \"./TokenFactory\";\nimport { TokenSource } from \"./TokenSource\";\n\n/**\n * Provides an implementation of {@link TokenSource} as a wrapper around a list\n * of {@link Token} objects.\n *\n * If the final token in the list is an {@link Token#EOF} token, it will be used\n * as the EOF token for every call to {@link #nextToken} after the end of the\n * list is reached. Otherwise, an EOF token will be created.\n */\nexport class ListTokenSource implements TokenSource {\n\t/**\n\t * The wrapped collection of {@link Token} objects to return.\n\t */\n\tprotected tokens: Token[];\n\n\t/**\n\t * The name of the input source. If this value is `undefined`, a call to\n\t * {@link #getSourceName} should return the source name used to create the\n\t * the next token in {@link #tokens} (or the previous token if the end of\n\t * the input has been reached).\n\t */\n\tprivate _sourceName?: string;\n\n\t/**\n\t * The index into {@link #tokens} of token to return by the next call to\n\t * {@link #nextToken}. The end of the input is indicated by this value\n\t * being greater than or equal to the number of items in {@link #tokens}.\n\t */\n\tprotected i: number = 0;\n\n\t/**\n\t * This field caches the EOF token for the token source.\n\t */\n\tprotected eofToken?: Token;\n\n\t/**\n\t * This is the backing field for {@link #getTokenFactory} and\n\t * {@link setTokenFactory}.\n\t */\n\tprivate _factory: TokenFactory = CommonTokenFactory.DEFAULT;\n\n\t/**\n\t * Constructs a new {@link ListTokenSource} instance from the specified\n\t * collection of {@link Token} objects and source name.\n\t *\n\t * @param tokens The collection of {@link Token} objects to provide as a\n\t * {@link TokenSource}.\n\t * @param sourceName The name of the {@link TokenSource}. If this value is\n\t * `undefined`, {@link #getSourceName} will attempt to infer the name from\n\t * the next {@link Token} (or the previous token if the end of the input has\n\t * been reached).\n\t *\n\t * @exception NullPointerException if `tokens` is `undefined`\n\t */\n\tconstructor(@NotNull tokens: Token[], sourceName?: string) {\n\t\tif (tokens == null) {\n\t\t\tthrow new Error(\"tokens cannot be null\");\n\t\t}\n\n\t\tthis.tokens = tokens;\n\t\tthis._sourceName = sourceName;\n\t}\n\n\t/**\n\t * {@inheritDoc}\n\t */\n\t@Override\n\tget charPositionInLine(): number {\n\t\tif (this.i < this.tokens.length) {\n\t\t\treturn this.tokens[this.i].charPositionInLine;\n\t\t} else if (this.eofToken != null) {\n\t\t\treturn this.eofToken.charPositionInLine;\n\t\t} else if (this.tokens.length > 0) {\n\t\t\t// have to calculate the result from the line/column of the previous\n\t\t\t// token, along with the text of the token.\n\t\t\tlet lastToken: Token = this.tokens[this.tokens.length - 1];\n\t\t\tlet tokenText: string | undefined = lastToken.text;\n\t\t\tif (tokenText != null) {\n\t\t\t\tlet lastNewLine: number = tokenText.lastIndexOf(\"\\n\");\n\t\t\t\tif (lastNewLine >= 0) {\n\t\t\t\t\treturn tokenText.length - lastNewLine - 1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn lastToken.charPositionInLine + lastToken.stopIndex - lastToken.startIndex + 1;\n\t\t}\n\n\t\t// only reach this if tokens is empty, meaning EOF occurs at the first\n\t\t// position in the input\n\t\treturn 0;\n\t}\n\n\t/**\n\t * {@inheritDoc}\n\t */\n\t@Override\n\tpublic nextToken(): Token {\n\t\tif (this.i >= this.tokens.length) {\n\t\t\tif (this.eofToken == null) {\n\t\t\t\tlet start: number = -1;\n\t\t\t\tif (this.tokens.length > 0) {\n\t\t\t\t\tlet previousStop: number = this.tokens[this.tokens.length - 1].stopIndex;\n\t\t\t\t\tif (previousStop !== -1) {\n\t\t\t\t\t\tstart = previousStop + 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tlet stop: number = Math.max(-1, start - 1);\n\t\t\t\tthis.eofToken = this._factory.create({ source: this, stream: this.inputStream }, Token.EOF, \"EOF\", Token.DEFAULT_CHANNEL, start, stop, this.line, this.charPositionInLine);\n\t\t\t}\n\n\t\t\treturn this.eofToken;\n\t\t}\n\n\t\tlet t: Token = this.tokens[this.i];\n\t\tif (this.i === this.tokens.length - 1 && t.type === Token.EOF) {\n\t\t\tthis.eofToken = t;\n\t\t}\n\n\t\tthis.i++;\n\t\treturn t;\n\t}\n\n\t/**\n\t * {@inheritDoc}\n\t */\n\t@Override\n\tget line(): number {\n\t\tif (this.i < this.tokens.length) {\n\t\t\treturn this.tokens[this.i].line;\n\t\t} else if (this.eofToken != null) {\n\t\t\treturn this.eofToken.line;\n\t\t} else if (this.tokens.length > 0) {\n\t\t\t// have to calculate the result from the line/column of the previous\n\t\t\t// token, along with the text of the token.\n\t\t\tlet lastToken: Token = this.tokens[this.tokens.length - 1];\n\t\t\tlet line: number = lastToken.line;\n\n\t\t\tlet tokenText: string | undefined = lastToken.text;\n\t\t\tif (tokenText != null) {\n\t\t\t\tfor (let i = 0; i < tokenText.length; i++) {\n\t\t\t\t\tif (tokenText.charAt(i) === \"\\n\") {\n\t\t\t\t\t\tline++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// if no text is available, assume the token did not contain any newline characters.\n\t\t\treturn line;\n\t\t}\n\n\t\t// only reach this if tokens is empty, meaning EOF occurs at the first\n\t\t// position in the input\n\t\treturn 1;\n\t}\n\n\t/**\n\t * {@inheritDoc}\n\t */\n\t@Override\n\tget inputStream(): CharStream | undefined {\n\t\tif (this.i < this.tokens.length) {\n\t\t\treturn this.tokens[this.i].inputStream;\n\t\t} else if (this.eofToken != null) {\n\t\t\treturn this.eofToken.inputStream;\n\t\t} else if (this.tokens.length > 0) {\n\t\t\treturn this.tokens[this.tokens.length - 1].inputStream;\n\t\t}\n\n\t\t// no input stream information is available\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * {@inheritDoc}\n\t */\n\t@Override\n\tget sourceName(): string {\n\t\tif (this._sourceName) {\n\t\t\treturn this._sourceName;\n\t\t}\n\n\t\tlet inputStream: CharStream | undefined = this.inputStream;\n\t\tif (inputStream != null) {\n\t\t\treturn inputStream.sourceName;\n\t\t}\n\n\t\treturn \"List\";\n\t}\n\n\t/**\n\t * {@inheritDoc}\n\t */\n\t// @Override\n\tset tokenFactory(@NotNull factory: TokenFactory) {\n\t\tthis._factory = factory;\n\t}\n\n\t/**\n\t * {@inheritDoc}\n\t */\n\t@Override\n\t@NotNull\n\tget tokenFactory(): TokenFactory {\n\t\treturn this._factory;\n\t}\n}\n"]}