Add support for reading begin/end bounds in the new standard-properties format.

This commit is contained in:
Tom Alexander
2023-08-13 01:06:55 -04:00
parent f7afcec824
commit e33ec4a02c
3 changed files with 33 additions and 9 deletions

View File

@@ -74,6 +74,13 @@ enum ParseState {
}
impl<'s> Token<'s> {
pub fn as_vector<'p>(&'p self) -> Result<&'p Vec<Token<'s>>, Box<dyn std::error::Error>> {
Ok(match self {
Token::Vector(children) => Ok(children),
_ => Err(format!("wrong token type {:?}", self)),
}?)
}
pub fn as_list<'p>(&'p self) -> Result<&'p Vec<Token<'s>>, Box<dyn std::error::Error>> {
Ok(match self {
Token::List(children) => Ok(children),