grammars-v4 icon indicating copy to clipboard operation
grammars-v4 copied to clipboard

feat: postgresql support golang

Open CC11001100 opened this issue 3 years ago • 9 comments

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:

  1. Basic support of Postgresql's golang, some golang code file.
  2. English and Chinese documents of how to use

CC11001100 avatar Aug 11 '22 06:08 CC11001100

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.

kaby76 avatar Aug 18 '22 10:08 kaby76

@CC11001100 Are you going to update your PR with the requested changes?

kaby76 avatar Aug 24 '22 17:08 kaby76

@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

CC11001100 avatar Aug 25 '22 11:08 CC11001100

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.

CC11001100 avatar Aug 25 '22 12:08 CC11001100

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

kaby76 avatar Aug 25 '22 14:08 kaby76

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 avatar Aug 25 '22 15:08 kaby76

@kaby76 @KvanTTT pull this?

teverett avatar Aug 27 '22 15:08 teverett

Yes, this is a good demo of the Go target.

kaby76 avatar Aug 27 '22 17:08 kaby76

I've already approved it.

KvanTTT avatar Aug 27 '22 19:08 KvanTTT

@CC11001100 thanks!

teverett avatar Nov 08 '22 02:11 teverett