From ad08f8be820d5bf4b29812038cf9ee9abe9cec2f Mon Sep 17 00:00:00 2001 From: Michael Sheets Date: Tue, 9 Aug 2016 01:02:04 -0500 Subject: [PATCH] Match parenthesis inside arguments as a pair A comment following the arguments in the function definition would prevent the argument rule from ending. Now matches the parenthesis inside arguments as a pair, doing so removes the need to look-ahead after the ending `)`. ```ruby def foo(_) # ["a", "b"] end ``` Fixes #103, original issue discussed in atom/language-ruby#78 --- Syntaxes/Ruby.plist | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 050fa7c..bb24c21 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -427,7 +427,7 @@ begin (?=[&*_a-zA-Z]) end - (?=,|\)\s*$) + (?=[,)]) patterns @@ -457,6 +457,29 @@ match \G([&*]?)(?:([_a-zA-Z]\w*(:))|([_a-zA-Z]\w*)) + + begin + \( + captures + + 0 + + name + punctuation.section.function.ruby + + + comment + Prevent end pattern of parent rule from ending prematurely. + end + \) + patterns + + + include + $self + + + include $self