<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html><body style='font-size: 14pt; font-family: Verdana,Geneva,sans-serif'>
<p>Hi Denis, I can see how it would be nice to have a mode that can be used with an IDE without having to add a customization. It should be easier to do with the ragel 7 frontend. I've added it as a feature request to my issue tracking system.</p>
<p>On 2019-04-13 13:09, Denis Naumov wrote:</p>
<blockquote type="cite" style="padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px"><!-- html ignored --><!-- head ignored --><!-- meta ignored -->
<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.</div>
<br />
<pre>_______________________________________________
ragel-users mailing list
<a href="mailto:ragel-users@colm.net">ragel-users@colm.net</a>
<a href="http://www.colm.net/cgi-bin/mailman/listinfo/ragel-users">http://www.colm.net/cgi-bin/mailman/listinfo/ragel-users</a>
</pre>
</blockquote>
</body></html>