One thing I mentally trip over a bit is what .next() will and will not do for you.
As things stand Parser.next() will skip horizontal whitespace for you and then return the next token if there is one left.
.peek() uses the .next() implementation to let you check for tokens. But this carries over the assumptions from .next().
For example in .simple_expression() this means that the range and path access would still try to be parsed even if there is whitespace between the first expression part and the .. or ..
One thing I mentally trip over a bit is what
.next()
will and will not do for you.As things stand
Parser.next()
will skip horizontal whitespace for you and then return the next token if there is one left..peek()
uses the.next()
implementation to let you check for tokens. But this carries over the assumptions from.next()
.For example in
.simple_expression()
this means that the range and path access would still try to be parsed even if there is whitespace between the first expression part and the..
or.
.