diff options
Diffstat (limited to 'subex/subexstate.go')
-rw-r--r-- | subex/subexstate.go | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/subex/subexstate.go b/subex/subexstate.go index b5e1e9b..56063c0 100644 --- a/subex/subexstate.go +++ b/subex/subexstate.go @@ -153,8 +153,7 @@ type SubexCopyBoolState struct { next SubexState } func (state SubexCopyBoolState) eat(store Store, outputStack OutputStack, char walk.Atom) []SubexBranch { - _, isBool := char.(walk.ValueBool) - if isBool { + if char.Typ == walk.AtomBool { return []SubexBranch{{ state: state.next, outputStack: topAppend(outputStack, []walk.Atom{char}), @@ -172,8 +171,7 @@ type SubexCopyNumberState struct { next SubexState } func (state SubexCopyNumberState) eat(store Store, outputStack OutputStack, char walk.Atom) []SubexBranch { - _, isNumber := char.(walk.ValueNumber) - if isNumber { + if char.Typ == walk.AtomNumber { return []SubexBranch{{ state: state.next, outputStack: topAppend(outputStack, []walk.Atom{char}), @@ -191,8 +189,7 @@ type SubexCopyStringAtomState struct { next SubexState } func (state SubexCopyStringAtomState) eat(store Store, outputStack OutputStack, char walk.Atom) []SubexBranch { - _, isStringAtom := char.(walk.StringAtom) - if isStringAtom { + if char.Typ == walk.AtomStringRune { return []SubexBranch{{ state: state.next, outputStack: topAppend(outputStack, []walk.Atom{char}), @@ -210,9 +207,7 @@ type SubexCopyNonStringAtomState struct { next SubexState } func (state SubexCopyNonStringAtomState) eat(store Store, outputStack OutputStack, char walk.Atom) []SubexBranch { - _, isStringAtom := char.(walk.StringAtom) - _, isStringTerminal := char.(walk.StringTerminal) - if isStringAtom || isStringTerminal { + if char.Typ == walk.AtomStringRune || char.Typ == walk.AtomStringTerminal { return nil } return []SubexBranch{{ |