diff --git a/src/graphviz_lex.l b/src/graphviz_lex.l index 5cbd3b5a..75d8ffb0 100644 --- a/src/graphviz_lex.l +++ b/src/graphviz_lex.l @@ -33,6 +33,9 @@ static std::string literal; static void begin_literal(); static void add_string(const char* str); static void end_literal(); + +#include "yystype.h" +#define YY_DECL int yylex(YYSTYPE* lvalp) %} %x Comment @@ -58,9 +61,9 @@ ID {VARIABLE}|{NUMBER} "strict" ; "subgraph" { return SUBGRAPH_T; } "->"|"--" { return EDGEOP_T; } -{ID} { yylval.ptr = (void*)(new std::string(yytext)); return ID_T; } +{ID} { lvalp->ptr = (void*)(new std::string(yytext)); return ID_T; } ["] { BEGIN Literal; begin_literal(); } -["] { BEGIN INITIAL; end_literal(); yylval.ptr = (void*)(new std::string(literal)); return ID_T; } +["] { BEGIN INITIAL; end_literal(); lvalp->ptr = (void*)(new std::string(literal)); return ID_T; } [\\][\n] ; ([^"\\]*|[\\].) { add_string(yytext); } [ \t] ;