%option noyywrap %{ /* * * * * * * * * * * * * * * DEFINITIONS * * * * * * * * * * * * * * */ #include #include #include #include "graph.h" #include "y.tab.h" extern int line_num; %} %x error %x label %% %{ /* * * * * * * * * * * * RULES * * * * * * * * * * * */ %} [1-9][0-9]* { yylval.num = atoi(yytext); return NUMBER; } [ \t\f\r] // ignore white space \n { line_num++; } direction { return DIRECTION; } vertical { return VERTICAL; } horizontal { return HORIZONTAL; } color { return COLOR; } shape { return SHAPE; } fontname { return FONTNAME; } fontsize { return FONTSIZE; } nodestyle { return NODESTYLE; } edgestyle { return EDGESTYLE; } "=" { return EQUALS; } "," { return COMMA; } ";" { return SEMI; } "[" { return LBRACK; } "]" { return RBRACK; } "->" { return ARROW; } \" { BEGIN(label); }