Skip to content

Commit d53e571

Browse files
Lenny222marijnh
authored andcommitted
---
yaml --- r: 6912 b: refs/heads/master c: 6f5a0a3 h: refs/heads/master v: v3
1 parent 3446f80 commit d53e571

File tree

6 files changed

+27
-16
lines changed

6 files changed

+27
-16
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 8005f0c564311fe2a3c0a72a5f3d4482ad0947e2
2+
refs/heads/master: 6f5a0a3b3ba6fc444ce722049cadcfb26a96dc35

trunk/src/comp/syntax/parse/parser.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -910,13 +910,10 @@ fn parse_bottom_expr(p: parser) -> @ast::expr {
910910
ex = ast::expr_fail(some(e));
911911
} else { ex = ast::expr_fail(none); }
912912
} else if eat_word(p, "log_full") {
913-
expect(p, token::LPAREN);
914913
let lvl = parse_expr(p);
915-
expect(p, token::COMMA);
916914
let e = parse_expr(p);
917915
ex = ast::expr_log(2, lvl, e);
918-
hi = p.get_hi_pos();
919-
expect(p, token::RPAREN);
916+
hi = e.span.hi;
920917
} else if eat_word(p, "log") {
921918
let e = parse_expr(p);
922919
ex = ast::expr_log(1, mk_lit_u32(p, 1u32), e);

trunk/src/comp/syntax/print/pprust.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -919,12 +919,8 @@ fn print_expr(s: ps, &&expr: @ast::expr) {
919919
0 { word_nbsp(s, "log_err"); print_expr(s, expr); }
920920
2 {
921921
word_nbsp(s, "log_full");
922-
popen(s);
922+
word(s.s, " ");
923923
print_expr(s, lexp);
924-
word(s.s, ",");
925-
space_if_not_bol(s);
926-
print_expr(s, expr);
927-
pclose(s);
928924
}
929925
}
930926
}

trunk/src/libstd/json.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ tag json {
3434
list(@[json]);
3535
/* Variant: dict */
3636
dict(map::hashmap<str,json>);
37+
/* Variant: null */
38+
null;
3739
}
3840

3941
/*
@@ -233,6 +235,14 @@ fn from_str_bool(s: str) -> (option::t<json>, str) {
233235
}
234236
}
235237

238+
fn from_str_null(s: str) -> (option::t<json>, str) {
239+
if (str::starts_with(s, "null")) {
240+
(some(null), str::slice(s, 4u, str::byte_len(s)))
241+
} else {
242+
(none, s)
243+
}
244+
}
245+
236246
fn from_str_helper(s: str) -> (option::t<json>, str) {
237247
let s = str::trim_left(s);
238248
if str::is_empty(s) { ret (none, s); }
@@ -243,6 +253,7 @@ fn from_str_helper(s: str) -> (option::t<json>, str) {
243253
'{' { from_str_dict(s) }
244254
'0' to '9' | '-' | '+' | '.' { from_str_float(s) }
245255
't' | 'f' { from_str_bool(s) }
256+
'n' { from_str_null(s) }
246257
_ { ret (none, s); }
247258
}
248259
}

trunk/src/snapshots.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
S 2011-12-21 047b02d
2-
winnt-i386 cf6ed4fed5b07357cea5865ff91a9c4a0377a2f0
3-
linux-i386 6f6e329199d4e3e3ce2e9dc595fe6f4334e00684
4-
macos-i386 d125f065125bf0f3186d88afd58a1e471fe830a3
5-
linux-x86_64 c3315c5c679648bcfdf65910f427a37982918b09
6-
macos-x86_64 bab127bc6c383889d482c99e771be5e80405d7c9
1+
S 2011-12-21 5d1cf2a
2+
winnt-i386 5ea4aceb8d40e2987f12c9fc808ef9f3023b8dad
3+
linux-i386 3324be923f2b170b3e426423583a190d666c6da0
4+
macos-i386 c29af3d5e05c9b01a9878859727978a9d9951a2b
5+
linux-x86_64 5ea63b6550d6fef9a70244e6052c9405b6ef6b11
6+
macos-x86_64 ece4fd073ca816a5be8dbcd2f132f96340d2cf85
77

88
S 2011-12-19 edf6e1e
99
winnt-i386 7a358117e123ad3d16fa66106819ec0daf5a6aba

trunk/src/test/stdtest/json.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ import option;
55
import std::json::*;
66
import option::{none, some};
77

8+
#[test]
9+
fn test_from_str_null() {
10+
assert(from_str("null") == some(null));
11+
}
12+
813
#[test]
914
fn test_from_str_num() {
1015
assert(from_str("3") == some(num(3f)));
@@ -31,6 +36,7 @@ fn test_from_str_bool() {
3136
fn test_from_str_list() {
3237
assert(from_str("[]") == some(list(@[])));
3338
assert(from_str("[true]") == some(list(@[boolean(true)])));
39+
assert(from_str("[null]") == some(list(@[null])));
3440
assert(from_str("[3, 1]") == some(list(@[num(3f), num(1f)])));
3541
assert(from_str("[2, [4, 1]]") ==
3642
some(list(@[num(2f), list(@[num(4f), num(1f)])])));
@@ -44,6 +50,7 @@ fn test_from_str_list() {
4450
fn test_from_str_dict() {
4551
assert(from_str("{}") != none);
4652
assert(from_str("{\"a\": 3}") != none);
53+
assert(from_str("{\"a\": null}") != none);
4754
assert(from_str("{\"a\": }") == none);
4855
assert(from_str("{\"a\" }") == none);
4956
assert(from_str("{\"a\"") == none);

0 commit comments

Comments
 (0)