prometheus/promql
Julius Volz 8155cc4992
Expose lexer item types (#5358)
* Expose lexer item types

We have generally agreed to expose AST types / values that are necessary
to make sense of the AST outside of the promql package. Currently the
`UnaryExpr`, `BinaryExpr`, and `AggregateExpr` AST nodes store the lexer
item type to indicate the operator type, but since the individual item
types aren't exposed, an external user of the package cannot determine
the operator type. So this PR exposes them.

Although not all item types are required to make sense of the AST (some
are really only used in the lexer), I decided to expose them all here to
be somewhat more consistent. Another option would be to not use lexer
item types at all in AST nodes.

The concrete motivation is my work on the PromQL->Flux transpiler, but
this ought to be useful for other cases as well.

Signed-off-by: Julius Volz <julius.volz@gmail.com>

* Fix item type names in tests

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2019-03-14 20:53:55 +01:00
..
fuzz-data textparse: Add fuzzing and fix bug caught 2017-07-07 11:12:17 +02:00
testdata exponentation operator to drop metric name in result of op operation (#5329) 2019-03-12 10:21:42 +00:00
ast.go Fix panic when aggregator param is not a literal. 2019-03-04 12:00:05 +00:00
bench_test.go Allow promql benchmarks to query more samples (#4770) 2018-10-22 18:02:22 +01:00
engine.go Expose lexer item types (#5358) 2019-03-14 20:53:55 +01:00
engine_test.go Move err to be the last return value from storage.Select. (#5054) 2019-01-02 11:10:13 +00:00
functions.go Fix spelling/typos (#4921) 2018-11-27 17:44:29 +01:00
functions_test.go WIP: keep track of samples per query, set a max # of samples (#4513) 2018-10-02 12:59:19 +01:00
fuzz.go textparse: Add fuzzing and fix bug caught 2017-07-07 11:12:17 +02:00
lex.go Expose lexer item types (#5358) 2019-03-14 20:53:55 +01:00
lex_test.go Expose lexer item types (#5358) 2019-03-14 20:53:55 +01:00
parse.go Expose lexer item types (#5358) 2019-03-14 20:53:55 +01:00
parse_test.go Expose lexer item types (#5358) 2019-03-14 20:53:55 +01:00
printer.go *: use latest release of staticcheck (#5057) 2019-01-04 14:47:38 +01:00
printer_test.go promql: Remove old and unused alerting/reconding syntax 2018-08-07 15:14:06 +02:00
promql_test.go Fix most golint warnings. 2015-08-26 12:44:46 +02:00
quantile.go In histogram_quantile merge buckets with equivalent le values (#5158) 2019-02-01 10:22:44 +00:00
test.go promql: apply golint suggestions (#5066) 2019-01-08 18:26:02 +00:00
test_test.go Fix some spelling issues (#5361) 2019-03-14 14:38:54 +00:00
value.go *: use latest release of staticcheck (#5057) 2019-01-04 14:47:38 +01:00