From 84c768fd5e65edc9463296f0e4781e320e1ada7d Mon Sep 17 00:00:00 2001 From: Aadhavan Srinivasan Date: Mon, 28 Oct 2024 09:40:03 -0400 Subject: [PATCH] Fixed small bug with question mark operator, wasn't adding the empty state's output --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index db871a0..c3e8257 100644 --- a/main.go +++ b/main.go @@ -158,7 +158,7 @@ func thompson(re string) *State { s2 := &State{} s2.transitions = make(map[int][]*State) s2.content = EPSILON - s2.output = make([]*State, 0) + s2.output = append(s2.output, s2) s2.isEmpty = true s3 := alternate(s1, s2) nfa = append(nfa, s3)