2019-10-11 14:49:14 +00:00
|
|
|
use std::sync::Arc;
|
|
|
|
|
2018-09-28 15:26:53 +00:00
|
|
|
mod compiler;
|
2018-09-28 15:40:20 +00:00
|
|
|
mod implementation;
|
2019-10-11 14:49:14 +00:00
|
|
|
mod interner;
|
|
|
|
mod values;
|
2018-09-28 15:40:20 +00:00
|
|
|
|
2019-10-11 14:49:14 +00:00
|
|
|
use self::compiler::Compiler;
|
2018-10-05 08:54:51 +00:00
|
|
|
use self::implementation::DatabaseImpl;
|
2019-10-11 14:49:14 +00:00
|
|
|
use self::interner::Interner;
|
|
|
|
|
|
|
|
static INPUT_STR: &'static str = r#"
|
|
|
|
lorem,ipsum
|
|
|
|
dolor,sit,amet,
|
|
|
|
consectetur,adipiscing,elit
|
|
|
|
"#;
|
2018-09-28 15:26:53 +00:00
|
|
|
|
2018-09-28 17:54:40 +00:00
|
|
|
#[test]
|
|
|
|
fn test() {
|
2019-10-11 14:49:14 +00:00
|
|
|
let mut db = DatabaseImpl::default();
|
|
|
|
|
|
|
|
db.set_input_string(Arc::new(INPUT_STR.to_owned()));
|
|
|
|
|
|
|
|
let all_fields = db.all_fields();
|
2018-09-28 17:54:40 +00:00
|
|
|
assert_eq!(
|
2019-10-11 14:49:14 +00:00
|
|
|
format!("{:?}", all_fields),
|
|
|
|
"[Field(0), Field(1), Field(2), Field(3), Field(4), Field(5), Field(6), Field(7)]"
|
2018-09-28 17:54:40 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2018-09-28 15:26:53 +00:00
|
|
|
fn main() {
|
2019-10-11 14:49:14 +00:00
|
|
|
let mut db = DatabaseImpl::default();
|
|
|
|
|
|
|
|
db.set_input_string(Arc::new(INPUT_STR.to_owned()));
|
|
|
|
|
|
|
|
for field in db.all_fields().iter() {
|
|
|
|
let field_data = db.lookup_intern_field(*field);
|
|
|
|
println!("{:?} => {:?}", field, field_data);
|
2018-09-28 15:40:20 +00:00
|
|
|
}
|
2018-09-28 15:26:53 +00:00
|
|
|
}
|