%option nounput %option bison-locations %{ #include "nodes.h" #include "parser.h" #include "parser.tab.hh" %} %% \+ return PLUS; - return MINUS; \* return STAR; \/ return DIVIDE; % return MOD; ; return SEMICOLON; : return COLON; \? return QUESTION; \$ return DOLLAR; \. return DOT; \" return DQUOTE; \' return SQUOTE; , return COMMA; \{ return LCURLY; \} return RCURLY; \[ return LBRACKET; \] return RBRACKET; \( return LPAREN; \) return RPAREN; \< return LESS; \> return GREATER; -?[0-9]+ *yylval = new IntegerNode(atoi(yytext)); return DEC_NUMBER; -?[0-9]*\.[0-9]+ *yylval = new NumberNode(atof(yytext)); return REAL_NUMBER; ambient return AMBIENT; ambient_occlusion return AMBIENT_OCCLUSION; box return BOX; camera return CAMERA; color return COLOR; cyl return CYL; define return DEFINE; diffuse return DIFFUSE; exposure return EXPOSURE; extrude return EXTRUDE; height return HEIGHT; intersect return INTERSECT; jitter return JITTER; light return LIGHT; look_at return LOOKAT; material return MATERIAL; max_depth return MAXDEPTH; multisample return MULTISAMPLE; ngon return NGON; offset return OFFSET; options return OPTIONS; plane return PLANE; polygon return POLYGON; position return POSITION; radius return RADIUS; reflectance return REFLECTANCE; rotate return ROTATE; scale return SCALE; scene return SCENE; shininess return SHININESS; size return SIZE; specular return SPECULAR; sphere return SPHERE; subtract return SUBTRACT; translate return TRANSLATE; transparency return TRANSPARENCY; union return UNION; up return UP; vfov return VFOV; width return WIDTH; [a-zA-Z_][a-zA-Z_0-9]* { *yylval = new IdentifierNode(yytext); return IDENTIFIER; } \n yylloc->first_line++; yylloc->last_line++; [ \t\v] /* ignore whitespace */ . return yytext[0]; %%