added location directives to flex and bison sources

git-svn-id: svn://anubis/fart/trunk@127 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
Josh Holtrop 2009-02-18 01:35:09 +00:00
parent b9cc1fe9f9
commit aaaac6d887
2 changed files with 8 additions and 3 deletions

View File

@ -1,5 +1,6 @@
%option nounput %option nounput
%option bison-locations
%{ %{
@ -35,8 +36,8 @@
\< return LESS; \< return LESS;
\> return GREATER; \> return GREATER;
-?[0-9]+ yylval = new IntegerNode(atoi(yytext)); return DEC_NUMBER; -?[0-9]+ *yylval = new IntegerNode(atoi(yytext)); return DEC_NUMBER;
-?[0-9]*\.[0-9]+ yylval = new NumberNode(atof(yytext)); return REAL_NUMBER; -?[0-9]*\.[0-9]+ *yylval = new NumberNode(atof(yytext)); return REAL_NUMBER;
ambient return AMBIENT; ambient return AMBIENT;
box return BOX; box return BOX;

View File

@ -7,9 +7,10 @@
#include "util/refptr.h" #include "util/refptr.h"
#include "nodes.h" #include "nodes.h"
#include "parser.h" #include "parser.h"
#include "parser.tab.hh" /* bison-generated header with YY[SL]TYPE */
using namespace std; using namespace std;
int yylex(void); int yylex(YYSTYPE *, YYLTYPE *);
extern FILE * yyin; extern FILE * yyin;
@ -27,6 +28,9 @@ static refptr<Node> parsed_scene_node;
%} %}
%pure-parser
%locations
%token PLUS; %token PLUS;
%token MINUS; %token MINUS;
%token STAR; %token STAR;