Grammar Name Conflict Golang with SPARQL issue
See original GitHub issueHi! So im trying to build a simple sparql parser for golang. Got the grammar for it from here: https://github.com/antlr/grammars-v4/tree/master/sparql
Then i ran this command to generate the code:
java -jar antlr-4.10.1-complete.jar -Dlanguage=Go -o parser Sparql.g4
Now, after i included it into a Go program, without even using it, it errors out with this:
parser/sparql_parser.go:9806:9: cannot use s (variable of type *RdfLiteralContext) as type antlr.RuleContext in return statement:
*RdfLiteralContext does not implement antlr.RuleContext (wrong type for String method)
have String() IStringContext
want String([]string, antlr.RuleContext) string
parser/sparql_parser.go:9829:13: cannot use NewRdfLiteralContext(p, p.GetParserRuleContext(), p.GetState()) (value of type *RdfLiteralContext) as type IRdfLiteralContext in assignment:
*RdfLiteralContext does not implement IRdfLiteralContext (wrong type for String method)
have String() IStringContext
want String([]string, antlr.RuleContext) string
From what i’ve seen in another issue, i think this might be related to some grammar name conflicts with the code generation, but i dont know how to fix it. If someone recognizes the problem, i’ll be glad to make the changes myself and open a pull request.
Thanks 😃
Issue Analytics
- State:
- Created a year ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
antlr4 - Go Packages
Package antlr4 provides pre-compiled parsers for Go using the antlr4 generator. Example ¶. Example shows how to use the JSON lexer and parser....
Read more >go - Conflict in repo name and module name - Stack Overflow
The issue is that you are using this file structure: qjson/engine.go qjson/errors.go. When you should just be putting them at the top level, ......
Read more >Antlr4 Versions - Open Source Agenda
... Grammar Name Conflict Golang with SPARQL issue (target:go, type:cleanup) ... Augment error message during testing to include full cause of problem.
Read more >SPARQL Query Language for RDF - W3C
abc identify the same variable. The possible names for variables are given in the SPARQL grammar. Grammar rules: [44], Var ...
Read more >How do you deal with package name conflicts? - Google Groups
It is possible to customize the name under which you refer to an imported package. e.g. import myhttp "my/http". See http://golang.org/doc/go_spec.html# ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
go.mod is updated and go.sum is added to the repo. We can close this when the PR is merged.
@parrt There are I think 3 outstanding PRs to fix go runtime bugs. I could merge them but do not have permissions (which also means I cannot get a free Github copilot license 😉
Cool. Thanks for the verify.
On Mon, Aug 22, 2022 at 21:00 Ken Domino @.***> wrote: