Rudimentary support for reporting the line number of syntax errors.

This commit is contained in:
David Gibson
2005-10-19 16:00:31 +10:00
parent b4ac04952a
commit 86dbcbd1e4
2 changed files with 22 additions and 4 deletions

View File

@@ -18,6 +18,9 @@
* USA
*/
%glr-parser
%locations
%{
#include "dtc.h"
@@ -69,8 +72,6 @@ extern struct boot_info *the_boot_info;
%type <str> label
%type <str> nodename
%glr-parser
%%
sourcefile: memreserves devicetree {
@@ -160,5 +161,5 @@ label: DT_LABEL { $$ = $1; }
void yyerror (char const *s)
{
fprintf (stderr, "%s\n", s);
fprintf (stderr, "%s at line %d\n", s, yylloc.first_line);
}