ftomassetti / LangSandbox

Project to illustrate how to build a programming language
Apache License 2.0
694 stars 90 forks source link

Correct Token.endPoint() for $reciever of <EOF> #6

Closed CAD97 closed 7 years ago

CAD97 commented 7 years ago

When the ANTLR Token is an , #getText() returns "<EOF>". So that Token.endPoint() calculates the correct end position when the token is an , we need to make sure that the length of the EOF token is counted as 0 and not 5.

CAD97 commented 7 years ago

This should make the test MappingTest::mapSimpleFileWithPositions pass where it failed before (due to the extra length on the token), but unfortunately I can't seem to get gradle to build the project locally to test.

This is based off of the behavior that I observed while following along with your illustration with my own project, which showed this error.

ftomassetti commented 7 years ago

Thanks a lot for this PR!