Closed rofl0r closed 4 years ago
The %% write ..
statements are just single line forms of arbitrary ragel statements. If a machine block (single or multiline) doesn't have a name then it just uses the name of the previous block. You could write:
%% machine test;
%% main := ( "" >{puts("x");} ( [0-9]+ ) "foo" );
%% write data;
%% write exec;
If you wanted to. So to put a write in with a name just use:
%%{
machine foo;
write data;
}%%
this is basically what's been asked here: https://stackoverflow.com/questions/32265063/is-it-possible-to-invocate-multiple-machines-in-one-ragel-file
since ragel's write statement doesn't allow to specify the machine name, the offered solution seems hackish.
would it make sense to introduce another statement e.g.
write-machine
that acts just likewrite
but takes a machine name as first parameter ?