Skip to content

Commit f46110a

Browse files
committed
Name regex variable after its usage
1 parent 5783870 commit f46110a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

internal/filter/lexer.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import (
1010
"text/scanner"
1111
)
1212

13-
// regex contains a compiled regexp and is used by the Lexer to match filter identifiers.
14-
// Currently, it allows to match any character except these inside the curly braces.
15-
var regex = regexp.MustCompile("[^!&|~<>=()]")
13+
// identifiersMatcher contains a compiled regexp and is used by the Lexer to match filter identifiers.
14+
// Currently, it allows to match any character except a LogicalOp and CompOperator.
15+
var identifiersMatcher = regexp.MustCompile("[^!&|~<>=()]")
1616

1717
// init just sets the global yyErrorVerbose variable to true.
1818
func init() {
@@ -146,7 +146,7 @@ func (l *Lexer) Error(s string) {
146146
// isIdentRune provides custom implementation of scanner.IsIdentRune.
147147
// This function determines whether a given character is allowed to be part of an identifier.
148148
func isIdentRune(ch rune, i int) bool {
149-
return regex.MatchString(string(ch))
149+
return identifiersMatcher.MatchString(string(ch))
150150
}
151151

152152
// ScanError is used to capture all errors the Scanner encounters.

0 commit comments

Comments
 (0)