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

Commit

Permalink
Allow symbols to start with $
Browse files Browse the repository at this point in the history
Closes #59
  • Loading branch information
kevinsawicki committed Oct 6, 2014
1 parent e8c7479 commit 1128725
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion grammars/ruby.cson
Original file line number Diff line number Diff line change
Expand Up @@ -1464,7 +1464,7 @@
'1':
'name': 'punctuation.definition.constant.ruby'
'comment': 'symbols'
'match': '(?<!:)(:)(?>[a-zA-Z_]\\w*(?>[?!]|=(?![>=]))?|===?|>[>=]?|<[<=]?|<=>|[%&`/\\|]|\\*\\*?|=?~|[-+]@?|\\[\\]=?|@@?[a-zA-Z_]\\w*)'
'match': '(?<!:)(:)(?>[$a-zA-Z_]\\w*(?>[?!]|=(?![>=]))?|===?|>[>=]?|<[<=]?|<=>|[%&`/\\|]|\\*\\*?|=?~|[-+]@?|\\[\\]=?|@@?[a-zA-Z_]\\w*)'
'name': 'constant.other.symbol.ruby'
}
{
Expand Down
11 changes: 10 additions & 1 deletion spec/ruby-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,19 @@ describe "Ruby grammar", ->
expect(grammar).toBeTruthy()
expect(grammar.scopeName).toBe "source.ruby"

it 'tokenizes self', ->
it "tokenizes self", ->
{tokens} = grammar.tokenizeLine('self')
expect(tokens[0]).toEqual value: 'self', scopes: ['source.ruby', 'variable.language.self.ruby']

it "tokenizes symbols", ->
{tokens} = grammar.tokenizeLine(':test')
expect(tokens[0]).toEqual value: ':', scopes: ['source.ruby', 'constant.other.symbol.ruby', 'punctuation.definition.constant.ruby']
expect(tokens[1]).toEqual value: 'test', scopes: ['source.ruby', 'constant.other.symbol.ruby']

{tokens} = grammar.tokenizeLine(':$symbol')
expect(tokens[0]).toEqual value: ':', scopes: ['source.ruby', 'constant.other.symbol.ruby', 'punctuation.definition.constant.ruby']
expect(tokens[1]).toEqual value: '$symbol', scopes: ['source.ruby', 'constant.other.symbol.ruby']

it "tokenizes %{} style strings", ->
{tokens} = grammar.tokenizeLine('%{te{s}t}')

Expand Down

0 comments on commit 1128725

Please sign in to comment.