Require documentation on reader public items.

This commit is contained in:
Jakob Stoklund Olesen
2016-10-26 17:43:18 -07:00
parent 447baf015e
commit e2418c6ec9
4 changed files with 21 additions and 0 deletions

View File

@@ -8,13 +8,16 @@ use std::result;
/// The location of a `Token` or `Error`.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub struct Location {
/// Line number, starting from 1.
pub line_number: usize,
}
/// A parse error is returned when the parse failed.
#[derive(Debug)]
pub struct Error {
/// Location of the error.
pub location: Location,
/// Error message.
pub message: String,
}
@@ -24,6 +27,7 @@ impl fmt::Display for Error {
}
}
/// Result of a parser operation. The `Error` variant includes a location.
pub type Result<T> = result::Result<T, Error>;
// Create an `Err` variant of `Result<X>` from a location and `format!` args.