Skip to content

Commit 518abad

Browse files
authored
Merge pull request #123 from tursodatabase/inline_parser
Copy code from github.com/libsql/sqlite-antlr4-parser and stop using the external package
2 parents 6d998ac + 1f22c3e commit 518abad

24 files changed

+38201
-24
lines changed

.github/workflows/go.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
run: go get ./...
4141

4242
- name: Vet
43-
run: go vet -v ./...
43+
run: go vet -v $(go list ./... | grep -v "github.com/tursodatabase/libsql-client-go/sqliteparser$")
4444

4545
- name: Install sqlclosecheck
4646
run: go install github.com/ryanrolds/sqlclosecheck@latest
@@ -49,7 +49,7 @@ jobs:
4949
run: go vet -vettool=${HOME}/go/bin/sqlclosecheck ./...
5050

5151
- name: Run golangci-lint
52-
uses: golangci/golangci-lint-action@v3
52+
uses: golangci/golangci-lint-action@v6
5353

5454
- name: Build
5555
run: go build -v ./...

go.mod

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,8 @@ go 1.20
44

55
require (
66
github.com/antlr4-go/antlr/v4 v4.13.0
7-
github.com/libsql/sqlite-antlr4-parser v0.0.0-20240327125255-dbf53b6cbf06
8-
github.com/stretchr/testify v1.9.0
97
golang.org/x/sync v0.3.0
108
nhooyr.io/websocket v1.8.10
119
)
1210

13-
require (
14-
github.com/davecgh/go-spew v1.1.1 // indirect
15-
github.com/pmezard/go-difflib v1.0.0 // indirect
16-
golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 // indirect
17-
gopkg.in/yaml.v3 v3.0.1 // indirect
18-
)
11+
require golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 // indirect

go.sum

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,8 @@
11
github.com/antlr4-go/antlr/v4 v4.13.0 h1:lxCg3LAv+EUK6t1i0y1V6/SLeUi0eKEKdhQAlS8TVTI=
22
github.com/antlr4-go/antlr/v4 v4.13.0/go.mod h1:pfChB/xh/Unjila75QW7+VU4TSnWnnk9UTnmpPaOR2g=
3-
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
4-
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
5-
github.com/libsql/sqlite-antlr4-parser v0.0.0-20240327125255-dbf53b6cbf06 h1:JLvn7D+wXjH9g4Jsjo+VqmzTUpl/LX7vfr6VOfSWTdM=
6-
github.com/libsql/sqlite-antlr4-parser v0.0.0-20240327125255-dbf53b6cbf06/go.mod h1:FUkZ5OHjlGPjnM2UyGJz9TypXQFgYqw6AFNO1UiROTM=
7-
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
8-
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
9-
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
10-
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
113
golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 h1:aAcj0Da7eBAtrTp03QXWvm88pSyOt+UgdZw2BFZ+lEw=
124
golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8/go.mod h1:CQ1k9gNrJ50XIzaKCRR2hssIjF07kZFEiieALBM/ARQ=
135
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
146
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
15-
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
16-
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
17-
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
18-
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
197
nhooyr.io/websocket v1.8.10 h1:mv4p+MnGrLDcPlBoWsvPP7XCzTYMXP9F9eIGoKbgx7Q=
208
nhooyr.io/websocket v1.8.10/go.mod h1:rN9OFWIUwuxg4fR5tELlYC04bXYowCP9GX47ivo2l+c=

libsql/internal/http/shared/statement.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import (
88
"sort"
99

1010
"github.com/antlr4-go/antlr/v4"
11-
"github.com/libsql/sqlite-antlr4-parser/sqliteparser"
12-
"github.com/libsql/sqlite-antlr4-parser/sqliteparserutils"
11+
"github.com/tursodatabase/libsql-client-go/sqliteparser"
12+
"github.com/tursodatabase/libsql-client-go/sqliteparserutils"
1313
)
1414

1515
type ParamsInfo struct {

sqliteparser/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# ANTLR SQLite Parser
2+
3+
This project is just a generation of a [ANTLR4](https://www.antlr.org/) go parser using [SQLite grammar](https://github.com/antlr/grammars-v4/tree/master/sql/sqlite) from [antlr/grammars-v4](https://github.com/antlr/grammars-v4/tree/master) project. Its only reason to exist is to avoid forcing everyone that want a simple parser to install JAVA.
4+
5+
You can find the grammar inside `./grammar` and the generated parser inside `./sqliteparser`
6+
7+
## Generate parser
8+
9+
### Requirements
10+
- JAVA 11+ installed
11+
- ANTLR4 compelte java binaries. Link [here](https://www.antlr.org/download.html)
12+
- Put the binary inside `/usr/local/lib`
13+
14+
Important: The parser inside `./sqliteparser` was generated using OpenJDK 11 and ANTLR 4.12.0
15+
16+
### Steps
17+
- Just run `./generate-parser.sh`
18+

0 commit comments

Comments
 (0)