Set up SGF reading and start on the game database #47
|
@ -379,17 +379,27 @@ fn parse_propval<'a, E: nom::error::ParseError<&'a str>>(
|
||||||
) -> IResult<&'a str, String, E> {
|
) -> IResult<&'a str, String, E> {
|
||||||
let (input, _) = multispace0(input)?;
|
let (input, _) = multispace0(input)?;
|
||||||
println!("- {}", input);
|
println!("- {}", input);
|
||||||
|
|
||||||
let (input, _) = tag("[")(input)?;
|
let (input, _) = tag("[")(input)?;
|
||||||
println!("-- {}", input);
|
println!("-- {}", input);
|
||||||
|
|
||||||
|
let (input, value) = parse_propval_text(input)?;
|
||||||
|
println!("--- {}", input);
|
||||||
|
|
||||||
|
let (input, _) = tag("]")(input)?;
|
||||||
|
|
||||||
|
Ok((input, value.unwrap_or(String::new())))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn parse_propval_text<'a, E: nom::error::ParseError<&'a str>>(
|
||||||
|
input: &'a str,
|
||||||
|
) -> IResult<&'a str, Option<String>, E> {
|
||||||
let (input, value) = opt(escaped_transform(
|
let (input, value) = opt(escaped_transform(
|
||||||
is_not(r"\]"),
|
is_not(r"\]"),
|
||||||
'\\',
|
'\\',
|
||||||
alt((value("]", tag("\\]")), value("", tag("\\\n")))),
|
value("]", tag(r"\]")), // alt((value("]", tag(r"\]")), value("", tag("\\\n")))),
|
||||||
))(input)?;
|
))(input)?;
|
||||||
println!("--- {}", input);
|
Ok((input, value.map(|v| v.to_owned())))
|
||||||
let (input, _) = tag("]")(input)?;
|
|
||||||
|
|
||||||
Ok((input, value.map(|v| v.to_owned()).unwrap_or(String::new())))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_size<'a, E: nom::error::ParseError<&'a str>>(input: &'a str) -> IResult<&'a str, Size, E> {
|
fn parse_size<'a, E: nom::error::ParseError<&'a str>>(input: &'a str) -> IResult<&'a str, Size, E> {
|
||||||
|
|
Loading…
Reference in New Issue