urQL/urql/lib/parse.hoon

494 lines
22 KiB
Plaintext
Raw Normal View History

2022-08-12 21:08:20 +03:00
/- ast
2022-08-21 03:29:26 +03:00
|_ current-database=@t :: (parse:parse(current-database '<db>') "<script>")
2022-08-12 21:08:20 +03:00
+$ command-ast
$%
2022-08-13 05:00:44 +03:00
create-database:ast
create-index:ast
create-namespace:ast
create-table:ast
create-view:ast
2022-08-16 22:18:14 +03:00
drop-database:ast
drop-index:ast
drop-namespace:ast
drop-table:ast
drop-view:ast
2022-08-23 03:53:59 +03:00
grant:ast
2022-08-23 18:59:52 +03:00
revoke:ast
2022-08-17 20:10:50 +03:00
truncate-table:ast
2022-08-12 21:08:20 +03:00
==
+$ command
$%
%create-database
%create-index
%create-namespace
%create-table
%create-view
2022-08-16 22:18:14 +03:00
%drop-database
%drop-index
%drop-namespace
%drop-table
%drop-view
2022-08-23 03:53:59 +03:00
%grant
2022-08-23 18:59:52 +03:00
%revoke
2022-08-17 20:10:50 +03:00
%truncate-table
2022-08-12 21:08:20 +03:00
==
2022-08-13 05:00:44 +03:00
::
2022-08-22 00:09:24 +03:00
:: get next position in script
::
++ get-next-cursor
|= [last-cursor=[@ud @ud] command-hair=[@ud @ud] end-hair=[@ud @ud]]
^- [@ud @ud]
=/ next-hair ?: (gth -.command-hair 1) :: if we advanced to next input line
[(sub (add -.command-hair -.last-cursor) 1) +.command-hair] :: add lines and use last column
[-.command-hair (sub (add +.command-hair +.last-cursor) 1)] :: else add column positions
?: (gth -.end-hair 1) :: if we advanced to next input line
[(sub (add -.next-hair -.end-hair) 1) +.end-hair] :: add lines and use last column
[-.next-hair (sub (add +.next-hair +.end-hair) 1)] :: else add column positions
::
2022-08-17 20:10:50 +03:00
:: parser rules and helpers
2022-08-16 22:18:14 +03:00
::
2022-08-17 20:10:50 +03:00
++ jester :: match a cord, case agnostic, thanks ~tinnus-napbus
2022-08-16 22:18:14 +03:00
|= daf=@t
|= tub=nail
=+ fad=daf
|- ^- (like @t)
?: =(`@`0 daf)
[p=p.tub q=[~ u=[p=fad q=tub]]]
2022-08-17 20:10:50 +03:00
=+ n=(end 3 daf)
?. ?& ?=(^ q.tub)
?| =(n i.q.tub)
&((lte 97 n) (gte 122 n) =((sub n 32) i.q.tub))
&((lte 65 n) (gte 90 n) =((add 32 n) i.q.tub))
==
==
2022-08-16 22:18:14 +03:00
(fail tub)
$(p.tub (lust i.q.tub p.tub), q.tub t.q.tub, daf (rsh 3 daf))
2022-08-22 06:25:18 +03:00
++ cook-qualified-3object
|= a=*
2022-08-22 04:03:52 +03:00
?: ?=([[@ %~] [@ %~] [@ %~]] a) :: db.ns.name
(qualified-object:ast %qualified-object ~ `@t`-<.a `@t`+<-.a `@t`+>-.a)
?: ?=([[@ %~] * [@ %~]] a) :: db..name
(qualified-object:ast %qualified-object ~ `@t`-<.a 'dbo' `@t`+>-.a)
?: ?=([[@ %~] [@ %~]] a) :: ns.name
(qualified-object:ast %qualified-object ~ current-database `@t`-<.a `@t`+<.a)
?: ?=([@ %~] a) :: name
(qualified-object:ast %qualified-object ~ current-database 'dbo' `@t`-.a)
!!
2022-08-21 03:29:26 +03:00
++ cook-qualified-object
|= a=*
?: ?=([@ [@ %~] [@ %~] [@ %~]] a) :: ~firsub.db.ns.name
(qualified-object:ast %qualified-object ``@p`-.a `@t`+<-.a `@t`+>-<.a `@t`+>+<.a)
?: ?=([@ [@ %~] * [@ %~]] a) ::~firsub..ns.name
(qualified-object:ast %qualified-object ``@p`-.a `@t`+<-.a 'dbo' `@t`+>+<.a)
?: ?=([[@ %~] [@ %~] [@ %~]] a) :: db.ns.name
(qualified-object:ast %qualified-object ~ `@t`-<.a `@t`+<-.a `@t`+>-.a)
?: ?=([[@ %~] * [@ %~]] a) :: db..name
(qualified-object:ast %qualified-object ~ `@t`-<.a 'dbo' `@t`+>-.a)
?: ?=([[@ %~] [@ %~]] a) :: ns.name
(qualified-object:ast %qualified-object ~ current-database `@t`-<.a `@t`+<.a)
?: ?=([@ %~] a) :: name
(qualified-object:ast %qualified-object ~ current-database 'dbo' `@t`-.a)
!!
2022-08-23 03:53:59 +03:00
++ qualified-namespace
|= [a=* current-database=@t]
?: ?=([@ @] [a])
a
[current-database a]
2022-08-25 22:21:07 +03:00
++ cook-column
|= a=*
?: ?=([@ @] [a])
(column:ast %column -.a +.a)
!!
2022-08-21 03:29:26 +03:00
::
:: parse urQL script
2022-08-13 05:00:44 +03:00
::
2022-08-06 17:06:18 +03:00
++ parse
2022-08-21 03:29:26 +03:00
|= script=tape
2022-08-06 17:06:18 +03:00
~| 'Input script is empty.'
?> !=((lent script) 0)
2022-08-13 05:13:25 +03:00
^- (list command-ast)
2022-08-13 05:00:44 +03:00
=/ commands `(list command-ast)`~
2022-08-13 05:13:25 +03:00
=/ script-position [1 1]
2022-08-12 21:08:20 +03:00
::
:: parser rules
2022-08-25 22:21:07 +03:00
::
2022-08-12 21:08:20 +03:00
=/ whitespace (star ;~(pose gah (just '\09') (just '\0d')))
2022-08-13 05:00:44 +03:00
=/ end-or-next-command ;~(pose ;~(plug whitespace mic) whitespace mic)
2022-08-25 22:21:07 +03:00
=/ prn-less-whitespace (star ;~(less gah (just '\09') (just '\0d') (just `@`127) (shim 32 256)))
=/ prn-less-soz ;~(less (just `@`39) (just `@`127) (shim 32 256))
=/ cord-literal ;~(plug soq (star ;~(pose (jest '\\\'') prn-less-soz)) soq)
=/ open-paren ;~ pose
;~(pfix whitespace ;~(sfix pal whitespace))
;~(pfix whitespace pal)
==
=/ close-paren ;~ pose
;~(pfix whitespace ;~(sfix par whitespace))
;~(pfix whitespace par)
==
=/ root-aura ;~ pose
(jest '@c')
(jest '@da')
(jest '@dr')
(jest '@d')
(jest '@f')
(jest '@if')
(jest '@is')
(jest '@i')
(jest '@n')
(jest '@p')
(jest '@q')
(jest '@rh')
(jest '@rs')
(jest '@rd')
(jest '@rq')
(jest '@r')
(jest '@sb')
(jest '@sd')
(jest '@sv')
(jest '@sw')
(jest '@sx')
(jest '@s')
(jest '@ta')
(jest '@tas')
(jest '@t')
(jest '@ub')
(jest '@ud')
(jest '@uv')
(jest '@uw')
(jest '@ux')
(jest '@u')
(jest '@')
==
=/ parse-aura ;~ pose
;~(plug root-aura (shim 'A' 'J'))
root-aura
==
2022-08-12 21:08:20 +03:00
=/ parse-face ;~(pfix whitespace sym)
2022-08-16 22:18:14 +03:00
=/ parse-qualified-2-name ;~(pose ;~(pfix whitespace ;~((glue dot) sym sym)) parse-face)
=/ parse-qualified-3 ;~ pose
2022-08-17 20:10:50 +03:00
;~((glue dot) (star sym) (star sym) (star sym))
;~(plug (star sym) dot dot (star sym))
;~((glue dot) (star sym) (star sym))
(star sym)
==
2022-08-22 04:03:52 +03:00
=/ parse-qualified-3object (cook cook-qualified-3object ;~(pfix whitespace parse-qualified-3))
2022-08-22 06:25:18 +03:00
=/ parse-table-or-view ;~ sfix
2022-08-22 04:03:52 +03:00
;~(pose ;~(pfix whitespace ;~(plug (jester 'force') parse-qualified-3object)) parse-qualified-3object)
2022-08-17 20:10:50 +03:00
end-or-next-command
==
2022-08-22 04:03:52 +03:00
=/ parse-ship ;~(pfix sig fed:ag)
2022-08-24 02:30:27 +03:00
=/ white-ship ;~(pose ;~(sfix ;~(pfix whitespace parse-ship) whitespace) ;~(pfix whitespace parse-ship) ;~(sfix parse-ship whitespace) parse-ship)
=/ ship-list (more com white-ship)
2022-08-22 04:03:52 +03:00
=/ parse-qualified-object (cook cook-qualified-object ;~(pose ;~((glue dot) parse-ship (star sym) (star sym) (star sym)) ;~((glue dot) parse-ship (star sym) dot dot (star sym)) parse-qualified-3))
2022-08-23 18:59:52 +03:00
=/ on-database ;~(plug (jester 'database') parse-face)
=/ on-namespace
;~(plug (jester 'namespace') (cook |=(a=* (qualified-namespace [a current-database])) parse-qualified-2-name))
=/ grant-object
;~(pfix whitespace ;~(pfix (jester 'on') ;~(pfix whitespace ;~(pose on-database on-namespace parse-qualified-3object))))
2022-08-12 21:08:20 +03:00
=/ parse-command ;~ pose
2022-08-13 05:13:25 +03:00
(cold %create-database ;~(plug whitespace (jester 'create') whitespace (jester 'database')))
(cold %create-index ;~(plug whitespace (jester 'create') whitespace (jester 'index')))
(cold %create-namespace ;~(plug whitespace (jester 'create') whitespace (jester 'namespace')))
(cold %create-table ;~(plug whitespace (jester 'create') whitespace (jester 'table')))
(cold %create-view ;~(plug whitespace (jester 'create') whitespace (jester 'view')))
2022-08-16 22:18:14 +03:00
(cold %drop-database ;~(plug whitespace (jester 'drop') whitespace (jester 'database')))
(cold %drop-index ;~(plug whitespace (jester 'drop') whitespace (jester 'index')))
(cold %drop-namespace ;~(plug whitespace (jester 'drop') whitespace (jester 'namespace')))
(cold %drop-table ;~(plug whitespace (jester 'drop') whitespace (jester 'table')))
(cold %drop-view ;~(plug whitespace (jester 'drop') whitespace (jester 'view')))
2022-08-23 03:53:59 +03:00
(cold %grant ;~(plug whitespace (jester 'grant')))
2022-08-23 18:59:52 +03:00
(cold %revoke ;~(plug whitespace (jester 'revoke')))
2022-08-17 20:10:50 +03:00
(cold %truncate-table ;~(plug whitespace (jester 'truncate') whitespace (jester 'table')))
2022-08-13 05:13:25 +03:00
:: (cold ;~(plug whitespace (jester '') whitespace (jester '')))
2022-08-12 21:08:20 +03:00
==
2022-08-21 00:09:56 +03:00
~| 'Current database name is not a proper term'
2022-08-13 22:08:34 +03:00
=/ dummy (scan (trip current-database) sym)
2022-08-13 05:13:25 +03:00
:: main loop
2022-08-12 21:08:20 +03:00
::
2022-08-06 17:06:18 +03:00
|-
2022-08-12 21:08:20 +03:00
?: =(~ script) :: https://github.com/urbit/arvo/issues/1024
2022-08-13 05:00:44 +03:00
(flop commands)
~| "Error parsing command keyword: {<script-position>}"
=/ command-nail u.+3:q.+3:(parse-command [script-position script])
2022-08-12 21:08:20 +03:00
?- `command`p.command-nail
%create-database
2022-08-14 00:20:30 +03:00
~| 'Create database must be only statement in script'
?> =((lent commands) 0)
%= $
2022-08-16 22:18:14 +03:00
script ""
commands
[`command-ast`(create-database:ast %create-database p.u.+3:q.+3:(parse-face [[1 1] q.q.command-nail])) commands]
2022-08-14 00:20:30 +03:00
==
2022-08-12 21:08:20 +03:00
%create-index
!!
%create-namespace
2022-08-17 19:26:46 +03:00
=/ parse-create-namespace ;~ sfix
parse-qualified-2-name
end-or-next-command
==
2022-08-21 22:12:55 +03:00
~| "Cannot parse name to term in create-namespace {<p.q.command-nail>}"
2022-08-17 19:26:46 +03:00
=/ create-namespace-nail (parse-create-namespace [[1 1] q.q.command-nail])
2022-08-17 20:10:50 +03:00
=/ parsed (wonk create-namespace-nail)
2022-08-22 00:09:24 +03:00
=/ next-cursor
(get-next-cursor [script-position +<.command-nail p.q.u.+3:q.+3:create-namespace-nail])
2022-08-17 19:26:46 +03:00
?@ parsed
%= $
script q.q.u.+3.q:create-namespace-nail
script-position next-cursor
commands [`command-ast`(create-namespace:ast %create-namespace current-database parsed) commands]
2022-08-13 05:00:44 +03:00
==
%= $
2022-08-17 19:26:46 +03:00
script q.q.u.+3.q:create-namespace-nail
script-position next-cursor
commands [`command-ast`(create-namespace:ast %create-namespace -.parsed +.parsed) commands]
2022-08-13 05:00:44 +03:00
==
2022-08-12 21:08:20 +03:00
%create-table
2022-08-25 22:21:07 +03:00
=/ column-definition ;~ plug
sym
;~(pfix whitespace parse-aura)
==
=/ white-column (cook cook-column ;~(pose ;~(pfix whitespace ;~(sfix column-definition whitespace)) ;~(sfix column-definition whitespace) ;~(pfix whitespace column-definition) column-definition))
=/ column-list (more com white-column)
=/ parse-table ;~ plug
;~(pfix whitespace parse-qualified-3object)
;~(pfix whitespace (ifix [pal par] column-list))
==
~| "Cannot parse table {<p.q.command-nail>}"
=/ table-nail (parse-table [[1 1] q.q.command-nail])
~| "command-nail: {<command-nail>}"
~| "table-nail: {<table-nail>}"
=/ parsed (wonk table-nail)
=/ next-cursor
(get-next-cursor [script-position +<.command-nail p.q.u.+3:q.+3:table-nail])
~| "parsed: {<parsed>}"
=/ yikes 0
2022-08-12 21:08:20 +03:00
!!
%create-view
!!
2022-08-16 22:18:14 +03:00
%drop-database
2022-08-22 01:01:22 +03:00
=/ parse-drop-database ;~ sfix
;~(pose ;~(plug ;~(pfix whitespace (jester 'force')) ;~(pfix whitespace sym)) ;~(pfix whitespace sym))
end-or-next-command
==
~| "Cannot parse drop-database {<p.q.command-nail>}"
=/ drop-database-nail (parse-drop-database [[1 1] q.q.command-nail])
=/ parsed (wonk drop-database-nail)
=/ next-cursor
(get-next-cursor [script-position +<.command-nail p.q.u.+3:q.+3:drop-database-nail])
?@ parsed :: name
%= $
script q.q.u.+3.q:drop-database-nail
script-position next-cursor
commands [`command-ast`(drop-database:ast %drop-database parsed %.n) commands]
==
?: ?=([@ @] parsed) :: force name
%= $
script q.q.u.+3.q:drop-database-nail
script-position next-cursor
commands [`command-ast`(drop-database:ast %drop-database +.parsed %.y) commands]
==
2022-08-16 22:18:14 +03:00
!!
%drop-index
2022-08-22 06:25:18 +03:00
=/ parse-drop-index ;~ sfix
;~(pfix whitespace ;~(plug parse-face ;~(pfix whitespace ;~(pfix (jester 'on') ;~(pfix whitespace parse-qualified-3object)))))
end-or-next-command
==
~| "Cannot parse drop-index {<p.q.command-nail>}"
=/ drop-index-nail (parse-drop-index [[1 1] q.q.command-nail])
=/ parsed (wonk drop-index-nail)
=/ next-cursor
(get-next-cursor [script-position +<.command-nail p.q.u.+3:q.+3:drop-index-nail])
%= $
script q.q.u.+3.q:drop-index-nail
script-position next-cursor
commands [`command-ast`(drop-index:ast %drop-index -.parsed +.parsed) commands]
==
2022-08-16 22:18:14 +03:00
%drop-namespace
2022-08-21 22:12:55 +03:00
=/ parse-drop-namespace ;~ sfix
2022-08-22 00:09:24 +03:00
;~(pose ;~(plug ;~(pfix whitespace (cold %force (jester 'force'))) parse-qualified-2-name) parse-qualified-2-name)
2022-08-21 22:12:55 +03:00
end-or-next-command
==
~| "Cannot parse drop-namespace {<p.q.command-nail>}"
=/ drop-namespace-nail (parse-drop-namespace [[1 1] q.q.command-nail])
=/ parsed (wonk drop-namespace-nail)
2022-08-22 00:09:24 +03:00
=/ next-cursor
(get-next-cursor [script-position +<.command-nail p.q.u.+3:q.+3:drop-namespace-nail])
?@ parsed :: name
2022-08-21 22:12:55 +03:00
%= $
script q.q.u.+3.q:drop-namespace-nail
script-position next-cursor
commands [`command-ast`(drop-namespace:ast %drop-namespace current-database parsed %.n) commands]
==
2022-08-22 00:09:24 +03:00
?: ?=([@ @] parsed) :: force name
?: =(%force -.parsed)
%= $
script q.q.u.+3.q:drop-namespace-nail
script-position next-cursor
commands [`command-ast`(drop-namespace:ast %drop-namespace current-database +.parsed %.y) commands]
==
%= $ :: db.name
2022-08-21 22:12:55 +03:00
script q.q.u.+3.q:drop-namespace-nail
script-position next-cursor
commands [`command-ast`(drop-namespace:ast %drop-namespace -.parsed +.parsed %.n) commands]
==
2022-08-22 00:09:24 +03:00
?: ?=([* [@ @]] parsed) :: force db.name
2022-08-21 22:12:55 +03:00
%= $
script q.q.u.+3.q:drop-namespace-nail
script-position next-cursor
commands [`command-ast`(drop-namespace:ast %drop-namespace +<.parsed +>.parsed %.y) commands]
==
2022-08-16 22:18:14 +03:00
!!
%drop-table
2022-08-17 19:35:12 +03:00
~| "Cannot parse drop-table {<p.q.command-nail>}"
2022-08-22 06:25:18 +03:00
=/ drop-table-nail (parse-table-or-view [[1 1] q.q.command-nail])
2022-08-17 20:10:50 +03:00
=/ parsed (wonk drop-table-nail)
2022-08-22 00:09:24 +03:00
=/ next-cursor
(get-next-cursor [script-position +<.command-nail p.q.u.+3:q.+3:drop-table-nail])
2022-08-22 04:03:52 +03:00
?: ?=([@ @ @ @ @ @] parsed) :: force qualified table name
2022-08-17 19:35:12 +03:00
%= $
script q.q.u.+3.q:drop-table-nail
script-position next-cursor
commands
2022-08-22 04:03:52 +03:00
[`command-ast`(drop-table:ast %drop-table +.parsed %.y) commands]
2022-08-17 19:35:12 +03:00
==
2022-08-22 04:03:52 +03:00
?: ?=([@ @ @ @ @] parsed) :: qualified table name
2022-08-17 19:35:12 +03:00
%= $
script q.q.u.+3.q:drop-table-nail
script-position next-cursor
commands
2022-08-22 04:03:52 +03:00
[`command-ast`(drop-table:ast %drop-table parsed %.n) commands]
2022-08-17 19:35:12 +03:00
==
2022-08-16 22:18:14 +03:00
!!
%drop-view
~| "Cannot parse drop-view {<p.q.command-nail>}"
2022-08-22 06:25:18 +03:00
=/ drop-view-nail (parse-table-or-view [[1 1] q.q.command-nail])
2022-08-17 20:10:50 +03:00
=/ parsed (wonk drop-view-nail)
2022-08-22 00:09:24 +03:00
=/ next-cursor
(get-next-cursor [script-position +<.command-nail p.q.u.+3:q.+3:drop-view-nail])
2022-08-22 04:03:52 +03:00
?: ?=([@ @ @ @ @ @] parsed) :: force qualified view
2022-08-16 22:18:14 +03:00
%= $
script q.q.u.+3.q:drop-view-nail
script-position next-cursor
commands
2022-08-22 04:03:52 +03:00
[`command-ast`(drop-view:ast %drop-view +.parsed %.y) commands]
2022-08-16 22:18:14 +03:00
==
2022-08-22 04:03:52 +03:00
?: ?=([@ @ @ @ @] parsed) :: qualified view
2022-08-16 22:18:14 +03:00
%= $
script q.q.u.+3.q:drop-view-nail
script-position next-cursor
commands
2022-08-22 04:03:52 +03:00
[`command-ast`(drop-view:ast %drop-view parsed %.n) commands]
2022-08-16 22:18:14 +03:00
==
!!
2022-08-23 03:53:59 +03:00
%grant
=/ permission
;~(pfix whitespace ;~(pose (jester 'adminread') (jester 'readonly') (jester 'readwrite')))
=/ grantee
2022-08-24 02:30:27 +03:00
;~(pose (jester 'parent') (jester 'siblings') (jester 'moons') (stag %ships ship-list))
2022-08-23 03:53:59 +03:00
=/ parse-grantee
;~(pfix whitespace ;~(pfix (jester 'to') ;~(pfix whitespace grantee)))
=/ parse-grant ;~ plug
permission
parse-grantee
;~(sfix grant-object end-or-next-command)
==
~| "Cannot parse grant {<p.q.command-nail>}"
=/ grant-nail (parse-grant [[1 1] q.q.command-nail])
=/ parsed (wonk grant-nail)
=/ next-cursor
(get-next-cursor [script-position +<.command-nail p.q.u.+3:q.+3:grant-nail])
2022-08-24 02:30:27 +03:00
?: ?=([@ [@ [@ %~]] [@ @]] [parsed]) ::"grant adminread to ~sampel-palnet on database db"
2022-08-23 03:53:59 +03:00
%= $
script q.q.u.+3.q:grant-nail
script-position next-cursor
commands
2022-08-24 02:30:27 +03:00
[`command-ast`(grant:ast %grant -.parsed +<+.parsed +>.parsed) commands]
2022-08-23 03:53:59 +03:00
==
?: ?=([@ @ [@ @]] [parsed]) ::"grant adminread to parent on database db"
%= $
script q.q.u.+3.q:grant-nail
script-position next-cursor
commands
[`command-ast`(grant:ast %grant -.parsed +<.parsed +>.parsed) commands]
==
2022-08-24 02:30:27 +03:00
?: ?=([@ [@ [@ *]] [@ *]] [parsed]) ::"grant Readwrite to ~zod,~bus,~nec,~sampel-palnet on namespace db.ns"
%= $ ::"grant adminread to ~zod,~bus,~nec,~sampel-palnet on namespace ns" (ns previously cooked)
script q.q.u.+3.q:grant-nail ::"grant Readwrite to ~zod,~bus,~nec,~sampel-palnet on db.ns.table"
2022-08-23 03:53:59 +03:00
script-position next-cursor
commands
2022-08-24 02:30:27 +03:00
[`command-ast`(grant:ast %grant -.parsed +<+.parsed +>.parsed) commands]
2022-08-23 03:53:59 +03:00
==
2022-08-23 18:59:52 +03:00
?: ?=([@ @ [@ [@ *]]] [parsed]) ::"grant readonly to siblings on namespace db.ns"
%= $ ::"grant readwrite to moons on namespace ns" (ns previously cooked)
2022-08-23 03:53:59 +03:00
script q.q.u.+3.q:grant-nail
script-position next-cursor
commands
[`command-ast`(grant:ast %grant -.parsed +<.parsed +>.parsed) commands]
==
!!
2022-08-23 18:59:52 +03:00
%revoke
=/ revoke-permission
;~(pfix whitespace ;~(pose (jester 'adminread') (jester 'readonly') (jester 'readwrite') (jester 'all')))
=/ revokee
2022-08-24 02:30:27 +03:00
;~(pose (jester 'parent') (jester 'siblings') (jester 'moons') (jester 'all') (stag %ships ship-list))
2022-08-23 18:59:52 +03:00
=/ parse-revokee
;~(pfix whitespace ;~(pfix (jester 'from') ;~(pfix whitespace revokee)))
=/ parse-revoke ;~ plug
revoke-permission
parse-revokee
;~(sfix grant-object end-or-next-command)
==
~| "Cannot parse revoke {<p.q.command-nail>}"
=/ revoke-nail (parse-revoke [[1 1] q.q.command-nail])
=/ parsed (wonk revoke-nail)
=/ next-cursor
(get-next-cursor [script-position +<.command-nail p.q.u.+3:q.+3:revoke-nail])
2022-08-24 02:30:27 +03:00
?: ?=([@ [@ [@ %~]] [@ @]] [parsed]) ::"revoke adminread from ~sampel-palnet on database db"
2022-08-23 18:59:52 +03:00
%= $
script q.q.u.+3.q:revoke-nail
script-position next-cursor
commands
2022-08-24 02:30:27 +03:00
[`command-ast`(revoke:ast %revoke -.parsed +<+.parsed +>.parsed) commands]
2022-08-23 18:59:52 +03:00
==
?: ?=([@ @ [@ @]] [parsed]) ::"revoke adminread from parent on database db"
%= $
script q.q.u.+3.q:revoke-nail
script-position next-cursor
commands
[`command-ast`(revoke:ast %revoke -.parsed +<.parsed +>.parsed) commands]
==
2022-08-24 02:30:27 +03:00
?: ?=([@ [@ [@ *]] [@ *]] [parsed]) ::"revoke Readwrite from ~zod,~bus,~nec,~sampel-palnet on namespace db.ns"
%= $ ::"revoke adminread from ~zod,~bus,~nec,~sampel-palnet on namespace ns" (ns previously cooked)
script q.q.u.+3.q:revoke-nail ::"revoke Readwrite from ~zod,~bus,~nec,~sampel-palnet on db.ns.table"
2022-08-23 18:59:52 +03:00
script-position next-cursor
commands
2022-08-24 02:30:27 +03:00
[`command-ast`(revoke:ast %revoke -.parsed +<+.parsed +>.parsed) commands]
2022-08-23 18:59:52 +03:00
==
?: ?=([@ @ [@ [@ *]]] [parsed]) ::"revoke readonly from siblings on namespace db.ns"
%= $ ::"revoke readwrite from moons on namespace ns" (ns previously cooked)
script q.q.u.+3.q:revoke-nail
script-position next-cursor
commands
[`command-ast`(revoke:ast %revoke -.parsed +<.parsed +>.parsed) commands]
==
!!
2022-08-17 20:10:50 +03:00
%truncate-table
=/ parse-truncate-table ;~ sfix
2022-08-21 00:09:56 +03:00
;~(pfix whitespace parse-qualified-object)
2022-08-17 20:10:50 +03:00
end-or-next-command
==
~| "Cannot parse truncate-table {<p.q.command-nail>}"
=/ truncate-table-nail (parse-truncate-table [[1 1] q.q.command-nail])
2022-08-22 00:09:24 +03:00
=/ next-cursor
(get-next-cursor [script-position +<.command-nail p.q.u.+3:q.+3:truncate-table-nail])
2022-08-21 03:29:26 +03:00
%= $
script q.q.u.+3.q:truncate-table-nail
script-position next-cursor
commands
[`command-ast`(truncate-table:ast %truncate-table (wonk truncate-table-nail)) commands]
==
2022-08-16 22:18:14 +03:00
==
2022-08-13 05:13:25 +03:00
--