Rudimentary support for reporting the line number of syntax errors.
diff --git a/dtc-parser.y b/dtc-parser.y
index 66e243d..1bfbfa3 100644
--- a/dtc-parser.y
+++ b/dtc-parser.y
@@ -18,6 +18,9 @@
* USA
*/
+%glr-parser
+%locations
+
%{
#include "dtc.h"
@@ -69,8 +72,6 @@
%type <str> label
%type <str> nodename
-%glr-parser
-
%%
sourcefile: memreserves devicetree {
@@ -160,5 +161,5 @@
void yyerror (char const *s)
{
- fprintf (stderr, "%s\n", s);
+ fprintf (stderr, "%s at line %d\n", s, yylloc.first_line);
}