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

Method currentError

pkg/dsl/parser/parser.go:883–888  ·  view source on GitHub ↗

currentError adds an error message to the parser's error list indicating that the current token in the input did not match the expected type(s). It takes one or more token types as arguments that indicate the expected types.

(t ...token.Type)

Source from the content-addressed store, hash-verified

881// did not match the expected type(s).
882// It takes one or more token types as arguments that indicate the expected types.
883func (p *Parser) currentError(t ...token.Type) {
884 expected := strings.Join(tokenTypesToStrings(t), ", ")
885 msg := fmt.Sprintf("%v:%v:expected token to be %s, got %s instead", p.l.GetLinePosition(),
886 p.l.GetColumnPosition(), expected, p.currentToken.Type)
887 p.errors = append(p.errors, msg)
888}
889
890// tokenTypesToStrings converts a slice of token types to a slice of their string representations.
891func tokenTypesToStrings(types []token.Type) []string {

Callers 4

parseEntityStatementMethod · 0.95
parseInfixExpressionMethod · 0.95
parseCallExpressionMethod · 0.95

Calls 3

tokenTypesToStringsFunction · 0.85
GetLinePositionMethod · 0.80
GetColumnPositionMethod · 0.80

Tested by

no test coverage detected