A SGF Parser for Rust. Supports all SGF properties, and tree branching.
NOTE when converting a GameTree
to a string we convert all charset tokens to be UTF-8, since
that is the encoding for all strings in Rust.
Using pest
for the actual parsing part.
Code quality is ensured by running both cargo clippy
and cargo fmt
on each commit.
All code should also be unit tested.
```rust use sgf_parser::*;
let sgfsource = "(;C[comment]EV[event]PB[black]PW[white];B[aa])";
let tree: Result
let tree = tree.unwrap(); let unknownnodes = tree.getunknownnodes(); asserteq!(unknown_nodes.len(), 0);
let invalidnodes = tree.getinvalidnodes(); asserteq!(invalid_nodes.len(), 0);
tree.iter().foreach(|node| { assert!(!node.tokens.isempty()); });
let sgfstring: String = tree.into(); asserteq!(sgfsource, sgfstring()); ```