Renamed 'EPSILON' to 'epsilon' to avoid exporting
This commit is contained in:
10
regex/nfa.go
10
regex/nfa.go
@@ -5,7 +5,7 @@ import (
|
|||||||
"slices"
|
"slices"
|
||||||
)
|
)
|
||||||
|
|
||||||
const EPSILON int = 0xF0000
|
const epsilon int = 0xF0000
|
||||||
|
|
||||||
type assertType int
|
type assertType int
|
||||||
|
|
||||||
@@ -276,7 +276,7 @@ func kleene(s1 nfaState) (*nfaState, error) {
|
|||||||
|
|
||||||
toReturn := &nfaState{}
|
toReturn := &nfaState{}
|
||||||
toReturn.transitions = make(map[int][]*nfaState)
|
toReturn.transitions = make(map[int][]*nfaState)
|
||||||
toReturn.content = newContents(EPSILON)
|
toReturn.content = newContents(epsilon)
|
||||||
toReturn.isEmpty = true
|
toReturn.isEmpty = true
|
||||||
toReturn.isKleene = true
|
toReturn.isKleene = true
|
||||||
toReturn.output = append(toReturn.output, toReturn)
|
toReturn.output = append(toReturn.output, toReturn)
|
||||||
@@ -307,7 +307,7 @@ func alternate(s1 *nfaState, s2 *nfaState) *nfaState {
|
|||||||
for _, c := range s2.content {
|
for _, c := range s2.content {
|
||||||
toReturn.transitions[c], _ = unique_append(toReturn.transitions[c], s2)
|
toReturn.transitions[c], _ = unique_append(toReturn.transitions[c], s2)
|
||||||
}
|
}
|
||||||
toReturn.content = newContents(EPSILON)
|
toReturn.content = newContents(epsilon)
|
||||||
toReturn.isEmpty = true
|
toReturn.isEmpty = true
|
||||||
|
|
||||||
return toReturn
|
return toReturn
|
||||||
@@ -316,7 +316,7 @@ func alternate(s1 *nfaState, s2 *nfaState) *nfaState {
|
|||||||
func question(s1 *nfaState) *nfaState { // Use the fact that ab? == a(b|)
|
func question(s1 *nfaState) *nfaState { // Use the fact that ab? == a(b|)
|
||||||
s2 := &nfaState{}
|
s2 := &nfaState{}
|
||||||
s2.transitions = make(map[int][]*nfaState)
|
s2.transitions = make(map[int][]*nfaState)
|
||||||
s2.content = newContents(EPSILON)
|
s2.content = newContents(epsilon)
|
||||||
s2.output = append(s2.output, s2)
|
s2.output = append(s2.output, s2)
|
||||||
s2.isEmpty = true
|
s2.isEmpty = true
|
||||||
s3 := alternate(s1, s2)
|
s3 := alternate(s1, s2)
|
||||||
@@ -341,7 +341,7 @@ func newState() nfaState {
|
|||||||
// Creates and returns a state that _always_ has a zero-length match.
|
// Creates and returns a state that _always_ has a zero-length match.
|
||||||
func zeroLengthMatchState() nfaState {
|
func zeroLengthMatchState() nfaState {
|
||||||
start := newState()
|
start := newState()
|
||||||
start.content = newContents(EPSILON)
|
start.content = newContents(epsilon)
|
||||||
start.isEmpty = true
|
start.isEmpty = true
|
||||||
start.assert = alwaysTrueAssert
|
start.assert = alwaysTrueAssert
|
||||||
return start
|
return start
|
||||||
|
Reference in New Issue
Block a user