[ragel-users] rlgen-ruby / ruby 1.9 incompatibilities, possiblefixes, and offer to patch
Adrian Thurston
thurs... at cs.queensu.ca
Thu Jan 3 02:43:57 UTC 2008
I'll look this up tomorrow. Right now I'm in a train station. In the meantime are there any ruby experts out there that know the proper way to index arrays and strings and pull out numbers?
Adrian
-----Original Message-----
From: dcgrigsby <dan-google at unpossible.com>
Date: Wed, 2 Jan 2008 11:56:55
To:ragel-users <ragel-users at googlegroups.com>
Subject: [ragel-users] rlgen-ruby / ruby 1.9 incompatibilities, possible
fixes, and offer to patch
Hello,
The code generated by rlgen-ruby is incompatible with Ruby 1.9.
Using the simple DevChix Hello World example (http://www.devchix.com/
2007/12/13/a-hello-world-for-ruby-on-ragel/)., the generated "write
exec" ruby contains a handful of errors.
1) the "when" clause in the generated case statements uses a
deprecated form. It is in the form "when <value>:" and should be
"when <value> then" instead.
2) under 1.9, a string element reference (i.e., [] operator) returns a
string, not a fixnum as under 1.8. So the comparisons like this...
if data[p] < _hello_trans_keys[_mid]
...result in "`<': comparison of String with 104 failed
(ArgumentError)" under 1.9.
I'd be happy to work up a patch, hopefully one that works under both
1.8 and 1.9, but I need some guidance.
The former should be easy. I found all the instances that use the
colon in when and changed them successfully.
The later is where I'm uncertain. Appending ".to_s" to both sides of
the comparison (needs to be both sides to retain 1.8 compatibility)
everywhere seems wrong. At this point I'm doing little more than
grepping the source; I don't really comprehend what's going on, so a
point in the right direction would be welcome.
Thanks,
Dan
More information about the ragel-users
mailing list