From ba2b83d5669f9fcf6f49fcd2adac5997eb07f7d8 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Wed, 11 Jul 2018 14:13:43 -0700 Subject: Fixed nomsu codegen for indented text and improved text parsing. Also moved some more tests inline. --- core/control_flow.nom | 3 +++ 1 file changed, 3 insertions(+) (limited to 'core/control_flow.nom') diff --git a/core/control_flow.nom b/core/control_flow.nom index 61438d1..4733168 100644 --- a/core/control_flow.nom +++ b/core/control_flow.nom @@ -8,14 +8,17 @@ use "core/operators.nom" use "core/errors.nom" # No-Op +test: do nothing compile [do nothing] to: Lua "" # Conditionals +test: if (no): barf "conditional fail" compile [if %condition %if_body] to Lua ".." if \(%condition as lua expr) then \(%if_body as lua statements) end +test: unless (yes): barf "conditional fail" parse [unless %condition %unless_body] as: if (not %condition) %unless_body compile [if %condition %if_body else %else_body, unless %condition %else_body else %if_body] to -- cgit v1.2.3