diff --git a/regex/postfixNode.go b/regex/postfixNode.go index 88e4c62..0447669 100644 --- a/regex/postfixNode.go +++ b/regex/postfixNode.go @@ -44,6 +44,7 @@ type postfixNode struct { lookaroundDir int // Lookbehind or lookahead nodeContents []postfixNode // ONLY USED WHEN nodetype == CHARCLASS. Holds all the nodes inside the given CHARCLASS node. referencedGroup int // ONLY USED WHEN nodetype == backreferenceNode. Holds the group which this one refers to. After parsing is done, the expression will be rewritten eg. (a)\1 will become (a)(a). So the return value of ShuntingYard() shouldn't contain a backreferenceNode. + isLazy bool // ONLY USED WHEN nodetype == kleene or question } // Converts the given list of postfixNodes to one node of type CHARCLASS. @@ -162,10 +163,19 @@ func newPostfixNode(contents ...rune) postfixNode { switch contents[0] { case '+': to_return.nodetype = plusNode + case lazyPlusRune: + to_return.nodetype = plusNode + to_return.isLazy = true case '?': to_return.nodetype = questionNode + case lazyQuestionRune: + to_return.nodetype = questionNode + to_return.isLazy = true case '*': to_return.nodetype = kleeneNode + case lazyKleeneRune: + to_return.nodetype = kleeneNode + to_return.isLazy = true case '|': to_return.nodetype = pipeNode case concatRune: