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

Commit

Permalink
Tokenize '?' as 'keyword.operator.nullable-type.php' in nullable type…
Browse files Browse the repository at this point in the history
…s in comments.
  • Loading branch information
BladeMF committed Dec 26, 2021
1 parent 18862cf commit a056647
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions grammars/php.cson
Original file line number Diff line number Diff line change
Expand Up @@ -2499,6 +2499,10 @@
'captures':
'0':
'patterns': [
{
'match': '\\?'
'name': 'keyword.operator.nullable-type.php'
}
{
'match': '''(?x)\\b
(string|integer|int|boolean|bool|float|double|object|mixed
Expand Down
8 changes: 4 additions & 4 deletions spec/php-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2569,7 +2569,7 @@ describe 'PHP grammar', ->

expect(lines[1][1]).toEqual value: '@param', scopes: ['source.php', 'comment.block.documentation.phpdoc.php', 'keyword.other.phpdoc.php']
expect(lines[1][2]).toEqual value: ' ', scopes: ['source.php', 'comment.block.documentation.phpdoc.php']
expect(lines[1][3]).toEqual value: '?', scopes: ['source.php', 'comment.block.documentation.phpdoc.php', 'meta.other.type.phpdoc.php']
expect(lines[1][3]).toEqual value: '?', scopes: ['source.php', 'comment.block.documentation.phpdoc.php', 'meta.other.type.phpdoc.php', 'keyword.operator.nullable-type.php']
expect(lines[1][4]).toEqual value: 'int', scopes: ['source.php', 'comment.block.documentation.phpdoc.php', 'meta.other.type.phpdoc.php', 'keyword.other.type.php']
expect(lines[1][5]).toEqual value: ' description', scopes: ['source.php', 'comment.block.documentation.phpdoc.php']

Expand All @@ -2580,7 +2580,7 @@ describe 'PHP grammar', ->

expect(lines[1][1]).toEqual value: '@param', scopes: ['source.php', 'comment.block.documentation.phpdoc.php', 'keyword.other.phpdoc.php']
expect(lines[1][2]).toEqual value: ' ', scopes: ['source.php', 'comment.block.documentation.phpdoc.php']
expect(lines[1][3]).toEqual value: '?', scopes: ['source.php', 'comment.block.documentation.phpdoc.php', 'meta.other.type.phpdoc.php']
expect(lines[1][3]).toEqual value: '?', scopes: ['source.php', 'comment.block.documentation.phpdoc.php', 'meta.other.type.phpdoc.php', 'keyword.operator.nullable-type.php']
expect(lines[1][4]).toEqual value: 'Test', scopes: ['source.php', 'comment.block.documentation.phpdoc.php', 'meta.other.type.phpdoc.php', 'support.class.php']
expect(lines[1][5]).toEqual value: ' description', scopes: ['source.php', 'comment.block.documentation.phpdoc.php']

Expand Down Expand Up @@ -2619,10 +2619,10 @@ describe 'PHP grammar', ->

expect(lines[1][1]).toEqual value: '@param', scopes: ['source.php', 'comment.block.documentation.phpdoc.php', 'keyword.other.phpdoc.php']
expect(lines[1][2]).toEqual value: ' ', scopes: ['source.php', 'comment.block.documentation.phpdoc.php']
expect(lines[1][3]).toEqual value: '?', scopes: ['source.php', 'comment.block.documentation.phpdoc.php', 'meta.other.type.phpdoc.php']
expect(lines[1][3]).toEqual value: '?', scopes: ['source.php', 'comment.block.documentation.phpdoc.php', 'meta.other.type.phpdoc.php', 'keyword.operator.nullable-type.php']
expect(lines[1][4]).toEqual value: 'int', scopes: ['source.php', 'comment.block.documentation.phpdoc.php', 'meta.other.type.phpdoc.php', 'keyword.other.type.php']
expect(lines[1][5]).toEqual value: '|', scopes: ['source.php', 'comment.block.documentation.phpdoc.php', 'meta.other.type.phpdoc.php', 'punctuation.separator.delimiter.php']
expect(lines[1][6]).toEqual value: '?', scopes: ['source.php', 'comment.block.documentation.phpdoc.php', 'meta.other.type.phpdoc.php']
expect(lines[1][6]).toEqual value: '?', scopes: ['source.php', 'comment.block.documentation.phpdoc.php', 'meta.other.type.phpdoc.php', 'keyword.operator.nullable-type.php']
expect(lines[1][7]).toEqual value: 'Class', scopes: ['source.php', 'comment.block.documentation.phpdoc.php', 'meta.other.type.phpdoc.php', 'support.class.php']
expect(lines[1][8]).toEqual value: ' description', scopes: ['source.php', 'comment.block.documentation.phpdoc.php']

Expand Down

0 comments on commit a056647

Please sign in to comment.