-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCommonTokenStream.js.map
1 lines (1 loc) · 12.9 KB
/
CommonTokenStream.js.map
1
{"version":3,"sources":["CommonTokenStream.js","../src/CommonTokenStream.ts"],"names":["__decorate","decorators","target","key","desc","c","arguments","length","r","Object","getOwnPropertyDescriptor","d","Reflect","decorate","i","defineProperty","__param","paramIndex","decorator","exports","value","BufferedTokenStream_1","require","Decorators_1","Token_1","CommonTokenStream","tokenSource","channel","Token","DEFAULT_CHANNEL","nextTokenOnChannel","k","p","undefined","n","previousTokenOnChannel","tokens","lazyInit","RangeError","tryLB","sync","fill","t","type","EOF","BufferedTokenStream","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,CAAC,GAAGV,UAAU,CAACa,CAAD,CAAlB,EAAuBN,CAAC,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AAC,GAAW,CAAhB;AACA,WAAKO,IAAL;AAFgC;AAAA;AAAA;;AAAA;AAGhC,6BAAc,KAAKL,MAAnB,8HAA2B;AAAA,cAAlBM,CAAkB;;AAC1B,cAAIA,CAAC,CAACf,OAAF,KAAc,KAAKA,OAAvB,EAAgC;AAC/BO,YAAAA,CAAC;AACD;;AAED,cAAIQ,CAAC,CAACC,IAAF,KAAWnB,OAAA,CAAAI,KAAA,CAAMgB,GAArB,EAA0B;AACzB;AACA;AACD;AAX+B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAahC,aAAOV,CAAP;AACA;AA7F4B;AAAA;AAAA,EAASb,qBAAA,CAAAwB,mBAAT,CAA9B;;AAyBC7C,UAAA,CAAA,CADCuB,YAAA,CAAAuB,QACD,CAAA,EDwDErB,iBAAiB,CAACsB,SCxDpB,EDwD+B,iBCxD/B,EDwDkD,ICxDlD,CAAA;;AAKA/C,UAAA,CAAA,CADCuB,YAAA,CAAAuB,QACD,CAAA,EDsDErB,iBAAiB,CAACsB,SCtDpB,EDsD+B,OCtD/B,EDsDwC,ICtDxC,CAAA;;AAsBA/C,UAAA,CAAA,CADCuB,YAAA,CAAAuB,QACD,CAAA,EDmCErB,iBAAiB,CAACsB,SCnCpB,EDmC+B,OCnC/B,EDmCwC,ICnCxC,CAAA;;AApDYtB,iBAAiB,GAAAzB,UAAA,CAAA,CAmBhBgB,OAAA,CAAA,CAAA,EAAAO,YAAA,CAAAyB,OAAA,CAnBgB,CAAA,EAAjBvB,iBAAiB,CAAjB;AAAAN,OAAA,CAAAM,iBAAA,GAAAA,iBAAA","file":"CommonTokenStream.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 });\n// ConvertTo-TS run at 2016-10-04T11:26:50.3953157-07:00\nconst BufferedTokenStream_1 = require(\"./BufferedTokenStream\");\nconst Decorators_1 = require(\"./Decorators\");\nconst Token_1 = require(\"./Token\");\n/**\n * This class extends {@link BufferedTokenStream} with functionality to filter\n * token streams to tokens on a particular channel (tokens where\n * {@link Token#getChannel} returns a particular value).\n *\n * This token stream provides access to all tokens by index or when calling\n * methods like {@link #getText}. The channel filtering is only used for code\n * accessing tokens via the lookahead methods {@link #LA}, {@link #LT}, and\n * {@link #LB}.\n *\n * By default, tokens are placed on the default channel\n * ({@link Token#DEFAULT_CHANNEL}), but may be reassigned by using the\n * `->channel(HIDDEN)` lexer command, or by using an embedded action to\n * call {@link Lexer#setChannel}.\n *\n * Note: lexer rules which use the `->skip` lexer command or call\n * {@link Lexer#skip} do not produce tokens at all, so input text matched by\n * such a rule will not be available as part of the token stream, regardless of\n * channel.\n */\nlet CommonTokenStream = class CommonTokenStream extends BufferedTokenStream_1.BufferedTokenStream {\n /**\n * Constructs a new {@link CommonTokenStream} using the specified token\n * source and filtering tokens to the specified channel. Only tokens whose\n * {@link Token#getChannel} matches `channel` or have the\n * `Token.type` equal to {@link Token#EOF} will be returned by the\n * token stream lookahead methods.\n *\n * @param tokenSource The token source.\n * @param channel The channel to use for filtering tokens.\n */\n constructor(tokenSource, channel = Token_1.Token.DEFAULT_CHANNEL) {\n super(tokenSource);\n this.channel = channel;\n }\n adjustSeekIndex(i) {\n return this.nextTokenOnChannel(i, this.channel);\n }\n tryLB(k) {\n if ((this.p - k) < 0) {\n return undefined;\n }\n let i = this.p;\n let n = 1;\n // find k good tokens looking backwards\n while (n <= k && i > 0) {\n // skip off-channel tokens\n i = this.previousTokenOnChannel(i - 1, this.channel);\n n++;\n }\n if (i < 0) {\n return undefined;\n }\n return this.tokens[i];\n }\n tryLT(k) {\n //System.out.println(\"enter LT(\"+k+\")\");\n this.lazyInit();\n if (k === 0) {\n throw new RangeError(\"0 is not a valid lookahead index\");\n }\n if (k < 0) {\n return this.tryLB(-k);\n }\n let i = this.p;\n let n = 1; // we know tokens[p] is a good one\n // find k good tokens\n while (n < k) {\n // skip off-channel tokens, but make sure to not look past EOF\n if (this.sync(i + 1)) {\n i = this.nextTokenOnChannel(i + 1, this.channel);\n }\n n++;\n }\n //\t\tif ( i>range ) range = i;\n return this.tokens[i];\n }\n /** Count EOF just once. */\n getNumberOfOnChannelTokens() {\n let n = 0;\n this.fill();\n for (let t of this.tokens) {\n if (t.channel === this.channel) {\n n++;\n }\n if (t.type === Token_1.Token.EOF) {\n break;\n }\n }\n return n;\n }\n};\n__decorate([\n Decorators_1.Override\n], CommonTokenStream.prototype, \"adjustSeekIndex\", null);\n__decorate([\n Decorators_1.Override\n], CommonTokenStream.prototype, \"tryLB\", null);\n__decorate([\n Decorators_1.Override\n], CommonTokenStream.prototype, \"tryLT\", null);\nCommonTokenStream = __decorate([\n __param(0, Decorators_1.NotNull)\n], CommonTokenStream);\nexports.CommonTokenStream = CommonTokenStream;\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:50.3953157-07:00\n\nimport { BufferedTokenStream } from \"./BufferedTokenStream\";\nimport { NotNull, Override } from \"./Decorators\";\nimport { Token } from \"./Token\";\nimport { TokenSource } from \"./TokenSource\";\n\n/**\n * This class extends {@link BufferedTokenStream} with functionality to filter\n * token streams to tokens on a particular channel (tokens where\n * {@link Token#getChannel} returns a particular value).\n *\n * This token stream provides access to all tokens by index or when calling\n * methods like {@link #getText}. The channel filtering is only used for code\n * accessing tokens via the lookahead methods {@link #LA}, {@link #LT}, and\n * {@link #LB}.\n *\n * By default, tokens are placed on the default channel\n * ({@link Token#DEFAULT_CHANNEL}), but may be reassigned by using the\n * `->channel(HIDDEN)` lexer command, or by using an embedded action to\n * call {@link Lexer#setChannel}.\n *\n * Note: lexer rules which use the `->skip` lexer command or call\n * {@link Lexer#skip} do not produce tokens at all, so input text matched by\n * such a rule will not be available as part of the token stream, regardless of\n * channel.\n */\nexport class CommonTokenStream extends BufferedTokenStream {\n\t/**\n\t * Specifies the channel to use for filtering tokens.\n\t *\n\t * The default value is {@link Token#DEFAULT_CHANNEL}, which matches the\n\t * default channel assigned to tokens created by the lexer.\n\t */\n\tprotected channel: number;\n\n\t/**\n\t * Constructs a new {@link CommonTokenStream} using the specified token\n\t * source and filtering tokens to the specified channel. Only tokens whose\n\t * {@link Token#getChannel} matches `channel` or have the\n\t * `Token.type` equal to {@link Token#EOF} will be returned by the\n\t * token stream lookahead methods.\n\t *\n\t * @param tokenSource The token source.\n\t * @param channel The channel to use for filtering tokens.\n\t */\n\tconstructor(@NotNull tokenSource: TokenSource, channel: number = Token.DEFAULT_CHANNEL) {\n\t\tsuper(tokenSource);\n\t\tthis.channel = channel;\n\t}\n\n\t@Override\n\tprotected adjustSeekIndex(i: number): number {\n\t\treturn this.nextTokenOnChannel(i, this.channel);\n\t}\n\n\t@Override\n\tprotected tryLB(k: number): Token | undefined {\n\t\tif ((this.p - k) < 0) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tlet i: number = this.p;\n\t\tlet n: number = 1;\n\t\t// find k good tokens looking backwards\n\t\twhile (n <= k && i > 0) {\n\t\t\t// skip off-channel tokens\n\t\t\ti = this.previousTokenOnChannel(i - 1, this.channel);\n\t\t\tn++;\n\t\t}\n\n\t\tif (i < 0) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn this.tokens[i];\n\t}\n\n\t@Override\n\tpublic tryLT(k: number): Token | undefined {\n\t\t//System.out.println(\"enter LT(\"+k+\")\");\n\t\tthis.lazyInit();\n\t\tif (k === 0) {\n\t\t\tthrow new RangeError(\"0 is not a valid lookahead index\");\n\t\t}\n\n\t\tif (k < 0) {\n\t\t\treturn this.tryLB(-k);\n\t\t}\n\n\t\tlet i: number = this.p;\n\t\tlet n: number = 1; // we know tokens[p] is a good one\n\t\t// find k good tokens\n\t\twhile (n < k) {\n\t\t\t// skip off-channel tokens, but make sure to not look past EOF\n\t\t\tif (this.sync(i + 1)) {\n\t\t\t\ti = this.nextTokenOnChannel(i + 1, this.channel);\n\t\t\t}\n\t\t\tn++;\n\t\t}\n\n\t\t//\t\tif ( i>range ) range = i;\n\t\treturn this.tokens[i];\n\t}\n\n\t/** Count EOF just once. */\n\tpublic getNumberOfOnChannelTokens(): number {\n\t\tlet n: number = 0;\n\t\tthis.fill();\n\t\tfor (let t of this.tokens) {\n\t\t\tif (t.channel === this.channel) {\n\t\t\t\tn++;\n\t\t\t}\n\n\t\t\tif (t.type === Token.EOF) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn n;\n\t}\n}\n"]}