---
builder/index-parse.y | 4 +++-
builder/index-parser-c.c | 1 +
builder/index-struct.h | 1 +
3 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/builder/index-parse.y b/builder/index-parse.y
index dee2aec..9c75f71 100644
--- a/builder/index-parse.y
+++ b/builder/index-parse.y
@@ -143,7 +143,9 @@ emptylines:
void
yyerror (YYLTYPE * yylloc, yyscan_t scanner, struct parse_context *context, const char
*msg)
{
- fprintf (stderr, "syntax error at line %d: %s\n",
+ fprintf (stderr, "%s%ssyntax error at line %d: %s\n",
+ context->input_file ? context->input_file : "",
+ context->input_file ? ": " : "",
yylloc->first_line, msg);
}
diff --git a/builder/index-parser-c.c b/builder/index-parser-c.c
index 7aeb6d0..8cae7b8 100644
--- a/builder/index-parser-c.c
+++ b/builder/index-parser-c.c
@@ -56,6 +56,7 @@ virt_builder_parse_index (value filenamev)
FILE *in;
parse_context_init (&context);
+ context.input_file = String_val (filenamev);
in = fopen (String_val (filenamev), "r");
if (in == NULL)
diff --git a/builder/index-struct.h b/builder/index-struct.h
index 9480526..7d4b8e0 100644
--- a/builder/index-struct.h
+++ b/builder/index-struct.h
@@ -43,6 +43,7 @@ struct parse_context {
* compatibility with virt-builder 1.24.
*/
int seen_comments;
+ const char *input_file;
};
/* Initialize the content of a parse_context. */
--
1.8.3.1