diff --git a/cmd/pint/debug.go b/cmd/pint/parse.go similarity index 91% rename from cmd/pint/debug.go rename to cmd/pint/parse.go index 2d5da7ce..9281fece 100644 --- a/cmd/pint/debug.go +++ b/cmd/pint/parse.go @@ -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:") diff --git a/cmd/pint/tests/0015_parse_1.txt b/cmd/pint/tests/0015_parse_1.txt index 1cd4bd17..ba7b6d70 100644 --- a/cmd/pint/tests/0015_parse_1.txt +++ b/cmd/pint/tests/0015_parse_1.txt @@ -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: diff --git a/cmd/pint/tests/0016_parse_2.txt b/cmd/pint/tests/0016_parse_2.txt index 4b940123..fe24caec 100644 --- a/cmd/pint/tests/0016_parse_2.txt +++ b/cmd/pint/tests/0016_parse_2.txt @@ -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: