diff options
author | Dave Davenport <qball@gmpclient.org> | 2017-03-13 16:42:17 +0100 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2017-03-13 16:42:17 +0100 |
commit | 9cfb075bc469faa11941cc7b2a9a1be5e0443038 (patch) | |
tree | 8d6779d87fd60e8d688e764768c695715a38a376 /lexer/theme-parser.y | |
parent | d67a562d884bbb8152bf75a21e97f7539a75bd25 (diff) |
Add filename to location in error message.
Diffstat (limited to 'lexer/theme-parser.y')
-rw-r--r-- | lexer/theme-parser.y | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lexer/theme-parser.y b/lexer/theme-parser.y index 78269fe7..e304ff29 100644 --- a/lexer/theme-parser.y +++ b/lexer/theme-parser.y @@ -7,6 +7,35 @@ %parse-param {const char *what} %code requires { #include "theme.h" + +typedef struct YYLTYPE { + int first_line; + int first_column; + int last_line; + int last_column; + char *filename; +} YYLTYPE; +# define YYLTYPE_IS_DECLARED 1 /* alert the parser that we have our own definition */ + +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (N) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + (Current).filename = YYRHSLOC (Rhs, 1).filename; \ + } \ + else \ + { /* empty RHS */ \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + (Current).filename = NULL; /* new */ \ + } \ + while (0) } %{ #include <stdio.h> |