Merge branch 'master' into master

This commit is contained in:
Stephen Chung
2020-03-13 18:27:53 +08:00
committed by GitHub
4 changed files with 16 additions and 22 deletions

View File

@@ -4,7 +4,7 @@ use crate::any::Dynamic;
use crate::error::ParseError;
use crate::parser::{Position, INT};
use std::{error::Error, fmt};
use std::{error::Error, fmt, path::PathBuf};
/// Evaluation result.
///
@@ -45,7 +45,7 @@ pub enum EvalAltResult {
/// Wrapped value is the type of the actual result.
ErrorMismatchOutputType(String, Position),
/// Error reading from a script file. Wrapped value is the path of the script file.
ErrorReadingScriptFile(String, std::io::Error),
ErrorReadingScriptFile(PathBuf, std::io::Error),
/// Inappropriate member access.
ErrorDotExpr(String, Position),
/// Arithmetic error encountered. Wrapped value is the error message.
@@ -125,8 +125,8 @@ impl fmt::Display for EvalAltResult {
}
Self::LoopBreak => write!(f, "{}", desc),
Self::Return(_, pos) => write!(f, "{} ({})", desc, pos),
Self::ErrorReadingScriptFile(filename, err) => {
write!(f, "{} '{}': {}", desc, filename, err)
Self::ErrorReadingScriptFile(path, err) => {
write!(f, "{} '{}': {}", desc, path.display(), err)
}
Self::ErrorParsing(p) => write!(f, "Syntax error: {}", p),
Self::ErrorFunctionArgsMismatch(fun, 0, n, pos) => write!(