#[macro_use]
extern crate nom;
use std::io::{Read};
use std::fs::File;
use std::path::Path;
mod error;
pub use error::Error;
pub type Result<T> = ::std::result::Result<T, Error>;
pub mod reader;
pub use reader::Reader;
mod entry;
pub use entry::{Table, Entry, Statement, Value};
pub mod parser;
pub fn open<P: AsRef<Path>>(path: P) -> Result<Reader<File>> {
Ok(Reader::from(try!(File::open(path))))
}
pub fn read<R: Read>(stream: R) -> Result<Reader<R>> {
Ok(Reader::from(stream))
}
pub fn load<P: AsRef<Path>>(path: P) -> Result<Entry> {
Ok(try!(Table::load(&mut try!(open(path)))).into())
}