2018-02-14 19:31:52 +01:00
|
|
|
%option bison-bridge
|
|
|
|
%option reentrant
|
|
|
|
|
2018-02-13 20:27:38 +01:00
|
|
|
%{
|
2018-05-11 16:57:55 +02:00
|
|
|
#define YYSTYPE DPSTYPE
|
2018-02-13 20:27:38 +01:00
|
|
|
#include "dice.h"
|
|
|
|
#include "dice_parse.h"
|
2018-02-14 19:31:52 +01:00
|
|
|
|
2018-02-17 10:52:46 +01:00
|
|
|
extern void dice_update_consumed(dice_t d, int off);
|
|
|
|
|
2018-02-13 20:27:38 +01:00
|
|
|
%}
|
|
|
|
|
|
|
|
%%
|
2018-02-14 19:31:52 +01:00
|
|
|
[0-9]+ {
|
2018-02-17 10:52:46 +01:00
|
|
|
dice_t d = yyget_extra(yyscanner);
|
|
|
|
dice_update_consumed(d, yyleng);
|
2018-02-14 19:31:52 +01:00
|
|
|
yylval->integer = atoi(yytext);
|
|
|
|
return TOK_INTEGER;
|
|
|
|
}
|
|
|
|
|
|
|
|
[d] {
|
2018-02-17 10:52:46 +01:00
|
|
|
dice_t d = yyget_extra(yyscanner);
|
|
|
|
dice_update_consumed(d, yyleng);
|
2018-02-14 19:31:52 +01:00
|
|
|
return TOK_DICESEP;
|
|
|
|
}
|
2018-03-23 17:44:52 +01:00
|
|
|
|
|
|
|
[fF] {
|
|
|
|
dice_t d = yyget_extra(yyscanner);
|
|
|
|
dice_update_consumed(d, yyleng);
|
|
|
|
return TOK_FUDGE;
|
|
|
|
}
|
|
|
|
|
2018-02-13 20:27:38 +01:00
|
|
|
%%
|