Add more robust support for line number, column number and byte number tracking to the lexer (#227)
The first batch of commits in this pull request involve minor refactors
that were found to be potentially worthwhile in the course of
development.
The latter half of this PR adds code in service of eventually closing
#86. The main additions are the classes `SourceLocation` and
`SourceExtent`. `class SourceLocation` is a dataclass that stores a line
number, column number, and byte index into the scrapscript program
source.
`class SourceExtent` has `start` and `end` members of type
`SourceLocation` to represent a swathe of contiguous source code from
the user's scrapscript program. The line and column numbers are
1-indexed as before whereas the byte numbers are 0-indexed. All end
indices are inclusive of the final characters of their corresponding
tokens, i.e. they do *not* demarcate the positions of "one past the end"
of the tokens.
The classes `Token` and `Lexer` are modified to work in terms of
`SourceExtent` so that the lexing phase can maintain richer source
information. This new code structure will hopefully be more robust and
hopefully allow for easier refactoring in the future if needed.
I expect to do a follow-up PR that can build atop this one to maintain
richer source information tracking for the parsing stage.