diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2018-11-09 14:36:15 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2018-11-09 14:37:22 -0800 |
| commit | 7d2b7199d87930096b7fd799709fe0105d51eccb (patch) | |
| tree | f33de61cb44357497758bb08ec6993753d8baa43 /core/text.nom | |
| parent | ba96cdfa07cea15ada62f8f89b2563de1286a0de (diff) | |
Lots of cleanups, including expanded use of (... compiles to "text
literal") shorthand, deprecating Lua value, and more use of Lua "..."
with text interpolations.
Diffstat (limited to 'core/text.nom')
| -rw-r--r-- | core/text.nom | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/core/text.nom b/core/text.nom index 38fa08b..1e297aa 100644 --- a/core/text.nom +++ b/core/text.nom @@ -29,17 +29,19 @@ test: %こんにちは = "こんにちは" (% と言う) とは "\(%)世界" assume (%こんにちは と言う) == "こんにちは世界" -(%expr for %match in %text matching %patt) compiles to (..) - Lua value "\ - ..(function() - local ret = _List{} - for \(%match as lua expr) in (\(%text as lua expr)):gmatch(\(..) - %patt as lua expr - ..) do - ret[#ret+1] = \(%expr as lua statements) - end - return ret - end)()" +(%expr for %match in %text matching %patt) compiles to: + define mangler + return (..) + Lua "\ + ..(function() + local \(mangle "comprehension") = _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 statements) + end + return \(mangle "comprehension") + end)()" test: assume "\n" == (newline) |
