expectOneOf consumes the next token and guarantees it has one of the required types.
(expected1, expected2 itemType, context, expectedAs string)
| 168 | |
| 169 | // expectOneOf consumes the next token and guarantees it has one of the required types. |
| 170 | func (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. |
| 179 | func (t *Template) unexpected(token item, context, expected string) { |
no test coverage detected