diff --git a/postfixNode.go b/postfixNode.go index ca45271..24645bb 100644 --- a/postfixNode.go +++ b/postfixNode.go @@ -1,6 +1,8 @@ package main -import "slices" +import ( + "slices" +) type NodeType int @@ -13,6 +15,8 @@ const ( QUESTION PLUS ASSERTION + LPAREN + RPAREN ) var INFINITE_REPS int = -1 // Represents infinite reps eg. the end range in {5,} @@ -20,8 +24,8 @@ var INFINITE_REPS int = -1 // Represents infinite reps eg. the end range in {5,} type postfixNode struct { nodetype NodeType contents []rune // Contents of the node - the length of this would only be >1 if the node represents a character class - startReps int // How many times the node should be repeated - used with numeric specifiers - endReps int + startReps int // Minimum number of times the node should be repeated - used with numeric specifiers + endReps int // Maximum number of times the node should be repeated - used with numeric specifiers } // Creates a new escaped node - the given character is assumed to have been preceded by a backslash @@ -89,6 +93,10 @@ func newPostfixNode(contents ...rune) postfixNode { to_return.nodetype = CONCATENATE case '^', '$': to_return.nodetype = ASSERTION + case '(': + to_return.nodetype = LPAREN + case ')': + to_return.nodetype = RPAREN default: to_return.nodetype = CHARACTER }