Added field to NFA, denoting if a node is lazy or not
This commit is contained in:
@@ -34,6 +34,7 @@ type nfaState struct {
|
|||||||
isKleene bool // Identifies whether current node is a 0-state representing Kleene star
|
isKleene bool // Identifies whether current node is a 0-state representing Kleene star
|
||||||
isQuestion bool // Identifies whether current node is a 0-state representing the question operator
|
isQuestion bool // Identifies whether current node is a 0-state representing the question operator
|
||||||
isAlternation bool // Identifies whether current node is a 0-state representing an alternation
|
isAlternation bool // Identifies whether current node is a 0-state representing an alternation
|
||||||
|
isLazy bool // Only for split states - Identifies whether or not to flip the order of branches (try one branch before the other)
|
||||||
splitState *nfaState // Only for alternation states - the 'other' branch of the alternation ('next' is the first)
|
splitState *nfaState // Only for alternation states - the 'other' branch of the alternation ('next' is the first)
|
||||||
assert assertType // Type of assertion of current node - NONE means that the node doesn't assert anything
|
assert assertType // Type of assertion of current node - NONE means that the node doesn't assert anything
|
||||||
allChars bool // Whether or not the state represents all characters (eg. a 'dot' metacharacter). A 'dot' node doesn't store any contents directly, as it would take up too much space
|
allChars bool // Whether or not the state represents all characters (eg. a 'dot' metacharacter). A 'dot' node doesn't store any contents directly, as it would take up too much space
|
||||||
@@ -77,6 +78,7 @@ func cloneStateHelper(stateToClone *nfaState, cloneMap map[*nfaState]*nfaState)
|
|||||||
isKleene: stateToClone.isKleene,
|
isKleene: stateToClone.isKleene,
|
||||||
isQuestion: stateToClone.isQuestion,
|
isQuestion: stateToClone.isQuestion,
|
||||||
isAlternation: stateToClone.isAlternation,
|
isAlternation: stateToClone.isAlternation,
|
||||||
|
isLazy: stateToClone.isLazy,
|
||||||
assert: stateToClone.assert,
|
assert: stateToClone.assert,
|
||||||
allChars: stateToClone.allChars,
|
allChars: stateToClone.allChars,
|
||||||
except: append([]rune{}, stateToClone.except...),
|
except: append([]rune{}, stateToClone.except...),
|
||||||
@@ -421,6 +423,7 @@ func (s nfaState) equals(other nfaState) bool {
|
|||||||
s.next == other.next &&
|
s.next == other.next &&
|
||||||
s.isKleene == other.isKleene &&
|
s.isKleene == other.isKleene &&
|
||||||
s.isQuestion == other.isQuestion &&
|
s.isQuestion == other.isQuestion &&
|
||||||
|
s.isLazy == other.isLazy &&
|
||||||
s.isAlternation == other.isAlternation &&
|
s.isAlternation == other.isAlternation &&
|
||||||
s.splitState == other.splitState &&
|
s.splitState == other.splitState &&
|
||||||
s.assert == other.assert &&
|
s.assert == other.assert &&
|
||||||
|
Reference in New Issue
Block a user