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

Method expect

pkg/dsl/parser/parser.go:589–597  ·  view source on GitHub ↗

expect method checks if the next token is of the expected type, without advancing the lexer. It returns true if the next token is of the expected type, and false otherwise.

(t token.Type)

Source from the content-addressed store, hash-verified

587
588// expect method checks if the next token is of the expected type, without advancing the lexer. It returns true if the next token is of the expected type, and false otherwise.
589func (p *Parser) expect(t token.Type) bool {
590 // if the next token is of the expected type, return true
591 if p.peekTokenIs(t) {
592 return true
593 }
594 // otherwise, generate an error message indicating that the expected token type was not found and return false
595 p.peekError(t)
596 return false
597}
598
599// parseExpression method parses an expression with a given precedence level and returns the parsed expression as an AST node. It takes an integer value indicating the precedence level.
600func (p *Parser) parseExpression(precedence int) (ast.Expression, error) {

Callers 2

parseExpressionMethod · 0.95

Calls 2

peekTokenIsMethod · 0.95
peekErrorMethod · 0.95

Tested by

no test coverage detected