aboutsummaryrefslogtreecommitdiff
path: root/lib/core/text.nom
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2019-02-05 15:45:27 -0800
committerBruce Hill <bruce@bruce-hill.com>2019-02-05 15:47:01 -0800
commit72d699fe86ddb34473b54a0df27d21b4a9159284 (patch)
treebdb4036181b5c15d920d1500f8f67407a44d2014 /lib/core/text.nom
parent0ff3219f355b4307783288800724213636920912 (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/text.nom')
-rw-r--r--lib/core/text.nom19
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/core/text.nom b/lib/core/text.nom
index 1401cf2..d7719b3 100644
--- a/lib/core/text.nom
+++ b/lib/core/text.nom
@@ -43,16 +43,15 @@ test:
($expr for $match in $text matching $patt) compiles to:
define mangler
- return
- Lua ("
- (function()
- local \(mangle "comprehension") = a_List{}
- for \($match as lua expr) in (\($text as lua expr)):gmatch(\($patt as lua expr)) do
- \(mangle "comprehension")[#\(mangle "comprehension")+1] = \($expr as lua)
- end
- return \(mangle "comprehension")
- end)()
- ")
+ return Lua ("
+ (function()
+ local \(mangle "comprehension") = a_List{}
+ for \($match as lua expr) in (\($text as lua expr)):gmatch(\($patt as lua expr)) do
+ \(mangle "comprehension")[#\(mangle "comprehension")+1] = \($expr as lua)
+ end
+ return \(mangle "comprehension")
+ end)()
+ ")
test:
assume "\n" == (newline)