* Hack for Bison 2.3 compatability.

This commit is contained in:
Eelco Dolstra 2006-10-02 14:43:15 +00:00
parent f316b6c1a9
commit 7581cfdee4
2 changed files with 14 additions and 2 deletions

View file

@ -10,6 +10,7 @@
#include "aterm.hh" #include "aterm.hh"
#include "nixexpr.hh" #include "nixexpr.hh"
#include "nixexpr-ast.hh" #include "nixexpr-ast.hh"
#define BISON_HEADER_HACK
#include "parser-tab.hh" #include "parser-tab.hh"
using namespace nix; using namespace nix;

View file

@ -2,12 +2,20 @@
%pure-parser %pure-parser
%locations %locations
%error-verbose %error-verbose
%defines
%no-lines
%parse-param { yyscan_t scanner } %parse-param { yyscan_t scanner }
%parse-param { ParseData * data } %parse-param { ParseData * data }
%lex-param { yyscan_t scanner } %lex-param { yyscan_t scanner }
%{ %{
/* Newer versions of Bison copy the declarations below to
parser-tab.hh, which sucks bigtime since lexer.l doesn't want that
stuff. So allow it to be excluded. */
#ifndef BISON_HEADER_HACK
#define BISON_HEADER_HACK
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -75,7 +83,7 @@ static Pos makeCurPos(YYLTYPE * loc, ParseData * data)
} }
void yyerror(YYLTYPE * loc, yyscan_t scanner, ParseData * data, char * error) void yyerror(YYLTYPE * loc, yyscan_t scanner, ParseData * data, const char * error)
{ {
data->error = (format("%1%, at `%2%':%3%:%4%") data->error = (format("%1%, at `%2%':%3%:%4%")
% error % data->path % loc->first_line % loc->first_column).str(); % error % data->path % loc->first_line % loc->first_column).str();
@ -101,6 +109,9 @@ static void freeAndUnprotect(void * p)
#define YYFREE freeAndUnprotect #define YYFREE freeAndUnprotect
#endif
%} %}
%union { %union {