pub fn parse_complex(to_parse: &str) -> Result<Unifiable, String>
Expand description
Parses a string to produce a complex term.
§Arguments
to_parse
- &str
§Return
Result
- Ok(SComplex) or Err(message)
§Usage
use suiron::*;
let cmplx = parse_complex("symptom(Covid, fever)");
match cmplx {
Ok(c) => { println!("{}", c); },
Err(err) => { println!("{}", err); },
}
// Prints: symptom(Covid, fever)
§Note
Backslash is used to escape characters, such as the comma.
For example:
use suiron::*;
let cmplx = parse_complex("punctuation(comma, \\,)");
match cmplx {
Ok(c) => { println!("{}", c); },
Err(err) => { println!("{}", err); },
}
// Prints: punctuation(comma, ,)
The backslash is doubled because the Rust compiler also interprets the backslash.