我正在使用Ragel 6.10和Go。我确定它可能是我的代码的问题,但是当我尝试使用带有扫描仪块的堆栈时,我得到了一些奇怪的错误。我试图设置括号匹配,我的代码看起来大致如此;
ObjectValues := |*
# other stuff
'}' => { fret; };
*|
main := ('{' @{fcall ObjectValues;})*;
查看指南中的第46页看起来应该是可行的。当我运行Ragel ragel -G2 -Z main.rl
时。我尝试编译时遇到以下错误(仅适用于-G2 FSM生成);
graphql_collections.rl:47[/Users/nathanfisher/workspace/go/src/github.com/nfisher/gir/graphql_collections.go:325:2]: syntax error: unexpected goto at end of statement
graphql_collections.go:60[/Users/nathanfisher/workspace/go/src/github.com/nfisher/gir/graphql_collections.go:60:1]: label _again defined and not used
评论音品线会删除错误并警告postpop和prepush无法访问。
完整的代码在这里;
https://github.com/nfisher/gir/blob/broken/graphql_collections.rl#L47
这是一个工作最小的测试用例;
https://gist.github.com/nfisher/649ca816f82bb3ccd7164331ac2324ac
测试用例的错误;
main.rl:13[/Users/nathanfisher/workspace/go/src/github.com/nfisher/gir/command/runner/main.go:119:2]: syntax error: unexpected goto at end of statement
main.go:59[/Users/nathanfisher/workspace/go/src/github.com/nfisher/gir/command/runner/main.go:59:1]: label _again defined and not used