Skip to content

Commit

Permalink
rewrite executeCode (weird syntax has to do with: arturo-lang/artur…
Browse files Browse the repository at this point in the history
  • Loading branch information
drkameleon committed Dec 12, 2024
1 parent 02621dd commit 6e833f7
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions src/grace.art
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,26 @@ doSth: function [n][

executeCode: function [inp][
Got: null

unless null? err: <= try.verbose [
unless null? err: <= try.verbose to :block inp ->
return #[ok: false, content: to :string err]

StackSize: size stack

if StackSize > 0 -> Got: unstack 1
unless null? Got -> return #[ok: true, content: render.once "|Got|"]

return #[ok: true, content: null]
] -> return #[ok: false, content: to :string err]
RES: null

(not? null? err: <= try [
(not? null? err: <= try to :block inp)?[
RES: #[ok: false, content: to :string err]
][
StackSize: size stack
if StackSize > 0 -> Got: unstack 1
(null? Got)?[
RES: #[ok: true, content: null]
][
RES: #[ok: true, content: to :string Got]
]
]

])? [
return #[ok: false, content: to :string err]
][
return RES
]
]

export module [
Expand Down

0 comments on commit 6e833f7

Please sign in to comment.