|
|
@ -111,17 +111,10 @@ func (s State) matchesFor(str []rune, idx int) ([]*State, int) {
|
|
|
|
// Assertions can be viewed as 'checks'. If the check fails, we return
|
|
|
|
// Assertions can be viewed as 'checks'. If the check fails, we return
|
|
|
|
// an empty array and 0.
|
|
|
|
// an empty array and 0.
|
|
|
|
// If it passes, we treat it like any other state, and return all the transitions.
|
|
|
|
// If it passes, we treat it like any other state, and return all the transitions.
|
|
|
|
if s.assert == SOS && idx != 0 {
|
|
|
|
if s.assert != NONE {
|
|
|
|
return make([]*State, 0), -1
|
|
|
|
if s.checkAssertion(str, idx) == false {
|
|
|
|
}
|
|
|
|
|
|
|
|
if s.assert == EOS && idx != len(str) {
|
|
|
|
|
|
|
|
return make([]*State, 0), -1
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if s.assert == WBOUND && !isWordBoundary(str, idx) {
|
|
|
|
|
|
|
|
return make([]*State, 0), -1
|
|
|
|
return make([]*State, 0), -1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if s.assert == NONWBOUND && isWordBoundary(str, idx) {
|
|
|
|
|
|
|
|
return make([]*State, 0), -1
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
listTransitions := s.transitions[int(str[idx])]
|
|
|
|
listTransitions := s.transitions[int(str[idx])]
|
|
|
|
for _, dest := range s.transitions[int(ANY_CHAR)] {
|
|
|
|
for _, dest := range s.transitions[int(ANY_CHAR)] {
|
|
|
|