Discussion:
[ragel-users] space bug space bug space bug
Laurent Laborde
2014-05-12 14:10:04 UTC
Permalink
Friendly greetings !

I'm trying to use ragel with ruby as target but i have a problem that drive
me crazy since many days.

Here is the code : https://gist.github.com/ker2x/a86b1f6fc0de6a9c1f2e

and the output

[{:type=>:NUMBER, :name=>"+1 "}, {:type=>:SPACE, :name=>" 2"},
{:type=>:NUMBER, :name=>"2 "}, {:type=>:SPACE, :name=>" -"},
{:type=>:NUMBER, :name=>"-3 "}, {:type=>:SPACE, :name=>" 4"},
{:type=>:NUMBER, :name=>"4 "}, {:type=>:SPACE, :name=>" p"}]

there is an extra char everywhere.
Somehow, with this simplified version, it works when catching "print".
On a bigger version (that recognize string) i have to do "print " (with an
extra space)

What's happening ?
Thank you very much.

(i asked on irc for a few days but it's idle)
--
Laurent "ker2x" Laborde
Bigdata hacker @ Ebuzzing
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.complang.org/pipermail/ragel-users/attachments/20140512/69cbf601/attachment.html>
Adrian Thurston
2014-06-28 22:57:15 UTC
Permalink
Hi Laurent,

The te variable points (indexes) one past the end of the token buffer.
This is true in all languages. To use it in a ruby array index you need
to subtract 1.

Regards,
Adrian
Post by Laurent Laborde
Friendly greetings !
I'm trying to use ragel with ruby as target but i have a problem that
drive me crazy since many days.
Here is the code : https://gist.github.com/ker2x/a86b1f6fc0de6a9c1f2e
and the output
[{:type=>:NUMBER, :name=>"+1 "}, {:type=>:SPACE, :name=>" 2"},
{:type=>:NUMBER, :name=>"2 "}, {:type=>:SPACE, :name=>" -"},
{:type=>:NUMBER, :name=>"-3 "}, {:type=>:SPACE, :name=>" 4"},
{:type=>:NUMBER, :name=>"4 "}, {:type=>:SPACE, :name=>" p"}]
there is an extra char everywhere.
Somehow, with this simplified version, it works when catching "print".
On a bigger version (that recognize string) i have to do "print " (with
an extra space)
What's happening ?
Thank you very much.
(i asked on irc for a few days but it's idle)
--
Laurent "ker2x" Laborde
_______________________________________________
ragel-users mailing list
ragel-users at complang.org
http://www.complang.org/mailman/listinfo/ragel-users
Loading...