grammars-v4
grammars-v4 copied to clipboard
feat: postgresql support golang
Hello, I used this project to do Postgresql parser in my recent work, but I found that there is currently support for Java and C#, no support for Golang, it took me some time to add support for golang and request push Merge into the original repository to help newcomers save time.
what I do:
- Basic support of Postgresql's golang, some golang code file.
- English and Chinese documents of how to use
Just an FYI about sub-parsing that is occurring for this grammar. Sub-parser code is not propagating errors to the main parse. After this code is merged, all target-specific code must be fixed to do this right.
Please note that the "Go" code should be in a directory called "Go" not "golang". The name of the directory is exactly the name in the target when specifying the Antlr4 Tool Jar run (e.g., antlr4 -Dlanguage=Go -lib parser -o parser *.g4). You can rename the directory now, or I will rename after you in a separate PR. Thanks.
@CC11001100 Are you going to update your PR with the requested changes?
@CC11001100 Are you going to update your PR with the requested changes?
Sorry for my poor English, I thought the merge was rejected. Thank you for your willingness to continue reviewing my code. I will keep modifying my PR until the merge is successful or rejected.
I renamed the Golang directory to Go
I see that the Java code for PG has changed. I was just translating the Java code to Go. It seems that I should modify the Go code until it behaves the same as the latest Java code?
Just an FYI about sub-parsing that is occurring for this grammar. Sub-parser code is not propagating errors to the main parse. After this code is merged, all target-specific code must be fixed to do this right.
Please note that the "Go" code should be in a directory called "Go" not "golang". The name of the directory is exactly the name in the target when specifying the Antlr4 Tool Jar run (e.g.,
antlr4 -Dlanguage=Go -lib parser -o parser *.g4). You can rename the directory now, or I will rename after you in a separate PR. Thanks.
I see that the Java code for PG has changed. I was just translating the Java code to Go. It seems that I should modify the Go code until it behaves the same as the latest Java code?
Yes, if you can model the changes that I made to the CSharp and Java targets, that would be great. Thank you so much for working on this. Also, your English is fine! --Ken
Also, there is a huge fix to the Antlr Go runtime, to be released soon in version 4.11. The Go target performance will be as fast as any other target. So, the change here by you will be wonderful to see.
@kaby76 @KvanTTT pull this?
Yes, this is a good demo of the Go target.
I've already approved it.
@CC11001100 thanks!