Updated references to 'epsilon'

master
Aadhavan Srinivasan 3 days ago
parent 7aee4280cc
commit be60f2fb51

@ -867,7 +867,7 @@ func thompson(re []postfixNode) (Reg, error) {
stateToAdd.isEmpty = false stateToAdd.isEmpty = false
if c.nodetype == assertionNode { if c.nodetype == assertionNode {
stateToAdd.isEmpty = true // This is a little weird. A lookaround has the 'isEmpty' flag set, even though it _isn't_ empty (the contents are the regex). But, there's so much error-checking that relies on this flag that it's better to keep it this way. stateToAdd.isEmpty = true // This is a little weird. A lookaround has the 'isEmpty' flag set, even though it _isn't_ empty (the contents are the regex). But, there's so much error-checking that relies on this flag that it's better to keep it this way.
stateToAdd.content = newContents(EPSILON) // Ideally, an assertion shouldn't have any content, since it doesn't say anything about the content of string stateToAdd.content = newContents(epsilon) // Ideally, an assertion shouldn't have any content, since it doesn't say anything about the content of string
if c.lookaroundDir == 0 || c.lookaroundSign == 0 { if c.lookaroundDir == 0 || c.lookaroundSign == 0 {
switch c.contents[0] { switch c.contents[0] {
case '^': case '^':
@ -920,7 +920,7 @@ func thompson(re []postfixNode) (Reg, error) {
if c.nodetype == lparenNode || c.nodetype == rparenNode { if c.nodetype == lparenNode || c.nodetype == rparenNode {
s := &nfaState{} s := &nfaState{}
s.assert = noneAssert s.assert = noneAssert
s.content = newContents(EPSILON) s.content = newContents(epsilon)
s.isEmpty = true s.isEmpty = true
s.output = make([]*nfaState, 0) s.output = make([]*nfaState, 0)
s.output = append(s.output, s) s.output = append(s.output, s)

@ -63,8 +63,8 @@ func (g Group) isValid() bool {
// If a state begins or ends a capturing group, its 'thread' is updated to contain the correct index. // If a state begins or ends a capturing group, its 'thread' is updated to contain the correct index.
func takeZeroState(states []*nfaState, numGroups int, idx int) (rtv []*nfaState, isZero bool) { func takeZeroState(states []*nfaState, numGroups int, idx int) (rtv []*nfaState, isZero bool) {
for _, state := range states { for _, state := range states {
if len(state.transitions[EPSILON]) > 0 { if len(state.transitions[epsilon]) > 0 {
for _, s := range state.transitions[EPSILON] { for _, s := range state.transitions[epsilon] {
if s.threadGroups == nil { if s.threadGroups == nil {
s.threadGroups = newMatch(numGroups + 1) s.threadGroups = newMatch(numGroups + 1)
} }
@ -78,7 +78,7 @@ func takeZeroState(states []*nfaState, numGroups int, idx int) (rtv []*nfaState,
// closeParenGroups = append(closeParenGroups, s.groupNum) // closeParenGroups = append(closeParenGroups, s.groupNum)
} }
} }
rtv = append(rtv, state.transitions[EPSILON]...) rtv = append(rtv, state.transitions[epsilon]...)
} }
} }
for _, state := range rtv { for _, state := range rtv {

Loading…
Cancel
Save