@prometheus-io/lezer-promql 0.308.0 → 0.311.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  // This file was generated by lezer-generator. You probably shouldn't edit it.
2
2
  export const
3
- inf = 167,
4
- nan = 168,
3
+ inf = 177,
4
+ nan = 178,
5
5
  Bool = 1,
6
6
  Ignoring = 2,
7
7
  On = 3,
@@ -32,135 +32,145 @@ export const
32
32
  End = 28,
33
33
  Smoothed = 29,
34
34
  Anchored = 30,
35
- LineComment = 31,
36
- PromQL = 32,
37
- AggregateExpr = 33,
38
- AggregateOp = 34,
39
- AggregateModifier = 35,
40
- GroupingLabels = 36,
41
- LabelName = 37,
42
- QuotedLabelName = 38,
43
- StringLiteral = 39,
44
- FunctionCallBody = 40,
45
- BinaryExpr = 41,
46
- Pow = 42,
47
- BoolModifier = 43,
48
- MatchingModifierClause = 44,
49
- Mul = 45,
50
- Div = 46,
51
- Mod = 47,
52
- Add = 48,
53
- Sub = 49,
54
- Eql = 50,
55
- Gte = 51,
56
- Gtr = 52,
57
- Lte = 53,
58
- Lss = 54,
59
- Neq = 55,
60
- FunctionCall = 56,
61
- FunctionIdentifier = 57,
62
- AbsentOverTime = 58,
63
- Identifier = 59,
64
- Absent = 60,
65
- Abs = 61,
66
- Acos = 62,
67
- Acosh = 63,
68
- Asin = 64,
69
- Asinh = 65,
70
- Atan = 66,
71
- Atanh = 67,
72
- AvgOverTime = 68,
73
- Ceil = 69,
74
- Changes = 70,
75
- Clamp = 71,
76
- ClampMax = 72,
77
- ClampMin = 73,
78
- Cos = 74,
79
- Cosh = 75,
80
- CountOverTime = 76,
81
- DaysInMonth = 77,
82
- DayOfMonth = 78,
83
- DayOfWeek = 79,
84
- DayOfYear = 80,
85
- Deg = 81,
86
- Delta = 82,
87
- Deriv = 83,
88
- Exp = 84,
89
- FirstOverTime = 85,
90
- Floor = 86,
91
- HistogramCount = 87,
92
- HistogramFraction = 88,
93
- HistogramQuantile = 89,
94
- HistogramStdDev = 90,
95
- HistogramStdVar = 91,
96
- HistogramSum = 92,
97
- HistogramAvg = 93,
98
- DoubleExponentialSmoothing = 94,
99
- Hour = 95,
100
- Idelta = 96,
101
- Increase = 97,
102
- Info = 98,
103
- Irate = 99,
104
- LabelReplace = 100,
105
- LabelJoin = 101,
106
- LastOverTime = 102,
107
- Ln = 103,
108
- Log10 = 104,
109
- Log2 = 105,
110
- MadOverTime = 106,
111
- MaxOverTime = 107,
112
- MinOverTime = 108,
113
- TsOfFirstOverTime = 109,
114
- TsOfMaxOverTime = 110,
115
- TsOfMinOverTime = 111,
116
- TsOfLastOverTime = 112,
117
- Minute = 113,
118
- Month = 114,
119
- Pi = 115,
120
- PredictLinear = 116,
121
- PresentOverTime = 117,
122
- QuantileOverTime = 118,
123
- Rad = 119,
124
- Rate = 120,
125
- Resets = 121,
126
- Round = 122,
127
- Scalar = 123,
128
- Sgn = 124,
129
- Sin = 125,
130
- Sinh = 126,
131
- Sort = 127,
132
- SortDesc = 128,
133
- SortByLabel = 129,
134
- SortByLabelDesc = 130,
135
- Sqrt = 131,
136
- StddevOverTime = 132,
137
- StdvarOverTime = 133,
138
- SumOverTime = 134,
139
- Tan = 135,
140
- Tanh = 136,
141
- Timestamp = 137,
142
- Time = 138,
143
- Vector = 139,
144
- Year = 140,
145
- MatrixSelector = 141,
146
- NumberDurationLiteralInDurationContext = 142,
147
- NumberDurationLiteral = 143,
148
- OffsetExpr = 144,
149
- AnchoredExpr = 145,
150
- SmoothedExpr = 146,
151
- ParenExpr = 147,
152
- SubqueryExpr = 148,
153
- UnaryExpr = 149,
154
- UnaryOp = 150,
155
- VectorSelector = 151,
156
- LabelMatchers = 152,
157
- UnquotedLabelMatcher = 153,
158
- MatchOp = 154,
159
- EqlSingle = 155,
160
- EqlRegex = 156,
161
- NeqRegex = 157,
162
- QuotedLabelMatcher = 158,
163
- StepInvariantExpr = 159,
164
- At = 160,
165
- AtModifierPreprocessors = 161,
166
- MetricName = 162
35
+ Fill = 31,
36
+ FillLeft = 32,
37
+ FillRight = 33,
38
+ LineComment = 34,
39
+ PromQL = 35,
40
+ AggregateExpr = 36,
41
+ AggregateOp = 37,
42
+ AggregateModifier = 38,
43
+ GroupingLabels = 39,
44
+ LabelName = 40,
45
+ QuotedLabelName = 41,
46
+ StringLiteral = 42,
47
+ FunctionCallBody = 43,
48
+ BinaryExpr = 44,
49
+ Pow = 45,
50
+ BoolModifier = 46,
51
+ MatchingModifierClause = 47,
52
+ FillModifier = 48,
53
+ FillClause = 49,
54
+ NumberDurationLiteral = 50,
55
+ FillLeftClause = 51,
56
+ FillRightClause = 52,
57
+ Mul = 53,
58
+ Div = 54,
59
+ Mod = 55,
60
+ Add = 56,
61
+ Sub = 57,
62
+ Eql = 58,
63
+ Gte = 59,
64
+ Gtr = 60,
65
+ TrimUpper = 61,
66
+ TrimLower = 62,
67
+ Lte = 63,
68
+ Lss = 64,
69
+ Neq = 65,
70
+ FunctionCall = 66,
71
+ FunctionIdentifier = 67,
72
+ AbsentOverTime = 68,
73
+ Identifier = 69,
74
+ Absent = 70,
75
+ Abs = 71,
76
+ Acos = 72,
77
+ Acosh = 73,
78
+ Asin = 74,
79
+ Asinh = 75,
80
+ Atan = 76,
81
+ Atanh = 77,
82
+ AvgOverTime = 78,
83
+ Ceil = 79,
84
+ Changes = 80,
85
+ Clamp = 81,
86
+ ClampMax = 82,
87
+ ClampMin = 83,
88
+ Cos = 84,
89
+ Cosh = 85,
90
+ CountOverTime = 86,
91
+ DaysInMonth = 87,
92
+ DayOfMonth = 88,
93
+ DayOfWeek = 89,
94
+ DayOfYear = 90,
95
+ Deg = 91,
96
+ Delta = 92,
97
+ Deriv = 93,
98
+ Exp = 94,
99
+ FirstOverTime = 95,
100
+ Floor = 96,
101
+ HistogramCount = 97,
102
+ HistogramFraction = 98,
103
+ HistogramQuantile = 99,
104
+ HistogramQuantiles = 100,
105
+ HistogramStdDev = 101,
106
+ HistogramStdVar = 102,
107
+ HistogramSum = 103,
108
+ HistogramAvg = 104,
109
+ DoubleExponentialSmoothing = 105,
110
+ Hour = 106,
111
+ Idelta = 107,
112
+ Increase = 108,
113
+ Info = 109,
114
+ Irate = 110,
115
+ LabelReplace = 111,
116
+ LabelJoin = 112,
117
+ LastOverTime = 113,
118
+ Ln = 114,
119
+ Log10 = 115,
120
+ Log2 = 116,
121
+ MadOverTime = 117,
122
+ MaxOverTime = 118,
123
+ MinOverTime = 119,
124
+ TsOfFirstOverTime = 120,
125
+ TsOfMaxOverTime = 121,
126
+ TsOfMinOverTime = 122,
127
+ TsOfLastOverTime = 123,
128
+ Minute = 124,
129
+ Month = 125,
130
+ Pi = 126,
131
+ PredictLinear = 127,
132
+ PresentOverTime = 128,
133
+ QuantileOverTime = 129,
134
+ Rad = 130,
135
+ Rate = 131,
136
+ Resets = 132,
137
+ Round = 133,
138
+ Scalar = 134,
139
+ Sgn = 135,
140
+ Sin = 136,
141
+ Sinh = 137,
142
+ Sort = 138,
143
+ SortDesc = 139,
144
+ SortByLabel = 140,
145
+ SortByLabelDesc = 141,
146
+ Sqrt = 142,
147
+ StddevOverTime = 143,
148
+ StdvarOverTime = 144,
149
+ SumOverTime = 145,
150
+ Tan = 146,
151
+ Tanh = 147,
152
+ Timestamp = 148,
153
+ Time = 149,
154
+ Vector = 150,
155
+ Year = 151,
156
+ MatrixSelector = 152,
157
+ NumberDurationLiteralInDurationContext = 153,
158
+ OffsetExpr = 154,
159
+ AnchoredExpr = 155,
160
+ SmoothedExpr = 156,
161
+ ParenExpr = 157,
162
+ SubqueryExpr = 158,
163
+ UnaryExpr = 159,
164
+ UnaryOp = 160,
165
+ VectorSelector = 161,
166
+ LabelMatchers = 162,
167
+ UnquotedLabelMatcher = 163,
168
+ MatchOp = 164,
169
+ EqlSingle = 165,
170
+ EqlRegex = 166,
171
+ NeqRegex = 167,
172
+ QuotedLabelMatcher = 168,
173
+ StepInvariantExpr = 169,
174
+ At = 170,
175
+ AtModifierPreprocessors = 171,
176
+ MetricName = 172
@@ -88,6 +88,8 @@ BinaryExpr {
88
88
  expr !eql Eql binModifiers expr |
89
89
  expr !eql Gte binModifiers expr |
90
90
  expr !eql Gtr binModifiers expr |
91
+ expr !eql TrimUpper binModifiers expr |
92
+ expr !eql TrimLower binModifiers expr |
91
93
  expr !eql Lte binModifiers expr |
92
94
  expr !eql Lss binModifiers expr |
93
95
  expr !eql Neq binModifiers expr |
@@ -101,11 +103,30 @@ MatchingModifierClause {
101
103
  ((GroupLeft | GroupRight) (!group GroupingLabels)?)?
102
104
  }
103
105
 
106
+ FillClause {
107
+ Fill "(" NumberDurationLiteral ")"
108
+ }
109
+
110
+ FillLeftClause {
111
+ FillLeft "(" NumberDurationLiteral ")"
112
+ }
113
+
114
+ FillRightClause {
115
+ FillRight "(" NumberDurationLiteral ")"
116
+ }
117
+
118
+ FillModifier {
119
+ (FillClause | FillLeftClause | FillRightClause) |
120
+ (FillLeftClause FillRightClause) |
121
+ (FillRightClause FillLeftClause)
122
+ }
123
+
104
124
  BoolModifier { Bool }
105
125
 
106
126
  binModifiers {
107
127
  BoolModifier?
108
128
  MatchingModifierClause?
129
+ FillModifier?
109
130
  }
110
131
 
111
132
  GroupingLabels {
@@ -148,6 +169,7 @@ FunctionIdentifier {
148
169
  HistogramCount |
149
170
  HistogramFraction |
150
171
  HistogramQuantile |
172
+ HistogramQuantiles |
151
173
  HistogramStdDev |
152
174
  HistogramStdVar |
153
175
  HistogramSum |
@@ -318,6 +340,8 @@ NumberDurationLiteralInDurationContext {
318
340
  Lss { "<" }
319
341
  Gte { ">=" }
320
342
  Gtr { ">" }
343
+ TrimUpper { "</" }
344
+ TrimLower { ">/" }
321
345
  EqlRegex { "=~" }
322
346
  EqlSingle { "=" }
323
347
  NeqRegex { "!~" }
@@ -366,7 +390,10 @@ NumberDurationLiteralInDurationContext {
366
390
  Start,
367
391
  End,
368
392
  Smoothed,
369
- Anchored
393
+ Anchored,
394
+ Fill,
395
+ FillLeft,
396
+ FillRight
370
397
  }
371
398
 
372
399
  @external propSource promQLHighLight from "./highlight"
@@ -404,6 +431,7 @@ NumberDurationLiteralInDurationContext {
404
431
  HistogramCount { condFn<"histogram_count"> }
405
432
  HistogramFraction { condFn<"histogram_fraction"> }
406
433
  HistogramQuantile { condFn<"histogram_quantile"> }
434
+ HistogramQuantiles { condFn<"histogram_quantiles"> }
407
435
  HistogramStdDev { condFn<"histogram_stddev"> }
408
436
  HistogramStdVar { condFn<"histogram_stdvar"> }
409
437
  HistogramSum { condFn<"histogram_sum"> }
package/src/tokens.js CHANGED
@@ -1,4 +1,4 @@
1
- // Copyright 2021 The Prometheus Authors
1
+ // Copyright The Prometheus Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -12,82 +12,88 @@
12
12
  // limitations under the License.
13
13
 
14
14
  import {
15
- And,
16
- Avg,
17
- Atan2,
18
- Bool,
19
- Bottomk,
20
- By,
21
- Count,
22
- CountValues,
23
- End,
24
- Group,
25
- GroupLeft,
26
- GroupRight,
27
- Ignoring,
28
- inf,
29
- Max,
30
- Min,
31
- nan,
32
- Offset,
33
- On,
34
- Or,
35
- Quantile,
36
- LimitK,
37
- LimitRatio,
38
- Start,
39
- Stddev,
40
- Stdvar,
41
- Sum,
42
- Topk,
43
- Unless,
44
- Without,
45
- Smoothed,
46
- Anchored,
47
- } from './parser.terms.js';
15
+ And,
16
+ Avg,
17
+ Atan2,
18
+ Bool,
19
+ Bottomk,
20
+ By,
21
+ Count,
22
+ CountValues,
23
+ End,
24
+ Group,
25
+ GroupLeft,
26
+ GroupRight,
27
+ Ignoring,
28
+ inf,
29
+ Max,
30
+ Min,
31
+ nan,
32
+ Offset,
33
+ On,
34
+ Or,
35
+ Quantile,
36
+ LimitK,
37
+ LimitRatio,
38
+ Start,
39
+ Stddev,
40
+ Stdvar,
41
+ Sum,
42
+ Topk,
43
+ Unless,
44
+ Without,
45
+ Smoothed,
46
+ Anchored,
47
+ Fill,
48
+ FillLeft,
49
+ FillRight,
50
+ } from "./parser.terms.js";
48
51
 
49
52
  const keywordTokens = {
50
- inf: inf,
51
- nan: nan,
52
- bool: Bool,
53
- ignoring: Ignoring,
54
- on: On,
55
- group_left: GroupLeft,
56
- group_right: GroupRight,
57
- offset: Offset,
53
+ inf: inf,
54
+ nan: nan,
55
+ bool: Bool,
56
+ ignoring: Ignoring,
57
+ on: On,
58
+ group_left: GroupLeft,
59
+ group_right: GroupRight,
60
+ offset: Offset,
58
61
  };
59
62
 
60
63
  export const specializeIdentifier = (value, stack) => {
61
- return keywordTokens[value.toLowerCase()] || -1;
64
+ return keywordTokens[value.toLowerCase()] || -1;
62
65
  };
63
66
 
64
67
  const contextualKeywordTokens = {
65
- avg: Avg,
66
- atan2: Atan2,
67
- bottomk: Bottomk,
68
- count: Count,
69
- count_values: CountValues,
70
- group: Group,
71
- max: Max,
72
- min: Min,
73
- quantile: Quantile,
74
- limitk: LimitK,
75
- limit_ratio: LimitRatio,
76
- stddev: Stddev,
77
- stdvar: Stdvar,
78
- sum: Sum,
79
- topk: Topk,
80
- by: By,
81
- without: Without,
82
- and: And,
83
- or: Or,
84
- unless: Unless,
85
- start: Start,
86
- end: End,
87
- smoothed: Smoothed,
88
- anchored: Anchored,
68
+ avg: Avg,
69
+ atan2: Atan2,
70
+ bottomk: Bottomk,
71
+ count: Count,
72
+ count_values: CountValues,
73
+ group: Group,
74
+ max: Max,
75
+ min: Min,
76
+ quantile: Quantile,
77
+ limitk: LimitK,
78
+ limit_ratio: LimitRatio,
79
+ stddev: Stddev,
80
+ stdvar: Stdvar,
81
+ sum: Sum,
82
+ topk: Topk,
83
+ by: By,
84
+ without: Without,
85
+ and: And,
86
+ or: Or,
87
+ unless: Unless,
88
+ start: Start,
89
+ end: End,
90
+ smoothed: Smoothed,
91
+ anchored: Anchored,
92
+ fill: Fill,
93
+ fill_left: FillLeft,
94
+ fill_right: FillRight,
89
95
  };
90
96
 
91
97
  export const extendIdentifier = (value, stack) => {
92
- return contextualKeywordTokens[value.toLowerCase()] || -1;
98
+ return contextualKeywordTokens[value.toLowerCase()] || -1;
93
99
  };