Added lookaround-related fields to postfixNode struct
This commit is contained in:
@@ -15,15 +15,23 @@ const (
|
|||||||
RPAREN
|
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,}
|
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
|
// This represents a node in the postfix representation of the expression
|
||||||
type postfixNode struct {
|
type postfixNode struct {
|
||||||
nodetype NodeType
|
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
|
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
|
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)
|
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.
|
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
|
// Creates a new escaped node - the given character is assumed to have been preceded by a backslash
|
||||||
|
Reference in New Issue
Block a user