ragel 5.23 released

Steve Horne stephenhorne... at aol.com
Wed Jul 25 08:04:05 UTC 2007

On Jul 24, 10:38 pm, Adrian Thurston <thurs... at cs.queensu.ca> wrote:

> This will be the last development release of the 5.X line. I am going to
> begin work on version 6.

Probably a good time to make a few suggestions then...

First, any chance of a new built-in machine? - one that never matches
anything? The idea is to use it in placeholder rules, that will be
filled in later - options that aren't implemented yet.

Second, consider this fragment of the code generated by Ragel in
response to a 'write data' command...

static const char _mwt_scn2_actions[] = {

First the really trivial issue - according to the C and C++ standards,
identifiers beginning with an underscore or containing a double-
underscore anywhere are reserved (non-standard keywords and standard
library stuff). A trailing single underscore is perfectly fine,
however. Yes, I know, sorry, I can't help it.

More significantly, this cannot be embedded in a class or struct, at
least in some compilers (Microsoft VC++ 2003 being the case in point).
There was an older approach to this kind of thing, where the static
const data is declared in the class but defined (given values)
outside, and usually in the .cpp file rather than the header. Syntax
is IIRC...

class classname
  static const int membername;
static const int classname::membername = 5;

(not quite 100% on this - not sure if the 'static' should be repeated)

I'm not really clear on the state of this in the standard. Certainly,
more recent compilers can cope with static const data in the class
definition, but I don't know if there are any limitations. In any
case, it might be useful to some (i.e. me) if you could have 'write
data declarations' and 'write data definitions in scopename' or
similar options.

But only if it's easy, of course - there's plenty of ways of working
around this issue. I tend to just put the 'write data' in a global
area ATM.

More information about the ragel-users mailing list