mirror of
https://github.com/alecthomas/chroma.git
synced 2025-03-17 20:58:08 +02:00
Fix a typo into the lables regex for PromQL lexer
The correct label matching operator is `!~` instead of `~!`.
This commit is contained in:
parent
b790655195
commit
9866a75161
@ -44,7 +44,7 @@ func promqlRules() Rules {
|
||||
{`\n`, TextWhitespace, nil},
|
||||
{`\s+`, TextWhitespace, nil},
|
||||
{`,`, Punctuation, nil},
|
||||
{`([_a-zA-Z][a-zA-Z0-9_]*?)(\s*?)(=~|!=|=|~!)(\s*?)("|')(.*?)("|')`, ByGroups(NameLabel, TextWhitespace, Operator, TextWhitespace, Punctuation, LiteralString, Punctuation), nil},
|
||||
{`([_a-zA-Z][a-zA-Z0-9_]*?)(\s*?)(=~|!=|=|!~)(\s*?)("|')(.*?)("|')`, ByGroups(NameLabel, TextWhitespace, Operator, TextWhitespace, Punctuation, LiteralString, Punctuation), nil},
|
||||
},
|
||||
"range": {
|
||||
{`\]`, Punctuation, Pop(1)},
|
||||
|
3
lexers/testdata/promql.actual
vendored
3
lexers/testdata/promql.actual
vendored
@ -31,3 +31,6 @@ label_replace(
|
||||
|
||||
# Values for labels enclosed within single quotes
|
||||
metric_test_app{app='turtle',proc='web'}
|
||||
|
||||
# Use label matching operator `!~`
|
||||
metric_test_app{status!~'(4|5)..'}
|
||||
|
10
lexers/testdata/promql.expected
vendored
10
lexers/testdata/promql.expected
vendored
@ -180,5 +180,15 @@
|
||||
{"type":"Punctuation","value":"'"},
|
||||
{"type":"LiteralString","value":"web"},
|
||||
{"type":"Punctuation","value":"'}"},
|
||||
{"type":"TextWhitespace","value":"\n\n"},
|
||||
{"type":"CommentSingle","value":"# Use label matching operator `!~`"},
|
||||
{"type":"TextWhitespace","value":"\n"},
|
||||
{"type":"NameVariable","value":"metric_test_app"},
|
||||
{"type":"Punctuation","value":"{"},
|
||||
{"type":"NameLabel","value":"status"},
|
||||
{"type":"Operator","value":"!~"},
|
||||
{"type":"Punctuation","value":"'"},
|
||||
{"type":"LiteralString","value":"(4|5).."},
|
||||
{"type":"Punctuation","value":"'}"},
|
||||
{"type":"TextWhitespace","value":"\n"}
|
||||
]
|
||||
|
Loading…
x
Reference in New Issue
Block a user