Implement return, implement instant break, add exit function, implement dumping and loading of AST via encoding/json

This commit is contained in:
2021-03-07 17:25:16 -08:00
parent f7a34b3da4
commit 1c99345af1
6 changed files with 138 additions and 62 deletions
Regular → Executable
+16 -3
View File
@@ -1,3 +1,5 @@
#!/usr/bin/env scpt
set y to (display-dialog "Hello" with title 12 with type "yesno")
display-dialog "Goodbye" with title 21 with type "error"
do-shell-script "notify-send Test Notification"
@@ -30,9 +32,9 @@ This is a multiline comment
# This is a single line comment
set hi to ["testovich", 3]
set hi to ["test", 3]
set hi[0] to "testo"
set hi[0] to "test2"
print $hi[0]
@@ -55,9 +57,20 @@ loop while $f {
print {"iter: " + (str $c)}
}
repeat 6 times { i in
print {"brktest: " + (str $i)}
if {$i == 3} {
break
}
print {"brktest: " + (str $i) + " (2)"}
}
define hi {
print {"Hello, " + $_args[""]}
return {"Hello, " + $_args[""]}
print "Something isn't right"
}
hi "Function"
hi "World"
set f to (hi "World")
print {"Returned: " + $f}