Skip to content

Commit

Permalink
Literal cannot begin with a character - or : followed by =[{( (syntax…
Browse files Browse the repository at this point in the history
… BC break)
  • Loading branch information
dg committed Dec 27, 2019
1 parent 9cd8bcb commit 00f31ef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Neon/Decoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ final class Decoder

// literal / boolean / integer / float
'
(?: [^#"\',:=[\]{}()\x00-\x20`-] | [:-][^"\',\]})\s] )
(?: [^#"\',:=[\]{}()\x00-\x20`-] | [:-] [^"\',=[\]{}()\s] )
(?:
[^,:=\]})(\x00-\x20]++ |
:(?! [\s,\]})] | $ ) |
Expand Down
13 changes: 7 additions & 6 deletions tests/Neon/Decoder.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -126,19 +126,13 @@ $dataSet = [

['!hello', '!hello'],

[':[', ':['],
[':{', ':{'],
[':(', ':('],
['::', '::'],
[':0', ':0'],
[':-1', ':-1'],
[':true', ':true'],
[':false', ':false'],
[':null', ':null'],
[':NULL', ':NULL'],
['-[', '-['],
['-{', '-{'],
['-(', '-('],
['-:', '-:'],
['-0', -0],
['-true', '-true'],
Expand Down Expand Up @@ -211,6 +205,13 @@ $dataSet = [
['=abc'],
['{a :b}'],
['a :b'],

['-['],
['-{'],
['-('],
[':['],
[':{'],
[':('],
],

// RFC JSON with valid syntax which can not be encoded in UTF-8
Expand Down

0 comments on commit 00f31ef

Please sign in to comment.