MCPcopy Create free account
hub / github.com/CloudyKit/jet / expectOneOf

Method expectOneOf

parse.go:170–176  ·  view source on GitHub ↗

expectOneOf consumes the next token and guarantees it has one of the required types.

(expected1, expected2 itemType, context, expectedAs string)

Source from the content-addressed store, hash-verified

168
169// expectOneOf consumes the next token and guarantees it has one of the required types.
170func (t *Template) expectOneOf(expected1, expected2 itemType, context, expectedAs string) item {
171 token := t.nextNonSpace()
172 if token.typ != expected1 && token.typ != expected2 {
173 t.unexpected(token, context, expectedAs)
174 }
175 return token
176}
177
178// unexpected complains about the token and terminates processing.
179func (t *Template) unexpected(token item, context, expected string) {

Callers 3

expectStringMethod · 0.95
actionMethod · 0.95
pipelineMethod · 0.95

Calls 2

nextNonSpaceMethod · 0.95
unexpectedMethod · 0.95

Tested by

no test coverage detected