libdice/lib/dice_lexer.l
Florian Stinglmayr 4c2b7c3087 differentiate libdice flex/bison with prefix "dp"
This allows the library to be linked with other libraries that also
use flex and bison.
2018-05-11 16:57:55 +02:00

35 lines
559 B
Plaintext

%option prefix="dp"
%option bison-bridge
%option reentrant
%{
#define YYSTYPE DPSTYPE
#include "dice.h"
#include "dice_parse.h"
extern void dice_update_consumed(dice_t d, int off);
%}
%%
[0-9]+ {
dice_t d = yyget_extra(yyscanner);
dice_update_consumed(d, yyleng);
yylval->integer = atoi(yytext);
return TOK_INTEGER;
}
[d] {
dice_t d = yyget_extra(yyscanner);
dice_update_consumed(d, yyleng);
return TOK_DICESEP;
}
[fF] {
dice_t d = yyget_extra(yyscanner);
dice_update_consumed(d, yyleng);
return TOK_FUDGE;
}
%%