Function sgf_parse::parse[][src]

pub fn parse(text: &str) -> Result<Vec<SgfNode>, SgfParseError>

Returns a Vector of the root SgfNodes parsed from the provided text.

Any SgfNode returned by this function should be valid according to the SGF specification.

Errors

If the text isn't a valid SGF FF[4] collection, then an error is returned.

Examples

use sgf_parse::parse;

// Prints the all the properties for the two root nodes in the SGF
let sgf = "(;SZ[9]C[Some comment];B[de];W[fe])(;B[de];W[ff])";
for node in parse(&sgf).unwrap().iter() {
    for prop in node.properties() {
        println!("{:?}", prop);
    }
}