20 lines
401 B
Go
20 lines
401 B
Go
package parser
|
|
|
|
import (
|
|
"git.makaay.nl/mauricem/go-parsekit/parse"
|
|
)
|
|
|
|
var (
|
|
// Booleans are just the tokens you're used to. Always lowercase.
|
|
trueOrFalse = a.Str("true").Or(a.Str("false"))
|
|
)
|
|
|
|
func (t *parser) startBoolean(p *parse.API) {
|
|
switch {
|
|
case p.Accept(tok.Boolean(nil, trueOrFalse)):
|
|
t.emitCommand(csetBoolVal, p.Result().Value(0).(bool))
|
|
default:
|
|
p.Expected("true or false")
|
|
}
|
|
}
|