...

Source file src/github.com/Azure/go-ansiterm/csi_param_state.go

Documentation: github.com/Azure/go-ansiterm

     1  package ansiterm
     2  
     3  type csiParamState struct {
     4  	baseState
     5  }
     6  
     7  func (csiState csiParamState) Handle(b byte) (s state, e error) {
     8  	csiState.parser.logf("CsiParam::Handle %#x", b)
     9  
    10  	nextState, err := csiState.baseState.Handle(b)
    11  	if nextState != nil || err != nil {
    12  		return nextState, err
    13  	}
    14  
    15  	switch {
    16  	case sliceContains(alphabetics, b):
    17  		return csiState.parser.ground, nil
    18  	case sliceContains(csiCollectables, b):
    19  		csiState.parser.collectParam()
    20  		return csiState, nil
    21  	case sliceContains(executors, b):
    22  		return csiState, csiState.parser.execute()
    23  	}
    24  
    25  	return csiState, nil
    26  }
    27  
    28  func (csiState csiParamState) Transition(s state) error {
    29  	csiState.parser.logf("CsiParam::Transition %s --> %s", csiState.Name(), s.Name())
    30  	csiState.baseState.Transition(s)
    31  
    32  	switch s {
    33  	case csiState.parser.ground:
    34  		return csiState.parser.csiDispatch()
    35  	}
    36  
    37  	return nil
    38  }
    39  

View as plain text