Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
Fixed grammar for multiple method arguments as symbols with parentheses
Browse files Browse the repository at this point in the history
  • Loading branch information
mamenama committed Oct 30, 2015
1 parent 17c43c0 commit 34813e6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion grammars/ruby.cson
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
'patterns': [
{
'begin': '(?![\\s,)])'
'end': '(?=[,)])'
'end': '(?=\\,|\\)\\s*$)'
'patterns': [
{
'captures':
Expand Down
12 changes: 12 additions & 0 deletions spec/ruby-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -555,3 +555,15 @@ describe "Ruby grammar", ->
expect(tokens[3]).toEqual value: ' ', scopes: [ 'source.ruby', 'meta.function.method.with-arguments.ruby']
expect(tokens[4]).toEqual value: '*', scopes: [ 'source.ruby', 'meta.function.method.with-arguments.ruby', 'storage.type.variable.ruby' ]
expect(tokens[5]).toEqual value: 'args', scopes: ['source.ruby', 'meta.function.method.with-arguments.ruby', 'variable.parameter.function.ruby']

it "tokenizes a method with (symbol: arg(paren), symbol: arg2(paren)...) properly", ->
{tokens} = grammar.tokenizeLine('def method(red: rand(2), green: rand(3), blue: rand(4))')
expect(tokens[0]).toEqual value: 'def', scopes: [ 'source.ruby', 'meta.function.method.with-arguments.ruby', 'keyword.control.def.ruby' ]
expect(tokens[2]).toEqual value: 'method', scopes: ['source.ruby', 'meta.function.method.with-arguments.ruby', 'entity.name.function.ruby']
expect(tokens[3]).toEqual value: '(', scopes: [ 'source.ruby', 'meta.function.method.with-arguments.ruby', 'punctuation.definition.parameters.ruby' ]
expect(tokens[4]).toEqual value: 'red', scopes: ['source.ruby', 'meta.function.method.with-arguments.ruby', 'variable.parameter.function.ruby']
expect(tokens[7]).toEqual value: 'rand', scopes: ['source.ruby', 'meta.function.method.with-arguments.ruby', 'support.function.kernel.ruby']
expect(tokens[9]).toEqual value: '2', scopes: ['source.ruby', 'meta.function.method.with-arguments.ruby', 'constant.numeric.ruby']
expect(tokens[12]).toEqual value: 'green', scopes: ['source.ruby', 'meta.function.method.with-arguments.ruby', 'variable.parameter.function.ruby']
expect(tokens[15]).toEqual value: 'rand', scopes: ['source.ruby', 'meta.function.method.with-arguments.ruby', 'support.function.kernel.ruby']
expect(tokens[17]).toEqual value: '3', scopes: ['source.ruby', 'meta.function.method.with-arguments.ruby', 'constant.numeric.ruby']

1 comment on commit 34813e6

@infininight
Copy link

@infininight infininight commented on 34813e6 Aug 9, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mamenama Had an issue reported to the TextMate bundle in regards to this commit:

textmate/ruby.tmbundle#103

Fixed the issue by in another fashion here:

textmate/ruby.tmbundle@ad08f8b

Please sign in to comment.