[ragel-users] Does ragel support something like %x in flex?

Adrian Thurston thurston at colm.net
Tue Feb 19 02:53:54 UTC 2019


Hi Peng, you can embed a condition into a pattern. I would recommend an 
entry condition.

pattern >when {test()} => {match_code();}

On 2019-02-19 07:22, Peng Yu wrote:
> Hi,
> 
> I don't see ragel support something like Chapter 10 of flex manual.
> 
> """
> flex provides a mechanism for conditionally activating rules. Any rule
> whose pattern is
> prefixed with ‘<sc>’ will only be active when the scanner is in the
> start condition named
> sc. For example,
> <STRING>[^"]* { /* eat up the string body ... */
> ...
> }
> will be active only when the scanner is in the STRING start condition, 
> and
> <INITIAL,STRING,QUOTE>\. { /* handle an escape ... */
> ...
> }
> will be active only when the current start condition is either
> INITIAL, STRING, or QUOTE.
> """
> 
> Maybe I miss something. Does ragel support such a feature? Thanks.



More information about the ragel-users mailing list