[ragel-users] //line directives in ragel-generated Go code

Adrian Thurston thurston at colm.net
Tue May 15 16:53:15 UTC 2018


For C codegen they are there so that any problems that spill back into
the generated code can be reported properly. Rare, given that it's a
code generator, but useful when you're doing ragel development. Also,
there can be environmental factors that trigger a problem in the
generated code, such as a define. 

I don't know GO well enough to say that's important there as well. 

On 2018-05-15 11:17, Dmitry Savintsev wrote: 

> What is the meaning and intended usage of `//line filename.go` directives in the Go code generated by ragel? I understand that '//line filename.rl' references can help to trace back the origin of the statements, but don't yet see the significance or intended usage of the .go file references. 
> -L directive is applicable only to C/D/Ruby/C#/OCaml - I wonder if it would be difficult to enable it for Go as well? The '//line' directives seem to confuse the `go test -cover` command into producing invalid data (and then an internal error like "cover: inconsistent NumStmt: changed from 3 to 2"). I am using ragel version 6.10 (on a Mac). 
> The workaround I'm using is removing the `//line` lines from the generated .go file: 
> sed -i '' /^//line.*/d filename.go 
> Many thanks, 
> Dmitry 
> _______________________________________________
> ragel-users mailing list
> ragel-users at colm.net
> http://www.colm.net/cgi-bin/mailman/listinfo/ragel-users [1]

[1] http://www.colm.net/cgi-bin/mailman/listinfo/ragel-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.colm.net/pipermail/ragel-users/attachments/20180515/81f9fd83/attachment.html>

More information about the ragel-users mailing list