1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//! Data structures and utilities for parsing [SGF FF\[4\] files](https://www.red-bean.com/sgf/).
//!
//! ## Quick Start
//!
//! Most common use case - parsing a Go game and iterating through its moves:
//! ```rust
//! use sgf_parse::{parse, go::Prop, go::Move};
//!
//! let sgf = "(;FF[4]GM[1]B[aa];W[ab])";
//!
//! let collection = parse(sgf).unwrap();
//! let root_node = collection.first().unwrap().as_go_node().unwrap();
//!
//! // Iterate through the main variation
//! for node in root_node.main_variation() {
//! if let Some(prop) = node.get_move() {
//! println!("Move: {}", prop);
//! }
//! }
//! ```
//!
//! Working with multi-game collections:
//! ```rust
//! # use sgf_parse::parse;
//! let sgf = "(;FF[4]GM[1];B[aa])(;FF[4]GM[1];B[dd])";
//! let collection = parse(sgf).unwrap();
//!
//! for gametree in &collection {
//! let root_node = gametree.as_go_node().unwrap();
//! println!("Game has {} nodes", root_node.main_variation().count());
//! }
//! ```
//!
//! For reading SGFs your starting point will likely be [`go::parse`]. For parsing non-go games
//! check out the [`parse`](`parse()`) function.
//!
//! For writing SGFs check out [`SgfNode::serialize`] for writing single game trees or
//! [`serialize`](`serialize()`) for writing whole collections.
pub use ;
pub use LexerError;
pub use ;
pub use ;
pub use serialize;
pub use ;