From 96abc5986e432002631b7c4abdf7008f115e8fc0 Mon Sep 17 00:00:00 2001 From: leaf corcoran Date: Mon, 20 Jun 2011 20:35:05 -0700 Subject: [PATCH] bang function call --- moonscript/parse.lua | 2 +- tests/inputs/syntax.moon | 10 ++++++++++ tests/outputs/syntax.lua | 7 ++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/moonscript/parse.lua b/moonscript/parse.lua index b6f7d7c..47b09dd 100644 --- a/moonscript/parse.lua +++ b/moonscript/parse.lua @@ -306,7 +306,7 @@ local build_grammar = wrap(function() Callable = Name + Parens / mark"parens", Parens = sym"(" * Exp * sym")", - FnArgs = symx"(" * Ct(ExpList^-1) * sym")", + FnArgs = symx"(" * Ct(ExpList^-1) * sym")" + sym"!" * -P"=" * Ct"", -- chain that starts with colon expression (for precedence over table literal) ColonChain = diff --git a/tests/inputs/syntax.moon b/tests/inputs/syntax.moon index d99cfc0..0c4cdc6 100644 --- a/tests/inputs/syntax.moon +++ b/tests/inputs/syntax.moon @@ -167,4 +167,14 @@ what whack - 5 x = hello - world - something +hello! +hello.world! + +hello!.something +what!["ofefe"] + +what! the! heck! + + + diff --git a/tests/outputs/syntax.lua b/tests/outputs/syntax.lua index 23e472d..af8a14a 100644 --- a/tests/outputs/syntax.lua +++ b/tests/outputs/syntax.lua @@ -123,4 +123,9 @@ _ = 5 + what(wack) what(whack + 5) _ = 5 - what(wack) what(whack - 5) -x = hello - world - something \ No newline at end of file +x = hello - world - something +hello() +hello.world() +_ = hello().something +_ = what()["ofefe"] +what()(the()(heck())) \ No newline at end of file