Skip to content

Commit

Permalink
Merge pull request #3252 from Vladimir-Chan/master
Browse files Browse the repository at this point in the history
make Python2 runtime keep consistent with Java
  • Loading branch information
ericvergnaud authored Aug 26, 2021
2 parents 5a428c4 + 9e8cb26 commit 10b0a2e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions runtime/Python2/src/antlr4/BufferedTokenStream.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,17 +196,17 @@ def setTokenSource(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
# on channel between i and EOF.
# Return i if tokens[i] is on channel. Return the index of the EOF toekn
# if there are no tokens on channel between i and EOF.
#/
def nextTokenOnChannel(self, i, channel):
self.sync(i)
if i>=len(self.tokens):
return -1
return len(self.tokens) - 1
token = self.tokens[i]
while token.channel!=channel:
if token.type==Token.EOF:
return -1
return i
i += 1
self.sync(i)
token = self.tokens[i]
Expand Down

0 comments on commit 10b0a2e

Please sign in to comment.