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

Explicit octal notation #433

Merged
merged 1 commit into from
Jul 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions grammars/php.cson
Original file line number Diff line number Diff line change
Expand Up @@ -2231,6 +2231,10 @@
'match': '0[bB][01]+(?:_[01]+)*'
'name': 'constant.numeric.binary.php'
}
{
'match': '0[oO][0-7]+(?:_[0-7]+)*'
'name': 'constant.numeric.octal.php'
}
{
'match': '0(?:_?[0-7]+)+'
'name': 'constant.numeric.octal.php'
Expand Down
12 changes: 12 additions & 0 deletions spec/php-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -1957,6 +1957,12 @@ describe 'PHP grammar', ->
{tokens} = grammar.tokenizeLine '0010'
expect(tokens[0]).toEqual value: '0010', scopes: ['source.php', 'constant.numeric.octal.php']

{tokens} = grammar.tokenizeLine '0o010'
expect(tokens[0]).toEqual value: '0o010', scopes: ['source.php', 'constant.numeric.octal.php']

{tokens} = grammar.tokenizeLine '0O10'
expect(tokens[0]).toEqual value: '0O10', scopes: ['source.php', 'constant.numeric.octal.php']

it 'tokenizes decimals', ->
{tokens} = grammar.tokenizeLine '1234'
expect(tokens[0]).toEqual value: '1234', scopes: ['source.php', 'constant.numeric.decimal.php']
Expand Down Expand Up @@ -2011,6 +2017,12 @@ describe 'PHP grammar', ->
{tokens} = grammar.tokenizeLine '0_655'
expect(tokens[0]).toEqual value: '0_655', scopes: ['source.php', 'constant.numeric.octal.php']

{tokens} = grammar.tokenizeLine '0o6_4_4'
expect(tokens[0]).toEqual value: '0o6_4_4', scopes: ['source.php', 'constant.numeric.octal.php']

{tokens} = grammar.tokenizeLine '0O6_4_4'
expect(tokens[0]).toEqual value: '0O6_4_4', scopes: ['source.php', 'constant.numeric.octal.php']

it 'tokenizes decimals', ->
{tokens} = grammar.tokenizeLine '1_234'
expect(tokens[0]).toEqual value: '1_234', scopes: ['source.php', 'constant.numeric.decimal.php']
Expand Down