clean up crash sites

This commit is contained in:
jackfoxy 2022-11-30 15:06:42 -08:00
parent efb752bbbb
commit edbd4ad94f

View File

@ -180,7 +180,7 @@
(qualified-object:ast %qualified-object ~ current-database -.a +.a) (qualified-object:ast %qualified-object ~ current-database -.a +.a)
?@ a :: name ?@ a :: name
(qualified-object:ast %qualified-object ~ current-database 'dbo' a) (qualified-object:ast %qualified-object ~ current-database 'dbo' a)
!! ~|("cannot parse qualified-object {<a>}" !!)
++ cook-qualified-object :: @p.database.namespace.object-name ++ cook-qualified-object :: @p.database.namespace.object-name
|= a=* |= a=*
~+ ~+
@ -196,7 +196,7 @@
(qualified-object:ast %qualified-object ~ current-database -.a +.a) (qualified-object:ast %qualified-object ~ current-database -.a +.a)
?@ a :: name ?@ a :: name
(qualified-object:ast %qualified-object ~ current-database 'dbo' a) (qualified-object:ast %qualified-object ~ current-database 'dbo' a)
!! ~|("cannot parse qualified-object {<a>}" !!)
++ qualified-namespace :: database.namespace ++ qualified-namespace :: database.namespace
|= [a=* current-database=@t] |= [a=* current-database=@t]
~+ ~+
@ -276,7 +276,7 @@
?: =(literal-list ~) ?: =(literal-list ~)
$(b +.b, literal-list (a-co:co ->.b)) $(b +.b, literal-list (a-co:co ->.b))
$(b +.b, literal-list (weld (weld (a-co:co ->.b) ";") literal-list)) $(b +.b, literal-list (weld (weld (a-co:co ->.b) ";") literal-list))
!! ~|("cannot parse literal-list {<a>}" !!)
++ value-literal-list ~+ ++ value-literal-list ~+
(cook cook-literal-list ;~(pose ;~(pfix whitespace (ifix [pal par] (more com get-value-literal))) (ifix [pal par] (more com get-value-literal)))) (cook cook-literal-list ;~(pose ;~(pfix whitespace (ifix [pal par] (more com get-value-literal))) (ifix [pal par] (more com get-value-literal))))
++ parse-insert-value ;~ pose ++ parse-insert-value ;~ pose
@ -288,15 +288,11 @@
:: ::
:: used for various commands :: used for various commands
:: ::
++ crash
|= msg=tape
~& msg
!!
++ cook-column ++ cook-column
|= a=* |= a=*
?: ?=([@ @] [a]) ?: ?=([@ @] [a])
(column:ast %column -.a +.a) (column:ast %column -.a +.a)
!! ~|("cannot parse column {<a>}" !!)
++ cook-ordered-column ++ cook-ordered-column
|= a=* |= a=*
?@ a ?@ a
@ -305,8 +301,7 @@
?: =(+.a %asc) ?: =(+.a %asc)
(ordered-column:ast %ordered-column -.a %.y) (ordered-column:ast %ordered-column -.a %.y)
(ordered-column:ast %ordered-column -.a %.n) (ordered-column:ast %ordered-column -.a %.n)
!! ~|("cannot parse ordered-column {<a>}" !!)
++ cook-referential-integrity ++ cook-referential-integrity
|= a=* |= a=*
?: ?=([[@ @] @ @] [a]) :: <type> cascade, <type> cascade ?: ?=([[@ @] @ @] [a]) :: <type> cascade, <type> cascade
@ -329,7 +324,7 @@
~ ~
?: ?=([[@ @ [@ %~] @] @ @ [@ %~] @] a) :: <type> no action, <type> no action ?: ?=([[@ @ [@ %~] @] @ @ [@ %~] @] a) :: <type> no action, <type> no action
~ ~
!! ~|("cannot parse ordered-column {<a>}" !!)
++ end-or-next-command ;~ plug ++ end-or-next-command ;~ plug
(cold %end-command ;~(pose ;~(plug whitespace mic) whitespace mic)) (cold %end-command ;~(pose ;~(plug whitespace mic) whitespace mic))
(easy ~) (easy ~)
@ -441,7 +436,7 @@
(foreign-key:ast %foreign-key -<.a ->-.a ->+<-.a ->+<+.a ->+>.a +.a) (foreign-key:ast %foreign-key -<.a ->-.a ->+<-.a ->+<+.a ->+>.a +.a)
?: ?=([[@ [[@ @ @] %~] @ [@ %~]] *] [a]) :: foreign key table ... references fk-table ... on action on action ?: ?=([[@ [[@ @ @] %~] @ [@ %~]] *] [a]) :: foreign key table ... references fk-table ... on action on action
(foreign-key:ast %foreign-key -<.a ->-.a ->+<-.a 'dbo' ->+.a +.a) (foreign-key:ast %foreign-key -<.a ->-.a ->+<-.a 'dbo' ->+.a +.a)
!! ~|("cannot parse foreign-key {<a>}" !!)
++ build-foreign-keys ++ build-foreign-keys
|= a=[table=qualified-object:ast f-keys=(list *)] |= a=[table=qualified-object:ast f-keys=(list *)]
~+ ~+
@ -523,7 +518,7 @@
(query-object:ast %query-object parsed ~) (query-object:ast %query-object parsed ~)
?: ?=([[@ @ @ @ @] @] parsed) ?: ?=([[@ @ @ @ @] @] parsed)
(query-object:ast %query-object -.parsed `+.parsed) (query-object:ast %query-object -.parsed `+.parsed)
!! ~|("cannot parse query-object {<parsed>}" !!)
++ parse-cross-joined-object ~+ ;~(plug parse-cross-join-type parse-query-object) ++ parse-cross-joined-object ~+ ;~(plug parse-cross-join-type parse-query-object)
::(cook cook-joined-object ;~(plug parse-cross-join-type parse-query-object)) ::(cook cook-joined-object ;~(plug parse-cross-join-type parse-query-object))
++ parse-joined-object ~+ ;~ plug ++ parse-joined-object ~+ ;~ plug
@ -572,7 +567,7 @@
(qualified-column:ast %qualified-column (qualified-object:ast %qualified-object ~ 'UNKNOWN' 'COLUMN' -.a) +.a ~) (qualified-column:ast %qualified-column (qualified-object:ast %qualified-object ~ 'UNKNOWN' 'COLUMN' -.a) +.a ~)
?@ a :: column, column alias, or cte ?@ a :: column, column alias, or cte
(qualified-column:ast %qualified-column (qualified-object:ast %qualified-object ~ 'UNKNOWN' 'COLUMN-OR-CTE' a) a ~) (qualified-column:ast %qualified-column (qualified-object:ast %qualified-object ~ 'UNKNOWN' 'COLUMN-OR-CTE' a) a ~)
!! ~|("cannot parse qualified-column {<a>}" !!)
++ parse-column ~+ ;~ pose ++ parse-column ~+ ;~ pose
;~((glue dot) parse-ship sym sym sym sym) ;~((glue dot) parse-ship sym sym sym sym)
;~(plug parse-ship ;~(pfix dot sym) dot dot sym ;~(pfix dot sym)) ;~(plug parse-ship ;~(pfix dot sym) dot dot sym ;~(pfix dot sym))
@ -1025,7 +1020,7 @@
?: ?=(value-literal:ast -.parsed) ?: ?=(value-literal:ast -.parsed)
?: =('else' +>-.parsed) (case:ast %case -.parsed (flop cases) +>+<.parsed) ?: =('else' +>-.parsed) (case:ast %case -.parsed (flop cases) +>+<.parsed)
(case:ast %case -.parsed (flop cases) ~) (case:ast %case -.parsed (flop cases) ~)
!! ~|("cannot parse case {<parsed>}" !!)
++ parse-case ;~ plug ++ parse-case ;~ plug
parse-datum parse-datum
(star parse-when-then) (star parse-when-then)
@ -1226,14 +1221,12 @@
=/ raw-joined-objects +.a =/ raw-joined-objects +.a
=/ joined-objects=(list joined-object:ast) ~ =/ joined-objects=(list joined-object:ast) ~
=/ is-cross-join=? %.n =/ is-cross-join=? %.n
~| "a: {<a>}"
|- |-
~| "->+>.raw-joined-objects: {<->+>.raw-joined-objects>}"
?: =(raw-joined-objects ~) ?: =(raw-joined-objects ~)
?: is-cross-join ?: is-cross-join
?: =((lent joined-objects) 1) ?: =((lent joined-objects) 1)
(from:ast query-object %from query-object (flop joined-objects)) (from:ast query-object %from query-object (flop joined-objects))
(crash "cross join must be only join in query") ~|("cross join must be only join in query" !!)
(from:ast query-object %from query-object (flop joined-objects)) (from:ast query-object %from query-object (flop joined-objects))
::~& "raw-joined-objects: {<raw-joined-objects>}" ::~& "raw-joined-objects: {<raw-joined-objects>}"
:: ->-.raw-joined-objects join type :: ->-.raw-joined-objects join type
@ -1291,7 +1284,7 @@
:: ?: ?&(=(-.a %bottom) ?=(@ud +<.a)) $(a +>.a, bottom `+<.a) :: ?: ?&(=(-.a %bottom) ?=(@ud +<.a)) $(a +>.a, bottom `+<.a)
:: ?: =(-.a %distinct) $(a +.a, distinct %.y) :: ?: =(-.a %distinct) $(a +.a, distinct %.y)
:: ?: =(-.a %all) $(a ~, columns ~[(selected-column:ast %all)]) :: ?: =(-.a %all) $(a ~, columns ~[(selected-column:ast %all)])
!! ~|("cannot parse select {<a>}" !!)
++ cook-simple-query ++ cook-simple-query
|= a=(list *) |= a=(list *)
^- simple-query:ast ^- simple-query:ast
@ -1303,7 +1296,7 @@
=/ having=(unit having:ast) ~ =/ having=(unit having:ast) ~
=/ order-by=(unit order-by:ast) ~ =/ order-by=(unit order-by:ast) ~
|- |-
?~ a !! ?~ a ~|("cannot parse simple-query {<a>}" !!)
?: =(i.a %query) ~& "%query" $(a t.a) ?: =(i.a %query) ~& "%query" $(a t.a)
?: =(i.a %end-command) (simple-query:ast %simple-query from scalars predicate (need select) group-by having order-by) ?: =(i.a %end-command) (simple-query:ast %simple-query from scalars predicate (need select) group-by having order-by)
::?: =(i.a %scalars) $(a t.a, scalars +.i.a) ::?: =(i.a %scalars) $(a t.a, scalars +.i.a)
@ -1315,7 +1308,7 @@
?: =(-<.a %order-by) ~& "%order-by" $(a t.a, order-by ~) ?: =(-<.a %order-by) ~& "%order-by" $(a t.a, order-by ~)
?: =(-<-.a %query-object) ~& "%query-object" $(a t.a, from `(produce-from i.a)) ?: =(-<-.a %query-object) ~& "%query-object" $(a t.a, from `(produce-from i.a))
:: ?: =(-<-.a %query-object) ~& "%query-object" $(a t.a, from ~) :: ?: =(-<-.a %query-object) ~& "%query-object" $(a t.a, from ~)
(crash "fucked up something {<a>}") ~|("cannot parse simple-query {<a>}" !!)
:: ::
:: parse urQL command :: parse urQL command
:: ::
@ -1446,11 +1439,9 @@
=/ check-empty u.+3:q.+3:(whitespace [[1 1] script]) =/ check-empty u.+3:q.+3:(whitespace [[1 1] script])
?: =(0 (lent q.q:check-empty)) :: trailing whitespace after last end-command (;) ?: =(0 (lent q.q:check-empty)) :: trailing whitespace after last end-command (;)
(flop commands) (flop commands)
~| "Error parsing command keyword: {<script-position>}"
=/ command-nail u.+3:q.+3:(parse-command [script-position script]) =/ command-nail u.+3:q.+3:(parse-command [script-position script])
?- `command`p.command-nail ?- `command`p.command-nail
%alter-index %alter-index
~| "Cannot parse alter-index {<p.q.command-nail>}"
=/ index-nail (parse-alter-index [[1 1] q.q.command-nail]) =/ index-nail (parse-alter-index [[1 1] q.q.command-nail])
=/ parsed (wonk index-nail) =/ parsed (wonk index-nail)
=/ next-cursor =/ next-cursor
@ -1483,9 +1474,8 @@
commands commands
[`command-ast`(alter-index:ast %alter-index -.parsed +<.parsed +>.parsed %rebuild) commands] [`command-ast`(alter-index:ast %alter-index -.parsed +<.parsed +>.parsed %rebuild) commands]
== ==
!! ~|("Cannot parse alter-index {<p.q.command-nail>}" !!)
%alter-namespace %alter-namespace
~| "Cannot parse namespace {<p.q.command-nail>}"
=/ namespace-nail (parse-alter-namespace [[1 1] q.q.command-nail]) =/ namespace-nail (parse-alter-namespace [[1 1] q.q.command-nail])
=/ parsed (wonk namespace-nail) =/ parsed (wonk namespace-nail)
=/ next-cursor =/ next-cursor
@ -1497,7 +1487,6 @@
[`command-ast`(alter-namespace:ast %alter-namespace -<.parsed ->.parsed +<.parsed +>+>+<.parsed +>+>+>.parsed) commands] [`command-ast`(alter-namespace:ast %alter-namespace -<.parsed ->.parsed +<.parsed +>+>+<.parsed +>+>+>.parsed) commands]
== ==
%alter-table %alter-table
~| "Cannot parse table {<p.q.command-nail>}"
=/ table-nail (parse-alter-table [[1 1] q.q.command-nail]) =/ table-nail (parse-alter-table [[1 1] q.q.command-nail])
=/ parsed (wonk table-nail) =/ parsed (wonk table-nail)
=/ next-cursor =/ next-cursor
@ -1537,7 +1526,7 @@
commands commands
[`command-ast`(alter-table:ast %alter-table -.parsed ~ ~ ~ ~ +>.parsed) commands] [`command-ast`(alter-table:ast %alter-table -.parsed ~ ~ ~ ~ +>.parsed) commands]
== ==
!! ~|("Cannot parse table {<p.q.command-nail>}" !!)
%create-database %create-database
~| 'Create database must be only statement in script' ~| 'Create database must be only statement in script'
?> =((lent commands) 0) ?> =((lent commands) 0)
@ -1547,7 +1536,6 @@
[`command-ast`(create-database:ast %create-database p.u.+3:q.+3:(parse-face [[1 1] q.q.command-nail])) commands] [`command-ast`(create-database:ast %create-database p.u.+3:q.+3:(parse-face [[1 1] q.q.command-nail])) commands]
== ==
%create-index %create-index
~| "Cannot parse index {<p.q.command-nail>}"
=/ index-nail (parse-create-index [[1 1] q.q.command-nail]) =/ index-nail (parse-create-index [[1 1] q.q.command-nail])
=/ parsed (wonk index-nail) =/ parsed (wonk index-nail)
=/ next-cursor =/ next-cursor
@ -1581,7 +1569,7 @@
commands commands
[`command-ast`(create-index:ast %create-index ->.parsed +<.parsed %.n %.n +>.parsed) commands] [`command-ast`(create-index:ast %create-index ->.parsed +<.parsed %.n %.n +>.parsed) commands]
== ==
!! ~|("Cannot parse index {<p.q.command-nail>}" !!)
?: ?=([[@ @ @] [* *]] [parsed]) ?: ?=([[@ @ @] [* *]] [parsed])
?: =(->-.parsed %clustered) ::"create unique clustered index ..." ?: =(->-.parsed %clustered) ::"create unique clustered index ..."
%= $ %= $
@ -1597,10 +1585,9 @@
commands commands
[`command-ast`(create-index:ast %create-index ->+.parsed +<.parsed %.y %.n +>.parsed) commands] [`command-ast`(create-index:ast %create-index ->+.parsed +<.parsed %.y %.n +>.parsed) commands]
== ==
!! ~|("Cannot parse index {<p.q.command-nail>}" !!)
!! ~|("Cannot parse index {<p.q.command-nail>}" !!)
%create-namespace %create-namespace
~| "Cannot parse name to term in create-namespace {<p.q.command-nail>}"
=/ create-namespace-nail (parse-create-namespace [[1 1] q.q.command-nail]) =/ create-namespace-nail (parse-create-namespace [[1 1] q.q.command-nail])
=/ parsed (wonk create-namespace-nail) =/ parsed (wonk create-namespace-nail)
=/ next-cursor =/ next-cursor
@ -1617,7 +1604,6 @@
commands [`command-ast`(create-namespace:ast %create-namespace -.parsed +.parsed) commands] commands [`command-ast`(create-namespace:ast %create-namespace -.parsed +.parsed) commands]
== ==
%create-table %create-table
~| "Cannot parse table {<p.q.command-nail>}"
=/ table-nail (parse-create-table [[1 1] q.q.command-nail]) =/ table-nail (parse-create-table [[1 1] q.q.command-nail])
=/ parsed (wonk table-nail) =/ parsed (wonk table-nail)
=/ next-cursor =/ next-cursor
@ -1638,7 +1624,6 @@
%create-view %create-view
!! !!
%drop-database %drop-database
~| "Cannot parse drop-database {<p.q.command-nail>}"
=/ drop-database-nail (parse-drop-database [[1 1] q.q.command-nail]) =/ drop-database-nail (parse-drop-database [[1 1] q.q.command-nail])
=/ parsed (wonk drop-database-nail) =/ parsed (wonk drop-database-nail)
=/ next-cursor =/ next-cursor
@ -1655,9 +1640,9 @@
script-position next-cursor script-position next-cursor
commands [`command-ast`(drop-database:ast %drop-database +.parsed %.y) commands] commands [`command-ast`(drop-database:ast %drop-database +.parsed %.y) commands]
== ==
::~|("Cannot parse drop-database {<parsed>}" !!)
!! !!
%drop-index %drop-index
~| "Cannot parse drop-index {<p.q.command-nail>}"
=/ drop-index-nail (parse-drop-index [[1 1] q.q.command-nail]) =/ drop-index-nail (parse-drop-index [[1 1] q.q.command-nail])
=/ parsed (wonk drop-index-nail) =/ parsed (wonk drop-index-nail)
=/ next-cursor =/ next-cursor
@ -1668,7 +1653,6 @@
commands [`command-ast`(drop-index:ast %drop-index -.parsed +.parsed) commands] commands [`command-ast`(drop-index:ast %drop-index -.parsed +.parsed) commands]
== ==
%drop-namespace %drop-namespace
~| "Cannot parse drop-namespace {<p.q.command-nail>}"
=/ drop-namespace-nail (parse-drop-namespace [[1 1] q.q.command-nail]) =/ drop-namespace-nail (parse-drop-namespace [[1 1] q.q.command-nail])
=/ parsed (wonk drop-namespace-nail) =/ parsed (wonk drop-namespace-nail)
=/ next-cursor =/ next-cursor
@ -1697,9 +1681,9 @@
script-position next-cursor script-position next-cursor
commands [`command-ast`(drop-namespace:ast %drop-namespace +<.parsed +>.parsed %.y) commands] commands [`command-ast`(drop-namespace:ast %drop-namespace +<.parsed +>.parsed %.y) commands]
== ==
::~|("Cannot parse drop-namespace {<parsed>}" !!)
!! !!
%drop-table %drop-table
~| "Cannot parse drop-table {<p.q.command-nail>}"
=/ drop-table-nail (drop-table-or-view [[1 1] q.q.command-nail]) =/ drop-table-nail (drop-table-or-view [[1 1] q.q.command-nail])
=/ parsed (wonk drop-table-nail) =/ parsed (wonk drop-table-nail)
=/ next-cursor =/ next-cursor
@ -1718,9 +1702,8 @@
commands commands
[`command-ast`(drop-table:ast %drop-table parsed %.n) commands] [`command-ast`(drop-table:ast %drop-table parsed %.n) commands]
== ==
!! ~|("Cannot parse drop-table {<parsed>}" !!)
%drop-view %drop-view
~| "Cannot parse drop-view {<p.q.command-nail>}"
=/ drop-view-nail (drop-table-or-view [[1 1] q.q.command-nail]) =/ drop-view-nail (drop-table-or-view [[1 1] q.q.command-nail])
=/ parsed (wonk drop-view-nail) =/ parsed (wonk drop-view-nail)
=/ next-cursor =/ next-cursor
@ -1739,9 +1722,8 @@
commands commands
[`command-ast`(drop-view:ast %drop-view parsed %.n) commands] [`command-ast`(drop-view:ast %drop-view parsed %.n) commands]
== ==
!! ~|("Cannot parse drop-view {<parsed>}" !!)
%grant %grant
~| "Cannot parse grant {<p.q.command-nail>}"
=/ grant-nail (parse-grant [[1 1] q.q.command-nail]) =/ grant-nail (parse-grant [[1 1] q.q.command-nail])
=/ parsed (wonk grant-nail) =/ parsed (wonk grant-nail)
=/ next-cursor =/ next-cursor
@ -1774,9 +1756,8 @@
commands commands
[`command-ast`(grant:ast %grant -.parsed +<.parsed +>.parsed) commands] [`command-ast`(grant:ast %grant -.parsed +<.parsed +>.parsed) commands]
== ==
!! ~|("Cannot parse grant {<parsed>}" !!)
%insert %insert
~| "Cannot parse insert {<p.q.command-nail>}"
=/ insert-nail (parse-insert [[1 1] q.q.command-nail]) =/ insert-nail (parse-insert [[1 1] q.q.command-nail])
=/ parsed (wonk insert-nail) =/ parsed (wonk insert-nail)
=/ next-cursor =/ next-cursor
@ -1796,7 +1777,7 @@
commands commands
[`command-ast`(insert:ast %insert -.parsed `+<-.parsed (insert-values:ast %data +>-.parsed)) commands] [`command-ast`(insert:ast %insert -.parsed `+<-.parsed (insert-values:ast %data +>-.parsed)) commands]
== ==
!! ~|("Cannot parse insert {<parsed>}" !!)
%query %query
~| "Cannot parse query {<p.q.command-nail>}" ~| "Cannot parse query {<p.q.command-nail>}"
~| "q.q.command-nail: {<q.q.command-nail>}" ~| "q.q.command-nail: {<q.q.command-nail>}"
@ -1808,7 +1789,7 @@
~| "remainder: {<q.q.u.+3:q.+3.query-nail>}" ~| "remainder: {<q.q.u.+3:q.+3.query-nail>}"
!! !!
%revoke %revoke
~| "Cannot parse revoke {<p.q.command-nail>}"
=/ revoke-nail (parse-revoke [[1 1] q.q.command-nail]) =/ revoke-nail (parse-revoke [[1 1] q.q.command-nail])
=/ parsed (wonk revoke-nail) =/ parsed (wonk revoke-nail)
=/ next-cursor =/ next-cursor
@ -1841,9 +1822,8 @@
commands commands
[`command-ast`(revoke:ast %revoke -.parsed +<.parsed +>.parsed) commands] [`command-ast`(revoke:ast %revoke -.parsed +<.parsed +>.parsed) commands]
== ==
!! ~|("Cannot parse revoke {<parsed>}" !!)
%truncate-table %truncate-table
~| "Cannot parse truncate-table {<p.q.command-nail>}"
=/ truncate-table-nail (parse-truncate-table [[1 1] q.q.command-nail]) =/ truncate-table-nail (parse-truncate-table [[1 1] q.q.command-nail])
=/ next-cursor =/ next-cursor
(get-next-cursor [script-position +<.command-nail p.q.u.+3:q.+3:truncate-table-nail]) (get-next-cursor [script-position +<.command-nail p.q.u.+3:q.+3:truncate-table-nail])