Commit 071b0a55 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

widl: Enable bison locations option.

parent 2edd194a
......@@ -26,7 +26,7 @@
int parser_parse(void);
extern void generic_msg( const struct location *where, const char *s, const char *t, va_list ap );
extern void parser_error( const char *message );
extern void parser_error( const struct location *where, const char *message );
extern void init_location( struct location *where );
extern FILE *parser_in;
......
......@@ -19,6 +19,7 @@
*/
%option bison-bridge
%option bison-locations
%option stack
%option noinput nounput noyy_top_state
%option noyywrap
......@@ -53,6 +54,7 @@ uuid {hd}{8}-{hd}{4}-{hd}{4}-{hd}{4}-{hd}{12}
#define YYerror PARSER_error
#define YYSTYPE PARSER_STYPE
#define YYLTYPE PARSER_LTYPE
#define YYUNDEF PARSER_UNDEF
#define yyerror parser_error
......@@ -197,13 +199,16 @@ static void winrt_enable( int ns_prefix )
}
}
<PP_LINE>[0-9]+{ws}* {
line_number = strtoul( yytext, NULL, 10 ) - 1; /* We didn't read the newline */
yylloc->first_line = strtoul( yytext, NULL, 10 ) - 1;
yylloc->last_line = yylloc->first_line;
line_number = yylloc->first_line;
yy_pop_state();
yy_push_state(PP_FILE);
}
<PP_FILE>\"(\\[^n]|[^"\\\n])*\"{ws}* {
input_name = xstrdup( yytext + 1 );
*strchr( input_name, '"' ) = 0;
yylloc->input_name = input_name;
}
<PP_FILE>[^"][^\n]* { yy_pop_state(); }
......@@ -557,9 +562,9 @@ void generic_msg( const struct location *where, const char *s, const char *t, va
}
/* yyerror: yacc assumes this is not newline terminated. */
void parser_error( const char *message )
void parser_error( const struct location *where, const char *message )
{
error_loc( "%s\n", message );
error_at( where, "%s\n", message );
}
static void warning_disable(int warning)
......
......@@ -124,15 +124,17 @@ static typelib_t *current_typelib;
%code provides
{
int parser_lex( PARSER_STYPE *yylval );
int parser_lex( PARSER_STYPE *yylval, PARSER_LTYPE *yylloc );
void push_import( char *input_name );
void pop_import(void);
}
%define api.location.type {struct location}
%define api.prefix {parser_}
%define api.pure full
%define parse.error verbose
%locations
%union {
attr_t *attr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment