Skip to content

Commit

Permalink
Match parenthesis inside arguments as a pair
Browse files Browse the repository at this point in the history
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
  • Loading branch information
infininight committed Aug 9, 2016
1 parent 8f4e77c commit ad08f8b
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion Syntaxes/Ruby.plist
Expand Up @@ -427,7 +427,7 @@
<key>begin</key>
<string>(?=[&amp;*_a-zA-Z])</string>
<key>end</key>
<string>(?=,|\)\s*$)</string>
<string>(?=[,)])</string>
<key>patterns</key>
<array>
<dict>
Expand Down Expand Up @@ -457,6 +457,29 @@
<key>match</key>
<string>\G([&amp;*]?)(?:([_a-zA-Z]\w*(:))|([_a-zA-Z]\w*))</string>
</dict>
<dict>
<key>begin</key>
<string>\(</string>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.section.function.ruby</string>
</dict>
</dict>
<key>comment</key>
<string>Prevent end pattern of parent rule from ending prematurely.</string>
<key>end</key>
<string>\)</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>$self</string>
</dict>
</array>
</dict>
<dict>
<key>include</key>
<string>$self</string>
Expand Down

0 comments on commit ad08f8b

Please sign in to comment.