difftreelog
Merge pull request #58 from CertainLach/fix/number-parsing
in: master
Fix number parsing
3 files changed
cmds/jrsonnet/src/main.rsdiffbeforeafterboth--- a/cmds/jrsonnet/src/main.rs
+++ b/cmds/jrsonnet/src/main.rs
@@ -131,8 +131,8 @@
fn main_real(state: &EvaluationState, opts: Opts) -> Result<(), Error> {
opts.gc.configure_global();
- opts.general.configure(&state)?;
- opts.manifest.configure(&state)?;
+ opts.general.configure(state)?;
+ opts.manifest.configure(state)?;
let val = if opts.input.exec {
state.evaluate_snippet_raw(
@@ -158,7 +158,7 @@
}
for (file, data) in state.manifest_multi(val)?.iter() {
let mut path = multi.clone();
- path.push(&file as &str);
+ path.push(file as &str);
if opts.output.create_output_dirs {
let mut dir = path.clone();
dir.pop();
crates/jrsonnet-evaluator/src/error.rsdiffbeforeafterboth--- a/crates/jrsonnet-evaluator/src/error.rs
+++ b/crates/jrsonnet-evaluator/src/error.rs
@@ -189,6 +189,6 @@
#[macro_export]
macro_rules! throw {
($e: expr) => {
- return Err($e.into());
+ return Err($e.into())
};
}
crates/jrsonnet-parser/src/lib.rsdiffbeforeafterboth44 rule digit() -> char = d:$(['0'..='9']) {d.chars().next().unwrap()}44 rule digit() -> char = d:$(['0'..='9']) {d.chars().next().unwrap()}45 rule end_of_ident() = !['0'..='9' | '_' | 'a'..='z' | 'A'..='Z']45 rule end_of_ident() = !['0'..='9' | '_' | 'a'..='z' | 'A'..='Z']46 /// Sequence of digits46 /// Sequence of digits47 rule uint() -> u64 = a:$(digit()+) { a.parse().unwrap() }47 rule uint_str() -> &'input str = a:$(digit()+) { a }48 /// Number in scientific notation format48 /// Number in scientific notation format49 rule number() -> f64 = quiet!{a:$(uint() ("." uint())? (['e'|'E'] (s:['+'|'-'])? uint())?) { a.parse().unwrap() }} / expected!("<number>")49 rule number() -> f64 = quiet!{a:$(uint_str() ("." uint_str())? (['e'|'E'] (s:['+'|'-'])? uint_str())?) {? a.parse().map_err(|_| "<number>") }} / expected!("<number>")505051 /// Reserved word followed by any non-alphanumberic51 /// Reserved word followed by any non-alphanumberic52 rule reserved() = ("assert" / "else" / "error" / "false" / "for" / "function" / "if" / "import" / "importstr" / "in" / "local" / "null" / "tailstrict" / "then" / "self" / "super" / "true") end_of_ident()52 rule reserved() = ("assert" / "else" / "error" / "false" / "for" / "function" / "if" / "import" / "importstr" / "in" / "local" / "null" / "tailstrict" / "then" / "self" / "super" / "true") end_of_ident()