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

Commit a056647

Browse files
committed
Tokenize '?' as 'keyword.operator.nullable-type.php' in nullable types in comments.
1 parent 18862cf commit a056647

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

grammars/php.cson

+4
Original file line numberDiff line numberDiff line change
@@ -2499,6 +2499,10 @@
24992499
'captures':
25002500
'0':
25012501
'patterns': [
2502+
{
2503+
'match': '\\?'
2504+
'name': 'keyword.operator.nullable-type.php'
2505+
}
25022506
{
25032507
'match': '''(?x)\\b
25042508
(string|integer|int|boolean|bool|float|double|object|mixed

spec/php-spec.coffee

+4-4
Original file line numberDiff line numberDiff line change
@@ -2569,7 +2569,7 @@ describe 'PHP grammar', ->
25692569

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

@@ -2580,7 +2580,7 @@ describe 'PHP grammar', ->
25802580

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

@@ -2619,10 +2619,10 @@ describe 'PHP grammar', ->
26192619

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

0 commit comments

Comments
 (0)