diff --git a/lib.rs b/lib.rs index 4db2a81a..b67a38d5 100644 --- a/lib.rs +++ b/lib.rs @@ -16,8 +16,10 @@ extern crate test; #[cfg(test)] extern crate serialize; -pub use tokenizer::tokenize; -pub use parser::{parse_stylesheet_rules, parse_rule_list, parse_declaration_list, +pub use tokenizer::{tokenize, Tokenizer}; +pub use parser::{parse_stylesheet_rules, StylesheetParser, + parse_rule_list, RuleListParser, + parse_declaration_list, DeclarationListParser, parse_one_rule, parse_one_declaration, parse_one_component_value}; pub use from_bytes::{decode_stylesheet_bytes, parse_stylesheet_rules_from_bytes}; pub use color::{RGBA, Color, CurrentColor}; diff --git a/parser.rs b/parser.rs index c8cede68..f89e2c7c 100644 --- a/parser.rs +++ b/parser.rs @@ -20,6 +20,10 @@ use std::ascii::StrAsciiExt; use ast::*; +pub struct StylesheetParser{ priv iter: T } +pub struct RuleListParser{ priv iter: T } +pub struct DeclarationListParser{ priv iter: T } + /// Parse top-level of a CSS stylesheet. /// Return a Iterator> #[inline] @@ -98,13 +102,6 @@ pub fn parse_one_component_value>(mut iter: T) // *********** End of public API *********** -// used in from_bytes.rs but not reexported in the crate top-level -pub struct StylesheetParser{ iter: T } - -struct RuleListParser{ iter: T } -struct DeclarationListParser{ iter: T } - - // Work around "error: cannot borrow `*iter` as mutable more than once at a time" // when using a normal for loop. macro_rules! for_iter( diff --git a/tests.rs b/tests.rs index 43fd8503..9cdd1b66 100644 --- a/tests.rs +++ b/tests.rs @@ -16,7 +16,7 @@ use ast::*; fn write_whole_file(path: &Path, data: &str) { match File::open_mode(path, io::Open, io::Write) { - Ok(mut writer) => { writer.write(data.as_bytes()); }, + Ok(mut writer) => { writer.write(data.as_bytes()).unwrap(); }, _ => fail!("could not open file"), } } @@ -48,9 +48,11 @@ fn assert_json_eq(results: json::Json, expected: json::Json, message: ~str) { expected_path.push("expected.json"); write_whole_file(&result_path, results); write_whole_file(&expected_path, expected); - Process::status("colordiff", [~"-u1000", result_path.display().to_str(), - expected_path.display().to_str()]); - }); + Process::status( + "colordiff", + [~"-u1000", result_path.display().to_str(), expected_path.display().to_str()] + ).unwrap(); + }).unwrap(); fail!(message) }