Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Commit

Permalink
feat: suppport expr as action/extension call arg
Browse files Browse the repository at this point in the history
  • Loading branch information
Yaiba committed Sep 27, 2023
1 parent 81351f9 commit 2868efa
Show file tree
Hide file tree
Showing 15 changed files with 2,405 additions and 1,391 deletions.
9 changes: 3 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ module github.com/kwilteam/kuneiform

go 1.21

toolchain go1.21.0

require (
github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230512164433-5d1fd1a340c9
github.com/kwilteam/kwil-db v0.5.1-0.20230904060923-e1e9e6783500
github.com/kwilteam/kwil-db v0.5.1-0.20230927233025-c3e8ef579ade
github.com/spf13/cobra v1.7.0
github.com/stretchr/testify v1.8.4
)
Expand All @@ -16,9 +14,8 @@ require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kwilteam/action-grammar-go v0.0.0 // indirect
github.com/kwilteam/sql-grammar-go v0.0.2 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/kwilteam/action-grammar-go v0.0.1-0.20230926160920-472768e1186c // indirect
github.com/kwilteam/sql-grammar-go v0.0.3-0.20230925230724-00685e1bac32 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 // indirect
Expand Down
14 changes: 6 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kwilteam/action-grammar-go v0.0.0 h1:FyKRrSdE52ex/YPSlKpjhJkfIcBEX9SY4xw9m3VdooA=
github.com/kwilteam/action-grammar-go v0.0.0/go.mod h1:2KYz1ittMk7BbKRJSnSnRSysrgDUUtNB1Ha47ZMdc6M=
github.com/kwilteam/kwil-db v0.5.1-0.20230904060923-e1e9e6783500 h1:/raDARSfbbaroPd7WmRlPE87tkFvDfZ4QDyMkqCynD4=
github.com/kwilteam/kwil-db v0.5.1-0.20230904060923-e1e9e6783500/go.mod h1:pMO2O+q1NkzJ0GyTKHbrBSVbA+3tRnZxoQTLdLwt/tM=
github.com/kwilteam/sql-grammar-go v0.0.2 h1:Tg8xo/Pzd72QsO19wwNvFrpw2muuBaERP7XTv21U4Iw=
github.com/kwilteam/sql-grammar-go v0.0.2/go.mod h1:OqmGyCwHfBZvYv/sYPrQ5Ih290dhlD5AcKOHDlUSS0Y=
github.com/kwilteam/action-grammar-go v0.0.1-0.20230926160920-472768e1186c h1:TAH/HIjj49I2v42ehDHjkQbnHkaYjvw8J1BpAZfmA4E=
github.com/kwilteam/action-grammar-go v0.0.1-0.20230926160920-472768e1186c/go.mod h1:2KYz1ittMk7BbKRJSnSnRSysrgDUUtNB1Ha47ZMdc6M=
github.com/kwilteam/kwil-db v0.5.1-0.20230927233025-c3e8ef579ade h1:0UawIUwW9BTyN/of/EaHaoBAUvG4FtQ2bylCy8uoU0o=
github.com/kwilteam/kwil-db v0.5.1-0.20230927233025-c3e8ef579ade/go.mod h1:4ivsxHQd1XY6leb3gORj0Q5/XfwsPhIMAVJvBEE0//A=
github.com/kwilteam/sql-grammar-go v0.0.3-0.20230925230724-00685e1bac32 h1:NDMw+6BKSqLxFyfpbbCJNx8EOLB3+ugCUEnMpomXBeQ=
github.com/kwilteam/sql-grammar-go v0.0.3-0.20230925230724-00685e1bac32/go.mod h1:OqmGyCwHfBZvYv/sYPrQ5Ih290dhlD5AcKOHDlUSS0Y=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
Expand Down
68 changes: 64 additions & 4 deletions kfgrammar/KuneiformLexer.interp

Large diffs are not rendered by default.

