MCPcopy Create free account
hub / github.com/Permify/permify / next

Method next

pkg/dsl/parser/parser.go:81–97  ·  view source on GitHub ↗

next retrieves the next non-ignored token from the Parser's lexer and updates the Parser's currentToken and peekToken fields

()

Source from the content-addressed store, hash-verified

79
80// next retrieves the next non-ignored token from the Parser's lexer and updates the Parser's currentToken and peekToken fields
81func (p *Parser) next() {
82 for {
83 // retrieve the next token from the lexer
84 peek := p.l.NextToken()
85 // if the token is not an ignored token (e.g. whitespace or comments), update the currentToken and peekToken fields and exit the loop
86 if !token.IsIgnores(peek.Type) {
87 // store the current token as previous before advancing
88 p.previousToken = p.currentToken // save current token for lookahead
89 // set the currentToken field to the previous peekToken value
90 p.currentToken = p.peekToken
91 // set the peekToken field to the new peek value
92 p.peekToken = peek
93 // exit the loop
94 break
95 }
96 }
97}
98
99// nextWithIgnores advances the parser's token stream by one position.
100// It updates the currentToken and peekToken of the Parser.

Callers 12

ParseMethod · 0.95
ParsePartialMethod · 0.95
parseEntityStatementMethod · 0.95
parseRuleStatementMethod · 0.95
expectAndNextMethod · 0.95
parseExpressionMethod · 0.95
parseInfixExpressionMethod · 0.95
parseCallExpressionMethod · 0.95

Calls 2

IsIgnoresFunction · 0.92
NextTokenMethod · 0.80

Tested by

no test coverage detected