Merge pull request #2461 from youkaichao/python/doc

update python runtime doc
This commit is contained in:
Terence Parr 2019-01-03 10:16:54 -07:00 committed by GitHub
commit 07735085bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 7 deletions

View File

@ -101,14 +101,11 @@ class TokenStreamRewriter(object):
return self.programs.setdefault(program_name, [])
def getDefaultText(self):
return self.getText(self.DEFAULT_PROGRAM_NAME, 0, len(self.tokens.tokens))
return self.getText(self.DEFAULT_PROGRAM_NAME, 0, len(self.tokens.tokens) - 1)
def getText(self, program_name, start, stop):
"""
:type interval: IntervalSet.Interval
:param program_name:
:param interval:
:return:
:return: the text in tokens[start, stop](closed interval)
"""
rewrites = self.programs.get(program_name)

View File

@ -101,11 +101,11 @@ class TokenStreamRewriter(object):
return self.programs.setdefault(program_name, [])
def getDefaultText(self):
return self.getText(self.DEFAULT_PROGRAM_NAME, 0, len(self.tokens.tokens))
return self.getText(self.DEFAULT_PROGRAM_NAME, 0, len(self.tokens.tokens) - 1)
def getText(self, program_name, start:int, stop:int):
"""
:return:
:return: the text in tokens[start, stop](closed interval)
"""
rewrites = self.programs.get(program_name)