diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2019-01-01 17:15:51 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2019-01-01 17:17:23 -0800 |
| commit | 3e89092833a6d407e711fe4ae5f44474ff34cf64 (patch) | |
| tree | 5ffe2df86f648b604347b59999992d74f71a796c /core/control_flow.nom | |
| parent | e68eb04d690454428216a0f0f1b11399feeb7dc1 (diff) | |
Some changes to the error API, a fix for statement block parsing, and
replacing ((foo 1 baz)'s meaning) with $(foo 1 baz).
Diffstat (limited to 'core/control_flow.nom')
| -rw-r--r-- | core/control_flow.nom | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/core/control_flow.nom b/core/control_flow.nom index f066767..5c90bcc 100644 --- a/core/control_flow.nom +++ b/core/control_flow.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V6.13.12.8 +#!/usr/bin/env nomsu -V6.14 # This file contains compile-time actions that define basic control flow structures like "if" statements and loops. @@ -16,7 +16,7 @@ test: # Conditionals test: if (no): - barf "conditional fail" + fail "conditional fail" (if $condition $if_body) compiles to (" if \($condition as lua expr) then @@ -26,7 +26,7 @@ test: test: unless (yes): - barf "conditional fail" + fail "conditional fail" (unless $condition $unless_body) parses as (if (not $condition) $unless_body) [ @@ -134,7 +134,7 @@ test: $x += 1 if (yes): do next - barf "Failed to 'do next'" + fail "Failed to 'do next'" assume ($x == 20) (repeat while $condition $body) compiles to: @@ -311,16 +311,16 @@ test: test: when: (1 == 2) (100 < 0): - barf "bad conditional" + fail "bad conditional" (1 == 0) (1 == 1) $not_a_variable.x: do nothing (1 == 1): - barf "bad conditional" + fail "bad conditional" (1 == 2): - barf "bad conditional" + fail "bad conditional" else: - barf "bad conditional" + fail "bad conditional" # Multi-branch conditional (if..elseif..else) (when $body) compiles to: @@ -374,16 +374,16 @@ test: test: if 5 is: 1 2 3: - barf "bad switch statement" + fail "bad switch statement" 4 5: do nothing 5 6: - barf "bad switch statement" + fail "bad switch statement" else: - barf "bad switch statement" + fail "bad switch statement" # Switch statement [if $branch_value is $body, when $branch_value is $body] all compile to: |
