<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Hello,</div><div><br></div><div>Right… I think there is not a straight path from flex to Erlang leex. </div><div>Instead of porting flex input rules, I would take a look into flex interim results and try to map them to leex.  </div><div><br></div><div>- Dmitry </div><br><div><div>On 18 Jan 2014, at 03:25, Xiao Jia <<a href="mailto:me@xiao-jia.com">me@xiao-jia.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">On Fri, Jan 17, 2014 at 10:53 PM, Dmitry Kolesnikov<br><<a href="mailto:dmkolesnikov@gmail.com">dmkolesnikov@gmail.com</a>> wrote:<br><blockquote type="cite">Hello,<br><br>Probably, I've missed something… The start condition is the literal part of lex regex.<br>e.g.<br><br>Definitions.<br><br>WSS = [\x20\x09\x0A\x0D]+<br>VAR = [a-zA-Z.]+<br><br>Rules.<br><br>{if{WSS}{VAR}} : {token, {'if', TokenLine, TokenChars}}.<br><br>this matches token is it starts with if<br></blockquote><br>That's probably not what Vance Shipley wants.  Using start conditions<br>is sort of moving between state machines.  See below example excerpted<br>from<span class="Apple-converted-space"> </span><a href="http://flex.sourceforge.net/manual/Start-Conditions.html#Start-Conditions">http://flex.sourceforge.net/manual/Start-Conditions.html#Start-Conditions</a><br><br><br>        "/*"         BEGIN(comment);<br><br>        <comment>[^*\n]*        /* eat anything that's not a '*' */<br>        <comment>"*"+[^*/\n]*   /* eat up '*'s not followed by '/'s */<br>        <comment>\n             ++line_num;<br>        <comment>"*"+"/"        BEGIN(INITIAL);<br><br><br><blockquote type="cite"><br>- Dmitry<br><br>On Jan 17, 2014, at 4:42 PM, Vance Shipley <<a href="mailto:vances@motivity.ca">vances@motivity.ca</a>> wrote:<br><br><blockquote type="cite">I've never tried using leex before but since the job at hand is<br>to parse a language file, where the reference implementation uses<br>flex, it seemed like porting their lex input file for use with leex<br>would be the way to go.<br><br>However I got stuck right away in that leex doesn't seem to support<br>"start conditions":<br><br> <a href="http://flex.sourceforge.net/manual/Start-Conditions.html#Start-Conditions">http://flex.sourceforge.net/manual/Start-Conditions.html#Start-Conditions</a><br><br>Am I missing something?<br></blockquote></blockquote><br><br>From<span class="Apple-converted-space"> </span><a href="http://erlang.org/doc/man/leex.html">http://erlang.org/doc/man/leex.html</a><span class="Apple-converted-space"> </span>rules have the following format:<br><br>       <Regexp> : <Erlang code>.<br><br>and apparently start conditions are not regular expressions... so<br>probably there is no support for that.<br><br><br>--<span class="Apple-converted-space"> </span><br>Regards,<br>Xiao Jia</div></blockquote></div><br></body></html>