commit before attempting to compile flex scanner with C++ instead of C

git-svn-id: svn://anubis/fart/trunk@114 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
Josh Holtrop 2009-02-17 01:29:25 +00:00
parent 3aed1c21ca
commit 6e67597dc7
2 changed files with 11 additions and 12 deletions

View File

@ -1,6 +1,10 @@
%{
#include "nodes.h"
#define YYSTYPE refptr<Node>
#include "parser.tab.hh"
%}
%%
@ -29,8 +33,8 @@
\< return LESS;
\> return GREATER;
-?[0-9]+ return DEC_NUMBER;
-?[0-9]*\.[0-9]+ return REAL_NUMBER;
-?[0-9]+ yylval = new NumberNode(atoi(yytext)); return DEC_NUMBER;
-?[0-9]*\.[0-9]+ yylval = new NumberNode(atof(yytext)); return REAL_NUMBER;
ambient return AMBIENT;
box return BOX;

View File

@ -16,7 +16,6 @@ extern "C" {
}
extern FILE * yyin;
extern char * yytext;
void yyerror(const char * str)
{
@ -218,12 +217,8 @@ material_item: AMBIENT vector {
}
;
number: DEC_NUMBER {
$$ = new NumberNode(atoi(yytext));
}
| REAL_NUMBER {
$$ = new NumberNode(atof(yytext));
}
number: DEC_NUMBER { $$ = $1; }
| REAL_NUMBER { $$ = $1; }
;
options: OPTIONS LCURLY options_items RCURLY {
@ -241,13 +236,13 @@ options_items: /* empty */
;
options_item: WIDTH DEC_NUMBER {
$$ = new WidthNode(atoi(yytext));
$$ = new WidthNode($2->getNumber());
}
| HEIGHT DEC_NUMBER {
$$ = new HeightNode(atoi(yytext));
$$ = new HeightNode($2->getNumber());
}
| MULTISAMPLE DEC_NUMBER {
$$ = new MultisampleNode(atoi(yytext));
$$ = new MultisampleNode($2->getNumber());
}
;