clean-up create namespace

This commit is contained in:
jackfoxy 2022-08-17 09:26:46 -07:00
parent 0584a53f17
commit 9be59f5585

View File

@ -105,22 +105,27 @@
%create-index %create-index
!! !!
%create-namespace %create-namespace
~| "Cannot parse name to face in create-namespace {<p.q.command-nail>}" =/ parse-create-namespace ;~ sfix
=/ qualified-name-nail u.+3:q.+3:(parse-qualified-2-name [[1 1] q.q.command-nail]) parse-qualified-2-name
=/ namespace-ast ?@ p.qualified-name-nail end-or-next-command
(create-namespace:ast %create-namespace current-database p.qualified-name-nail) ==
(create-namespace:ast %create-namespace -:p.qualified-name-nail +:p.qualified-name-nail) ~| "Cannot parse name to face in create-namespace {<p.q.command-nail>}"
=/ last-nail (end-or-next-command q:qualified-name-nail) =/ create-namespace-nail (parse-create-namespace [[1 1] q.q.command-nail])
?: (gth -.p:last-nail -.p.q.command-nail) :: if we advanced to next input line =/ parsed p.u.+3:q.+3:create-namespace-nail
%= $ =/ cursor p.q.u.+3:q.+3:create-namespace-nail
script q.q.u.+3.q:last-nail :: then use the current position =/ next-cursor ?: (gth -.cursor -.script-position) :: if we advanced to next input line
script-position [p.p.q.+3.+3.q:last-nail q.p.q.+3.+3.q:last-nail] [(add -.cursor -.script-position) +.cursor] :: add lines and use nail cursor column
commands [`command-ast`namespace-ast commands] [-.cursor (add +.cursor +.script-position)] :: else add column positions
?@ 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]
== ==
%= $ %= $
script q.q.u.+3.q:last-nail :: else add starting column to current column position script q.q.u.+3.q:create-namespace-nail
script-position [p.p.q.command-nail (add q.p.q.command-nail q.p.q.+3.+3.q.last-nail)] script-position next-cursor
commands [`command-ast`namespace-ast commands] commands [`command-ast`(create-namespace:ast %create-namespace -.parsed +.parsed) commands]
== ==
%create-table %create-table
!! !!
@ -144,8 +149,8 @@
=/ parsed p.u.+3:q.+3:drop-view-nail =/ parsed p.u.+3:q.+3:drop-view-nail
=/ cursor p.q.u.+3:q.+3:drop-view-nail =/ cursor p.q.u.+3:q.+3:drop-view-nail
=/ next-cursor ?: (gth -.cursor -.script-position) :: if we advanced to next input line =/ next-cursor ?: (gth -.cursor -.script-position) :: if we advanced to next input line
cursor [(add -.cursor -.script-position) +.cursor] :: add lines and use nail cursor column
[-.cursor (add +.cursor +.script-position)] [-.cursor (add +.cursor +.script-position)] :: else add column positions
:: ::
:: "drop view force db.ns.name" :: "drop view force db.ns.name"
?: ?=([@ [[@ %~] [@ %~] [@ %~]]] parsed) ?: ?=([@ [[@ %~] [@ %~] [@ %~]]] parsed)