diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist
index d8e3756..e56bee5 100644
--- a/Syntaxes/Ruby.plist
+++ b/Syntaxes/Ruby.plist
@@ -522,100 +522,17 @@
match
\G([&*]?)(?:([_a-zA-Z]\w*(:))|([_a-zA-Z]\w*))
-
- include
- #parens
-
-
- include
- #braces
-
-
- include
- $self
-
-
-
-
- repository
-
- braces
-
- begin
- \{
- beginCaptures
-
- 0
-
- name
- punctuation.section.function.begin.ruby
-
-
- end
- \}
- endCaptures
-
- 0
-
- name
- punctuation.section.function.end.ruby
-
-
- patterns
-
-
- include
- #parens
-
-
- include
- #braces
-
include
$self
- parens
- begin
- \(
- beginCaptures
-
- 0
-
- name
- punctuation.section.function.begin.ruby
-
-
- end
- \)
- endCaptures
-
- 0
-
- name
- punctuation.section.function.end.ruby
-
-
- patterns
-
-
- include
- #parens
-
-
- include
- #braces
-
-
- include
- $self
-
-
+ include
+ $self
-
+
begin
@@ -644,16 +561,16 @@
comment
same as the previous rule, but without parentheses around the arguments
end
- $
+ (?<=[\w\])}`'";!?])\s*$
name
meta.function.method.with-arguments.ruby
patterns
begin
- (?![\s,])
+ (?=[&*_a-zA-Z])
end
- (?=,|$)
+ (?=,|\s*$)
patterns
@@ -682,8 +599,6 @@
match
\G([&*]?)(?:([_a-zA-Z]\w*(:))|([_a-zA-Z]\w*))
- name
- variable.parameter.function.ruby
include
@@ -691,6 +606,10 @@
+
+ include
+ $self
+
@@ -1956,34 +1875,91 @@
punctuation.separator.other.ruby
- match
+ begin
\{
- name
- punctuation.section.scope.begin.ruby
-
-
- match
+ beginCaptures
+
+ 0
+
+ name
+ punctuation.section.scope.begin.ruby
+
+
+ end
\}
- name
- punctuation.section.scope.end.ruby
+ endCaptures
+
+ 0
+
+ name
+ punctuation.section.scope.end.ruby
+
+
+ patterns
+
+
+ include
+ $self
+
+
- match
+ begin
\[
- name
- punctuation.section.array.begin.ruby
-
-
- match
+ beginCaptures
+
+ 0
+
+ name
+ punctuation.section.array.begin.ruby
+
+
+ end
\]
- name
- punctuation.section.array.end.ruby
+ endCaptures
+
+ 0
+
+ name
+ punctuation.section.array.end.ruby
+
+
+ patterns
+
+
+ include
+ $self
+
+
- match
- \(|\)
- name
- punctuation.section.function.ruby
+ begin
+ \(
+ beginCaptures
+
+ 0
+
+ name
+ punctuation.section.function.ruby
+
+
+ end
+ \)
+ endCaptures
+
+ 0
+
+ name
+ punctuation.section.function.ruby
+
+
+ patterns
+
+
+ include
+ $self
+
+
repository
diff --git a/Tests/method_arguments.rb b/Tests/method_arguments.rb
new file mode 100644
index 0000000..3a25d56
--- /dev/null
+++ b/Tests/method_arguments.rb
@@ -0,0 +1,54 @@
+def method
+ hello, world = [1,2]
+end
+
+def method_with_parentheses(a, b, c = [foo,bar,baz])
+ hello, world = [1,2]
+end
+
+def method_without_parentheses a, b, c = [foo,bar,baz]
+ hello, world = [1,2]
+end
+
+
+def method_with_parentheses(a, b = "hello", c = ["foo", "bar"], d = (2 + 2) * 2, e = {})
+ hello, world = [1,2]
+ do_something1
+ do_something2
+end
+
+def method_without_parentheses a, b = "hello", c = ["foo", "bar"], d = (2 + 2) * 2, e = ""
+ hello, world = [1,2]
+ do_something1
+ do_something2
+end
+
+def method_with_parentheses(a,
+ b = hello, # test comment
+ c = ["foo", bar, :baz],
+ d = (2 + 2) * 2,
+ e = {})
+ hello, world = [1,2]
+ do_something1
+ do_something2
+end
+
+def method_without_parentheses a,
+ b = "hello" , # test comment
+ c = ["foo", bar, :baz],
+ d = (2 + 2) * 2,
+ e = proc { |e| e + e }
+ hello, world = [1,2]
+ do_something1
+ do_something2
+end
+
+def method_without_parentheses a,
+ b: hello , # test comment
+ c: ["foo", bar, :baz],
+ d: (2 + 2) * 2,
+ e: proc { |e| e + e }
+ hello, world = [1,2]
+ do_something1
+ do_something2
+end