data-section #3

Merged
sashakoshka merged 42 commits from data-section into main 2022-08-17 18:21:20 +00:00
1 changed files with 9 additions and 0 deletions
Showing only changes of commit 384de58d41 - Show all commits

View File

@ -111,3 +111,12 @@ func (parser *ParsingOperation) nextToken (allowed ...lexer.TokenKind) (err erro
err = parser.expect(allowed...)
return
}
// previousToken goes back one token. If the parser is already at the beginning,
// this does nothing.
func (parser *ParsingOperation) previousToken () {
parser.tokenIndex --
if parser.tokenIndex < 0 { parser.tokenIndex = 0 }
parser.token = parser.tokens[parser.tokenIndex]
return
}