mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
25 lines
427 B
Go
25 lines
427 B
Go
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
|
|
}
|