#include 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; }