diff options
| author | Marijn Haverbeke <[email protected]> | 2011-03-10 16:02:53 +0100 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2011-03-14 14:57:13 -0700 |
| commit | 441697ab359ae2a17c531e5b8e26f66ffcf72992 (patch) | |
| tree | b094368c6bedb50bf52acb2e4fe775e47aef7741 /src/comp | |
| parent | Add basic file-system functionality (diff) | |
| download | rust-441697ab359ae2a17c531e5b8e26f66ffcf72992.tar.xz rust-441697ab359ae2a17c531e5b8e26f66ffcf72992.zip | |
Extend stream functionality
Writer and reader streams now come with methods to write and read
little-endian numbers. Whether that is the right place for such
methods is debatable, but for now, that's where they live.
Diffstat (limited to 'src/comp')
| -rw-r--r-- | src/comp/driver/rustc.rs | 2 | ||||
| -rw-r--r-- | src/comp/front/lexer.rs | 12 | ||||
| -rw-r--r-- | src/comp/front/parser.rs | 2 |
3 files changed, 8 insertions, 8 deletions
diff --git a/src/comp/driver/rustc.rs b/src/comp/driver/rustc.rs index 00d41fff..ed61b340 100644 --- a/src/comp/driver/rustc.rs +++ b/src/comp/driver/rustc.rs @@ -68,7 +68,7 @@ impure fn pretty_print_input(session.session sess, auto def = tup(0, 0); auto p = front.parser.new_parser(sess, env, def, input); auto crate = front.parser.parse_crate_from_source_file(p); - pretty.pprust.print_ast(crate.node.module, std.io.stdout_writer()); + pretty.pprust.print_ast(crate.node.module, std.io.stdout()); } fn warn_wrong_compiler() { diff --git a/src/comp/front/lexer.rs b/src/comp/front/lexer.rs index 0e15e3d8..95fd32c7 100644 --- a/src/comp/front/lexer.rs +++ b/src/comp/front/lexer.rs @@ -1,4 +1,4 @@ -import std.io.stdio_reader; +import std.io; import std._str; import std.map; import std.map.hashmap; @@ -18,9 +18,9 @@ state type reader = state obj { fn get_reserved() -> hashmap[str,()]; }; -fn new_reader(stdio_reader rdr, str filename) -> reader +impure fn new_reader(io.reader rdr, str filename) -> reader { - state obj reader(stdio_reader rdr, + state obj reader(io.reader rdr, str filename, mutable char c, mutable char n, @@ -72,7 +72,7 @@ fn new_reader(stdio_reader rdr, str filename) -> reader col += 1u; } - n = rdr.getc() as char; + n = rdr.read_char() as char; } fn mark() { @@ -200,8 +200,8 @@ fn new_reader(stdio_reader rdr, str filename) -> reader reserved.insert("m128", ()); // IEEE 754-2008 'decimal128' reserved.insert("dec", ()); // One of m32, m64, m128 - ret reader(rdr, filename, rdr.getc() as char, rdr.getc() as char, - 1u, 0u, 1u, 0u, keywords, reserved); + ret reader(rdr, filename, rdr.read_char() as char, + rdr.read_char() as char, 1u, 0u, 1u, 0u, keywords, reserved); } diff --git a/src/comp/front/parser.rs b/src/comp/front/parser.rs index 2ae3b844..832afe20 100644 --- a/src/comp/front/parser.rs +++ b/src/comp/front/parser.rs @@ -115,7 +115,7 @@ impure fn new_parser(session.session sess, if (_str.ends_with(path, ".rc")) { ftype = CRATE_FILE; } - auto srdr = io.new_stdio_reader(path); + auto srdr = io.file_reader(path); auto rdr = lexer.new_reader(srdr, path); auto npos = rdr.get_curr_pos(); ret stdio_parser(sess, env, ftype, lexer.next_token(rdr), |