--- a/bindings/jsonnet/Cargo.toml +++ b/bindings/jsonnet/Cargo.toml @@ -4,7 +4,7 @@ version = "0.4.2" authors = ["Yaroslav Bolyukin "] license = "MIT" -edition = "2018" +edition = "2021" publish = false [dependencies] --- a/cmds/jrsonnet/Cargo.toml +++ b/cmds/jrsonnet/Cargo.toml @@ -4,8 +4,7 @@ version = "0.4.2" authors = ["Yaroslav Bolyukin "] license = "MIT" -edition = "2018" -publish = false +edition = "2021" [features] # Use mimalloc as allocator --- a/crates/jrsonnet-cli/Cargo.toml +++ b/crates/jrsonnet-cli/Cargo.toml @@ -4,8 +4,7 @@ version = "0.4.2" authors = ["Yaroslav Bolyukin "] license = "MIT" -edition = "2018" -publish = false +edition = "2021" [dependencies] jrsonnet-evaluator = { path = "../../crates/jrsonnet-evaluator", version = "0.4.2", features = [ --- a/crates/jrsonnet-evaluator/Cargo.toml +++ b/crates/jrsonnet-evaluator/Cargo.toml @@ -4,7 +4,7 @@ version = "0.4.2" authors = ["Yaroslav Bolyukin "] license = "MIT" -edition = "2018" +edition = "2021" [features] default = ["serialized-stdlib", "explaining-traces"] --- a/crates/jrsonnet-evaluator/src/builtin/mod.rs +++ b/crates/jrsonnet-evaluator/src/builtin/mod.rs @@ -7,7 +7,7 @@ operator::evaluate_mod_op, primitive_equals, push_frame, throw, typed::{Either2, Either4}, - with_state, ArrValue, Context, FuncVal, IndexableVal, Val, + with_state, ArrValue, FuncVal, IndexableVal, Val, }; use crate::{Either, ObjValue}; use format::{format_arr, format_obj}; --- a/crates/jrsonnet-evaluator/src/lib.rs +++ b/crates/jrsonnet-evaluator/src/lib.rs @@ -23,6 +23,8 @@ pub mod typed; mod val; +pub use jrsonnet_parser as parser; + pub use ctx::*; pub use dynamic::*; use error::{Error::*, LocError, Result, StackTraceElement}; @@ -175,7 +177,7 @@ pub(crate) fn with_state(f: impl FnOnce(&EvaluationState) -> T) -> T { EVAL_STATE.with(|s| f(s.borrow().as_ref().unwrap())) } -pub(crate) fn push_frame( +pub fn push_frame( e: Option<&ExprLocation>, frame_desc: impl FnOnce() -> String, f: impl FnOnce() -> Result, @@ -184,7 +186,7 @@ } #[allow(dead_code)] -pub(crate) fn push_val_frame( +pub fn push_val_frame( e: &ExprLocation, frame_desc: impl FnOnce() -> String, f: impl FnOnce() -> Result, @@ -192,7 +194,7 @@ with_state(|s| s.push_val(e, frame_desc, f)) } #[allow(dead_code)] -pub(crate) fn push_description_frame( +pub fn push_description_frame( frame_desc: impl FnOnce() -> String, f: impl FnOnce() -> Result, ) -> Result { --- a/crates/jrsonnet-evaluator/src/typed/mod.rs +++ b/crates/jrsonnet-evaluator/src/typed/mod.rs @@ -13,9 +13,9 @@ #[macro_export] macro_rules! unwrap_type { - ($desc: expr, $value: expr, $typ: expr => $match: path) => {{ - use $crate::{push_stack_frame, typed::CheckType}; - push_stack_frame(None, $desc, || Ok($typ.check(&$value)?))?; + ($desc:expr, $value:expr, $typ:expr => $match:path) => {{ + use $crate::{push_frame, typed::CheckType}; + push_frame(None, $desc, || Ok($typ.check(&$value)?))?; match $value { $match(v) => v, _ => unreachable!(), --- a/crates/jrsonnet-interner/Cargo.toml +++ b/crates/jrsonnet-interner/Cargo.toml @@ -4,7 +4,7 @@ version = "0.4.2" authors = ["Yaroslav Bolyukin "] license = "MIT" -edition = "2018" +edition = "2021" [dependencies] serde = { version = "1.0" } --- a/crates/jrsonnet-macros/src/lib.rs +++ b/crates/jrsonnet-macros/src/lib.rs @@ -136,7 +136,11 @@ #[derive(Clone, Copy, gcmodule::Trace)] #vis struct #name {} const _: () = { - use ::jrsonnet_evaluator::function::{Builtin, StaticBuiltin, BuiltinParam, ArgsLike}; + use ::jrsonnet_evaluator::{ + function::{Builtin, StaticBuiltin, BuiltinParam, ArgsLike, parse_builtin_call}, + error::Result, Context, + parser::ExprLocation, + }; const PARAMS: &'static [BuiltinParam] = &[ #(#params),* ]; @@ -156,7 +160,7 @@ PARAMS } fn call(&self, context: Context, loc: Option<&ExprLocation>, args: &dyn ArgsLike) -> Result { - let parsed = ::jrsonnet_evaluator::function::parse_builtin_call(context, &PARAMS, args, false)?; + let parsed = parse_builtin_call(context, &PARAMS, args, false)?; let result: #result = #name(#(#args),*); let result = result?; --- a/crates/jrsonnet-parser/Cargo.toml +++ b/crates/jrsonnet-parser/Cargo.toml @@ -4,7 +4,7 @@ version = "0.4.2" authors = ["Yaroslav Bolyukin "] license = "MIT" -edition = "2018" +edition = "2021" [features] default = [] @@ -14,7 +14,7 @@ [dependencies] jrsonnet-interner = { path = "../jrsonnet-interner", version = "0.4.2" } -peg = "0.7.0" +peg = "0.8.0" serde = { version = "1.0", features = ["derive", "rc"], optional = true } gcmodule = { git = "https://github.com/CertainLach/gcmodule", branch = "jrsonnet" } --- a/crates/jrsonnet-parser/src/lib.rs +++ b/crates/jrsonnet-parser/src/lib.rs @@ -114,8 +114,8 @@ / "\\x" hex_char() hex_char() / ['\\'] (quiet! { ['b' | 'f' | 'n' | 'r' | 't'] / c() } / expected!("")) pub rule string() -> String - = ['"'] str:$(string_char(<['"']>)*) ['"'] {? unescape::unescape(str).ok_or("")} - / ['\''] str:$(string_char(<['\'']>)*) ['\''] {? unescape::unescape(str).ok_or("")} + = ['"'] str:$(string_char(<"\"">)*) ['"'] {? unescape::unescape(str).ok_or("")} + / ['\''] str:$(string_char(<"\'">)*) ['\''] {? unescape::unescape(str).ok_or("")} / quiet!{ "@'" str:$(("''" / (!['\''][_]))*) "'" {str.replace("''", "'")} / "@\"" str:$(("\"\"" / (!['"'][_]))*) "\"" {str.replace("\"\"", "\"")} / string_block() } / expected!("") --- a/crates/jrsonnet-stdlib/Cargo.toml +++ b/crates/jrsonnet-stdlib/Cargo.toml @@ -4,7 +4,7 @@ version = "0.4.2" authors = ["Yaroslav Bolyukin "] license = "MIT" -edition = "2018" +edition = "2021" [features] --- a/crates/jrsonnet-types/Cargo.toml +++ b/crates/jrsonnet-types/Cargo.toml @@ -4,8 +4,8 @@ version = "0.4.2" authors = ["Yaroslav Bolyukin "] license = "MIT" -edition = "2018" +edition = "2021" [dependencies] -peg = "0.7.0" +peg = "0.8.0" gcmodule = { git = "https://github.com/CertainLach/gcmodule", branch = "jrsonnet" }