antlr / antlr/antlr4

getTokens not inclusive in Python3 runtime

Open
#2,134 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
19k
Forks
3.5k
PR merge metrics
No merged PRs in 30d

Description

The function getTokens in the class BufferedTokenStream found in the Python3 runtime is supposed to be inclusive but isn't. Here is the link to the [line](https://github.com/antlr/antlr4/blame/master/runtime/Python3/src/antlr4/BufferedTokenStream.py#L140). Compare to this [line in the Java runtime](https://github.com/antlr/antlr4/blob/master/runtime/Java/src/org/antlr/v4/runtime/BufferedTokenStream.java#L288).

Easy to work around but still a confusing break of convention.

Contributor guide

Open the contributing guide

Research direction

Start at runtime/Python3/src/antlr4/BufferedTokenStream.py line 140 and compare getTokens with runtime/Java/src/org/antlr/v4/runtime/BufferedTokenStream.java line 288. Verify the Python runtime's range behavior against the Java implementation and add coverage showing that the requested endpoints are treated inclusively.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.