2018-01-30 08:47
浏览 49


I'm using Ragel 6.10 with Go. I'm sure it's likely an issue with my code but I'm getting some weird errors when I try to use a stack with a scanner block. I'm trying to setup bracket matching and my code looks roughly like this;

ObjectValues := |*
 # other stuff
 '}' => { fret; };

main := ('{' @{fcall ObjectValues;})*;

Looking at page 46 in the guide it looks like this should be possible. When I run Ragel ragel -G2 -Z main.rl. I get the following error when I try to compile (it only happens for -G2 FSM generation);

graphql_collections.rl:47[/Users/nathanfisher/workspace/go/src/]: syntax error: unexpected goto at end of statement
graphql_collections.go:60[/Users/nathanfisher/workspace/go/src/]: label _again defined and not used

Commenting out the fret line removes the error and warns postpop and prepush are unreachable.

The full code is here;

A working minimal test-case is here;

Error for test-case;

main.rl:13[/Users/nathanfisher/workspace/go/src/]: syntax error: unexpected goto at end of statement
main.go:59[/Users/nathanfisher/workspace/go/src/]: label _again defined and not used
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • douti8321 2018-01-30 19:18

    It looks like this is an issue relating to Ragel's generated code in v 6.10. Using the HEAD of ragel-6 branch fixes the issue. Thanks to Adrian Thurston for being super responsive/helpful via Twitter. :)

    Reformatting the code from this;

    compilation error

    To this fixes the error;


    打赏 评论

相关推荐 更多相似问题