Discussion:
[ragel-users] Bug in Go language when using %%{ write first_final; }%%
Iñaki Baz Castillo
2013-11-11 23:57:04 UTC
Permalink
The following code in Go:

-----------------
if cs != %%{ write first_final; }%% {
-----------------

generates the following lines in the .go file:

-----------------
if cs !=
// line 12549 "SDP.go"
461
// line 79 "SDP.rl"
{
-----------------

This produces, of course, a syntax error in Go:

sdp/SDP.go:12549: missing condition in if statement
sdp/SDP.go:12549: cs != 461 evaluated but not used



$ ragel -v
Ragel State Machine Compiler version 6.8 Feb 2013
--
I?aki Baz Castillo
<ibc at aliax.net>
Anton Ageev
2013-11-12 00:28:21 UTC
Permalink
Ragel defines constant "[machine name]_first_final" (where "[machine name]"
is a name specified in directive "machine [machine name]").

You could rewrite the code to use this constant:

%%{
machine sdp;

// the machine definitions are here
....
}%%

...
// go code

if cs != sdp_first_final {
...
}
Post by Iñaki Baz Castillo
-----------------
if cs != %%{ write first_final; }%% {
-----------------
-----------------
if cs !=
// line 12549 "SDP.go"
461
// line 79 "SDP.rl"
{
-----------------
sdp/SDP.go:12549: missing condition in if statement
sdp/SDP.go:12549: cs != 461 evaluated but not used
$ ragel -v
Ragel State Machine Compiler version 6.8 Feb 2013
--
I?aki Baz Castillo
<ibc at aliax.net>
_______________________________________________
ragel-users mailing list
ragel-users at complang.org
http://www.complang.org/mailman/listinfo/ragel-users
--
WBR, Anton
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.complang.org/pipermail/ragel-users/attachments/20131112/a5cbae2f/attachment.html>
Iñaki Baz Castillo
2013-11-18 09:41:26 UTC
Permalink
Post by Anton Ageev
Ragel defines constant "[machine name]_first_final" (where "[machine name]"
is a name specified in directive "machine [machine name]").
Yes, I know that and use that. Anyhow my bug report is valid :)

Thanks a lot.
--
I?aki Baz Castillo
<ibc at aliax.net>
Iñaki Baz Castillo
2013-11-25 19:47:52 UTC
Permalink
Hi, just a reminder of this bug as I expect it is just a minor detail :)
Post by Iñaki Baz Castillo
-----------------
if cs != %%{ write first_final; }%% {
-----------------
-----------------
if cs !=
// line 12549 "SDP.go"
461
// line 79 "SDP.rl"
{
-----------------
sdp/SDP.go:12549: missing condition in if statement
sdp/SDP.go:12549: cs != 461 evaluated but not used
$ ragel -v
Ragel State Machine Compiler version 6.8 Feb 2013
--
I?aki Baz Castillo
<ibc at aliax.net>
--
I?aki Baz Castillo
<ibc at aliax.net>
Adrian Thurston
2013-12-01 17:02:38 UTC
Permalink
I just pushed a fix to the ragel-6 branch.

I am currently working on the go code generator in master (ragel-7).

Adrian
@ehdtee
Post by Iñaki Baz Castillo
Hi, just a reminder of this bug as I expect it is just a minor detail :)
Post by Iñaki Baz Castillo
-----------------
if cs != %%{ write first_final; }%% {
-----------------
-----------------
if cs !=
// line 12549 "SDP.go"
461
// line 79 "SDP.rl"
{
-----------------
sdp/SDP.go:12549: missing condition in if statement
sdp/SDP.go:12549: cs != 461 evaluated but not used
$ ragel -v
Ragel State Machine Compiler version 6.8 Feb 2013
--
I?aki Baz Castillo
<ibc at aliax.net>
Iñaki Baz Castillo
2013-12-01 17:41:51 UTC
Permalink
Great.
Post by Adrian Thurston
I just pushed a fix to the ragel-6 branch.
I am currently working on the go code generator in master (ragel-7).
Adrian
@ehdtee
Post by Iñaki Baz Castillo
Hi, just a reminder of this bug as I expect it is just a minor detail :)
Post by Iñaki Baz Castillo
-----------------
if cs != %%{ write first_final; }%% {
-----------------
-----------------
if cs !=
// line 12549 "SDP.go"
461
// line 79 "SDP.rl"
{
-----------------
sdp/SDP.go:12549: missing condition in if statement
sdp/SDP.go:12549: cs != 461 evaluated but not used
$ ragel -v
Ragel State Machine Compiler version 6.8 Feb 2013
--
I?aki Baz Castillo
<ibc at aliax.net>
_______________________________________________
ragel-users mailing list
ragel-users at complang.org
http://www.complang.org/mailman/listinfo/ragel-users
--
I?aki Baz Castillo
<ibc at aliax.net>
Anton Ageev
2013-12-01 19:42:32 UTC
Permalink
Thanks Adrian. I was not sure how to fix this problem properly.
Post by Adrian Thurston
I just pushed a fix to the ragel-6 branch.
I am currently working on the go code generator in master (ragel-7).
Adrian
@ehdtee
Post by Iñaki Baz Castillo
Hi, just a reminder of this bug as I expect it is just a minor detail :)
Post by Iñaki Baz Castillo
-----------------
if cs != %%{ write first_final; }%% {
-----------------
-----------------
if cs !=
// line 12549 "SDP.go"
461
// line 79 "SDP.rl"
{
-----------------
sdp/SDP.go:12549: missing condition in if statement
sdp/SDP.go:12549: cs != 461 evaluated but not used
$ ragel -v
Ragel State Machine Compiler version 6.8 Feb 2013
--
I?aki Baz Castillo
<ibc at aliax.net>
_______________________________________________
ragel-users mailing list
ragel-users at complang.org
http://www.complang.org/mailman/listinfo/ragel-users
--
WBR, Anton
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.complang.org/pipermail/ragel-users/attachments/20131201/9397ef98/attachment.html>
Loading...