From e051b1a0f887104f807be7e8d7a4156ffd82e6c5 Mon Sep 17 00:00:00 2001 From: hkff Date: Wed, 21 Oct 2015 16:34:44 +0200 Subject: [PATCH] Fixing BufferedTokenStream.getTokenStream() calls --- runtime/JavaScript/src/antlr4/BufferedTokenStream.js | 3 --- runtime/JavaScript/src/antlr4/Parser.js | 2 +- runtime/Python2/src/antlr4/BufferedTokenStream.py | 3 +-- runtime/Python2/src/antlr4/Parser.py | 2 +- runtime/Python3/src/antlr4/BufferedTokenStream.py | 3 +-- runtime/Python3/src/antlr4/Parser.py | 2 +- 6 files changed, 5 insertions(+), 10 deletions(-) diff --git a/runtime/JavaScript/src/antlr4/BufferedTokenStream.js b/runtime/JavaScript/src/antlr4/BufferedTokenStream.js index 592233e1e..d8a6ba3c9 100644 --- a/runtime/JavaScript/src/antlr4/BufferedTokenStream.js +++ b/runtime/JavaScript/src/antlr4/BufferedTokenStream.js @@ -260,9 +260,6 @@ BufferedTokenStream.prototype.setTokenSource = function(tokenSource) { this.index = -1; }; -BufferedTokenStream.prototype.getTokenSource = function() { - return this.tokenSource; -}; // Given a starting index, return the index of the next token on channel. // Return i if tokens[i] is on channel. Return -1 if there are no tokens diff --git a/runtime/JavaScript/src/antlr4/Parser.js b/runtime/JavaScript/src/antlr4/Parser.js index b5db9271a..38e66dc74 100644 --- a/runtime/JavaScript/src/antlr4/Parser.js +++ b/runtime/JavaScript/src/antlr4/Parser.js @@ -322,7 +322,7 @@ Parser.prototype.compileParseTreePattern = function(pattern, patternRuleIndex, l lexer = lexer || null; if (lexer === null) { if (this.getTokenStream() !== null) { - var tokenSource = this.getTokenStream().getTokenSource(); + var tokenSource = this.getTokenStream().tokenSource; if (tokenSource instanceof Lexer) { lexer = tokenSource; } diff --git a/runtime/Python2/src/antlr4/BufferedTokenStream.py b/runtime/Python2/src/antlr4/BufferedTokenStream.py index 09608a860..fe11d2118 100644 --- a/runtime/Python2/src/antlr4/BufferedTokenStream.py +++ b/runtime/Python2/src/antlr4/BufferedTokenStream.py @@ -217,8 +217,7 @@ class BufferedTokenStream(TokenStream): self.tokens = [] self.index = -1 - def getTokenSource(self): - return self.tokenSource + # Given a starting index, return the index of the next token on channel. # Return i if tokens[i] is on channel. Return -1 if there are no tokens diff --git a/runtime/Python2/src/antlr4/Parser.py b/runtime/Python2/src/antlr4/Parser.py index db07cc812..47e58d073 100644 --- a/runtime/Python2/src/antlr4/Parser.py +++ b/runtime/Python2/src/antlr4/Parser.py @@ -280,7 +280,7 @@ class Parser (Recognizer): def compileParseTreePattern(self, pattern, patternRuleIndex, lexer = None): if lexer is None: if self.getTokenStream() is not None: - tokenSource = self.getTokenStream().getTokenSource() + tokenSource = self.getTokenStream().tokenSource if isinstance( tokenSource, Lexer ): lexer = tokenSource if lexer is None: diff --git a/runtime/Python3/src/antlr4/BufferedTokenStream.py b/runtime/Python3/src/antlr4/BufferedTokenStream.py index 6b87f9e82..919a27335 100644 --- a/runtime/Python3/src/antlr4/BufferedTokenStream.py +++ b/runtime/Python3/src/antlr4/BufferedTokenStream.py @@ -220,8 +220,7 @@ class BufferedTokenStream(TokenStream): self.tokens = [] self.index = -1 - def getTokenSource(self): - return self.tokenSource + # Given a starting index, return the index of the next token on channel. # Return i if tokens[i] is on channel. Return -1 if there are no tokens diff --git a/runtime/Python3/src/antlr4/Parser.py b/runtime/Python3/src/antlr4/Parser.py index 9038bdad9..224cd4024 100644 --- a/runtime/Python3/src/antlr4/Parser.py +++ b/runtime/Python3/src/antlr4/Parser.py @@ -287,7 +287,7 @@ class Parser (Recognizer): def compileParseTreePattern(self, pattern:str, patternRuleIndex:int, lexer:Lexer = None): if lexer is None: if self.getTokenStream() is not None: - tokenSource = self.getTokenStream().getTokenSource() + tokenSource = self.getTokenStream().tokenSource if isinstance( tokenSource, Lexer ): lexer = tokenSource if lexer is None: