///|
/// What is wrong with the text of a path.
#derive(Eq, Debug)
pub(all) enum PathErrorCode {
/// A character is where it cannot be.
PathSyntax
UnmatchedParenthesis
UnclosedIndexer
/// There is no name between two dots, or after the last one.
EmptySegment
/// `[]` has no argument. `[ ]` has an empty one.
EmptyIndexer
/// Syntax of WPF or Avalonia that this package does not have.
UnsupportedSyntax
UnknownPrefix
UnknownOwner
/// The owner type belongs to another registry than the path.
RegistryMismatch
UnknownProperty
UnknownArgumentType
/// The text of a typed argument is no value of its type.
ArgumentConversion
}
///|
/// Why a text is no path. `start` and `end` are the part of the text that is wrong, in UTF-16 code units.
#derive(Eq, Debug)
pub(all) suberror PathParseError {
PathParseError(
code~ : PathErrorCode,
message~ : String,
start~ : Int32,
end~ : Int32,
)
}
///|
/// The message and the range.
pub impl Show for PathParseError with fn output(self, logger) {
let PathParseError(message~, start~, end~, ..) = self
logger.write_string("\{message}, at [\{start}, \{end}) of the path")
}
///|
pub extend PathParseError with Show::{to_string}