summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2013-09-17 14:38:06 +0800
committerJeremy Kerr <jk@ozlabs.org>2013-09-24 13:14:59 +0800
commitd1052291224febe931fc95ed53d5008f66a72b96 (patch)
tree0123777be40a88ced260d4ebdb2a4c362d1b3f25
parentbda4feeab43ec0ef8bf2bf63d54d81ab54f3ba51 (diff)
downloadpetitboot-d1052291224febe931fc95ed53d5008f66a72b96.zip
petitboot-d1052291224febe931fc95ed53d5008f66a72b96.tar.gz
discover/grub2: Add print_token
For better trace output. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
-rw-r--r--discover/grub2/parser.y10
1 files changed, 10 insertions, 0 deletions
diff --git a/discover/grub2/parser.y b/discover/grub2/parser.y
index 81856df..3a5a142 100644
--- a/discover/grub2/parser.y
+++ b/discover/grub2/parser.y
@@ -11,7 +11,10 @@
#include "parser.h"
#include "lexer.h"
+static void print_token(FILE *fp, int type, YYSTYPE value);
+
#define YYLEX_PARAM parser->scanner
+#define YYPRINT(f, t, v) print_token(f, t, v)
static void yyerror(struct grub2_parser *, char const *s);
%}
@@ -147,6 +150,13 @@ void yyerror(struct grub2_parser *parser, char const *s)
s, yyget_text(parser->scanner));
}
+static void print_token(FILE *fp, int type, YYSTYPE value)
+{
+ if (type != TOKEN_WORD)
+ return;
+ fprintf(fp, "%s", value.word->text);
+}
+
struct grub2_statements *create_statements(struct grub2_parser *parser)
{
struct grub2_statements *stmts = talloc(parser,
OpenPOWER on IntegriCloud