Added fields to denote all the characters that an 'allChars' postfixNode _shouldn't_ represent (useful for inverting character classes)

master
Aadhavan Srinivasan 1 month ago
parent b3ee1fe5e8
commit e882f41400

@ -26,7 +26,8 @@ type postfixNode struct {
contents []rune // Contents of the node - the length of this would only be >1 if the node represents a character class
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
isDot bool // Whether or not the current node represents a 'dot' metacharacter
allChars bool // Whether or not the current node represents all characters (eg. dot metacharacter)
except []rune // For inverted character classes, we match every unicode character _except_ a few. In this case, allChars is true and the exceptions are placed here.
}
// Creates a new escaped node - the given character is assumed to have been preceded by a backslash
@ -115,7 +116,7 @@ func newPostfixDotNode() postfixNode {
toReturn.startReps = 1
toReturn.endReps = 1
toReturn.nodetype = CHARACTER
toReturn.isDot = true
toReturn.allChars = true
toReturn.contents = []rune{ANY_CHAR}
return toReturn
}

Loading…
Cancel
Save