Skip to content

Commit

Permalink
Refactor parse (#728)
Browse files Browse the repository at this point in the history
* basic types and decimal package

* unified parsers into single grammar

* trying out new visitors

* added ordering, aggregate checks

* added better documentation

* added generation, removed unused

* rebase

* bug fixes

* working tests, addressed gavins feedback

* added support for unnamed returns

* wasm changes

* fixed lint

* pglive build tag
  • Loading branch information
brennanjl committed May 22, 2024
1 parent 07025b0 commit ed2c974
Show file tree
Hide file tree
Showing 205 changed files with 33,181 additions and 55,158 deletions.
2 changes: 1 addition & 1 deletion cmd/kwil-cli/cmds/database/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func UnmarshalKf(file *os.File) (*types.Schema, error) {
return nil, fmt.Errorf("failed to read Kuneiform source file: %w", err)
}

res, err := parse.ParseKuneiform(string(source))
res, err := parse.ParseAndValidate(source)
if err != nil {
return nil, fmt.Errorf("failed to parse Kuneiform source file: %w", err)
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/kwil-cli/cmds/utils/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func newParseCmd() *cobra.Command {
return display.PrintErr(cmd, err)
}

res, err := parse.ParseKuneiform(string(file))
res, err := parse.ParseAndValidate(file)
if err != nil {
return display.PrintErr(cmd, err)
}
Expand All @@ -41,7 +41,7 @@ func newParseCmd() *cobra.Command {
// schemaDisplay is a struct that will be used to display the schema.
// It includes an error because the parser can return a schema even if there is an error.
type schemaDisplay struct {
Result *parse.ParseResult
Result *parse.SchemaParseResult
}

func (s *schemaDisplay) MarshalJSON() ([]byte, error) {
Expand Down
3 changes: 3 additions & 0 deletions core/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.21

require (
github.com/antihax/optional v1.0.0
github.com/cockroachdb/apd/v3 v3.2.1
github.com/cstockton/go-conv v1.0.0
github.com/decred/dcrd/certgen v1.1.2
github.com/ethereum/go-ethereum v1.14.3
Expand All @@ -17,6 +18,7 @@ require (
google.golang.org/genproto/googleapis/rpc v0.0.0-20240509183442-62759503f434
google.golang.org/grpc v1.63.2
google.golang.org/protobuf v1.34.1
gotest.tools v2.2.0+incompatible
)

require (
Expand All @@ -30,6 +32,7 @@ require (
github.com/ethereum/c-kzg-4844 v1.0.0 // indirect
github.com/holiman/uint256 v1.2.4 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/supranational/blst v0.3.11 // indirect
go.uber.org/multierr v1.11.0 // indirect
Expand Down
6 changes: 6 additions & 0 deletions core/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOF
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc=
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cockroachdb/apd/v3 v3.2.1 h1:U+8j7t0axsIgvQUqthuNm82HIrYXodOV2iWLWtEaIwg=
github.com/cockroachdb/apd/v3 v3.2.1/go.mod h1:klXJcjp+FffLTHlhIG69tezTDvdP065naDsHzKhYSqc=
github.com/cockroachdb/errors v1.11.1 h1:xSEW75zKaKCWzR3OfxXUxgrk/NtT4G1MiOv5lWZazG8=
github.com/cockroachdb/errors v1.11.1/go.mod h1:8MUxA3Gi6b25tYlFEBGLf+D8aISL+M4MIpiWMSNRfxw=
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE=
Expand Down Expand Up @@ -81,6 +83,8 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c=
github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8=
github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw=
github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU=
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI=
Expand Down Expand Up @@ -153,5 +157,7 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU=
rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA=

0 comments on commit ed2c974

Please sign in to comment.