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

Commit f58c024

Browse files
committed
Merge pull request #10 from bucaran/fix-json-number
Fix grammar to validate JSON numbers.
2 parents e06867d + 99748b0 commit f58c024

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

grammars/json.cson

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
'name': 'constant.language.json'
4343
'number':
4444
'comment': 'handles integer and decimal numbers'
45-
'match': '(?x: # turn on extended mode\n\t\t\t -? # an optional minus\n\t\t\t (?:\n\t\t\t 0 # a zero\n\t\t\t | # ...or...\n\t\t\t [1-9] # a 1-9 character\n\t\t\t \\d* # followed by zero or more digits\n\t\t\t )\n\t\t\t (?:\n\t\t\t (?:\n\t\t\t \\. # a period\n\t\t\t \\d+ # followed by one or more digits\n\t\t\t )?\n\t\t\t (?:\n\t\t\t [eE] # an e character\n\t\t\t [+-]? # followed by an option +/-\n\t\t\t \\d+ # followed by one or more digits\n\t\t\t )? # make exponent optional\n\t\t\t )? # make decimal portion optional\n\t\t\t )'
45+
'match': '-?(?=[1-9]|0(?!\\d))\\d+(\\.\\d+)?([eE][+-]?\\d+)?'
4646
'name': 'constant.numeric.json'
4747
'object':
4848
'begin': '\\{'

0 commit comments

Comments
 (0)