Code cleanups
This commit is contained in:
parent
18216160c9
commit
31e70bfc2a
|
@ -4,7 +4,7 @@ pub use date::Date;
|
||||||
// pub mod go;
|
// pub mod go;
|
||||||
|
|
||||||
mod tree;
|
mod tree;
|
||||||
use tree::parse_collection;
|
use tree::{parse_collection, Tree};
|
||||||
|
|
||||||
// mod game;
|
// mod game;
|
||||||
|
|
||||||
|
@ -18,8 +18,12 @@ pub enum Game {
|
||||||
Go(go::Game),
|
Go(go::Game),
|
||||||
Unsupported(tree::Tree),
|
Unsupported(tree::Tree),
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
pub fn parse_sgf(input: &str) -> Result<Vec<Game>, Error> {
|
pub fn parse_sgf(input: &str) -> Result<Vec<Tree>, Error> {
|
||||||
|
let (_, trees) = parse_collection::<nom::error::VerboseError<&str>>(input)?;
|
||||||
|
Ok(trees)
|
||||||
|
/*
|
||||||
let (_, trees) = parse_collection::<nom::error::VerboseError<&str>>(input)?;
|
let (_, trees) = parse_collection::<nom::error::VerboseError<&str>>(input)?;
|
||||||
Ok(trees
|
Ok(trees
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
@ -30,8 +34,8 @@ pub fn parse_sgf(input: &str) -> Result<Vec<Game>, Error> {
|
||||||
_ => Game::Unsupported(t),
|
_ => Game::Unsupported(t),
|
||||||
})
|
})
|
||||||
.collect::<Vec<Game>>())
|
.collect::<Vec<Game>>())
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
impl From<(&str, VerboseErrorKind)> for
|
impl From<(&str, VerboseErrorKind)> for
|
||||||
|
|
|
@ -2,7 +2,7 @@ use crate::{Color, Error, GameResult};
|
||||||
use nom::{
|
use nom::{
|
||||||
branch::alt,
|
branch::alt,
|
||||||
bytes::complete::{escaped_transform, tag},
|
bytes::complete::{escaped_transform, tag},
|
||||||
character::complete::{alpha1, digit1, multispace0, multispace1, none_of},
|
character::complete::{alpha1, multispace0, multispace1, none_of},
|
||||||
combinator::{opt, value},
|
combinator::{opt, value},
|
||||||
multi::{many0, many1, separated_list1},
|
multi::{many0, many1, separated_list1},
|
||||||
IResult,
|
IResult,
|
||||||
|
@ -646,6 +646,7 @@ fn parse_propval_text<'a, E: nom::error::ParseError<&'a str>>(
|
||||||
Ok((input, value.map(|v| v.to_owned())))
|
Ok((input, value.map(|v| v.to_owned())))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
pub fn parse_size<'a, E: nom::error::ParseError<&'a str>>(
|
pub fn parse_size<'a, E: nom::error::ParseError<&'a str>>(
|
||||||
input: &'a str,
|
input: &'a str,
|
||||||
) -> IResult<&'a str, Size, E> {
|
) -> IResult<&'a str, Size, E> {
|
||||||
|
@ -660,6 +661,7 @@ pub fn parse_size<'a, E: nom::error::ParseError<&'a str>>(
|
||||||
};
|
};
|
||||||
Ok((input, Size { width, height }))
|
Ok((input, Size { width, height }))
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
|
|
Loading…
Reference in New Issue