diff options
Diffstat (limited to 'core')
| -rw-r--r-- | core/collections.nom | 2 | ||||
| -rw-r--r-- | core/control_flow.nom | 8 | ||||
| -rw-r--r-- | core/math.nom | 2 | ||||
| -rw-r--r-- | core/metaprogramming.nom | 6 | ||||
| -rw-r--r-- | core/operators.nom | 4 | ||||
| -rw-r--r-- | core/text.nom | 2 |
6 files changed, 12 insertions, 12 deletions
diff --git a/core/collections.nom b/core/collections.nom index 9086e23..189aa5d 100644 --- a/core/collections.nom +++ b/core/collections.nom @@ -1,4 +1,4 @@ -#.. +# This file contains code that supports manipulating and using collections like lists and dictionaries. diff --git a/core/control_flow.nom b/core/control_flow.nom index c3b5b2b..3f20e10 100644 --- a/core/control_flow.nom +++ b/core/control_flow.nom @@ -1,4 +1,4 @@ -#.. +# This file contains compile-time actions that define basic control flow structures like "if" statements and loops. @@ -28,7 +28,7 @@ immediately end # Conditional expression (ternary operator) -#.. Note: this uses a function instead of "(condition and if_expr or else_expr)" +# Note: this uses a function instead of "(condition and if_expr or else_expr)" because that breaks if %if_expr is falsey, e.g. "x < 5 and false or 99" immediately compile [..] @@ -37,14 +37,14 @@ immediately %when_false_expr unless %condition else %when_true_expr %when_false_expr unless %condition then %when_true_expr ..to - #.. If %when_true_expr is guaranteed to be truthy, we can use Lua's idiomatic + # If %when_true_expr is guaranteed to be truthy, we can use Lua's idiomatic equivalent of a conditional expression: (cond and if_true or if_false) if: %when_true_expr.type in {Text:yes, List:yes, Dict:yes, Number:yes} return Lua value ".." (\(%condition as lua expr) and \(%when_true_expr as lua expr) or \(%when_false_expr as lua expr)) ..else - #.. Otherwise, need to do an anonymous inline function (yuck, too bad lua + # Otherwise, need to do an anonymous inline function (yuck, too bad lua doesn't have a proper ternary operator!) To see why this is necessary consider: (random()<.5 and false or 99) return diff --git a/core/math.nom b/core/math.nom index ad419fa..e79c8c3 100644 --- a/core/math.nom +++ b/core/math.nom @@ -1,4 +1,4 @@ -#.. +# This file defines some common math literals and functions use "core/metaprogramming.nom" diff --git a/core/metaprogramming.nom b/core/metaprogramming.nom index a2c3820..4b7f0bc 100644 --- a/core/metaprogramming.nom +++ b/core/metaprogramming.nom @@ -1,4 +1,4 @@ -#.. +# This File contains actions for making actions and compile-time actions and some helper functions to make that easier. @@ -182,14 +182,14 @@ immediately immediately compile [source] to: Lua value "tree.source" -#.. +# immediately action [Lua %]: Lua (=lua "tree.source") % action [Lua value %]: Lua value (=lua "tree.source") % # Return immediately - #.. Return statement is wrapped in a do..end block because Lua is unhappy if you + # Return statement is wrapped in a do..end block because Lua is unhappy if you put code after a return statement, unless you wrap it in a block. compile [return] to: Lua "do return; end" compile [return %return_value] to: Lua "do return \(%return_value as lua expr); end" diff --git a/core/operators.nom b/core/operators.nom index 56e89cb..60fe969 100644 --- a/core/operators.nom +++ b/core/operators.nom @@ -1,11 +1,11 @@ -#.. +# This file contains definitions of operators like "+" and "and". use "core/metaprogramming.nom" # Indexing immediately - #.. NOTE!!! It's critical that there are spaces around %key if it's a string, + # NOTE!!! It's critical that there are spaces around %key if it's a string, otherwise, Lua will get confused and interpret %obj[[[foo]]] as %obj("[foo]") instead of %obj[ "foo" ]. It's also critical to have parens around %obj, otherwise Lua is too dumb to diff --git a/core/text.nom b/core/text.nom index 465e3f6..e1aaa9d 100644 --- a/core/text.nom +++ b/core/text.nom @@ -1,4 +1,4 @@ -#.. +# This file contains some definitions of text escape sequences, including ANSI console color codes. |
