From a19d409796b478de86d34ad77d23d0e3bef69b5d Mon Sep 17 00:00:00 2001 From: Aadhavan Srinivasan Date: Thu, 31 Oct 2024 17:14:56 -0400 Subject: [PATCH] Set node type to ASSERTION if the character represents an assertion --- postfixNode.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/postfixNode.go b/postfixNode.go index 6fb5945..83c13c9 100644 --- a/postfixNode.go +++ b/postfixNode.go @@ -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 }