[ragel-users] semantic conditions and alphtype

Iain Nicol iain at thenicols.net
Sun Jun 26 13:22:58 UTC 2011

At the moment, if you're on a 32-bit machine and have alphtype signed or
unsigned int, you cannot use semantic conditions.  The longs Ragel
store the characters in have no free space.

IMHO this is unfortunate.  Suppose you want (basic) Unicode support.  It
is tempting to use unsigned int as the alphtype, and feed Ragel Unicode
code points (equivalently, UCS-4 encoded data). No more than 21 bits are
needed to do this, but Ragel has no way of knowing that the alphabet
doesn't cover the whole range of the unsigned int.

I realise there's contrib/Unicode2Ragel which has support for UTF-8, but
(again IMO) it's nice to deal with encoding completely separately from
Ragel, and hence give Ragel the abstract code points.

Would either of the following be reasonable?

  * have some way to give Ragel a more specific alphabet range.  (Would
    this be an extra parameter to alphtype, or would it replace the
    existing parameters to alphtype?)

  * allow Ragel to (conditionally?) use long longs internally.


ragel-users mailing list
ragel-users at complang.org

More information about the ragel-users mailing list