diff --git a/web/ui/module/codemirror-promql/src/complete/promql.terms.ts b/web/ui/module/codemirror-promql/src/complete/promql.terms.ts index 3caf235bf..4aba94e9f 100644 --- a/web/ui/module/codemirror-promql/src/complete/promql.terms.ts +++ b/web/ui/module/codemirror-promql/src/complete/promql.terms.ts @@ -28,6 +28,7 @@ export const binOpTerms = [ { label: '<' }, { label: '<=' }, { label: '!=' }, + { label: 'atan2' }, { label: 'and' }, { label: 'or' }, { label: 'unless' }, diff --git a/web/ui/module/codemirror-promql/src/grammar/promql.grammar b/web/ui/module/codemirror-promql/src/grammar/promql.grammar index 2814a35c5..a086003ce 100644 --- a/web/ui/module/codemirror-promql/src/grammar/promql.grammar +++ b/web/ui/module/codemirror-promql/src/grammar/promql.grammar @@ -16,7 +16,8 @@ @precedence { pow @right, - mul @left, + mul @left + atan2 @left, add @left, eql @left, and @left, @@ -69,6 +70,7 @@ BinaryExpr { Expr !mul Mul BinModifiers Expr | Expr !mul Div BinModifiers Expr | Expr !mul Mod BinModifiers Expr | + Expr !mul Atan2 BinModifiers Expr | Expr !add Add BinModifiers Expr | Expr !add Sub BinModifiers Expr | Expr !eql Eql BinModifiers Expr | @@ -333,6 +335,7 @@ NumberLiteral { // Contextual keywords @external extend {Identifier} extendIdentifier from "./tokens" { + Atan2, Avg, Bottomk, Count, diff --git a/web/ui/module/codemirror-promql/src/promql.ts b/web/ui/module/codemirror-promql/src/promql.ts index 8d282572f..a0bf72481 100644 --- a/web/ui/module/codemirror-promql/src/promql.ts +++ b/web/ui/module/codemirror-promql/src/promql.ts @@ -40,7 +40,7 @@ export function promQLLanguage(top: LanguageType): LezerLanguage { 'Avg Bottomk Count Count_values Group Max Min Quantile Stddev Stdvar Sum Topk': tags.operatorKeyword, 'By Without Bool On Ignoring GroupLeft GroupRight Offset Start End': tags.modifier, 'And Unless Or': tags.logicOperator, - 'Sub Add Mul Mod Div Eql Neq Lte Lss Gte Gtr EqlRegex EqlSingle NeqRegex Pow At': tags.operator, + 'Sub Add Mul Mod Div Atan2 Eql Neq Lte Lss Gte Gtr EqlRegex EqlSingle NeqRegex Pow At': tags.operator, UnaryOp: tags.arithmeticOperator, '( )': tags.paren, '[ ]': tags.squareBracket,