The next little game in the series where I make a fancy rogue game.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
roguish/scratchpad/testragel.rl

27 lines
525 B

#include <fmt/core.h>
using namespace fmt;
%%{
machine foo;
test1 = 0x1B . "[" . [0-9]+ @{ println("NUM1"); } . ";" . [0-9]+ @{ println("NUM2"); } . "m" 0 @{ res = 1; };
test2 = 0x1B "A" [0-9]+ @{ println("NUM1"); } ";" [0-9]+ @{ println("NUM2"); } "m" 0 @{ res = 2; };
main := (test1 | test2);
}%%
%% write data;
int main() {
int cs, res = 0;
char *test = "\x1B[36;46m";
char *p = test;
char *pe = p + strlen(p) + 1;
%% write init;
%% write exec;
fmt::println("result = {}", res);
return 0;
}