+
require 'metalua.extension.match'
+
module ('spmatch', package.seeall)
+
+require 'metalua.walk.id'
+
-{extension 'log'}
----------------------------------------------------------------------
--- Back-end for "match function ..." and "local match function..."
+-- Back-end for statements
+-- "match function ..." and "local match function...".
-- Tag must be either "Localrec" or "Set".
----------------------------------------------------------------------
named_match_function_builder = |tag| function (x)
----------------------------------------------------------------
{ 'function', mlp.expr, gg.optkeyword '|',
match_cases_list_parser, 'end',
- builder = match_function_builder 'Set' },
+ builder = named_match_function_builder 'Set' },
----------------------------------------------------------------
-- Reintroduce the original match statement:
mlp.stat:get'local'[2]:add{
'match', 'function', mlp.expr, gg.optkeyword '|',
match_cases_list_parser, 'end',
- builder = match_function_builder 'Localrec' }
+ builder = named_match_function_builder 'Localrec' }
----------------------------------------------------------------------
-- "match...with" expressions and "match function..."
return `Stat{ { `Local{{v}}; m }, v }
end } } }
-require 'walk.id'
-
function bind (x)
local patterns, values = unpack(x)