Set node type to ASSERTION if the character represents an assertion
This commit is contained in:
@@ -49,6 +49,9 @@ func newEscapedNode(c rune) postfixNode {
|
|||||||
toReturn.contents = append(toReturn.contents, slices.DeleteFunc(dotChars(), func(r rune) bool {
|
toReturn.contents = append(toReturn.contents, slices.DeleteFunc(dotChars(), func(r rune) bool {
|
||||||
return slices.Contains(wordChars, r)
|
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
|
default: // None of the above - append it as a regular character
|
||||||
toReturn.nodetype = CHARACTER
|
toReturn.nodetype = CHARACTER
|
||||||
toReturn.contents = append(toReturn.contents, c)
|
toReturn.contents = append(toReturn.contents, c)
|
||||||
@@ -77,6 +80,8 @@ func newPostfixNode(contents ...rune) postfixNode {
|
|||||||
to_return.nodetype = PIPE
|
to_return.nodetype = PIPE
|
||||||
case CONCAT:
|
case CONCAT:
|
||||||
to_return.nodetype = CONCATENATE
|
to_return.nodetype = CONCATENATE
|
||||||
|
case '^', '$':
|
||||||
|
to_return.nodetype = ASSERTION
|
||||||
default:
|
default:
|
||||||
to_return.nodetype = CHARACTER
|
to_return.nodetype = CHARACTER
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user