Skip to content

Commit

Permalink
Fix problem with multi sub not highlighting properly
Browse files Browse the repository at this point in the history
Fixes Issue #26
A test has been added for this as well.
  • Loading branch information
samcv committed Dec 23, 2016
1 parent 640756e commit 72e595d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
9 changes: 5 additions & 4 deletions grammars/perl6fe.cson
Original file line number Diff line number Diff line change
Expand Up @@ -578,10 +578,11 @@
}
{
'begin': '(?x) (?<![%$&@]|\\w)
(?: (multi)(?=\\s+))?
(?: (macro|sub|submethod|method|multi|proto|only|category) \\s+ )
\\s* (!)?
( [^\\s\\(\\)\\{\\}]+ )'
(?: (multi) \\s+ )?
(macro|sub|submethod|method|multi|proto|only|category)
\\s+
(!)?
( [^\\s\\(\\)\\{\\}]+ )'
'beginCaptures':
'1': 'name': 'storage.type.declarator.multi.perl6fe'
'2': 'name': 'storage.type.declarator.type.perl6fe'
Expand Down
13 changes: 13 additions & 0 deletions spec/grammar-perl6fe-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,19 @@ describe "Perl 6 FE grammar", ->
scopes: [ 'source.perl6fe', 'entity.name.section.head.abbreviated.perl6fe' ]

## Methods
it "multi sub highlights properly. Issue №26", ->
{tokens} = grammar.tokenizeLine "multi sub thingy"
expect(tokens[0]).toEqual value: 'multi',
scopes: [ 'source.perl6fe', 'storage.type.declarator.multi.perl6fe' ]
expect(tokens[1]).toEqual value: ' ',
scopes: [ 'source.perl6fe' ]
expect(tokens[2]).toEqual value: 'sub',
scopes: [ 'source.perl6fe', 'storage.type.declarator.type.perl6fe' ]
expect(tokens[3]).toEqual value: ' ',
scopes: [ 'source.perl6fe' ]
expect(tokens[4]).toEqual value: 'thingy',
scopes : [ 'source.perl6fe', 'entity.name.function.perl6fe' ]

it "FQ private methods are highlighted properly Issue №8", ->
{tokens} = grammar.tokenizeLine "self.List::perl;"
expect(tokens[0]).toEqual value: 'self',
Expand Down

0 comments on commit 72e595d

Please sign in to comment.