Added lookaround-related fields to postfixNode struct

master
Aadhavan Srinivasan 1 month ago
parent 77d19cd84e
commit 21b2d5a2a9

@ -15,15 +15,23 @@ const (
RPAREN
)
// Helper constants for lookarounds
const POSITIVE = 1
const NEGATIVE = -1
const LOOKAHEAD = 1
const LOOKBEHIND = -1
var INFINITE_REPS int = -1 // Represents infinite reps eg. the end range in {5,}
// This represents a node in the postfix representation of the expression
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
contents []rune // Contents of the node
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
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.
lookaroundSign int // ONLY USED WHEN nodetype == ASSERTION. Whether we have a positive or negative lookaround.
lookaroundDir int // Lookbehind or lookahead
}
// Creates a new escaped node - the given character is assumed to have been preceded by a backslash

Loading…
Cancel
Save