diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2019-02-05 15:45:27 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2019-02-05 15:47:01 -0800 |
| commit | 72d699fe86ddb34473b54a0df27d21b4a9159284 (patch) | |
| tree | bdb4036181b5c15d920d1500f8f67407a44d2014 /lib/core/things.nom | |
| parent | 0ff3219f355b4307783288800724213636920912 (diff) | |
Bunch of changes:
- Added shebangs to generated code output
- SyntaxTree:map() -> SyntaxTree:with(), and corresponding changes to
metaprogramming API
- Added (return Lua 1) shorthand for (return (Lua 1))
- (1 and 2 and 3) compile rule mapping to -> (1 and (*extra arguments*))
- Don't scan for errors, just report them when compiling
- Syntax changes:
- Added prefix actions (e.g. #$foo)
- Operator chars now include utf8 chars
- Ditch "escaped nomsu" type (use (\ 1) compile action instead)
Diffstat (limited to 'lib/core/things.nom')
| -rw-r--r-- | lib/core/things.nom | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/lib/core/things.nom b/lib/core/things.nom index 5f74b1a..6ba21cb 100644 --- a/lib/core/things.nom +++ b/lib/core/things.nom @@ -37,6 +37,8 @@ test: ($self, number of commas) means ((#$bits) - 1) $csv = (a Comma Buffer) assume $csv.is_a_buffer + assume ($csv is "a Comma Buffer") + assume ($csv is "a Buffer") assume "\$csv" == "" $csv, add "x" $csv, add "y" @@ -96,17 +98,20 @@ external: Compile error: This is not a list of variables. ") $class_id = ($classname.stub, as lua id) - if $class_body: - $class_body = - $class_body with vars { - : for $v in $vars: - add ($v as lua expr, text) = - "IndexChain" tree with ("Var" tree with "self") - "Index" tree with ("Text" tree with $v.1) - } + $class_body and= + $class_body, with + $t ->: + for $v in $vars: + if ($t == $v): + return + "IndexChain" tree with ("Var" tree with "self") + "Index" tree with ("Text" tree with $v.1) + + if ($parent.type == "Action"): + $parent = ("Var" tree with $parent) $lua = Lua (" - \$class_id = _1_class_named(\($parent as lua), \(quote $classname.stub)\( + \$class_id = _1_class_named(\($parent as lua id), \(quote $classname.stub)\( ( Lua (" , function(\$class_id) |
