aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2018-11-19 17:44:46 -0800
committerBruce Hill <bruce@bruce-hill.com>2018-11-19 17:44:46 -0800
commitf30413853063483147d941ffccc4b663b71bc943 (patch)
tree31747b3d020a5d252e70910fdd741ecf27a58ef5 /core
parenta89d69e843ba83df928051005d02a932a9981f46 (diff)
Deduplicated goto label syntax (now just use (--- (label) ---))
Diffstat (limited to 'core')
-rw-r--r--core/control_flow.nom34
1 files changed, 17 insertions, 17 deletions
diff --git a/core/control_flow.nom b/core/control_flow.nom
index 27ff96d..636f586 100644
--- a/core/control_flow.nom
+++ b/core/control_flow.nom
@@ -75,18 +75,18 @@ test:
# GOTOs
test:
%i = 0
- === %loop ===
+ --- %loop ---
%i += 1
unless (%i == 10):
go to %loop
assume (%i == 10)
- === (Loop) ===
+ --- (Loop) ---
%i -= 1
unless (%i == 0):
go to (Loop)
assume (%i == 0)
-[=== %label ===, --- %label ---, *** %label ***] all compile to "\
+(--- %label ---) compiles to "\
..::label_\((%label.stub if (%label.type == "Action") else %label) as lua identifier)::"
(go to %label) compiles to "\
@@ -105,10 +105,10 @@ test:
..else:
return (Lua "goto continue")
-[===stop %var ===, ---stop %var ---, ***stop %var ***] all compile to "\
+(---stop %var ---) compiles to "\
..::stop_\((%var.stub if (%var.type == "action") else %var) as lua identifier)::"
-[===next %var ===, ---next %var ---, ***next %var ***] all compile to "\
+(---next %var ---) compiles to "\
..::continue_\((%var.stub if (%var.type == "action") else %var) as lua identifier)::"
# While loops
@@ -214,14 +214,14 @@ test:
%lua::append "\n ::continue::"
if (%body has subtree \(do next %var)):
- %lua::append "\n " (what (===next %var ===) compiles to)
+ %lua::append "\n " (what (---next %var ---) compiles to)
%lua::append "\nend --numeric for-loop"
if (%body has subtree \(stop %var)):
%inner_lua = %lua
%lua = (Lua "do -- scope for stopping for-loop\n ")
%lua::append %inner_lua "\n "
- %lua::append (what (===stop %var ===) compiles to)
+ %lua::append (what (---stop %var ---) compiles to)
%lua::append "\nend -- end of scope for stopping for-loop"
return %lua
@@ -261,14 +261,14 @@ test:
%lua::append "\n ::continue::"
if (%body has subtree \(do next %var)):
- %lua::append "\n " (what (===next %var ===) compiles to)
+ %lua::append "\n " (what (---next %var ---) compiles to)
%lua::append "\nend --foreach-loop"
if (%body has subtree \(stop %var)):
%inner_lua = %lua
%lua = (Lua "do -- scope for stopping for-loop\n ")
%lua::append %inner_lua "\n "
- %lua::append (what (===stop %var ===) compiles to)
+ %lua::append (what (---stop %var ---) compiles to)
%lua::append "\nend -- end of scope for stopping for-loop"
return %lua
@@ -284,14 +284,14 @@ test:
%lua::append "\n ::continue::"
if (%body has subtree \(do next %var)):
- %lua::append "\n " (what (===next %var ===) compiles to)
+ %lua::append "\n " (what (---next %var ---) compiles to)
%lua::append "\nend --foreach-loop"
if (%body has subtree \(stop %var)):
%inner_lua = %lua
%lua = (Lua "do -- scope for stopping for-loop\n ")
%lua::append %inner_lua "\n "
- %lua::append (what (===stop %var ===) compiles to)
+ %lua::append (what (---stop %var ---) compiles to)
%lua::append "\nend -- end of scope for stopping for-loop"
return %lua
@@ -324,18 +324,18 @@ test:
%lua::append "\n ::continue::"
if (%body has subtree \(do next %key)):
- %lua::append "\n " (what (===next %key ===) compiles to)
+ %lua::append "\n " (what (---next %key ---) compiles to)
if (%body has subtree \(do next %value)):
- %lua::append "\n " (what (===next %value ===) compiles to)
+ %lua::append "\n " (what (---next %value ---) compiles to)
%lua::append "\nend --foreach-loop"
%stop_labels = (Lua "")
if (%body has subtree \(stop %key)):
- %stop_labels::append "\n" (what (===stop %key ===) compiles to)
+ %stop_labels::append "\n" (what (---stop %key ---) compiles to)
if (%body has subtree \(stop %value)):
- %stop_labels::append "\n" (what (===stop %value ===) compiles to)
+ %stop_labels::append "\n" (what (---stop %value ---) compiles to)
if ((size of "\%stop_labels") > 0):
%inner_lua = %lua
@@ -537,10 +537,10 @@ test:
%lua::append "\n ::continue::"
if (%body has subtree \(do next %var)):
- %lua::append "\n \(what (===next %var ===) compiles to)"
+ %lua::append "\n \(what (---next %var ---) compiles to)"
%lua::append "\n end -- Recursive loop"
if (%body has subtree \(stop %var)):
- %lua::append "\n \(what (===stop %var ===) compiles to)"
+ %lua::append "\n \(what (---stop %var ---) compiles to)"
%lua::append "\nend -- Recursive scope"
return %lua