|
|
@ -98,7 +98,7 @@ func (s State) checkAssertion(str []rune, idx int) bool {
|
|
|
|
if s.assert == NONWBOUND {
|
|
|
|
if s.assert == NONWBOUND {
|
|
|
|
return !isWordBoundary(str, idx)
|
|
|
|
return !isWordBoundary(str, idx)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if s.assert == PLA || s.assert == PLB || s.assert == NLA || s.assert == NLB { // Lookaround
|
|
|
|
if s.isLookaround() {
|
|
|
|
// The process here is simple:
|
|
|
|
// The process here is simple:
|
|
|
|
// 1. Compile the regex stored in the state's contents.
|
|
|
|
// 1. Compile the regex stored in the state's contents.
|
|
|
|
// 2. Run it on the test string.
|
|
|
|
// 2. Run it on the test string.
|
|
|
@ -143,6 +143,10 @@ func (s State) contentContains(str []rune, idx int) bool {
|
|
|
|
return slices.Contains(s.content, int(str[idx]))
|
|
|
|
return slices.Contains(s.content, int(str[idx]))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (s State) isLookaround() bool {
|
|
|
|
|
|
|
|
return s.assert == PLA || s.assert == PLB || s.assert == NLA || s.assert == NLB
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Returns the matches for the character at the given index of the given string.
|
|
|
|
// Returns the matches for the character at the given index of the given string.
|
|
|
|
// Also returns the number of matches. Returns -1 if an assertion failed.
|
|
|
|
// Also returns the number of matches. Returns -1 if an assertion failed.
|
|
|
|
func (s State) matchesFor(str []rune, idx int) ([]*State, int) {
|
|
|
|
func (s State) matchesFor(str []rune, idx int) ([]*State, int) {
|
|
|
|