Skip to content

Commit

Permalink
Literal cannot begin with a character ':' when it follows after '" to…
Browse files Browse the repository at this point in the history
… improve JSON compatibility (syntax BC break)
  • Loading branch information
dg committed Dec 27, 2019
1 parent 00f31ef commit e4e30bd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
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
3 changes: 3 additions & 0 deletions tests/Neon/Decoder.inline.array.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,6 @@ Assert::equal(
]),
Neon::decode('1() 2()')
);

// JSON compatibility
Assert::same(['a' => true], Neon::decode('{"a":true}'));

0 comments on commit e4e30bd

Please sign in to comment.