Skip to content

Commit

Permalink
Improve parse output
Browse files Browse the repository at this point in the history
  • Loading branch information
prymitive committed Nov 26, 2021
1 parent cca7a93 commit 454cb49
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
8 changes: 7 additions & 1 deletion cmd/pint/debug.go → cmd/pint/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,13 @@ func parseNode(node parser.Node, level int) {
printNode(level, "* Op: %v", n.Op)
printNode(level, "* LHS: %v", n.LHS)
printNode(level, "* RHS: %v", n.RHS)
printNode(level, "* VectorMatching: %v", n.VectorMatching)
printNode(level, "* VectorMatching:")
if n.VectorMatching != nil {
printNode(level+levelStep, "* Card: %v", n.VectorMatching.Card)
printNode(level+levelStep, "* MatchingLabels: %v", n.VectorMatching.MatchingLabels)
printNode(level+levelStep, "* On: %v", n.VectorMatching.On)
printNode(level+levelStep, "* Include: %v", n.VectorMatching.Include)
}
printNode(level, "* ReturnBool: %v", n.ReturnBool)
case *parser.EvalStmt:
printNode(level, "EvalStmt:")
Expand Down
6 changes: 5 additions & 1 deletion cmd/pint/tests/0015_parse_1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ cmp stdout stdout.txt
* Op: +
* LHS: sum without(job) (rate(foo[5m]))
* RHS: sum without(job) (rate(bar[5m]))
* VectorMatching: &{one-to-one [] false []}
* VectorMatching:
* Card: one-to-one
* MatchingLabels: []
* On: false
* Include: []
* ReturnBool: false
++ node: sum without(job) (rate(foo[5m]))
AggregateExpr:
Expand Down
6 changes: 5 additions & 1 deletion cmd/pint/tests/0016_parse_2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ cmp stdout stdout.txt
* Op: /
* LHS: sum without(job) (rate(foo[5m]))
* RHS: sum without(job) (rate(bar[5m]))
* VectorMatching: &{many-to-one [instance] true []}
* VectorMatching:
* Card: many-to-one
* MatchingLabels: [instance]
* On: true
* Include: []
* ReturnBool: false
++ node: sum without(job) (rate(foo[5m]))
AggregateExpr:
Expand Down

0 comments on commit 454cb49

Please # to comment.