Skip to content

Commit 0c1fa65

Browse files
committed
---
yaml --- r: 14550 b: refs/heads/try c: 0465d52 h: refs/heads/master v: v3
1 parent 3255ff8 commit 0c1fa65

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: cccb0fbf72389758d6a2880ebd613a53bbf59bf1
5+
refs/heads/try: 0465d5217d7268aed71d1cc99bf025ee1fe748b5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/libstd/json.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ impl parser for parser {
392392

393393
if self.ch == ']' {
394394
self.bump();
395+
self.parse_whitespace();
395396
ret ok(list(values));
396397
}
397398

@@ -406,7 +407,11 @@ impl parser for parser {
406407

407408
alt self.ch {
408409
',' { self.bump(); }
409-
']' { self.bump(); ret ok(list(values)); }
410+
']' {
411+
self.bump();
412+
self.parse_whitespace();
413+
ret ok(list(values));
414+
}
410415
_ { ret self.error("expecting ',' or ']'"); }
411416
}
412417
}
@@ -422,6 +427,7 @@ impl parser for parser {
422427

423428
if self.ch == '}' {
424429
self.bump();
430+
self.parse_whitespace();
425431
ret ok(dict(values));
426432
}
427433

@@ -453,7 +459,11 @@ impl parser for parser {
453459

454460
alt self.ch {
455461
',' { self.bump(); }
456-
'}' { self.bump(); ret ok(dict(values)); }
462+
'}' {
463+
self.bump();
464+
self.parse_whitespace();
465+
ret ok(dict(values));
466+
}
457467
_ {
458468
if self.eof() { break; }
459469
ret self.error("expecting ',' or '}'");
@@ -691,6 +701,7 @@ mod tests {
691701
assert from_str("[ false ]") == ok(list([boolean(false)]));
692702
assert from_str("[null]") == ok(list([null]));
693703
assert from_str("[3, 1]") == ok(list([num(3f), num(1f)]));
704+
assert from_str("\n[3, 2]\n") == ok(list([num(3f), num(2f)]));
694705
assert from_str("[2, [4, 1]]") ==
695706
ok(list([num(2f), list([num(4f), num(1f)])]));
696707
}
@@ -727,6 +738,8 @@ mod tests {
727738

728739
assert eq(result::get(from_str("{ \"a\": null, \"b\" : true }")),
729740
mk_dict([("a", null), ("b", boolean(true))]));
741+
assert eq(result::get(from_str("\n{ \"a\": null, \"b\" : true }\n")),
742+
mk_dict([("a", null), ("b", boolean(true))]));
730743
assert eq(result::get(from_str("{\"a\" : 1.0 ,\"b\": [ true ]}")),
731744
mk_dict([
732745
("a", num(1.0)),

0 commit comments

Comments
 (0)