Fixing BufferedTokenStream.getTokenStream() calls

This commit is contained in:
hkff 2015-10-21 16:34:44 +02:00
parent 0e09f8b659
commit e051b1a0f8
6 changed files with 5 additions and 10 deletions

View File

@ -260,9 +260,6 @@ BufferedTokenStream.prototype.setTokenSource = function(tokenSource) {
this.index = -1; this.index = -1;
}; };
BufferedTokenStream.prototype.getTokenSource = function() {
return this.tokenSource;
};
// Given a starting index, return the index of the next token on channel. // 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 // Return i if tokens[i] is on channel. Return -1 if there are no tokens

View File

@ -322,7 +322,7 @@ Parser.prototype.compileParseTreePattern = function(pattern, patternRuleIndex, l
lexer = lexer || null; lexer = lexer || null;
if (lexer === null) { if (lexer === null) {
if (this.getTokenStream() !== null) { if (this.getTokenStream() !== null) {
var tokenSource = this.getTokenStream().getTokenSource(); var tokenSource = this.getTokenStream().tokenSource;
if (tokenSource instanceof Lexer) { if (tokenSource instanceof Lexer) {
lexer = tokenSource; lexer = tokenSource;
} }

View File

@ -217,8 +217,7 @@ class BufferedTokenStream(TokenStream):
self.tokens = [] self.tokens = []
self.index = -1 self.index = -1
def getTokenSource(self):
return self.tokenSource
# Given a starting index, return the index of the next token on channel. # 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 # Return i if tokens[i] is on channel. Return -1 if there are no tokens

View File

@ -280,7 +280,7 @@ class Parser (Recognizer):
def compileParseTreePattern(self, pattern, patternRuleIndex, lexer = None): def compileParseTreePattern(self, pattern, patternRuleIndex, lexer = None):
if lexer is None: if lexer is None:
if self.getTokenStream() is not None: if self.getTokenStream() is not None:
tokenSource = self.getTokenStream().getTokenSource() tokenSource = self.getTokenStream().tokenSource
if isinstance( tokenSource, Lexer ): if isinstance( tokenSource, Lexer ):
lexer = tokenSource lexer = tokenSource
if lexer is None: if lexer is None:

View File

@ -220,8 +220,7 @@ class BufferedTokenStream(TokenStream):
self.tokens = [] self.tokens = []
self.index = -1 self.index = -1
def getTokenSource(self):
return self.tokenSource
# Given a starting index, return the index of the next token on channel. # 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 # Return i if tokens[i] is on channel. Return -1 if there are no tokens

View File

@ -287,7 +287,7 @@ class Parser (Recognizer):
def compileParseTreePattern(self, pattern:str, patternRuleIndex:int, lexer:Lexer = None): def compileParseTreePattern(self, pattern:str, patternRuleIndex:int, lexer:Lexer = None):
if lexer is None: if lexer is None:
if self.getTokenStream() is not None: if self.getTokenStream() is not None:
tokenSource = self.getTokenStream().getTokenSource() tokenSource = self.getTokenStream().tokenSource
if isinstance( tokenSource, Lexer ): if isinstance( tokenSource, Lexer ):
lexer = tokenSource lexer = tokenSource
if lexer is None: if lexer is None: