@prometheus-io/lezer-promql 0.307.2 → 0.308.0-rc.0
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.
- package/CHANGELOG.md +43 -0
- package/dist/index.cjs +159 -147
- package/dist/index.d.ts +4 -0
- package/dist/index.es.js +156 -148
- package/package.json +4 -4
- package/src/highlight.js +1 -1
- package/src/parser.js +147 -143
- package/src/parser.terms.js +136 -132
- package/src/promql.grammar +13 -1
- package/src/tokens.js +4 -0
package/src/parser.terms.js
CHANGED
|
@@ -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 =
|
|
4
|
-
nan =
|
|
3
|
+
inf = 167,
|
|
4
|
+
nan = 168,
|
|
5
5
|
Bool = 1,
|
|
6
6
|
Ignoring = 2,
|
|
7
7
|
On = 3,
|
|
@@ -30,133 +30,137 @@ export const
|
|
|
30
30
|
Unless = 26,
|
|
31
31
|
Start = 27,
|
|
32
32
|
End = 28,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
33
|
+
Smoothed = 29,
|
|
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
|
package/src/promql.grammar
CHANGED
|
@@ -31,6 +31,8 @@ expr[@isGroup=Expr] {
|
|
|
31
31
|
MatrixSelector |
|
|
32
32
|
NumberDurationLiteral |
|
|
33
33
|
OffsetExpr |
|
|
34
|
+
AnchoredExpr |
|
|
35
|
+
SmoothedExpr |
|
|
34
36
|
ParenExpr |
|
|
35
37
|
StringLiteral |
|
|
36
38
|
SubqueryExpr |
|
|
@@ -39,6 +41,14 @@ expr[@isGroup=Expr] {
|
|
|
39
41
|
StepInvariantExpr
|
|
40
42
|
}
|
|
41
43
|
|
|
44
|
+
AnchoredExpr {
|
|
45
|
+
expr Anchored
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
SmoothedExpr {
|
|
49
|
+
expr Smoothed
|
|
50
|
+
}
|
|
51
|
+
|
|
42
52
|
AggregateExpr {
|
|
43
53
|
AggregateOp AggregateModifier FunctionCallBody |
|
|
44
54
|
AggregateOp FunctionCallBody AggregateModifier |
|
|
@@ -354,7 +364,9 @@ NumberDurationLiteralInDurationContext {
|
|
|
354
364
|
Or,
|
|
355
365
|
Unless,
|
|
356
366
|
Start,
|
|
357
|
-
End
|
|
367
|
+
End,
|
|
368
|
+
Smoothed,
|
|
369
|
+
Anchored
|
|
358
370
|
}
|
|
359
371
|
|
|
360
372
|
@external propSource promQLHighLight from "./highlight"
|
package/src/tokens.js
CHANGED
|
@@ -42,6 +42,8 @@ import {
|
|
|
42
42
|
Topk,
|
|
43
43
|
Unless,
|
|
44
44
|
Without,
|
|
45
|
+
Smoothed,
|
|
46
|
+
Anchored,
|
|
45
47
|
} from './parser.terms.js';
|
|
46
48
|
|
|
47
49
|
const keywordTokens = {
|
|
@@ -82,6 +84,8 @@ const contextualKeywordTokens = {
|
|
|
82
84
|
unless: Unless,
|
|
83
85
|
start: Start,
|
|
84
86
|
end: End,
|
|
87
|
+
smoothed: Smoothed,
|
|
88
|
+
anchored: Anchored,
|
|
85
89
|
};
|
|
86
90
|
|
|
87
91
|
export const extendIdentifier = (value, stack) => {
|