Add a highlight subcommand

This commit is contained in:
Max Brunsfeld 2019-02-19 11:24:50 -08:00
parent 0dd15e2b02
commit e89b6b2402
14 changed files with 1870 additions and 22 deletions

View file

@ -1,4 +1,5 @@
use std::io;
use tree_sitter_highlight::PropertySheetError;
#[derive(Debug)]
pub struct Error(pub String);
@ -42,3 +43,13 @@ impl From<String> for Error {
Error(error)
}
}
impl From<PropertySheetError> for Error {
fn from(error: PropertySheetError) -> Self {
match error {
PropertySheetError::InvalidFormat(e) => Self::from(e),
PropertySheetError::InvalidRegex(e) => Self::regex(&e.to_string()),
PropertySheetError::InvalidJSON(e) => Self::from(e),
}
}
}