Tomboy toml dom

For those who are struggling with Rust's cool syntax, our goal is to provide a TOML parser that's as easy as pointing to a menu and eating fast food.
Rustのイケてる構文に難儀している人のために、メニューを指差してファーストフードを食べるぐらい簡単な操作のTOMLパーサーを提供することを目標とします。

It's a tryal and error process. Specifications will change.
試行錯誤中です。 仕様はコロコロ変わるでしょう。

Tomboy is a pun.
トムボーイ(おてんば娘)は語呂合わせです。

References:

Run (実行)

Take a look at the repository.
リポジトリを見てください。

shell cargo run --example comment cargo run --example cover cargo run --example example cargo run --example inline_table cargo run --example key_value_number cargo run --example key_value_wip cargo run --example key_value cargo run --example main cargo run --example mix_array cargo run --example table

Specification (仕様)

The specifications will gradually solidify.
仕様は少しずつ固めていきます。

You can think that you can't do anything that isn't written here.
ここに書かれていないことは何もできないと思ってもらって構いません。

``rust //! An exemplary program. //! 模範的なプログラム。 //! //!cargo run --example example`

extern crate tomboytomldom;

use tomboytomldom::model::layer310::Document; use tomboytomldom::Toml;

fn main() { // Read a toml. // Toml読取。 let tomlfile = "./resource/example.toml"; let doc = Toml::fromfile(toml_file);

// Read a number.
// 数値読取。
test_age(&doc);
test_weight(&doc);

// WIP. Read a string.
// 作業中。 文字列読取。
test_apple(&doc);
test_basic_strings_empty(&doc);
test_basic_strings_escape_backslash(&doc);
test_basic_strings_escape_double_quotation(&doc);
test_basic_strings_punctuation(&doc);
test_multiline_basic_strings_letter(&doc);
test_multiline_basic_strings_punctuation(&doc);
test_multiline_basic_strings_trim_start(&doc);

// Read a boolean.
// 論理値読取。
test_boolean_true(&doc);
test_boolean_false(&doc);

}

fn testage(doc: &Document) { if let Some(age) = doc.geti128bykey("age") { println!("age = {}", age); // age = 40 } } fn testweight(doc: &Document) { if let Some(age) = doc.getf64bykey("weight") { println!("weight = {}", age); // weight = 93.5 } } fn testapple(doc: &Document) { // "pie" if let Some(apple) = doc.getstrbykey("apple") { println!("apple = {}", apple); // apple = pie } } fn testbasicstringsempty(doc: &Document) { // "" if let Some(basicstringsempty) = doc.getstrbykey("basicstringsempty") { println!("basicstringsempty = {}", basicstringsempty); // basicstringsempty = } } fn testbasicstringsescapebackslash(doc: &Document) { // "\" if let Some(basicstringsescapebackslash) = doc.getstrbykey("basicstringsescapebackslash") { println!( "basicstringsescapebackslash = {}", basicstringsescapebackslash ); // basicstringsescapebackslash = \ } } fn testbasicstringsescapedoublequotation(doc: &Document) { // "\"" if let Some(basicstringsescapedoublequotation) = doc.getstrbykey("basicstringsescapedoublequotation") { println!( "basicstringsescapedoublequotation = {}", basicstringsescapedoublequotation ); // basicstringsescapedoublequotation = \ } } fn testbasicstringspunctuation(doc: &Document) { // "., ={}[]'\"\!?" if let Some(basicstringspunctuation) = doc.getstrbykey("basicstringspunctuation") { println!("basicstringspunctuation = {}", basicstringspunctuation); // basicstringspunctuation = ., ={}[]'"!? } } fn testmultilinebasicstringsletter(doc: &Document) { // """Hello, // world!!""" if let Some(multilinebasicstringsletter) = doc.getstrbykey("multilinebasicstringsletter") { println!( "multilinebasicstringsletter = {}", multilinebasicstringsletter ); // multilinebasicstringsletter = Hello, // world!! } } fn testmultilinebasicstringspunctuation(doc: &Document) { // """., ={}[]"'""\ // !?""" if let Some(multilinebasicstringspunctuation) = doc.getstrbykey("multilinebasicstringspunctuation") { println!( "multilinebasicstringspunctuation = {}", multilinebasicstringspunctuation ); // multilinebasicstringspunctuation = ., ={}[]"'""\ // !? } } fn testmultilinebasicstringstrimstart(doc: &Document) { // """\ // The quick brown \ // fox jumps over \ // the lazy dog.\ // """ if let Some(multilinebasicstringstrimstart) = doc.getstrbykey("multilinebasicstringstrimstart") { println!( "multilinebasicstringstrimstart = {}", multilinebasicstringstrimstart ); // multilinebasicstringstrimstart = } } fn testbooleantrue(doc: &Document) { if let Some(adult) = doc.getboolbykey("adult") { println!("adult = {}", adult); // adult = true } } fn testbooleanfalse(doc: &Document) { if let Some(student) = doc.getboolbykey("student") { println!("student = {}", student); // student = false } } ```

TODO