update document link. rename error.

This commit is contained in:
fengcen 2016-11-17 00:28:54 +08:00
parent 1d84eea270
commit 638b0d8af2
3 changed files with 7 additions and 7 deletions

View File

@ -1,12 +1,12 @@
[package]
name = "eval"
version = "0.1.0"
version = "0.1.1"
description = "Expression evaluator"
keywords = ["expression", "evaluate", "evaluator", "expr"]
authors = ["fengcen <fengcen.love@gmail.com>"]
repository = "https://github.com/fengcen/eval.git"
homepage = "https://github.com/fengcen/eval"
documentation = "https://github.com/fengcen/eval"
documentation = "https://docs.rs/eval"
readme = "README.md"
license = "MIT"

View File

@ -63,9 +63,9 @@ quick_error! {
UnsupportedTypes(a: String, b: String) {
display("This two value types are different or do not support mathematical calculations: {}, {}", a, b)
}
/// Invalid array expression like `1..2..3`
InvalidArray(ident: String) {
display("Invalid array expression: {}", ident)
/// Invalid range expression like `1..2..3`
InvalidRange(ident: String) {
display("Invalid range expression: {}", ident)
}
/// Custom error.
Custom(detail: String) {

View File

@ -472,7 +472,7 @@ fn is_range(ident: &str) -> bool {
fn parse_range(ident: &str) -> Result<Value, Error> {
let segments = ident.split("..").collect::<Vec<_>>();
if segments.len() != 2 {
Err(Error::InvalidArray(ident.to_owned()))
Err(Error::InvalidRange(ident.to_owned()))
} else {
let start = segments[0].parse::<i64>();
let end = segments[1].parse::<i64>();
@ -484,7 +484,7 @@ fn parse_range(ident: &str) -> Result<Value, Error> {
}
Ok(to_value(array))
} else {
Err(Error::InvalidArray(ident.to_owned()))
Err(Error::InvalidRange(ident.to_owned()))
}
}
}