From faf2a19de0badaba9327ce1cd05c6a586d85a121 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Fri, 7 Oct 2016 18:40:37 +0000 Subject: [PATCH] lib: Improve formatting for matcher tracing output Signed-off-by: Quentin Young --- lib/command_match.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/command_match.c b/lib/command_match.c index ac6a6c813a..e25bca2db8 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -192,8 +192,10 @@ command_match_r (struct graph_node *start, vector vline, unsigned int n) char *input_token = vector_slot (vline, n); #ifdef TRACE_MATCHER - fprintf (stdout, "\"%s\" matches \"%s\" (%d) ? ", input_token, token->text, token->type); - switch (match_token (token, input_token)) + fprintf (stdout, "\"%-20s\" matches \"%-30s\" ? ", input_token, token->text); + enum match_type mt = match_token (token, input_token); + fprintf (stdout, "min: %d - ", minmatch); + switch (mt) { case trivial_match: fprintf (stdout, "trivial_match "); @@ -208,7 +210,8 @@ command_match_r (struct graph_node *start, vector vline, unsigned int n) fprintf (stdout, "exact_match "); break; } - fprintf (stdout, "(minimum: %d)\n", minmatch); + if (mt >= minmatch) fprintf (stdout, " MATCH"); + fprintf (stdout, "\n"); #endif // if we don't match this node, die -- 2.39.5