blob: e95e333d526fcabe52ad3cc7622e69582489faa5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
|
<lexer>
<config>
<name>PromQL</name>
<alias>promql</alias>
<filename>*.promql</filename>
</config>
<rules>
<state name="range">
<rule pattern="\]">
<token type="Punctuation"/>
<pop depth="1"/>
</rule>
<rule pattern="[1-9][0-9]*[smhdwy]">
<token type="LiteralString"/>
</rule>
</state>
<state name="function">
<rule pattern="\)">
<token type="Operator"/>
<pop depth="1"/>
</rule>
<rule pattern="\(">
<token type="Operator"/>
<push/>
</rule>
<rule>
<pop depth="1"/>
</rule>
</state>
<state name="root">
<rule pattern="\n">
<token type="TextWhitespace"/>
</rule>
<rule pattern="\s+">
<token type="TextWhitespace"/>
</rule>
<rule pattern=",">
<token type="Punctuation"/>
</rule>
<rule pattern="(group_right|group_left|ignoring|without|offset|bool|on|by)\b">
<token type="Keyword"/>
</rule>
<rule pattern="(count_values|quantile|bottomk|stdvar|stddev|count|group|topk|sum|min|max|avg)\b">
<token type="Keyword"/>
</rule>
<rule pattern="(histogram_quantile|quantile_over_time|absent_over_time|stdvar_over_time|stddev_over_time|count_over_time|predict_linear|label_replace|max_over_time|avg_over_time|sum_over_time|days_in_month|min_over_time|day_of_month|holt_winters|day_of_week|label_join|sort_desc|clamp_max|timestamp|clamp_min|increase|changes|resets|vector|absent|idelta|minute|scalar|log10|delta|month|floor|deriv|round|irate|rate|year|sort|log2|sqrt|ceil|time|hour|abs|exp|ln)\b">
<token type="KeywordReserved"/>
</rule>
<rule pattern="[1-9][0-9]*[smhdwy]">
<token type="LiteralString"/>
</rule>
<rule pattern="-?[0-9]+\.[0-9]+">
<token type="LiteralNumberFloat"/>
</rule>
<rule pattern="-?[0-9]+">
<token type="LiteralNumberInteger"/>
</rule>
<rule pattern="#.*?$">
<token type="CommentSingle"/>
</rule>
<rule pattern="(\+|\-|\*|\/|\%|\^)">
<token type="Operator"/>
</rule>
<rule pattern="==|!=|>=|<=|<|>">
<token type="Operator"/>
</rule>
<rule pattern="and|or|unless">
<token type="OperatorWord"/>
</rule>
<rule pattern="[_a-zA-Z][a-zA-Z0-9_]+">
<token type="NameVariable"/>
</rule>
<rule pattern="(["\'])(.*?)(["\'])">
<bygroups>
<token type="Punctuation"/>
<token type="LiteralString"/>
<token type="Punctuation"/>
</bygroups>
</rule>
<rule pattern="\(">
<token type="Operator"/>
<push state="function"/>
</rule>
<rule pattern="\)">
<token type="Operator"/>
</rule>
<rule pattern="\{">
<token type="Punctuation"/>
<push state="labels"/>
</rule>
<rule pattern="\[">
<token type="Punctuation"/>
<push state="range"/>
</rule>
</state>
<state name="labels">
<rule pattern="\}">
<token type="Punctuation"/>
<pop depth="1"/>
</rule>
<rule pattern="\n">
<token type="TextWhitespace"/>
</rule>
<rule pattern="\s+">
<token type="TextWhitespace"/>
</rule>
<rule pattern=",">
<token type="Punctuation"/>
</rule>
<rule pattern="([_a-zA-Z][a-zA-Z0-9_]*?)(\s*?)(=~|!=|=|!~)(\s*?)("|')(.*?)("|')">
<bygroups>
<token type="NameLabel"/>
<token type="TextWhitespace"/>
<token type="Operator"/>
<token type="TextWhitespace"/>
<token type="Punctuation"/>
<token type="LiteralString"/>
<token type="Punctuation"/>
</bygroups>
</rule>
</state>
</rules>
</lexer>
|