<div dir="ltr">Alternative syntax for Ragel spec blocks.<br><br>Ragel uses code block syntax typical for other lexical generators ( %%{...}%% ).<br>But as a rule, we edit *.rl the file in some IDE and type of editor for *.rl file and for main code file is the same.<br>I.e. if we use C++, then *.rl is often also edited as C++ the file.<br>Using %%{...}%% blocks break IDE code analisis as C++(or other) code.<br><br>It would be good if Ragel could maintain "comment syntax" of code blocks in style like Re2C:<br>    /*!ragel<br>        <multi-line FSM spec><br>    */<br>    //!ragel <single-line FSM spec><br><br>"comment syntax" can be implement all languages with C-style comments.<br><br>With "comment syntax" *.rl file would IDE frendly:<br>- *.rl the file is 100% correct c/c++/java file.<br>- syntax highlighting of the source code - works correctly.<br>- IntelliSence, auto-formatting and so on - works correctly.<br><br>Ragel can process %%{...}%% and /*! ragel... */ syntax at the same time or to use a special option (for example, --syntax=general/comment)<br><br>Example:<br>--- general ragel ragel file ------------------<br>#include <string.h><br>#include <stdio.h><br><br>%%{<br>    machine foo;<br>    main := ( 'foo' | 'bar' ) 0 @{ res = 1; };<br>}%%<br><br>%% write data;<br><br>int main( int argc, char **argv )<br>{<br>    int cs, res = 0;<br><br>    if ( argc > 1 ) {<br>        char *p = argv[1];<br>        char *pe = p + strlen(p) + 1;<br>        %% write init;<br>        %% write exec;<br>    }<br><br>    printf("result = %i\n", res );<br>    return 0;<br>}<br>-----------------------------------------------<br><br>--- IDE frendly ragel file --------------------<br>#include <string.h><br>#include <stdio.h><br><br>/*!ragel<br>    machine foo;<br>    main := ( 'foo' | 'bar' ) 0 @{ res = 1; };<br>*/<br><br>//!ragel write data;<br><br>int main( int argc, char **argv )<br>{<br>    int cs, res = 0;<br>    if ( argc > 1 ) {<br>        char *p = argv[1];<br>        char *pe = p + strlen(p) + 1;<br>        //!ragel write init;<br>        //!ragel write exec;<br>    }<br>    printf("result = %i\n", res );<br>    return 0;<br>}<br>-----------------------------------------------<br><br>What do you think?<br><br>Thanks for good tool.<br><br>Best regards,<br>Denis.<br></div>