예제 #1
0
파일: c_comment.go 프로젝트: hhkbp2/go-hsm
// NewWorld() setup HSM and all states for this C Comment Parsing example.
func NewWorld() *CCommentHSM {
	// setup the state machine with proper hierarchy
	top := hsm.NewTop()
	initial := hsm.NewInitial(top, StateCodeID)
	NewCodeState(top)
	NewSlashState(top)
	NewCommentState(top)
	NewStarState(top)
	sm := NewCCommentHSM(top, initial)
	// don't forget to initialize the hsm and all states.
	sm.Init()
	return sm
}
예제 #2
0
파일: annotated.go 프로젝트: hhkbp2/go-hsm
func NewWorld() *AnnotatedHSM {
	top := hsm.NewTop()
	initial := hsm.NewInitial(top, StateS0ID)
	s0 := NewS0State(top)
	s1 := NewS1State(s0)
	NewS11State(s1)
	s2 := NewS2State(s0)
	s21 := NewS21State(s2)
	NewS211State(s21)
	sm := NewAnnotatedHSM(top, initial)
	sm.Init()
	return sm
}