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
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
engine_test.go
engine.go Expose lexer item types (#5358) 2019-03-14 20:53:55 +01:00
functions_test.go
functions.go
fuzz.go
lex_test.go Expose lexer item types (#5358) 2019-03-14 20:53:55 +01:00
lex.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
parse.go Expose lexer item types (#5358) 2019-03-14 20:53:55 +01:00
printer_test.go
printer.go *: use latest release of staticcheck (#5057) 2019-01-04 14:47:38 +01:00
promql_test.go
quantile.go In histogram_quantile merge buckets with equivalent le values (#5158) 2019-02-01 10:22:44 +00:00
test_test.go Fix some spelling issues (#5361) 2019-03-14 14:38:54 +00:00
test.go promql: apply golint suggestions (#5066) 2019-01-08 18:26:02 +00:00
value.go *: use latest release of staticcheck (#5057) 2019-01-04 14:47:38 +01:00