forked from ebhomengo/niki
1
0
Fork 0
niki/vendor/github.com/Azure/go-ansiterm/ground_state.go

25 lines
427 B
Go
Raw Normal View History

2024-08-29 03:26:59 +00:00
package ansiterm
type groundState struct {
baseState
}
func (gs groundState) Handle(b byte) (s state, e error) {
gs.parser.context.currentChar = b
nextState, err := gs.baseState.Handle(b)
if nextState != nil || err != nil {
return nextState, err
}
switch {
case sliceContains(printables, b):
return gs, gs.parser.print()
case sliceContains(executors, b):
return gs, gs.parser.execute()
}
return gs, nil
}