|
|
|
@ -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
|
|
|
|
|
// an empty array and 0.
|
|
|
|
|
// If it passes, we treat it like any other state, and return all the transitions.
|
|
|
|
|
if s.assert == SOS && idx != 0 {
|
|
|
|
|
return make([]*State, 0), -1
|
|
|
|
|
}
|
|
|
|
|
if s.assert == EOS && idx != len(str) {
|
|
|
|
|
return make([]*State, 0), -1
|
|
|
|
|
}
|
|
|
|
|
if s.assert == WBOUND && !isWordBoundary(str, idx) {
|
|
|
|
|
return make([]*State, 0), -1
|
|
|
|
|
}
|
|
|
|
|
if s.assert == NONWBOUND && isWordBoundary(str, idx) {
|
|
|
|
|
return make([]*State, 0), -1
|
|
|
|
|
if s.assert != NONE {
|
|
|
|
|
if s.checkAssertion(str, idx) == false {
|
|
|
|
|
return make([]*State, 0), -1
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
listTransitions := s.transitions[int(str[idx])]
|
|
|
|
|
for _, dest := range s.transitions[int(ANY_CHAR)] {
|
|
|
|
|