Set node type to ASSERTION if the character represents an assertion

master
Aadhavan Srinivasan 2 months ago
parent 0736e813c1
commit a19d409796

@ -49,6 +49,9 @@ func newEscapedNode(c rune) postfixNode {
toReturn.contents = append(toReturn.contents, slices.DeleteFunc(dotChars(), func(r rune) bool {
return slices.Contains(wordChars, r)
})...)
case 'b', 'B':
toReturn.nodetype = ASSERTION
toReturn.contents = append(toReturn.contents, c)
default: // None of the above - append it as a regular character
toReturn.nodetype = CHARACTER
toReturn.contents = append(toReturn.contents, c)
@ -77,6 +80,8 @@ func newPostfixNode(contents ...rune) postfixNode {
to_return.nodetype = PIPE
case CONCAT:
to_return.nodetype = CONCATENATE
case '^', '$':
to_return.nodetype = ASSERTION
default:
to_return.nodetype = CHARACTER
}

Loading…
Cancel
Save