219 changes: 130 additions & 89 deletions kfgrammar/KuneiformLexer.tokens
Original file line number Diff line number Diff line change
Expand Up @@ -9,60 +9,80 @@ DOLLAR=8
HASH=9
AT=10
PERIOD=11
EQ=12
DATABASE_=13
USE_=14
AS_=15
TABLE_=16
ACTION_=17
INIT_=18
PUBLIC_=19
PRIVATE_=20
VIEW_=21
MUSTSIGN_=22
OWNER_=23
INT_=24
TEXT_=25
BLOB_=26
MIN_=27
MAX_=28
MIN_LEN_=29
MAX_LEN_=30
NOT_NULL_=31
PRIMARY_=32
DEFAULT_=33
UNIQUE_=34
INDEX_=35
FOREIGN_KEY_=36
FOREIGN_KEY_ABBR_=37
REFERENCES_=38
REFERENCES_ABBR_=39
ACTION_ON_UPDATE_=40
ACTION_ON_DELETE_=41
ACTION_DO_=42
ACTION_DO_NO_ACTION_=43
ACTION_DO_CASCADE_=44
ACTION_DO_SET_NULL_=45
ACTION_DO_SET_DEFAULT_=46
ACTION_DO_RESTRICT_=47
SELECT_=48
INSERT_=49
UPDATE_=50
DELETE_=51
WITH_=52
IDENTIFIER=53
INDEX_NAME=54
PARAM_OR_VAR=55
BLOCK_VAR=56
UNSIGNED_NUMBER_LITERAL=57
SIGNED_NUMBER_LITERAL=58
STRING_LITERAL=59
SQL_KEYWORDS=60
SQL_STMT=61
WS=62
TERMINATOR=63
BLOCK_COMMENT=64
LINE_COMMENT=65
ASSIGN=12
PLUS=13
MINUS=14
STAR=15
DIV=16
MOD=17
TILDE=18
PIPE2=19
LT2=20
GT2=21
AMP=22
PIPE=23
EQ=24
LT=25
LT_EQ=26
GT=27
GT_EQ=28
SQL_NOT_EQ1=29
SQL_NOT_EQ2=30
DATABASE_=31
USE_=32
AS_=33
TABLE_=34
ACTION_=35
INIT_=36
PUBLIC_=37
PRIVATE_=38
VIEW_=39
MUSTSIGN_=40
OWNER_=41
INT_=42
TEXT_=43
BLOB_=44
MIN_=45
MAX_=46
MIN_LEN_=47
MAX_LEN_=48
NOT_NULL_=49
PRIMARY_=50
DEFAULT_=51
UNIQUE_=52
INDEX_=53
FOREIGN_KEY_=54
FOREIGN_KEY_ABBR_=55
REFERENCES_=56
REFERENCES_ABBR_=57
ACTION_ON_UPDATE_=58
ACTION_ON_DELETE_=59
ACTION_DO_=60
ACTION_DO_NO_ACTION_=61
ACTION_DO_CASCADE_=62
ACTION_DO_SET_NULL_=63
ACTION_DO_SET_DEFAULT_=64
ACTION_DO_RESTRICT_=65
SELECT_=66
INSERT_=67
UPDATE_=68
DELETE_=69
WITH_=70
NOT_=71
AND_=72
OR_=73
IDENTIFIER=74
INDEX_NAME=75
PARAM_OR_VAR=76
BLOCK_VAR=77
UNSIGNED_NUMBER_LITERAL=78
STRING_LITERAL=79
SQL_KEYWORDS=80
SQL_STMT=81
WS=82
TERMINATOR=83
BLOCK_COMMENT=84
LINE_COMMENT=85
':'=1
';'=2
'('=3
Expand All @@ -75,38 +95,59 @@ LINE_COMMENT=65
'@'=10
'.'=11
'='=12
'database'=13
'use'=14
'as'=15
'table'=16
'action'=17
'init'=18
'public'=19
'private'=20
'view'=21
'mustsign'=22
'owner'=23
'int'=24
'text'=25
'blob'=26
'min'=27
'max'=28
'minlen'=29
'maxlen'=30
'notnull'=31
'primary'=32
'default'=33
'unique'=34
'index'=35
'foreign_key'=36
'fk'=37
'references'=38
'ref'=39
'on_update'=40
'on_delete'=41
'do'=42
'no_action'=43
'cascade'=44
'set_null'=45
'set_default'=46
'restrict'=47
'+'=13
'-'=14
'*'=15
'/'=16
'%'=17
'~'=18
'||'=19
'<<'=20
'>>'=21
'&'=22
'|'=23
'=='=24
'<'=25
'<='=26
'>'=27
'>='=28
'!='=29
'<>'=30
'database'=31
'use'=32
'as'=33
'table'=34
'action'=35
'init'=36
'public'=37
'private'=38
'view'=39
'mustsign'=40
'owner'=41
'int'=42
'text'=43
'blob'=44
'min'=45
'max'=46
'minlen'=47
'maxlen'=48
'notnull'=49
'primary'=50
'default'=51
'unique'=52
'index'=53
'foreign_key'=54
'fk'=55
'references'=56
'ref'=57
'on_update'=58
'on_delete'=59
'do'=60
'no_action'=61
'cascade'=62
'set_null'=63
'set_default'=64
'restrict'=65
'not'=71
'and'=72
'or'=73
59 changes: 50 additions & 9 deletions kfgrammar/KuneiformParser.interp

Large diffs are not rendered by default.

Loading

0 comments on commit 2868efa

Please sign in to comment.