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

Commit da8fa4a

Browse files
committed
🐛 Don't scope decimals as illegal
1 parent 40ca255 commit da8fa4a

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

grammars/javascript.cson

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,15 +1211,13 @@
12111211
'patterns': [
12121212
{
12131213
'comment': '`prop` in `obj.prop`, `func().prop`'
1214-
'match': '(\\.)\\s*(?:(\\b\\d\\w*)|([A-Z][A-Z0-9_$]*\\b\\$*)|([\\w$]*))'
1214+
'match': '(\\.)\\s*(?:([A-Z][A-Z0-9_$]*\\b\\$*)|(\\$*[a-zA-Z_$][\\w$]*))'
12151215
'captures':
12161216
'1':
12171217
'name': 'meta.delimiter.property.period.js'
12181218
'2':
1219-
'name': 'invalid.illegal.js'
1220-
'3':
12211219
'name': 'constant.other.property.js'
1222-
'4':
1220+
'3':
12231221
'name': 'variable.other.property.js'
12241222
}
12251223
]

spec/javascript-spec.coffee

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,10 +1051,6 @@ describe "Javascript grammar", ->
10511051
{tokens} = grammar.tokenizeLine('123a.prop')
10521052
expect(tokens[0]).toEqual value: '123a', scopes: ['source.js', 'invalid.illegal.js']
10531053

1054-
it "doesn't confuse illegal objects with numbers", ->
1055-
{tokens} = grammar.tokenizeLine('123.')
1056-
expect(tokens[0]).toEqual value: '123', scopes: ['source.js', 'constant.numeric.js']
1057-
10581054
describe "function calls", ->
10591055
it "tokenizes function calls", ->
10601056
{tokens} = grammar.tokenizeLine('functionCall()')
@@ -1220,11 +1216,6 @@ describe "Javascript grammar", ->
12201216
expect(tokens[3]).toEqual value: '.', scopes: ['source.js', 'meta.delimiter.property.period.js']
12211217
expect(tokens[4]).toEqual value: 'b', scopes: ['source.js', 'variable.other.property.js']
12221218

1223-
{tokens} = grammar.tokenizeLine('a.123illegal')
1224-
expect(tokens[0]).toEqual value: 'a', scopes: ['source.js']
1225-
expect(tokens[1]).toEqual value: '.', scopes: ['source.js', 'meta.delimiter.property.period.js']
1226-
expect(tokens[2]).toEqual value: '123illegal', scopes: ['source.js', 'invalid.illegal.js']
1227-
12281219
it "tokenizes constant properties", ->
12291220
{tokens} = grammar.tokenizeLine('obj.MY_CONSTANT')
12301221
expect(tokens[0]).toEqual value: 'obj', scopes: ['source.js', 'variable.other.object.js']

0 commit comments

Comments
 (0)