Store multiline mode as a global flag
This commit is contained in:
@@ -77,6 +77,9 @@ func getPOSIXClass(str []rune) (bool, string) {
|
||||
// Stores whether the case-insensitive flag has been enabled.
|
||||
var caseInsensitive bool
|
||||
|
||||
// Stores whether the multiline flag has been enabled.
|
||||
var multilineMode bool
|
||||
|
||||
/*
|
||||
The Shunting-Yard algorithm is used to convert the given infix (regeular) expression to postfix.
|
||||
The primary benefit of this is getting rid of parentheses.
|
||||
@@ -89,9 +92,11 @@ func shuntingYard(re string, flags ...ReFlag) ([]postfixNode, error) {
|
||||
// Check which flags are enabled
|
||||
|
||||
caseInsensitive = false
|
||||
multilineMode = false
|
||||
// In Multiline mode, the newline character is considered a
|
||||
// 'dot' character ie. the dot metacharacter matches a newline as well.
|
||||
if slices.Contains(flags, RE_MULTILINE) {
|
||||
multilineMode = true
|
||||
notDotChars = []rune{}
|
||||
} else {
|
||||
notDotChars = []rune{'\n'}
|
||||
|
Reference in New Issue
Block a user