Skip to content
This repository has been archived by the owner on Jun 1, 2021. It is now read-only.

Commit

Permalink
Properly parse negative numbers in json literals
Browse files Browse the repository at this point in the history
  • Loading branch information
kkashin committed Mar 15, 2016
1 parent 19ce744 commit e064729
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 81 deletions.
3 changes: 3 additions & 0 deletions compiler/planout.jison
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ array
json: /* true, false, null, etc. */
IDENTIFIER { $$ = JSON.parse($1); }
| CONST { $$ = $1; }
| '-' json_neg_num {$$ = $2; }
| '[' json_array ']' { $$ = $2; }
| '{' json_map '}' { $$ = $2; }
;
Expand All @@ -181,6 +182,8 @@ json_map: /* empty */ { $$ = {}; }
| json_map ',' json ':' json { $$ = $1; $$[$3] = $5; }
;

json_neg_num: CONST { $$ = -$1; };

arguments
: /* empty */
{ $$ = {}; }
Expand Down

0 comments on commit e064729

Please sign in to comment.