Skip to content

Commit fdf506b

Browse files
committed
---
yaml --- r: 142516 b: refs/heads/try2 c: 52949fb h: refs/heads/master v: v3
1 parent 018ef18 commit fdf506b

File tree

3 files changed

+10
-30
lines changed

3 files changed

+10
-30
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 37494d39d38be33a589a1f46dae38fe2ceb9d94f
8+
refs/heads/try2: 52949fbf1876ecd03303006c534a74c5e29bc90d
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libextra/json.rs

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -481,30 +481,22 @@ pub fn to_pretty_str(json: &Json) -> ~str {
481481
io::with_str_writer(|wr| to_pretty_writer(wr, json))
482482
}
483483

484-
static BUF_SIZE : uint = 64000;
485-
486484
#[allow(missing_doc)]
487485
pub struct Parser {
488486
priv rdr: @io::Reader,
489-
priv buf: ~[char],
490-
priv buf_idx: uint,
491487
priv ch: char,
492488
priv line: uint,
493489
priv col: uint,
494490
}
495491

496492
/// Decode a json value from an io::reader
497493
pub fn Parser(rdr: @io::Reader) -> Parser {
498-
let mut p = Parser {
494+
Parser {
499495
rdr: rdr,
500-
buf: rdr.read_chars(BUF_SIZE),
501-
buf_idx: 0,
502-
ch: 0 as char,
496+
ch: rdr.read_char(),
503497
line: 1,
504-
col: 0,
505-
};
506-
p.bump();
507-
p
498+
col: 1,
499+
}
508500
}
509501

510502
impl Parser {
@@ -529,26 +521,13 @@ impl Parser {
529521
fn eof(&self) -> bool { self.ch == -1 as char }
530522

531523
fn bump(&mut self) {
532-
if self.eof() {
533-
return;
534-
}
535-
536-
self.col += 1u;
537-
538-
if self.buf_idx >= self.buf.len() {
539-
self.buf = self.rdr.read_chars(BUF_SIZE);
540-
if self.buf.len() == 0 {
541-
self.ch = -1 as char;
542-
return;
543-
}
544-
self.buf_idx = 0;
545-
}
546-
self.ch = self.buf[self.buf_idx];
547-
self.buf_idx += 1;
524+
self.ch = self.rdr.read_char();
548525

549526
if self.ch == '\n' {
550527
self.line += 1u;
551528
self.col = 1u;
529+
} else {
530+
self.col += 1u;
552531
}
553532
}
554533

branches/try2/src/libstd/char.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ pub fn is_uppercase(c: char) -> bool { general_category::Lu(c) }
8282
///
8383
#[inline]
8484
pub fn is_whitespace(c: char) -> bool {
85-
('\x09' <= c && c <= '\x0d')
85+
c == ' '
86+
|| ('\x09' <= c && c <= '\x0d')
8687
|| general_category::Zs(c)
8788
|| general_category::Zl(c)
8889
|| general_category::Zp(c)

0 commit comments

Comments
 (0)