From 45fc92ae3d168756a912f7515f9381d51879c45e Mon Sep 17 00:00:00 2001 From: vms Date: Fri, 26 Mar 2021 17:13:28 +0300 Subject: [PATCH] Use $ to identify streams instead of [] (#79) --- Cargo.lock | 72 +- crates/air-parser/Cargo.toml | 2 +- crates/air-parser/benches/parser.rs | 12 +- crates/air-parser/src/parser/air.lalrpop | 59 +- crates/air-parser/src/parser/air.rs | 1583 +++++++++-------- crates/air-parser/src/parser/air_parser.rs | 12 +- crates/air-parser/src/parser/ast.rs | 20 +- crates/air-parser/src/parser/ast/traits.rs | 7 +- .../air-parser/src/parser/lexer/air_lexer.rs | 24 - .../src/parser/lexer/call_variable_parser.rs | 70 +- crates/air-parser/src/parser/lexer/errors.rs | 4 +- crates/air-parser/src/parser/lexer/mod.rs | 1 + crates/air-parser/src/parser/lexer/tests.rs | 19 +- crates/air-parser/src/parser/lexer/token.rs | 23 +- crates/air-parser/src/parser/tests.rs | 137 +- crates/air-parser/src/parser/validator.rs | 11 +- interpreter-lib/Cargo.toml | 2 +- interpreter-lib/benches/chat_benchmark.rs | 8 +- .../src/contexts/execution_context/avalue.rs | 6 +- .../src/contexts/execution_trace_context.rs | 6 +- .../src/execution/air/call/triplet.rs | 8 +- .../src/execution/air/call/utils.rs | 9 +- .../compare_matchable/compare_matchable.rs | 17 +- interpreter-lib/src/execution/air/fold.rs | 14 +- .../src/execution/air/fold/utils.rs | 33 +- interpreter-lib/src/execution/air/mod.rs | 4 +- .../iterable/vec_json_path_result.rs | 2 +- .../boxed_value/iterable/vec_resolved_call.rs | 2 +- .../cell_vec_resolved_call_result.rs | 12 +- interpreter-lib/src/execution/errors.rs | 6 +- interpreter-lib/src/execution/mod.rs | 1 + interpreter-lib/src/execution/utils/mod.rs | 1 + .../src/execution/utils/resolve.rs | 21 +- interpreter-lib/tests/call_evidence_basic.rs | 4 +- interpreter-lib/tests/data_merge.rs | 18 +- interpreter-lib/tests/flattening.rs | 16 +- interpreter-lib/tests/join.rs | 14 +- .../tests/scripts/create_service_with_xor.clj | 2 +- .../tests/scripts/network_explore.clj | 6 +- interpreter-lib/tests/security_tetraplets.rs | 4 +- interpreter/Cargo.toml | 2 +- 41 files changed, 1257 insertions(+), 1017 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9966a73a..c9069ffe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13,7 +13,7 @@ dependencies = [ [[package]] name = "air-parser" -version = "0.6.0" +version = "0.7.0" dependencies = [ "codespan", "codespan-reporting", @@ -40,9 +40,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.38" +version = "1.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afddf7f520a80dbf76e6f50a35bca42a2331ef227a28b3b6dc5c2e2338d114b1" +checksum = "81cddc5f91628367664cc7c69714ff08deee8a3efc54623011c772544d7b2767" [[package]] name = "aqua-interpreter-interface" @@ -82,7 +82,7 @@ dependencies = [ [[package]] name = "aquamarine" -version = "0.7.0" +version = "0.8.0" dependencies = [ "fluence 0.4.2", "interpreter-lib", @@ -240,9 +240,9 @@ checksum = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" [[package]] name = "byteorder" -version = "1.4.2" +version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae44d1a3d5a19df61dd0c8beb138458ac2a53a7ac09eba97d55592540004306b" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "cast" @@ -481,9 +481,9 @@ dependencies = [ [[package]] name = "csv" -version = "1.1.5" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9d58633299b24b515ac72a3f869f8b91306a3cec616a602843a383acd6f9e97" +checksum = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1" dependencies = [ "bstr", "csv-core", @@ -503,9 +503,9 @@ dependencies = [ [[package]] name = "ctor" -version = "0.1.19" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8f45d9ad417bcef4817d614a501ab55cdd96a6fdb24f49aab89a54acfd66b19" +checksum = "5e98e2ad1a782e33928b96fc3948e7c355e5af34ba4de7670fe8bac2a3b2006d" dependencies = [ "quote", "syn", @@ -980,9 +980,9 @@ checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" [[package]] name = "indexmap" -version = "1.6.1" +version = "1.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb1fa934250de4de8aef298d81c729a7d33d8c239daa3a7575e6b92bfc7313b" +checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3" dependencies = [ "autocfg", "hashbrown", @@ -1000,7 +1000,7 @@ dependencies = [ [[package]] name = "interpreter-lib" -version = "0.7.0" +version = "0.8.0" dependencies = [ "air-parser", "aqua-interpreter-interface 0.3.1", @@ -1156,9 +1156,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.87" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "265d751d31d6780a3f956bb5b8022feba2d94eeee5a84ba64f4212eedca42213" +checksum = "8916b1f6ca17130ec6568feccee27c156ad12037880833a3b842a823236502e7" [[package]] name = "lock_api" @@ -1211,9 +1211,9 @@ dependencies = [ [[package]] name = "memoffset" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87" +checksum = "cc14fc54a812b4472b4113facc3e44d099fbc0ea2ce0551fa5c703f8edfbfd38" dependencies = [ "autocfg", ] @@ -1552,14 +1552,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.4.3" +version = "1.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a" +checksum = "957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19" dependencies = [ "aho-corasick", "memchr", "regex-syntax", - "thread_local", ] [[package]] @@ -1573,9 +1572,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.22" +version = "0.6.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581" +checksum = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" [[package]] name = "rust-argon2" @@ -1703,9 +1702,9 @@ dependencies = [ [[package]] name = "siphasher" -version = "0.3.3" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa8f3741c7372e75519bd9346068370c9cdaabcc1f9599cbcf2a2719352286b7" +checksum = "cbce6d4507c7e4a3962091436e56e95290cb71fa302d0d270e32130b75fbff27" [[package]] name = "smallvec" @@ -1739,9 +1738,9 @@ checksum = "1e81da0851ada1f3e9d4312c704aa4f8806f0f9d69faaf8df2f3464b4a9437c2" [[package]] name = "syn" -version = "1.0.61" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed22b90a0e734a23a7610f4283ac9e5acfb96cbb30dfefa540d66f866f1c09c5" +checksum = "3fd9d1e9976102a03c542daa2eff1b43f9d72306342f3f8b3ed5fb8908195d6f" dependencies = [ "proc-macro2", "quote", @@ -1803,15 +1802,6 @@ dependencies = [ "syn", ] -[[package]] -name = "thread_local" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8018d24e04c95ac8790716a5987d0fec4f8b27249ffa0f7d33f1369bdfb88cbd" -dependencies = [ - "once_cell", -] - [[package]] name = "time" version = "0.1.43" @@ -1852,9 +1842,9 @@ dependencies = [ [[package]] name = "typenum" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" +checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" [[package]] name = "typetag" @@ -1909,9 +1899,9 @@ dependencies = [ [[package]] name = "version_check" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" +checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" [[package]] name = "void" @@ -1921,9 +1911,9 @@ checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" [[package]] name = "walkdir" -version = "2.3.1" +version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" +checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" dependencies = [ "same-file", "winapi", diff --git a/crates/air-parser/Cargo.toml b/crates/air-parser/Cargo.toml index d6de21a1..cb3c6ec1 100644 --- a/crates/air-parser/Cargo.toml +++ b/crates/air-parser/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "air-parser" -version = "0.6.0" +version = "0.7.0" authors = ["Fluence Labs"] edition = "2018" license = "Apache-2.0" diff --git a/crates/air-parser/benches/parser.rs b/crates/air-parser/benches/parser.rs index 0ba36c02..6ac3cab6 100644 --- a/crates/air-parser/benches/parser.rs +++ b/crates/air-parser/benches/parser.rs @@ -28,24 +28,24 @@ use air_parser::AIRParser; const SOURCE_CODE_BAD: &'static str = r#"(seq (seq - (call node ("identity" "") [] void[]) + (call node ("identity" "") [] $void) (call provider (service_id "{fname}") {arg_list} result) ) (seq - (call node ("identity" "") [] void[]) - (call "{LOCAL_VM}" ("return" "result") [result] void[]) + (call node ("identity" "") [] $void) + (call "{LOCAL_VM}" ("return" "result") [result] $void) ) )"#; const SOURCE_CODE_GOOD: &'static str = r#" (seq (seq - (call node ("identity" "") [] void[]) + (call node ("identity" "") [] $void) (call provider (service_id "fname") [arg list] result) ) (seq - (call node ("identity" "") [] void[]) - (call "local_vm" ("return" "result") [result] void[]) + (call node ("identity" "") [] $void) + (call "local_vm" ("return" "result") [result] $void) ) )"#; diff --git a/crates/air-parser/src/parser/air.lalrpop b/crates/air-parser/src/parser/air.lalrpop index b9764ae7..fe3a34b2 100644 --- a/crates/air-parser/src/parser/air.lalrpop +++ b/crates/air-parser/src/parser/air.lalrpop @@ -1,11 +1,11 @@ use crate::parser::ast::*; -use crate::parser::air_parser::into_variable_and_path; use crate::parser::air_parser::make_flattened_error; use crate::parser::ParserError; use crate::parser::VariableValidator; use crate::parser::Span; use crate::parser::lexer::Token; use crate::parser::lexer::Number; +use crate::parser::lexer::Variable; use lalrpop_util::ErrorRecovery; use std::rc::Rc; @@ -16,10 +16,10 @@ grammar<'err, 'input, 'v>(input: &'input str, errors: &'err mut Vec> = { - "(" call ")" => { + "(" call ")" => { let output = output.unwrap_or(CallOutputValue::None); let args = Rc::new(args); - let call = Call { peer_part: p, function_part: f, args, output }; + let call = Call { peer_part, function_part, args, output }; let span = Span { left, right }; validator.met_call(&call, span); @@ -82,8 +82,8 @@ PeerPart: PeerPart<'input> = { } Output: CallOutputValue<'input> = { - => CallOutputValue::Scalar(s), - => CallOutputValue::Accumulator(a), + => CallOutputValue::Variable(Variable::Scalar(a)), + => CallOutputValue::Variable(Variable::Stream(s)), }; Function = CallInstrValue; @@ -91,13 +91,16 @@ PeerId = CallInstrValue; ServiceId = CallInstrValue; CallInstrValue: CallInstrValue<'input> = { - => CallInstrValue::Literal(s), - => CallInstrValue::Variable(s), - => { - let (variable, path) = into_variable_and_path(v.0, v.1, v.2); - let should_flatten = v.2; + => CallInstrValue::Literal(l), + => CallInstrValue::Variable(Variable::Scalar(a)), + => CallInstrValue::Variable(Variable::Stream(s)), + => { + let variable = j.0; + let path = j.1; + let should_flatten = j.2; + // Due the json path constraints json path should be flattened in a call triplet. if !should_flatten { - let token = Token::JsonPath(v.0, v.1, v.2); + let token = Token::VariableWithJsonPath(variable.clone(), path, should_flatten); errors.push(make_flattened_error(l, token, r)); } CallInstrValue::JsonPath { variable, path, should_flatten } @@ -109,12 +112,9 @@ Arg = CallInstrArgValue; CallInstrArgValue: CallInstrArgValue<'input> = { => CallInstrArgValue::Literal(s), - => CallInstrArgValue::Variable(s), - => { - let (variable, path) = into_variable_and_path(v.0, v.1, v.2); - let should_flatten = v.2; - CallInstrArgValue::JsonPath { variable, path, should_flatten } - }, + => CallInstrArgValue::Variable(Variable::Scalar(v)), + => CallInstrArgValue::Variable(Variable::Stream(v)), + => CallInstrArgValue::JsonPath { variable: j.0, path: j.1, should_flatten: j.2 }, => CallInstrArgValue::Number(n), => CallInstrArgValue::Boolean(b), InitPeerId => CallInstrArgValue::InitPeerId, @@ -122,25 +122,18 @@ CallInstrArgValue: CallInstrArgValue<'input> = { } Iterable: IterableValue<'input> = { - => IterableValue::Variable(s), - => { - let (variable, path) = into_variable_and_path(v.0, v.1, v.2); - - let should_flatten = v.2; - IterableValue::JsonPath { variable, path, should_flatten } - }, + => IterableValue::Variable(Variable::Scalar(v)), + => IterableValue::Variable(Variable::Stream(v)), + => IterableValue::JsonPath { variable: j.0, path: j.1, should_flatten: j.2 }, } Matchable: MatchableValue<'input> = { - => MatchableValue::Variable(s), + => MatchableValue::Variable(Variable::Scalar(v)), + => MatchableValue::Variable(Variable::Stream(v)), => MatchableValue::Literal(s), => MatchableValue::Boolean(b), => MatchableValue::Number(n), - => { - let (variable, path) = into_variable_and_path(v.0, v.1, v.2); - let should_flatten = v.2; - MatchableValue::JsonPath { variable, path, should_flatten } - }, + => MatchableValue::JsonPath { variable: j.0, path: j.1, should_flatten: j.2 }, } extern { @@ -153,10 +146,10 @@ extern { "[" => Token::OpenSquareBracket, "]" => Token::CloseSquareBracket, - Alphanumeric => Token::Alphanumeric(<&'input str>), Literal => Token::StringLiteral(<&'input str>), - JsonPath => Token::JsonPath(<&'input str>, , ), - Accumulator => Token::Accumulator(<&'input str>), + Alphanumeric => Token::Alphanumeric(<&'input str>), + Stream => Token::Stream(<&'input str>), + JsonPath => Token::VariableWithJsonPath(>, <&'input str>, ), Number => Token::Number(), Boolean => Token::Boolean(), diff --git a/crates/air-parser/src/parser/air.rs b/crates/air-parser/src/parser/air.rs index fd51dd6a..b95e4bd4 100644 --- a/crates/air-parser/src/parser/air.rs +++ b/crates/air-parser/src/parser/air.rs @@ -1,13 +1,13 @@ // auto-generated: "lalrpop 0.19.5" -// sha3: a551fad6476e75f31acbe9abae635a8145491797a38a5ca603084673e63d3 +// sha3: 459487c956989dc625789699836b2960f7bc355b78ff9a139d2fa6938832545 use crate::parser::ast::*; -use crate::parser::air_parser::into_variable_and_path; use crate::parser::air_parser::make_flattened_error; use crate::parser::ParserError; use crate::parser::VariableValidator; use crate::parser::Span; use crate::parser::lexer::Token; use crate::parser::lexer::Number; +use crate::parser::lexer::Variable; use lalrpop_util::ErrorRecovery; use std::rc::Rc; #[allow(unused_extern_crates)] @@ -22,13 +22,13 @@ mod __parse__AIR { #![allow(non_snake_case, non_camel_case_types, unused_mut, unused_variables, unused_imports, unused_parens)] use crate::parser::ast::*; - use crate::parser::air_parser::into_variable_and_path; use crate::parser::air_parser::make_flattened_error; use crate::parser::ParserError; use crate::parser::VariableValidator; use crate::parser::Span; use crate::parser::lexer::Token; use crate::parser::lexer::Number; + use crate::parser::lexer::Variable; use lalrpop_util::ErrorRecovery; use std::rc::Rc; #[allow(unused_extern_crates)] @@ -44,7 +44,7 @@ mod __parse__AIR { Variant0(Token<'input>), Variant1(&'input str), Variant2(bool), - Variant3((&'input str, usize, bool)), + Variant3((Variable<'input>, &'input str, bool)), Variant4(Number), Variant5(__lalrpop_util::ErrorRecovery, ParserError>), Variant6(CallInstrArgValue<'input>), @@ -64,13 +64,13 @@ mod __parse__AIR { // State 0 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, // State 1 - 10, 0, 0, 0, 0, 34, 0, 35, 36, 0, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 10, 0, 0, 0, 34, 0, 35, 36, 0, 37, 0, 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 2 - 0, 0, 0, 0, 0, 39, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 40, 0, 0, 41, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 3 - 0, 0, 0, 0, 0, 41, 42, 0, 43, 0, 44, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 43, 44, 0, 45, 0, 46, 47, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 4 - 0, 0, 0, 0, 0, 41, 42, 0, 43, 0, 44, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 43, 44, 0, 45, 0, 46, 47, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 5 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, // State 6 @@ -78,13 +78,13 @@ mod __parse__AIR { // State 7 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, // State 8 - 17, 0, 0, 0, 0, 34, 0, 35, 36, 0, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 17, 0, 0, 0, 34, 0, 35, 36, 0, 37, 0, 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 9 - 0, 0, 0, 0, 0, 34, 0, 35, 36, 0, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 34, 0, 35, 36, 0, 37, 0, 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 10 - 0, 0, 0, 0, 0, 41, 42, 0, 43, 0, 44, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 43, 44, 0, 45, 0, 46, 47, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 11 - 0, 0, 0, 0, 0, 41, 42, 0, 43, 0, 44, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 43, 44, 0, 45, 0, 46, 47, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 12 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, // State 13 @@ -94,9 +94,9 @@ mod __parse__AIR { // State 15 0, 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 16 - 0, 0, 0, 0, 0, 34, 0, 35, 36, 0, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 34, 0, 35, 36, 0, 37, 0, 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 17 - 0, 0, 0, 0, 0, 34, 0, 35, 36, 0, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 34, 0, 35, 36, 0, 37, 0, 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 18 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, // State 19 @@ -104,13 +104,13 @@ mod __parse__AIR { // State 20 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, // State 21 - 0, 63, 0, 0, 64, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 66, 0, 0, 67, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 22 - 0, 0, 0, 68, 0, 69, 70, 71, 72, 73, 74, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 71, 72, 73, 74, 75, 76, 77, 78, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 23 - 0, 0, 0, 0, 0, 34, 0, 35, 36, 0, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 34, 0, 35, 36, 0, 37, 0, 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 24 - 0, 0, 0, 83, 0, 69, 70, 71, 72, 73, 74, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 87, 72, 73, 74, 75, 76, 77, 78, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 25 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 26 @@ -118,117 +118,125 @@ mod __parse__AIR { // State 27 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 4, 5, 30, 31, 6, 7, 8, 0, // State 28 - -36, -36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -36, + -38, -38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -38, // State 29 - 0, 0, 0, 0, 0, 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 30 - 0, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - // State 31 - -48, 0, 0, 0, 0, -48, 0, -48, -48, 0, -48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - // State 32 - -49, 0, 0, 0, 0, -49, 0, -49, -49, 0, -49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - // State 33 - -20, -20, -20, 0, 0, -20, 0, -20, -20, 0, -20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - // State 34 - -22, -22, -22, 0, 0, -22, 0, -22, -22, 0, -22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - // State 35 - -21, -21, -21, 0, 0, -21, 0, -21, -21, 0, -21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - // State 36 - -19, -19, -19, 0, 0, -19, 0, -19, -19, 0, -19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - // State 37 - 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - // State 38 - 0, 0, 0, 0, 0, -37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - // State 39 - 0, 0, 0, 0, 0, -38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - // State 40 - -39, 0, 0, 0, 0, -39, -39, 0, -39, 0, -39, -39, 0, 0, 0, 0, 0, 0, 0, 0, 0, -39, - // State 41 - -41, 0, 0, 0, 0, -41, -41, 0, -41, 0, -41, -41, 0, 0, 0, 0, 0, 0, 0, 0, 0, -41, - // State 42 - -43, 0, 0, 0, 0, -43, -43, 0, -43, 0, -43, -43, 0, 0, 0, 0, 0, 0, 0, 0, 0, -43, - // State 43 - -40, 0, 0, 0, 0, -40, -40, 0, -40, 0, -40, -40, 0, 0, 0, 0, 0, 0, 0, 0, 0, -40, - // State 44 - -42, 0, 0, 0, 0, -42, -42, 0, -42, 0, -42, -42, 0, 0, 0, 0, 0, 0, 0, 0, 0, -42, - // State 45 0, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 31 + -52, 0, 0, 0, -52, 0, -52, -52, 0, -52, 0, -52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 32 + -53, 0, 0, 0, -53, 0, -53, -53, 0, -53, 0, -53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 33 + -21, -21, -21, 0, -21, 0, -21, -21, 0, -21, 0, -21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 34 + -24, -24, -24, 0, -24, 0, -24, -24, 0, -24, 0, -24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 35 + -23, -23, -23, 0, -23, 0, -23, -23, 0, -23, 0, -23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 36 + -20, -20, -20, 0, -20, 0, -20, -20, 0, -20, 0, -20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 37 + -22, -22, -22, 0, -22, 0, -22, -22, 0, -22, 0, -22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 38 + 0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 39 + 0, 0, 0, 0, -39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 40 + 0, 0, 0, 0, -41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 41 + 0, 0, 0, 0, -40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 42 + -42, 0, 0, 0, -42, -42, 0, -42, 0, -42, -42, -42, 0, 0, 0, 0, 0, 0, 0, 0, 0, -42, + // State 43 + -45, 0, 0, 0, -45, -45, 0, -45, 0, -45, -45, -45, 0, 0, 0, 0, 0, 0, 0, 0, 0, -45, + // State 44 + -47, 0, 0, 0, -47, -47, 0, -47, 0, -47, -47, -47, 0, 0, 0, 0, 0, 0, 0, 0, 0, -47, + // State 45 + -44, 0, 0, 0, -44, -44, 0, -44, 0, -44, -44, -44, 0, 0, 0, 0, 0, 0, 0, 0, 0, -44, // State 46 - -30, -30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -30, + -46, 0, 0, 0, -46, -46, 0, -46, 0, -46, -46, -46, 0, 0, 0, 0, 0, 0, 0, 0, 0, -46, // State 47 - 0, -25, -25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + -43, 0, 0, 0, -43, -43, 0, -43, 0, -43, -43, -43, 0, 0, 0, 0, 0, 0, 0, 0, 0, -43, // State 48 - 0, 0, -23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 49 -32, -32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -32, // State 50 - 0, 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, -27, -27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 51 - 0, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, -25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 52 - 0, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - // State 53 - 0, -51, 0, 0, 0, -51, 0, -51, -51, 0, -51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - // State 54 - 0, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - // State 55 - 0, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - // State 56 - 0, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - // State 57 - 0, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - // State 58 - -29, -29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -29, - // State 59 - -28, -28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -28, - // State 60 - -33, -33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -33, - // State 61 - 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - // State 62 - -27, -27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -27, - // State 63 - 0, -45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - // State 64 - 0, -44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - // State 65 - 0, 0, 0, -4, 0, -4, -4, -4, -4, -4, -4, -4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - // State 66 - 0, 0, 0, -9, 0, -9, -9, -9, -9, -9, -9, -9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - // State 67 - 0, -10, 0, 0, -10, -10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - // State 68 - 0, 0, 0, -13, 0, -13, -13, -13, -13, -13, -13, -13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - // State 69 - 0, 0, 0, -16, 0, -16, -16, -16, -16, -16, -16, -16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - // State 70 - 0, 0, 0, -17, 0, -17, -17, -17, -17, -17, -17, -17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - // State 71 - 0, 0, 0, -14, 0, -14, -14, -14, -14, -14, -14, -14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - // State 72 - 0, 0, 0, -18, 0, -18, -18, -18, -18, -18, -18, -18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - // State 73 - 0, 0, 0, -12, 0, -12, -12, -12, -12, -12, -12, -12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - // State 74 - 0, 0, 0, -15, 0, -15, -15, -15, -15, -15, -15, -15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - // State 75 - 0, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - // State 76 - -50, 0, 0, 0, 0, -50, 0, -50, -50, 0, -50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - // State 77 - -31, -31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -31, - // State 78 -34, -34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -34, - // State 79 + // State 53 + 0, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 54 + 0, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 55 + 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 56 + 0, -55, 0, 0, -55, 0, -55, -55, 0, -55, 0, -55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 57 + 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 58 + 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 59 + 0, 83, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 60 + 0, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 61 + -31, -31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -31, + // State 62 + -30, -30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -30, + // State 63 -35, -35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -35, + // State 64 + 0, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 65 + -29, -29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -29, + // State 66 + 0, -48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 67 + 0, -49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 68 + 0, 0, 0, -4, -4, -4, -4, -4, -4, -4, -4, -4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 69 + 0, 0, 0, -9, -9, -9, -9, -9, -9, -9, -9, -9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 70 + 0, -10, 0, 0, -10, 0, 0, 0, 0, 0, 0, -10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 71 + 0, 0, 0, -13, -13, -13, -13, -13, -13, -13, -13, -13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 72 + 0, 0, 0, -17, -17, -17, -17, -17, -17, -17, -17, -17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 73 + 0, 0, 0, -18, -18, -18, -18, -18, -18, -18, -18, -18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 74 + 0, 0, 0, -15, -15, -15, -15, -15, -15, -15, -15, -15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 75 + 0, 0, 0, -19, -19, -19, -19, -19, -19, -19, -19, -19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 76 + 0, 0, 0, -12, -12, -12, -12, -12, -12, -12, -12, -12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 77 + 0, 0, 0, -16, -16, -16, -16, -16, -16, -16, -16, -16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 78 + 0, 0, 0, -14, -14, -14, -14, -14, -14, -14, -14, -14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 79 + 0, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 80 - -26, -26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -26, + -54, 0, 0, 0, -54, 0, -54, -54, 0, -54, 0, -54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 81 - 0, 0, 0, -5, 0, -5, -5, -5, -5, -5, -5, -5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + -33, -33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -33, // State 82 - 0, -11, 0, 0, -11, -11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + -36, -36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -36, // State 83 - 0, 0, -24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + -37, -37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -37, + // State 84 + -28, -28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -28, + // State 85 + 0, 0, 0, -5, -5, -5, -5, -5, -5, -5, -5, -5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 86 + 0, -11, 0, 0, -11, 0, 0, 0, 0, 0, 0, -11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 87 + 0, 0, -26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ]; fn __action(state: i8, integer: usize) -> i8 { __ACTION[(state as usize) * 22 + integer] @@ -285,13 +293,13 @@ mod __parse__AIR { // State 24 0, // State 25 - -52, + -56, // State 26 -8, // State 27 0, // State 28 - -36, + -38, // State 29 0, // State 30 @@ -327,7 +335,7 @@ mod __parse__AIR { // State 45 0, // State 46 - -30, + 0, // State 47 0, // State 48 @@ -339,7 +347,7 @@ mod __parse__AIR { // State 51 0, // State 52 - 0, + -34, // State 53 0, // State 54 @@ -351,21 +359,21 @@ mod __parse__AIR { // State 57 0, // State 58 - -29, + 0, // State 59 - -28, + 0, // State 60 - -33, + 0, // State 61 - 0, + -31, // State 62 - -27, + -30, // State 63 - 0, + -35, // State 64 0, // State 65 - 0, + -29, // State 66 0, // State 67 @@ -389,18 +397,26 @@ mod __parse__AIR { // State 76 0, // State 77 - -31, + 0, // State 78 - -34, + 0, // State 79 - -35, + 0, // State 80 - -26, + 0, // State 81 - 0, + -33, // State 82 - 0, + -36, // State 83 + -37, + // State 84 + -28, + // State 85 + 0, + // State 86 + 0, + // State 87 0, ]; fn __goto(state: i8, nt: usize) -> i8 { @@ -408,48 +424,48 @@ mod __parse__AIR { 2 => 24, 5 => 25, 6 => match state { - 24 => 81, - _ => 65, + 24 => 85, + _ => 68, }, 7 => 21, - 8 => 66, + 8 => 69, 9 => match state { - 8 | 23 => 47, - 16..=17 => 53, + 8 | 23 => 50, + 16..=17 => 56, _ => 31, }, 10 => 15, 11 => match state { - 23 => 75, - _ => 48, + 23 => 79, + _ => 51, }, 12 => match state { 6 => 13, 7 => 14, 0 => 26, - 12 => 50, - 13 => 51, - 14 => 52, - 18 => 55, - 19 => 56, - 20 => 57, + 12 => 53, + 13 => 54, + 14 => 55, + 18 => 58, + 19 => 59, + 20 => 60, _ => 12, }, - 13 => 37, + 13 => 38, 14 => match state { 4 => 11, 10 => 19, 11 => 20, _ => 10, }, - 15 => 61, + 15 => 64, 17 => match state { 1 => 32, _ => 17, }, 18 => 8, 19 => match state { - 17 => 54, + 17 => 57, _ => 23, }, _ => 0, @@ -461,7 +477,6 @@ mod __parse__AIR { r###"")""###, r###""[""###, r###""]""###, - r###"Accumulator"###, r###"Alphanumeric"###, r###"Boolean"###, r###"InitPeerId"###, @@ -469,6 +484,7 @@ mod __parse__AIR { r###"LastError"###, r###"Literal"###, r###"Number"###, + r###"Stream"###, r###"call"###, r###"fold"###, r###"match_"###, @@ -603,14 +619,14 @@ mod __parse__AIR { Token::CloseRoundBracket if true => Some(1), Token::OpenSquareBracket if true => Some(2), Token::CloseSquareBracket if true => Some(3), - Token::Accumulator(_) if true => Some(4), - Token::Alphanumeric(_) if true => Some(5), - Token::Boolean(_) if true => Some(6), - Token::InitPeerId if true => Some(7), - Token::JsonPath(_, _, _) if true => Some(8), - Token::LastError if true => Some(9), - Token::StringLiteral(_) if true => Some(10), - Token::Number(_) if true => Some(11), + Token::Alphanumeric(_) if true => Some(4), + Token::Boolean(_) if true => Some(5), + Token::InitPeerId if true => Some(6), + Token::VariableWithJsonPath(_, _, _) if true => Some(7), + Token::LastError if true => Some(8), + Token::StringLiteral(_) if true => Some(9), + Token::Number(_) if true => Some(10), + Token::Stream(_) if true => Some(11), Token::Call if true => Some(12), Token::Fold if true => Some(13), Token::Match if true => Some(14), @@ -634,20 +650,20 @@ mod __parse__AIR { ) -> __Symbol<'input> { match __token_index { - 0 | 1 | 2 | 3 | 7 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 => __Symbol::Variant0(__token), - 4 | 5 | 10 => match __token { - Token::Accumulator(__tok0) | Token::Alphanumeric(__tok0) | Token::StringLiteral(__tok0) if true => __Symbol::Variant1(__tok0), + 0 | 1 | 2 | 3 | 6 | 8 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 => __Symbol::Variant0(__token), + 4 | 9 | 11 => match __token { + Token::Alphanumeric(__tok0) | Token::StringLiteral(__tok0) | Token::Stream(__tok0) if true => __Symbol::Variant1(__tok0), _ => unreachable!(), }, - 6 => match __token { + 5 => match __token { Token::Boolean(__tok0) if true => __Symbol::Variant2(__tok0), _ => unreachable!(), }, - 8 => match __token { - Token::JsonPath(__tok0, __tok1, __tok2) if true => __Symbol::Variant3((__tok0, __tok1, __tok2)), + 7 => match __token { + Token::VariableWithJsonPath(__tok0, __tok1, __tok2) if true => __Symbol::Variant3((__tok0, __tok1, __tok2)), _ => unreachable!(), }, - 11 => match __token { + 10 => match __token { Token::Number(__tok0) if true => __Symbol::Variant4(__tok0), _ => unreachable!(), }, @@ -778,7 +794,7 @@ mod __parse__AIR { 18 => { __state_machine::SimulatedReduce::Reduce { states_to_pop: 1, - nonterminal_produced: 9, + nonterminal_produced: 8, } } 19 => { @@ -802,115 +818,115 @@ mod __parse__AIR { 22 => { __state_machine::SimulatedReduce::Reduce { states_to_pop: 1, - nonterminal_produced: 10, + nonterminal_produced: 9, } } 23 => { __state_machine::SimulatedReduce::Reduce { - states_to_pop: 4, - nonterminal_produced: 10, + states_to_pop: 1, + nonterminal_produced: 9, } } 24 => { __state_machine::SimulatedReduce::Reduce { states_to_pop: 1, - nonterminal_produced: 11, + nonterminal_produced: 10, } } 25 => { + __state_machine::SimulatedReduce::Reduce { + states_to_pop: 4, + nonterminal_produced: 10, + } + } + 26 => { + __state_machine::SimulatedReduce::Reduce { + states_to_pop: 1, + nonterminal_produced: 11, + } + } + 27 => { __state_machine::SimulatedReduce::Reduce { states_to_pop: 7, nonterminal_produced: 12, } } - 26 => { - __state_machine::SimulatedReduce::Reduce { - states_to_pop: 6, - nonterminal_produced: 12, - } - } - 27 => { - __state_machine::SimulatedReduce::Reduce { - states_to_pop: 5, - nonterminal_produced: 12, - } - } 28 => { __state_machine::SimulatedReduce::Reduce { - states_to_pop: 5, + states_to_pop: 6, nonterminal_produced: 12, } } 29 => { __state_machine::SimulatedReduce::Reduce { - states_to_pop: 3, + states_to_pop: 5, nonterminal_produced: 12, } } 30 => { __state_machine::SimulatedReduce::Reduce { - states_to_pop: 6, + states_to_pop: 5, nonterminal_produced: 12, } } 31 => { __state_machine::SimulatedReduce::Reduce { - states_to_pop: 4, + states_to_pop: 3, nonterminal_produced: 12, } } 32 => { __state_machine::SimulatedReduce::Reduce { - states_to_pop: 5, + states_to_pop: 6, nonterminal_produced: 12, } } 33 => { __state_machine::SimulatedReduce::Reduce { - states_to_pop: 6, + states_to_pop: 4, nonterminal_produced: 12, } } 34 => { __state_machine::SimulatedReduce::Reduce { - states_to_pop: 6, + states_to_pop: 5, nonterminal_produced: 12, } } 35 => { __state_machine::SimulatedReduce::Reduce { - states_to_pop: 1, + states_to_pop: 6, nonterminal_produced: 12, } } 36 => { __state_machine::SimulatedReduce::Reduce { - states_to_pop: 1, - nonterminal_produced: 13, + states_to_pop: 6, + nonterminal_produced: 12, } } 37 => { __state_machine::SimulatedReduce::Reduce { states_to_pop: 1, - nonterminal_produced: 13, + nonterminal_produced: 12, } } 38 => { __state_machine::SimulatedReduce::Reduce { states_to_pop: 1, - nonterminal_produced: 14, + nonterminal_produced: 13, } } 39 => { __state_machine::SimulatedReduce::Reduce { states_to_pop: 1, - nonterminal_produced: 14, + nonterminal_produced: 13, } } 40 => { __state_machine::SimulatedReduce::Reduce { states_to_pop: 1, - nonterminal_produced: 14, + nonterminal_produced: 13, } } 41 => { @@ -928,52 +944,76 @@ mod __parse__AIR { 43 => { __state_machine::SimulatedReduce::Reduce { states_to_pop: 1, - nonterminal_produced: 15, + nonterminal_produced: 14, } } 44 => { __state_machine::SimulatedReduce::Reduce { states_to_pop: 1, - nonterminal_produced: 15, + nonterminal_produced: 14, } } 45 => { __state_machine::SimulatedReduce::Reduce { states_to_pop: 1, - nonterminal_produced: 16, + nonterminal_produced: 14, } } 46 => { __state_machine::SimulatedReduce::Reduce { - states_to_pop: 0, - nonterminal_produced: 16, + states_to_pop: 1, + nonterminal_produced: 14, } } 47 => { __state_machine::SimulatedReduce::Reduce { states_to_pop: 1, - nonterminal_produced: 17, + nonterminal_produced: 15, } } 48 => { __state_machine::SimulatedReduce::Reduce { states_to_pop: 1, - nonterminal_produced: 18, + nonterminal_produced: 15, } } 49 => { + __state_machine::SimulatedReduce::Reduce { + states_to_pop: 1, + nonterminal_produced: 16, + } + } + 50 => { + __state_machine::SimulatedReduce::Reduce { + states_to_pop: 0, + nonterminal_produced: 16, + } + } + 51 => { + __state_machine::SimulatedReduce::Reduce { + states_to_pop: 1, + nonterminal_produced: 17, + } + } + 52 => { + __state_machine::SimulatedReduce::Reduce { + states_to_pop: 1, + nonterminal_produced: 18, + } + } + 53 => { __state_machine::SimulatedReduce::Reduce { states_to_pop: 4, nonterminal_produced: 18, } } - 50 => { + 54 => { __state_machine::SimulatedReduce::Reduce { states_to_pop: 1, nonterminal_produced: 19, } } - 51 => __state_machine::SimulatedReduce::Accept, + 55 => __state_machine::SimulatedReduce::Accept, _ => panic!("invalid reduction index {}", __reduce_index) } } @@ -1224,6 +1264,18 @@ mod __parse__AIR { __reduce50(input, errors, validator, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &(), &())>) } 51 => { + __reduce51(input, errors, validator, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &(), &())>) + } + 52 => { + __reduce52(input, errors, validator, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &(), &())>) + } + 53 => { + __reduce53(input, errors, validator, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &(), &())>) + } + 54 => { + __reduce54(input, errors, validator, __lookahead_start, __symbols, core::marker::PhantomData::<(&(), &(), &())>) + } + 55 => { // __AIR = AIR => ActionFn(0); let __sym0 = __pop_Variant9(__symbols); let __start = __sym0.0.clone(); @@ -1248,7 +1300,7 @@ mod __parse__AIR { 'input, >( __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> - ) -> (usize, (&'input str, usize, bool), usize) + ) -> (usize, (Variable<'input>, &'input str, bool), usize) { match __symbols.pop() { Some((__l, __Symbol::Variant3(__v), __r)) => (__l, __v, __r), @@ -1455,11 +1507,11 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // () = Arg => ActionFn(43); + // () = Arg => ActionFn(47); let __sym0 = __pop_Variant6(__symbols); let __start = __sym0.0.clone(); let __end = __sym0.2.clone(); - let __nt = super::__action43::<>(input, errors, validator, __sym0); + let __nt = super::__action47::<>(input, errors, validator, __sym0); __symbols.push((__start, __Symbol::Variant6(__nt), __end)); (1, 0) } @@ -1476,10 +1528,10 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // ()* = => ActionFn(41); + // ()* = => ActionFn(45); let __start = __lookahead_start.cloned().or_else(|| __symbols.last().map(|s| s.2.clone())).unwrap_or_default(); let __end = __start.clone(); - let __nt = super::__action41::<>(input, errors, validator, &__start, &__end); + let __nt = super::__action45::<>(input, errors, validator, &__start, &__end); __symbols.push((__start, __Symbol::Variant7(__nt), __end)); (0, 1) } @@ -1496,11 +1548,11 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // ()* = ()+ => ActionFn(42); + // ()* = ()+ => ActionFn(46); let __sym0 = __pop_Variant7(__symbols); let __start = __sym0.0.clone(); let __end = __sym0.2.clone(); - let __nt = super::__action42::<>(input, errors, validator, __sym0); + let __nt = super::__action46::<>(input, errors, validator, __sym0); __symbols.push((__start, __Symbol::Variant7(__nt), __end)); (1, 1) } @@ -1517,11 +1569,11 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // ()+ = Arg => ActionFn(50); + // ()+ = Arg => ActionFn(54); let __sym0 = __pop_Variant6(__symbols); let __start = __sym0.0.clone(); let __end = __sym0.2.clone(); - let __nt = super::__action50::<>(input, errors, validator, __sym0); + let __nt = super::__action54::<>(input, errors, validator, __sym0); __symbols.push((__start, __Symbol::Variant7(__nt), __end)); (1, 2) } @@ -1538,13 +1590,13 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // ()+ = ()+, Arg => ActionFn(51); + // ()+ = ()+, Arg => ActionFn(55); assert!(__symbols.len() >= 2); let __sym1 = __pop_Variant6(__symbols); let __sym0 = __pop_Variant7(__symbols); let __start = __sym0.0.clone(); let __end = __sym1.2.clone(); - let __nt = super::__action51::<>(input, errors, validator, __sym0, __sym1); + let __nt = super::__action55::<>(input, errors, validator, __sym0, __sym1); __symbols.push((__start, __Symbol::Variant7(__nt), __end)); (2, 2) } @@ -1561,10 +1613,10 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // @L = => ActionFn(47); + // @L = => ActionFn(51); let __start = __lookahead_start.cloned().or_else(|| __symbols.last().map(|s| s.2.clone())).unwrap_or_default(); let __end = __start.clone(); - let __nt = super::__action47::<>(input, errors, validator, &__start, &__end); + let __nt = super::__action51::<>(input, errors, validator, &__start, &__end); __symbols.push((__start, __Symbol::Variant8(__nt), __end)); (0, 3) } @@ -1581,10 +1633,10 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // @R = => ActionFn(44); + // @R = => ActionFn(48); let __start = __lookahead_start.cloned().or_else(|| __symbols.last().map(|s| s.2.clone())).unwrap_or_default(); let __end = __start.clone(); - let __nt = super::__action44::<>(input, errors, validator, &__start, &__end); + let __nt = super::__action48::<>(input, errors, validator, &__start, &__end); __symbols.push((__start, __Symbol::Variant8(__nt), __end)); (0, 4) } @@ -1622,11 +1674,11 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // Arg = CallInstrArgValue => ActionFn(26); + // Arg = CallInstrArgValue => ActionFn(27); let __sym0 = __pop_Variant6(__symbols); let __start = __sym0.0.clone(); let __end = __sym0.2.clone(); - let __nt = super::__action26::<>(input, errors, validator, __sym0); + let __nt = super::__action27::<>(input, errors, validator, __sym0); __symbols.push((__start, __Symbol::Variant6(__nt), __end)); (1, 6) } @@ -1643,13 +1695,13 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // Args = "[", "]" => ActionFn(52); + // Args = "[", "]" => ActionFn(56); assert!(__symbols.len() >= 2); let __sym1 = __pop_Variant0(__symbols); let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0.clone(); let __end = __sym1.2.clone(); - let __nt = super::__action52::<>(input, errors, validator, __sym0, __sym1); + let __nt = super::__action56::<>(input, errors, validator, __sym0, __sym1); __symbols.push((__start, __Symbol::Variant10(__nt), __end)); (2, 7) } @@ -1666,14 +1718,14 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // Args = "[", ()+, "]" => ActionFn(53); + // Args = "[", ()+, "]" => ActionFn(57); assert!(__symbols.len() >= 3); let __sym2 = __pop_Variant0(__symbols); let __sym1 = __pop_Variant7(__symbols); let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0.clone(); let __end = __sym2.2.clone(); - let __nt = super::__action53::<>(input, errors, validator, __sym0, __sym1, __sym2); + let __nt = super::__action57::<>(input, errors, validator, __sym0, __sym1, __sym2); __symbols.push((__start, __Symbol::Variant10(__nt), __end)); (3, 7) } @@ -1690,11 +1742,11 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // CallInstrArgValue = Literal => ActionFn(27); + // CallInstrArgValue = Literal => ActionFn(28); let __sym0 = __pop_Variant1(__symbols); let __start = __sym0.0.clone(); let __end = __sym0.2.clone(); - let __nt = super::__action27::<>(input, errors, validator, __sym0); + let __nt = super::__action28::<>(input, errors, validator, __sym0); __symbols.push((__start, __Symbol::Variant6(__nt), __end)); (1, 8) } @@ -1711,11 +1763,11 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // CallInstrArgValue = Alphanumeric => ActionFn(28); + // CallInstrArgValue = Alphanumeric => ActionFn(29); let __sym0 = __pop_Variant1(__symbols); let __start = __sym0.0.clone(); let __end = __sym0.2.clone(); - let __nt = super::__action28::<>(input, errors, validator, __sym0); + let __nt = super::__action29::<>(input, errors, validator, __sym0); __symbols.push((__start, __Symbol::Variant6(__nt), __end)); (1, 8) } @@ -1732,11 +1784,11 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // CallInstrArgValue = JsonPath => ActionFn(29); - let __sym0 = __pop_Variant3(__symbols); + // CallInstrArgValue = Stream => ActionFn(30); + let __sym0 = __pop_Variant1(__symbols); let __start = __sym0.0.clone(); let __end = __sym0.2.clone(); - let __nt = super::__action29::<>(input, errors, validator, __sym0); + let __nt = super::__action30::<>(input, errors, validator, __sym0); __symbols.push((__start, __Symbol::Variant6(__nt), __end)); (1, 8) } @@ -1753,11 +1805,11 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // CallInstrArgValue = Number => ActionFn(30); - let __sym0 = __pop_Variant4(__symbols); + // CallInstrArgValue = JsonPath => ActionFn(31); + let __sym0 = __pop_Variant3(__symbols); let __start = __sym0.0.clone(); let __end = __sym0.2.clone(); - let __nt = super::__action30::<>(input, errors, validator, __sym0); + let __nt = super::__action31::<>(input, errors, validator, __sym0); __symbols.push((__start, __Symbol::Variant6(__nt), __end)); (1, 8) } @@ -1774,11 +1826,11 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // CallInstrArgValue = Boolean => ActionFn(31); - let __sym0 = __pop_Variant2(__symbols); + // CallInstrArgValue = Number => ActionFn(32); + let __sym0 = __pop_Variant4(__symbols); let __start = __sym0.0.clone(); let __end = __sym0.2.clone(); - let __nt = super::__action31::<>(input, errors, validator, __sym0); + let __nt = super::__action32::<>(input, errors, validator, __sym0); __symbols.push((__start, __Symbol::Variant6(__nt), __end)); (1, 8) } @@ -1795,11 +1847,11 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // CallInstrArgValue = InitPeerId => ActionFn(32); - let __sym0 = __pop_Variant0(__symbols); + // CallInstrArgValue = Boolean => ActionFn(33); + let __sym0 = __pop_Variant2(__symbols); let __start = __sym0.0.clone(); let __end = __sym0.2.clone(); - let __nt = super::__action32::<>(input, errors, validator, __sym0); + let __nt = super::__action33::<>(input, errors, validator, __sym0); __symbols.push((__start, __Symbol::Variant6(__nt), __end)); (1, 8) } @@ -1816,11 +1868,11 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // CallInstrArgValue = LastError => ActionFn(33); + // CallInstrArgValue = InitPeerId => ActionFn(34); let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0.clone(); let __end = __sym0.2.clone(); - let __nt = super::__action33::<>(input, errors, validator, __sym0); + let __nt = super::__action34::<>(input, errors, validator, __sym0); __symbols.push((__start, __Symbol::Variant6(__nt), __end)); (1, 8) } @@ -1836,6 +1888,27 @@ mod __parse__AIR { __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) + { + // CallInstrArgValue = LastError => ActionFn(35); + let __sym0 = __pop_Variant0(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action35::<>(input, errors, validator, __sym0); + __symbols.push((__start, __Symbol::Variant6(__nt), __end)); + (1, 8) + } + pub(crate) fn __reduce19< + 'err, + 'input, + 'v, + >( + input: &'input str, + errors: &'err mut Vec, ParserError>>, + validator: &'v mut VariableValidator<'input>, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, + ) -> (usize, usize) { // CallInstrValue = Literal => ActionFn(22); let __sym0 = __pop_Variant1(__symbols); @@ -1845,7 +1918,7 @@ mod __parse__AIR { __symbols.push((__start, __Symbol::Variant11(__nt), __end)); (1, 9) } - pub(crate) fn __reduce19< + pub(crate) fn __reduce20< 'err, 'input, 'v, @@ -1866,27 +1939,6 @@ mod __parse__AIR { __symbols.push((__start, __Symbol::Variant11(__nt), __end)); (1, 9) } - pub(crate) fn __reduce20< - 'err, - 'input, - 'v, - >( - input: &'input str, - errors: &'err mut Vec, ParserError>>, - validator: &'v mut VariableValidator<'input>, - __lookahead_start: Option<&usize>, - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, - _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, - ) -> (usize, usize) - { - // CallInstrValue = JsonPath => ActionFn(60); - let __sym0 = __pop_Variant3(__symbols); - let __start = __sym0.0.clone(); - let __end = __sym0.2.clone(); - let __nt = super::__action60::<>(input, errors, validator, __sym0); - __symbols.push((__start, __Symbol::Variant11(__nt), __end)); - (1, 9) - } pub(crate) fn __reduce21< 'err, 'input, @@ -1900,11 +1952,11 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // CallInstrValue = InitPeerId => ActionFn(25); - let __sym0 = __pop_Variant0(__symbols); + // CallInstrValue = Stream => ActionFn(24); + let __sym0 = __pop_Variant1(__symbols); let __start = __sym0.0.clone(); let __end = __sym0.2.clone(); - let __nt = super::__action25::<>(input, errors, validator, __sym0); + let __nt = super::__action24::<>(input, errors, validator, __sym0); __symbols.push((__start, __Symbol::Variant11(__nt), __end)); (1, 9) } @@ -1920,6 +1972,48 @@ mod __parse__AIR { __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) + { + // CallInstrValue = JsonPath => ActionFn(64); + let __sym0 = __pop_Variant3(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action64::<>(input, errors, validator, __sym0); + __symbols.push((__start, __Symbol::Variant11(__nt), __end)); + (1, 9) + } + pub(crate) fn __reduce23< + 'err, + 'input, + 'v, + >( + input: &'input str, + errors: &'err mut Vec, ParserError>>, + validator: &'v mut VariableValidator<'input>, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, + ) -> (usize, usize) + { + // CallInstrValue = InitPeerId => ActionFn(26); + let __sym0 = __pop_Variant0(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action26::<>(input, errors, validator, __sym0); + __symbols.push((__start, __Symbol::Variant11(__nt), __end)); + (1, 9) + } + pub(crate) fn __reduce24< + 'err, + 'input, + 'v, + >( + input: &'input str, + errors: &'err mut Vec, ParserError>>, + validator: &'v mut VariableValidator<'input>, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, + ) -> (usize, usize) { // FPart = Function => ActionFn(13); let __sym0 = __pop_Variant11(__symbols); @@ -1929,7 +2023,7 @@ mod __parse__AIR { __symbols.push((__start, __Symbol::Variant12(__nt), __end)); (1, 10) } - pub(crate) fn __reduce23< + pub(crate) fn __reduce25< 'err, 'input, 'v, @@ -1954,7 +2048,7 @@ mod __parse__AIR { __symbols.push((__start, __Symbol::Variant12(__nt), __end)); (4, 10) } - pub(crate) fn __reduce24< + pub(crate) fn __reduce26< 'err, 'input, 'v, @@ -1975,7 +2069,7 @@ mod __parse__AIR { __symbols.push((__start, __Symbol::Variant11(__nt), __end)); (1, 11) } - pub(crate) fn __reduce25< + pub(crate) fn __reduce27< 'err, 'input, 'v, @@ -1988,7 +2082,7 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // Instr = "(", call, PeerPart, FPart, Args, Output, ")" => ActionFn(66); + // Instr = "(", call, PeerPart, FPart, Args, Output, ")" => ActionFn(70); assert!(__symbols.len() >= 7); let __sym6 = __pop_Variant0(__symbols); let __sym5 = __pop_Variant15(__symbols); @@ -1999,11 +2093,11 @@ mod __parse__AIR { let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0.clone(); let __end = __sym6.2.clone(); - let __nt = super::__action66::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5, __sym6); + let __nt = super::__action70::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5, __sym6); __symbols.push((__start, __Symbol::Variant9(__nt), __end)); (7, 12) } - pub(crate) fn __reduce26< + pub(crate) fn __reduce28< 'err, 'input, 'v, @@ -2016,7 +2110,7 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // Instr = "(", call, PeerPart, FPart, Args, ")" => ActionFn(67); + // Instr = "(", call, PeerPart, FPart, Args, ")" => ActionFn(71); assert!(__symbols.len() >= 6); let __sym5 = __pop_Variant0(__symbols); let __sym4 = __pop_Variant10(__symbols); @@ -2026,11 +2120,11 @@ mod __parse__AIR { let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0.clone(); let __end = __sym5.2.clone(); - let __nt = super::__action67::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5); + let __nt = super::__action71::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5); __symbols.push((__start, __Symbol::Variant9(__nt), __end)); (6, 12) } - pub(crate) fn __reduce27< + pub(crate) fn __reduce29< 'err, 'input, 'v, @@ -2056,7 +2150,7 @@ mod __parse__AIR { __symbols.push((__start, __Symbol::Variant9(__nt), __end)); (5, 12) } - pub(crate) fn __reduce28< + pub(crate) fn __reduce30< 'err, 'input, 'v, @@ -2082,7 +2176,7 @@ mod __parse__AIR { __symbols.push((__start, __Symbol::Variant9(__nt), __end)); (5, 12) } - pub(crate) fn __reduce29< + pub(crate) fn __reduce31< 'err, 'input, 'v, @@ -2106,7 +2200,7 @@ mod __parse__AIR { __symbols.push((__start, __Symbol::Variant9(__nt), __end)); (3, 12) } - pub(crate) fn __reduce30< + pub(crate) fn __reduce32< 'err, 'input, 'v, @@ -2119,7 +2213,7 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // Instr = "(", fold, Iterable, Alphanumeric, Instr, ")" => ActionFn(62); + // Instr = "(", fold, Iterable, Alphanumeric, Instr, ")" => ActionFn(66); assert!(__symbols.len() >= 6); let __sym5 = __pop_Variant0(__symbols); let __sym4 = __pop_Variant9(__symbols); @@ -2129,11 +2223,11 @@ mod __parse__AIR { let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0.clone(); let __end = __sym5.2.clone(); - let __nt = super::__action62::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5); + let __nt = super::__action66::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5); __symbols.push((__start, __Symbol::Variant9(__nt), __end)); (6, 12) } - pub(crate) fn __reduce31< + pub(crate) fn __reduce33< 'err, 'input, 'v, @@ -2146,7 +2240,7 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // Instr = "(", next, Alphanumeric, ")" => ActionFn(63); + // Instr = "(", next, Alphanumeric, ")" => ActionFn(67); assert!(__symbols.len() >= 4); let __sym3 = __pop_Variant0(__symbols); let __sym2 = __pop_Variant1(__symbols); @@ -2154,11 +2248,11 @@ mod __parse__AIR { let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0.clone(); let __end = __sym3.2.clone(); - let __nt = super::__action63::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3); + let __nt = super::__action67::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3); __symbols.push((__start, __Symbol::Variant9(__nt), __end)); (4, 12) } - pub(crate) fn __reduce32< + pub(crate) fn __reduce34< 'err, 'input, 'v, @@ -2184,60 +2278,6 @@ mod __parse__AIR { __symbols.push((__start, __Symbol::Variant9(__nt), __end)); (5, 12) } - pub(crate) fn __reduce33< - 'err, - 'input, - 'v, - >( - input: &'input str, - errors: &'err mut Vec, ParserError>>, - validator: &'v mut VariableValidator<'input>, - __lookahead_start: Option<&usize>, - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, - _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, - ) -> (usize, usize) - { - // Instr = "(", match_, Matchable, Matchable, Instr, ")" => ActionFn(64); - assert!(__symbols.len() >= 6); - let __sym5 = __pop_Variant0(__symbols); - let __sym4 = __pop_Variant9(__symbols); - let __sym3 = __pop_Variant14(__symbols); - let __sym2 = __pop_Variant14(__symbols); - let __sym1 = __pop_Variant0(__symbols); - let __sym0 = __pop_Variant0(__symbols); - let __start = __sym0.0.clone(); - let __end = __sym5.2.clone(); - let __nt = super::__action64::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5); - __symbols.push((__start, __Symbol::Variant9(__nt), __end)); - (6, 12) - } - pub(crate) fn __reduce34< - 'err, - 'input, - 'v, - >( - input: &'input str, - errors: &'err mut Vec, ParserError>>, - validator: &'v mut VariableValidator<'input>, - __lookahead_start: Option<&usize>, - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, - _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, - ) -> (usize, usize) - { - // Instr = "(", mismatch, Matchable, Matchable, Instr, ")" => ActionFn(65); - assert!(__symbols.len() >= 6); - let __sym5 = __pop_Variant0(__symbols); - let __sym4 = __pop_Variant9(__symbols); - let __sym3 = __pop_Variant14(__symbols); - let __sym2 = __pop_Variant14(__symbols); - let __sym1 = __pop_Variant0(__symbols); - let __sym0 = __pop_Variant0(__symbols); - let __start = __sym0.0.clone(); - let __end = __sym5.2.clone(); - let __nt = super::__action65::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5); - __symbols.push((__start, __Symbol::Variant9(__nt), __end)); - (6, 12) - } pub(crate) fn __reduce35< 'err, 'input, @@ -2250,6 +2290,60 @@ mod __parse__AIR { __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) + { + // Instr = "(", match_, Matchable, Matchable, Instr, ")" => ActionFn(68); + assert!(__symbols.len() >= 6); + let __sym5 = __pop_Variant0(__symbols); + let __sym4 = __pop_Variant9(__symbols); + let __sym3 = __pop_Variant14(__symbols); + let __sym2 = __pop_Variant14(__symbols); + let __sym1 = __pop_Variant0(__symbols); + let __sym0 = __pop_Variant0(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym5.2.clone(); + let __nt = super::__action68::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5); + __symbols.push((__start, __Symbol::Variant9(__nt), __end)); + (6, 12) + } + pub(crate) fn __reduce36< + 'err, + 'input, + 'v, + >( + input: &'input str, + errors: &'err mut Vec, ParserError>>, + validator: &'v mut VariableValidator<'input>, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, + ) -> (usize, usize) + { + // Instr = "(", mismatch, Matchable, Matchable, Instr, ")" => ActionFn(69); + assert!(__symbols.len() >= 6); + let __sym5 = __pop_Variant0(__symbols); + let __sym4 = __pop_Variant9(__symbols); + let __sym3 = __pop_Variant14(__symbols); + let __sym2 = __pop_Variant14(__symbols); + let __sym1 = __pop_Variant0(__symbols); + let __sym0 = __pop_Variant0(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym5.2.clone(); + let __nt = super::__action69::<>(input, errors, validator, __sym0, __sym1, __sym2, __sym3, __sym4, __sym5); + __symbols.push((__start, __Symbol::Variant9(__nt), __end)); + (6, 12) + } + pub(crate) fn __reduce37< + 'err, + 'input, + 'v, + >( + input: &'input str, + errors: &'err mut Vec, ParserError>>, + validator: &'v mut VariableValidator<'input>, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, + ) -> (usize, usize) { // Instr = error => ActionFn(11); let __sym0 = __pop_Variant5(__symbols); @@ -2259,48 +2353,6 @@ mod __parse__AIR { __symbols.push((__start, __Symbol::Variant9(__nt), __end)); (1, 12) } - pub(crate) fn __reduce36< - 'err, - 'input, - 'v, - >( - input: &'input str, - errors: &'err mut Vec, ParserError>>, - validator: &'v mut VariableValidator<'input>, - __lookahead_start: Option<&usize>, - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, - _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, - ) -> (usize, usize) - { - // Iterable = Alphanumeric => ActionFn(34); - let __sym0 = __pop_Variant1(__symbols); - let __start = __sym0.0.clone(); - let __end = __sym0.2.clone(); - let __nt = super::__action34::<>(input, errors, validator, __sym0); - __symbols.push((__start, __Symbol::Variant13(__nt), __end)); - (1, 13) - } - pub(crate) fn __reduce37< - 'err, - 'input, - 'v, - >( - input: &'input str, - errors: &'err mut Vec, ParserError>>, - validator: &'v mut VariableValidator<'input>, - __lookahead_start: Option<&usize>, - __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, - _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, - ) -> (usize, usize) - { - // Iterable = JsonPath => ActionFn(35); - let __sym0 = __pop_Variant3(__symbols); - let __start = __sym0.0.clone(); - let __end = __sym0.2.clone(); - let __nt = super::__action35::<>(input, errors, validator, __sym0); - __symbols.push((__start, __Symbol::Variant13(__nt), __end)); - (1, 13) - } pub(crate) fn __reduce38< 'err, 'input, @@ -2314,13 +2366,13 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // Matchable = Alphanumeric => ActionFn(36); + // Iterable = Alphanumeric => ActionFn(36); let __sym0 = __pop_Variant1(__symbols); let __start = __sym0.0.clone(); let __end = __sym0.2.clone(); let __nt = super::__action36::<>(input, errors, validator, __sym0); - __symbols.push((__start, __Symbol::Variant14(__nt), __end)); - (1, 14) + __symbols.push((__start, __Symbol::Variant13(__nt), __end)); + (1, 13) } pub(crate) fn __reduce39< 'err, @@ -2335,13 +2387,13 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // Matchable = Literal => ActionFn(37); + // Iterable = Stream => ActionFn(37); let __sym0 = __pop_Variant1(__symbols); let __start = __sym0.0.clone(); let __end = __sym0.2.clone(); let __nt = super::__action37::<>(input, errors, validator, __sym0); - __symbols.push((__start, __Symbol::Variant14(__nt), __end)); - (1, 14) + __symbols.push((__start, __Symbol::Variant13(__nt), __end)); + (1, 13) } pub(crate) fn __reduce40< 'err, @@ -2356,13 +2408,13 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // Matchable = Boolean => ActionFn(38); - let __sym0 = __pop_Variant2(__symbols); + // Iterable = JsonPath => ActionFn(38); + let __sym0 = __pop_Variant3(__symbols); let __start = __sym0.0.clone(); let __end = __sym0.2.clone(); let __nt = super::__action38::<>(input, errors, validator, __sym0); - __symbols.push((__start, __Symbol::Variant14(__nt), __end)); - (1, 14) + __symbols.push((__start, __Symbol::Variant13(__nt), __end)); + (1, 13) } pub(crate) fn __reduce41< 'err, @@ -2377,8 +2429,8 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // Matchable = Number => ActionFn(39); - let __sym0 = __pop_Variant4(__symbols); + // Matchable = Alphanumeric => ActionFn(39); + let __sym0 = __pop_Variant1(__symbols); let __start = __sym0.0.clone(); let __end = __sym0.2.clone(); let __nt = super::__action39::<>(input, errors, validator, __sym0); @@ -2398,8 +2450,8 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // Matchable = JsonPath => ActionFn(40); - let __sym0 = __pop_Variant3(__symbols); + // Matchable = Stream => ActionFn(40); + let __sym0 = __pop_Variant1(__symbols); let __start = __sym0.0.clone(); let __end = __sym0.2.clone(); let __nt = super::__action40::<>(input, errors, validator, __sym0); @@ -2418,6 +2470,90 @@ mod __parse__AIR { __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) + { + // Matchable = Literal => ActionFn(41); + let __sym0 = __pop_Variant1(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action41::<>(input, errors, validator, __sym0); + __symbols.push((__start, __Symbol::Variant14(__nt), __end)); + (1, 14) + } + pub(crate) fn __reduce44< + 'err, + 'input, + 'v, + >( + input: &'input str, + errors: &'err mut Vec, ParserError>>, + validator: &'v mut VariableValidator<'input>, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, + ) -> (usize, usize) + { + // Matchable = Boolean => ActionFn(42); + let __sym0 = __pop_Variant2(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action42::<>(input, errors, validator, __sym0); + __symbols.push((__start, __Symbol::Variant14(__nt), __end)); + (1, 14) + } + pub(crate) fn __reduce45< + 'err, + 'input, + 'v, + >( + input: &'input str, + errors: &'err mut Vec, ParserError>>, + validator: &'v mut VariableValidator<'input>, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, + ) -> (usize, usize) + { + // Matchable = Number => ActionFn(43); + let __sym0 = __pop_Variant4(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action43::<>(input, errors, validator, __sym0); + __symbols.push((__start, __Symbol::Variant14(__nt), __end)); + (1, 14) + } + pub(crate) fn __reduce46< + 'err, + 'input, + 'v, + >( + input: &'input str, + errors: &'err mut Vec, ParserError>>, + validator: &'v mut VariableValidator<'input>, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, + ) -> (usize, usize) + { + // Matchable = JsonPath => ActionFn(44); + let __sym0 = __pop_Variant3(__symbols); + let __start = __sym0.0.clone(); + let __end = __sym0.2.clone(); + let __nt = super::__action44::<>(input, errors, validator, __sym0); + __symbols.push((__start, __Symbol::Variant14(__nt), __end)); + (1, 14) + } + pub(crate) fn __reduce47< + 'err, + 'input, + 'v, + >( + input: &'input str, + errors: &'err mut Vec, ParserError>>, + validator: &'v mut VariableValidator<'input>, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, + ) -> (usize, usize) { // Output = Alphanumeric => ActionFn(17); let __sym0 = __pop_Variant1(__symbols); @@ -2427,7 +2563,7 @@ mod __parse__AIR { __symbols.push((__start, __Symbol::Variant15(__nt), __end)); (1, 15) } - pub(crate) fn __reduce44< + pub(crate) fn __reduce48< 'err, 'input, 'v, @@ -2440,7 +2576,7 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // Output = Accumulator => ActionFn(18); + // Output = Stream => ActionFn(18); let __sym0 = __pop_Variant1(__symbols); let __start = __sym0.0.clone(); let __end = __sym0.2.clone(); @@ -2448,7 +2584,7 @@ mod __parse__AIR { __symbols.push((__start, __Symbol::Variant15(__nt), __end)); (1, 15) } - pub(crate) fn __reduce45< + pub(crate) fn __reduce49< 'err, 'input, 'v, @@ -2461,15 +2597,15 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // Output? = Output => ActionFn(45); + // Output? = Output => ActionFn(49); let __sym0 = __pop_Variant15(__symbols); let __start = __sym0.0.clone(); let __end = __sym0.2.clone(); - let __nt = super::__action45::<>(input, errors, validator, __sym0); + let __nt = super::__action49::<>(input, errors, validator, __sym0); __symbols.push((__start, __Symbol::Variant16(__nt), __end)); (1, 16) } - pub(crate) fn __reduce46< + pub(crate) fn __reduce50< 'err, 'input, 'v, @@ -2482,14 +2618,14 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // Output? = => ActionFn(46); + // Output? = => ActionFn(50); let __start = __lookahead_start.cloned().or_else(|| __symbols.last().map(|s| s.2.clone())).unwrap_or_default(); let __end = __start.clone(); - let __nt = super::__action46::<>(input, errors, validator, &__start, &__end); + let __nt = super::__action50::<>(input, errors, validator, &__start, &__end); __symbols.push((__start, __Symbol::Variant16(__nt), __end)); (0, 16) } - pub(crate) fn __reduce47< + pub(crate) fn __reduce51< 'err, 'input, 'v, @@ -2510,7 +2646,7 @@ mod __parse__AIR { __symbols.push((__start, __Symbol::Variant11(__nt), __end)); (1, 17) } - pub(crate) fn __reduce48< + pub(crate) fn __reduce52< 'err, 'input, 'v, @@ -2531,7 +2667,7 @@ mod __parse__AIR { __symbols.push((__start, __Symbol::Variant17(__nt), __end)); (1, 18) } - pub(crate) fn __reduce49< + pub(crate) fn __reduce53< 'err, 'input, 'v, @@ -2556,7 +2692,7 @@ mod __parse__AIR { __symbols.push((__start, __Symbol::Variant17(__nt), __end)); (4, 18) } - pub(crate) fn __reduce50< + pub(crate) fn __reduce54< 'err, 'input, 'v, @@ -2622,8 +2758,8 @@ fn __action2< (_, left, _): (usize, usize, usize), (_, _, _): (usize, Token<'input>, usize), (_, _, _): (usize, Token<'input>, usize), - (_, p, _): (usize, PeerPart<'input>, usize), - (_, f, _): (usize, FunctionPart<'input>, usize), + (_, peer_part, _): (usize, PeerPart<'input>, usize), + (_, function_part, _): (usize, FunctionPart<'input>, usize), (_, args, _): (usize, Vec>, usize), (_, output, _): (usize, core::option::Option>, usize), (_, _, _): (usize, Token<'input>, usize), @@ -2633,7 +2769,7 @@ fn __action2< { let output = output.unwrap_or(CallOutputValue::None); let args = Rc::new(args); - let call = Call { peer_part: p, function_part: f, args, output }; + let call = Call { peer_part, function_part, args, output }; let span = Span { left, right }; validator.met_call(&call, span); @@ -2933,10 +3069,10 @@ fn __action17< input: &'input str, errors: &'err mut Vec, ParserError>>, validator: &'v mut VariableValidator<'input>, - (_, s, _): (usize, &'input str, usize), + (_, a, _): (usize, &'input str, usize), ) -> CallOutputValue<'input> { - CallOutputValue::Scalar(s) + CallOutputValue::Variable(Variable::Scalar(a)) } #[allow(unused_variables)] @@ -2948,10 +3084,10 @@ fn __action18< input: &'input str, errors: &'err mut Vec, ParserError>>, validator: &'v mut VariableValidator<'input>, - (_, a, _): (usize, &'input str, usize), + (_, s, _): (usize, &'input str, usize), ) -> CallOutputValue<'input> { - CallOutputValue::Accumulator(a) + CallOutputValue::Variable(Variable::Stream(s)) } #[allow(unused_variables)] @@ -3008,10 +3144,10 @@ fn __action22< input: &'input str, errors: &'err mut Vec, ParserError>>, validator: &'v mut VariableValidator<'input>, - (_, s, _): (usize, &'input str, usize), + (_, l, _): (usize, &'input str, usize), ) -> CallInstrValue<'input> { - CallInstrValue::Literal(s) + CallInstrValue::Literal(l) } #[allow(unused_variables)] @@ -3023,10 +3159,10 @@ fn __action23< input: &'input str, errors: &'err mut Vec, ParserError>>, validator: &'v mut VariableValidator<'input>, - (_, s, _): (usize, &'input str, usize), + (_, a, _): (usize, &'input str, usize), ) -> CallInstrValue<'input> { - CallInstrValue::Variable(s) + CallInstrValue::Variable(Variable::Scalar(a)) } #[allow(unused_variables)] @@ -3034,20 +3170,37 @@ fn __action24< 'err, 'input, 'v, +>( + input: &'input str, + errors: &'err mut Vec, ParserError>>, + validator: &'v mut VariableValidator<'input>, + (_, s, _): (usize, &'input str, usize), +) -> CallInstrValue<'input> +{ + CallInstrValue::Variable(Variable::Stream(s)) +} + +#[allow(unused_variables)] +fn __action25< + 'err, + 'input, + 'v, >( input: &'input str, errors: &'err mut Vec, ParserError>>, validator: &'v mut VariableValidator<'input>, (_, l, _): (usize, usize, usize), - (_, v, _): (usize, (&'input str, usize, bool), usize), + (_, j, _): (usize, (Variable<'input>, &'input str, bool), usize), (_, r, _): (usize, usize, usize), ) -> CallInstrValue<'input> { { - let (variable, path) = into_variable_and_path(v.0, v.1, v.2); - let should_flatten = v.2; + let variable = j.0; + let path = j.1; + let should_flatten = j.2; + // Due the json path constraints json path should be flattened in a call triplet. if !should_flatten { - let token = Token::JsonPath(v.0, v.1, v.2); + let token = Token::VariableWithJsonPath(variable.clone(), path, should_flatten); errors.push(make_flattened_error(l, token, r)); } CallInstrValue::JsonPath { variable, path, should_flatten } @@ -3055,7 +3208,7 @@ fn __action24< } #[allow(unused_variables)] -fn __action25< +fn __action26< 'err, 'input, 'v, @@ -3070,7 +3223,7 @@ fn __action25< } #[allow(unused_variables)] -fn __action26< +fn __action27< 'err, 'input, 'v, @@ -3085,7 +3238,7 @@ fn __action26< } #[allow(unused_variables)] -fn __action27< +fn __action28< 'err, 'input, 'v, @@ -3099,21 +3252,6 @@ fn __action27< CallInstrArgValue::Literal(s) } -#[allow(unused_variables)] -fn __action28< - 'err, - 'input, - 'v, ->( - input: &'input str, - errors: &'err mut Vec, ParserError>>, - validator: &'v mut VariableValidator<'input>, - (_, s, _): (usize, &'input str, usize), -) -> CallInstrArgValue<'input> -{ - CallInstrArgValue::Variable(s) -} - #[allow(unused_variables)] fn __action29< 'err, @@ -3123,14 +3261,10 @@ fn __action29< input: &'input str, errors: &'err mut Vec, ParserError>>, validator: &'v mut VariableValidator<'input>, - (_, v, _): (usize, (&'input str, usize, bool), usize), + (_, v, _): (usize, &'input str, usize), ) -> CallInstrArgValue<'input> { - { - let (variable, path) = into_variable_and_path(v.0, v.1, v.2); - let should_flatten = v.2; - CallInstrArgValue::JsonPath { variable, path, should_flatten } - } + CallInstrArgValue::Variable(Variable::Scalar(v)) } #[allow(unused_variables)] @@ -3138,6 +3272,36 @@ fn __action30< 'err, 'input, 'v, +>( + input: &'input str, + errors: &'err mut Vec, ParserError>>, + validator: &'v mut VariableValidator<'input>, + (_, v, _): (usize, &'input str, usize), +) -> CallInstrArgValue<'input> +{ + CallInstrArgValue::Variable(Variable::Stream(v)) +} + +#[allow(unused_variables)] +fn __action31< + 'err, + 'input, + 'v, +>( + input: &'input str, + errors: &'err mut Vec, ParserError>>, + validator: &'v mut VariableValidator<'input>, + (_, j, _): (usize, (Variable<'input>, &'input str, bool), usize), +) -> CallInstrArgValue<'input> +{ + CallInstrArgValue::JsonPath { variable: j.0, path: j.1, should_flatten: j.2 } +} + +#[allow(unused_variables)] +fn __action32< + 'err, + 'input, + 'v, >( input: &'input str, errors: &'err mut Vec, ParserError>>, @@ -3149,7 +3313,7 @@ fn __action30< } #[allow(unused_variables)] -fn __action31< +fn __action33< 'err, 'input, 'v, @@ -3164,7 +3328,7 @@ fn __action31< } #[allow(unused_variables)] -fn __action32< +fn __action34< 'err, 'input, 'v, @@ -3179,7 +3343,7 @@ fn __action32< } #[allow(unused_variables)] -fn __action33< +fn __action35< 'err, 'input, 'v, @@ -3193,41 +3357,6 @@ fn __action33< CallInstrArgValue::LastError } -#[allow(unused_variables)] -fn __action34< - 'err, - 'input, - 'v, ->( - input: &'input str, - errors: &'err mut Vec, ParserError>>, - validator: &'v mut VariableValidator<'input>, - (_, s, _): (usize, &'input str, usize), -) -> IterableValue<'input> -{ - IterableValue::Variable(s) -} - -#[allow(unused_variables)] -fn __action35< - 'err, - 'input, - 'v, ->( - input: &'input str, - errors: &'err mut Vec, ParserError>>, - validator: &'v mut VariableValidator<'input>, - (_, v, _): (usize, (&'input str, usize, bool), usize), -) -> IterableValue<'input> -{ - { - let (variable, path) = into_variable_and_path(v.0, v.1, v.2); - - let should_flatten = v.2; - IterableValue::JsonPath { variable, path, should_flatten } - } -} - #[allow(unused_variables)] fn __action36< 'err, @@ -3237,10 +3366,10 @@ fn __action36< input: &'input str, errors: &'err mut Vec, ParserError>>, validator: &'v mut VariableValidator<'input>, - (_, s, _): (usize, &'input str, usize), -) -> MatchableValue<'input> + (_, v, _): (usize, &'input str, usize), +) -> IterableValue<'input> { - MatchableValue::Variable(s) + IterableValue::Variable(Variable::Scalar(v)) } #[allow(unused_variables)] @@ -3248,6 +3377,66 @@ fn __action37< 'err, 'input, 'v, +>( + input: &'input str, + errors: &'err mut Vec, ParserError>>, + validator: &'v mut VariableValidator<'input>, + (_, v, _): (usize, &'input str, usize), +) -> IterableValue<'input> +{ + IterableValue::Variable(Variable::Stream(v)) +} + +#[allow(unused_variables)] +fn __action38< + 'err, + 'input, + 'v, +>( + input: &'input str, + errors: &'err mut Vec, ParserError>>, + validator: &'v mut VariableValidator<'input>, + (_, j, _): (usize, (Variable<'input>, &'input str, bool), usize), +) -> IterableValue<'input> +{ + IterableValue::JsonPath { variable: j.0, path: j.1, should_flatten: j.2 } +} + +#[allow(unused_variables)] +fn __action39< + 'err, + 'input, + 'v, +>( + input: &'input str, + errors: &'err mut Vec, ParserError>>, + validator: &'v mut VariableValidator<'input>, + (_, v, _): (usize, &'input str, usize), +) -> MatchableValue<'input> +{ + MatchableValue::Variable(Variable::Scalar(v)) +} + +#[allow(unused_variables)] +fn __action40< + 'err, + 'input, + 'v, +>( + input: &'input str, + errors: &'err mut Vec, ParserError>>, + validator: &'v mut VariableValidator<'input>, + (_, v, _): (usize, &'input str, usize), +) -> MatchableValue<'input> +{ + MatchableValue::Variable(Variable::Stream(v)) +} + +#[allow(unused_variables)] +fn __action41< + 'err, + 'input, + 'v, >( input: &'input str, errors: &'err mut Vec, ParserError>>, @@ -3259,7 +3448,7 @@ fn __action37< } #[allow(unused_variables)] -fn __action38< +fn __action42< 'err, 'input, 'v, @@ -3274,7 +3463,7 @@ fn __action38< } #[allow(unused_variables)] -fn __action39< +fn __action43< 'err, 'input, 'v, @@ -3289,7 +3478,7 @@ fn __action39< } #[allow(unused_variables)] -fn __action40< +fn __action44< 'err, 'input, 'v, @@ -3297,18 +3486,14 @@ fn __action40< input: &'input str, errors: &'err mut Vec, ParserError>>, validator: &'v mut VariableValidator<'input>, - (_, v, _): (usize, (&'input str, usize, bool), usize), + (_, j, _): (usize, (Variable<'input>, &'input str, bool), usize), ) -> MatchableValue<'input> { - { - let (variable, path) = into_variable_and_path(v.0, v.1, v.2); - let should_flatten = v.2; - MatchableValue::JsonPath { variable, path, should_flatten } - } + MatchableValue::JsonPath { variable: j.0, path: j.1, should_flatten: j.2 } } #[allow(unused_variables)] -fn __action41< +fn __action45< 'err, 'input, 'v, @@ -3324,7 +3509,7 @@ fn __action41< } #[allow(unused_variables)] -fn __action42< +fn __action46< 'err, 'input, 'v, @@ -3339,7 +3524,7 @@ fn __action42< } #[allow(unused_variables)] -fn __action43< +fn __action47< 'err, 'input, 'v, @@ -3354,7 +3539,7 @@ fn __action43< } #[allow(unused_variables)] -fn __action44< +fn __action48< 'err, 'input, 'v, @@ -3370,7 +3555,7 @@ fn __action44< } #[allow(unused_variables)] -fn __action45< +fn __action49< 'err, 'input, 'v, @@ -3385,7 +3570,7 @@ fn __action45< } #[allow(unused_variables)] -fn __action46< +fn __action50< 'err, 'input, 'v, @@ -3401,7 +3586,7 @@ fn __action46< } #[allow(unused_variables)] -fn __action47< +fn __action51< 'err, 'input, 'v, @@ -3417,7 +3602,7 @@ fn __action47< } #[allow(unused_variables)] -fn __action48< +fn __action52< 'err, 'input, 'v, @@ -3432,7 +3617,7 @@ fn __action48< } #[allow(unused_variables)] -fn __action49< +fn __action53< 'err, 'input, 'v, @@ -3448,7 +3633,7 @@ fn __action49< } #[allow(unused_variables)] -fn __action50< +fn __action54< 'err, 'input, 'v, @@ -3461,14 +3646,14 @@ fn __action50< { let __start0 = __0.0.clone(); let __end0 = __0.2.clone(); - let __temp0 = __action43( + let __temp0 = __action47( input, errors, validator, __0, ); let __temp0 = (__start0, __temp0, __end0); - __action48( + __action52( input, errors, validator, @@ -3477,7 +3662,7 @@ fn __action50< } #[allow(unused_variables)] -fn __action51< +fn __action55< 'err, 'input, 'v, @@ -3491,14 +3676,14 @@ fn __action51< { let __start0 = __1.0.clone(); let __end0 = __1.2.clone(); - let __temp0 = __action43( + let __temp0 = __action47( input, errors, validator, __1, ); let __temp0 = (__start0, __temp0, __end0); - __action49( + __action53( input, errors, validator, @@ -3508,7 +3693,7 @@ fn __action51< } #[allow(unused_variables)] -fn __action52< +fn __action56< 'err, 'input, 'v, @@ -3522,7 +3707,7 @@ fn __action52< { let __start0 = __0.2.clone(); let __end0 = __1.0.clone(); - let __temp0 = __action41( + let __temp0 = __action45( input, errors, validator, @@ -3541,7 +3726,7 @@ fn __action52< } #[allow(unused_variables)] -fn __action53< +fn __action57< 'err, 'input, 'v, @@ -3556,7 +3741,7 @@ fn __action53< { let __start0 = __1.0.clone(); let __end0 = __1.2.clone(); - let __temp0 = __action42( + let __temp0 = __action46( input, errors, validator, @@ -3574,7 +3759,7 @@ fn __action53< } #[allow(unused_variables)] -fn __action54< +fn __action58< 'err, 'input, 'v, @@ -3582,13 +3767,13 @@ fn __action54< input: &'input str, errors: &'err mut Vec, ParserError>>, validator: &'v mut VariableValidator<'input>, - __0: (usize, (&'input str, usize, bool), usize), + __0: (usize, (Variable<'input>, &'input str, bool), usize), __1: (usize, usize, usize), ) -> CallInstrValue<'input> { let __start0 = __0.0.clone(); let __end0 = __0.0.clone(); - let __temp0 = __action47( + let __temp0 = __action51( input, errors, validator, @@ -3596,7 +3781,7 @@ fn __action54< &__end0, ); let __temp0 = (__start0, __temp0, __end0); - __action24( + __action25( input, errors, validator, @@ -3607,7 +3792,7 @@ fn __action54< } #[allow(unused_variables)] -fn __action55< +fn __action59< 'err, 'input, 'v, @@ -3627,7 +3812,7 @@ fn __action55< { let __start0 = __0.0.clone(); let __end0 = __0.0.clone(); - let __temp0 = __action47( + let __temp0 = __action51( input, errors, validator, @@ -3652,7 +3837,7 @@ fn __action55< } #[allow(unused_variables)] -fn __action56< +fn __action60< 'err, 'input, 'v, @@ -3671,7 +3856,7 @@ fn __action56< { let __start0 = __0.0.clone(); let __end0 = __0.0.clone(); - let __temp0 = __action47( + let __temp0 = __action51( input, errors, validator, @@ -3695,7 +3880,7 @@ fn __action56< } #[allow(unused_variables)] -fn __action57< +fn __action61< 'err, 'input, 'v, @@ -3712,7 +3897,7 @@ fn __action57< { let __start0 = __0.0.clone(); let __end0 = __0.0.clone(); - let __temp0 = __action47( + let __temp0 = __action51( input, errors, validator, @@ -3734,7 +3919,7 @@ fn __action57< } #[allow(unused_variables)] -fn __action58< +fn __action62< 'err, 'input, 'v, @@ -3753,7 +3938,7 @@ fn __action58< { let __start0 = __0.0.clone(); let __end0 = __0.0.clone(); - let __temp0 = __action47( + let __temp0 = __action51( input, errors, validator, @@ -3777,7 +3962,7 @@ fn __action58< } #[allow(unused_variables)] -fn __action59< +fn __action63< 'err, 'input, 'v, @@ -3796,7 +3981,7 @@ fn __action59< { let __start0 = __0.0.clone(); let __end0 = __0.0.clone(); - let __temp0 = __action47( + let __temp0 = __action51( input, errors, validator, @@ -3820,7 +4005,7 @@ fn __action59< } #[allow(unused_variables)] -fn __action60< +fn __action64< 'err, 'input, 'v, @@ -3828,12 +4013,12 @@ fn __action60< input: &'input str, errors: &'err mut Vec, ParserError>>, validator: &'v mut VariableValidator<'input>, - __0: (usize, (&'input str, usize, bool), usize), + __0: (usize, (Variable<'input>, &'input str, bool), usize), ) -> CallInstrValue<'input> { let __start0 = __0.2.clone(); let __end0 = __0.2.clone(); - let __temp0 = __action44( + let __temp0 = __action48( input, errors, validator, @@ -3841,7 +4026,7 @@ fn __action60< &__end0, ); let __temp0 = (__start0, __temp0, __end0); - __action54( + __action58( input, errors, validator, @@ -3851,7 +4036,7 @@ fn __action60< } #[allow(unused_variables)] -fn __action61< +fn __action65< 'err, 'input, 'v, @@ -3870,168 +4055,7 @@ fn __action61< { let __start0 = __6.2.clone(); let __end0 = __6.2.clone(); - let __temp0 = __action44( - input, - errors, - validator, - &__start0, - &__end0, - ); - let __temp0 = (__start0, __temp0, __end0); - __action55( - input, - errors, - validator, - __0, - __1, - __2, - __3, - __4, - __5, - __6, - __temp0, - ) -} - -#[allow(unused_variables)] -fn __action62< - 'err, - 'input, - 'v, ->( - input: &'input str, - errors: &'err mut Vec, ParserError>>, - validator: &'v mut VariableValidator<'input>, - __0: (usize, Token<'input>, usize), - __1: (usize, Token<'input>, usize), - __2: (usize, IterableValue<'input>, usize), - __3: (usize, &'input str, usize), - __4: (usize, Box>, usize), - __5: (usize, Token<'input>, usize), -) -> Box> -{ - let __start0 = __5.2.clone(); - let __end0 = __5.2.clone(); - let __temp0 = __action44( - input, - errors, - validator, - &__start0, - &__end0, - ); - let __temp0 = (__start0, __temp0, __end0); - __action56( - input, - errors, - validator, - __0, - __1, - __2, - __3, - __4, - __5, - __temp0, - ) -} - -#[allow(unused_variables)] -fn __action63< - 'err, - 'input, - 'v, ->( - input: &'input str, - errors: &'err mut Vec, ParserError>>, - validator: &'v mut VariableValidator<'input>, - __0: (usize, Token<'input>, usize), - __1: (usize, Token<'input>, usize), - __2: (usize, &'input str, usize), - __3: (usize, Token<'input>, usize), -) -> Box> -{ - let __start0 = __3.2.clone(); - let __end0 = __3.2.clone(); - let __temp0 = __action44( - input, - errors, - validator, - &__start0, - &__end0, - ); - let __temp0 = (__start0, __temp0, __end0); - __action57( - input, - errors, - validator, - __0, - __1, - __2, - __3, - __temp0, - ) -} - -#[allow(unused_variables)] -fn __action64< - 'err, - 'input, - 'v, ->( - input: &'input str, - errors: &'err mut Vec, ParserError>>, - validator: &'v mut VariableValidator<'input>, - __0: (usize, Token<'input>, usize), - __1: (usize, Token<'input>, usize), - __2: (usize, MatchableValue<'input>, usize), - __3: (usize, MatchableValue<'input>, usize), - __4: (usize, Box>, usize), - __5: (usize, Token<'input>, usize), -) -> Box> -{ - let __start0 = __5.2.clone(); - let __end0 = __5.2.clone(); - let __temp0 = __action44( - input, - errors, - validator, - &__start0, - &__end0, - ); - let __temp0 = (__start0, __temp0, __end0); - __action58( - input, - errors, - validator, - __0, - __1, - __2, - __3, - __4, - __5, - __temp0, - ) -} - -#[allow(unused_variables)] -fn __action65< - 'err, - 'input, - 'v, ->( - input: &'input str, - errors: &'err mut Vec, ParserError>>, - validator: &'v mut VariableValidator<'input>, - __0: (usize, Token<'input>, usize), - __1: (usize, Token<'input>, usize), - __2: (usize, MatchableValue<'input>, usize), - __3: (usize, MatchableValue<'input>, usize), - __4: (usize, Box>, usize), - __5: (usize, Token<'input>, usize), -) -> Box> -{ - let __start0 = __5.2.clone(); - let __end0 = __5.2.clone(); - let __temp0 = __action44( + let __temp0 = __action48( input, errors, validator, @@ -4049,6 +4073,7 @@ fn __action65< __3, __4, __5, + __6, __temp0, ) } @@ -4058,6 +4083,166 @@ fn __action66< 'err, 'input, 'v, +>( + input: &'input str, + errors: &'err mut Vec, ParserError>>, + validator: &'v mut VariableValidator<'input>, + __0: (usize, Token<'input>, usize), + __1: (usize, Token<'input>, usize), + __2: (usize, IterableValue<'input>, usize), + __3: (usize, &'input str, usize), + __4: (usize, Box>, usize), + __5: (usize, Token<'input>, usize), +) -> Box> +{ + let __start0 = __5.2.clone(); + let __end0 = __5.2.clone(); + let __temp0 = __action48( + input, + errors, + validator, + &__start0, + &__end0, + ); + let __temp0 = (__start0, __temp0, __end0); + __action60( + input, + errors, + validator, + __0, + __1, + __2, + __3, + __4, + __5, + __temp0, + ) +} + +#[allow(unused_variables)] +fn __action67< + 'err, + 'input, + 'v, +>( + input: &'input str, + errors: &'err mut Vec, ParserError>>, + validator: &'v mut VariableValidator<'input>, + __0: (usize, Token<'input>, usize), + __1: (usize, Token<'input>, usize), + __2: (usize, &'input str, usize), + __3: (usize, Token<'input>, usize), +) -> Box> +{ + let __start0 = __3.2.clone(); + let __end0 = __3.2.clone(); + let __temp0 = __action48( + input, + errors, + validator, + &__start0, + &__end0, + ); + let __temp0 = (__start0, __temp0, __end0); + __action61( + input, + errors, + validator, + __0, + __1, + __2, + __3, + __temp0, + ) +} + +#[allow(unused_variables)] +fn __action68< + 'err, + 'input, + 'v, +>( + input: &'input str, + errors: &'err mut Vec, ParserError>>, + validator: &'v mut VariableValidator<'input>, + __0: (usize, Token<'input>, usize), + __1: (usize, Token<'input>, usize), + __2: (usize, MatchableValue<'input>, usize), + __3: (usize, MatchableValue<'input>, usize), + __4: (usize, Box>, usize), + __5: (usize, Token<'input>, usize), +) -> Box> +{ + let __start0 = __5.2.clone(); + let __end0 = __5.2.clone(); + let __temp0 = __action48( + input, + errors, + validator, + &__start0, + &__end0, + ); + let __temp0 = (__start0, __temp0, __end0); + __action62( + input, + errors, + validator, + __0, + __1, + __2, + __3, + __4, + __5, + __temp0, + ) +} + +#[allow(unused_variables)] +fn __action69< + 'err, + 'input, + 'v, +>( + input: &'input str, + errors: &'err mut Vec, ParserError>>, + validator: &'v mut VariableValidator<'input>, + __0: (usize, Token<'input>, usize), + __1: (usize, Token<'input>, usize), + __2: (usize, MatchableValue<'input>, usize), + __3: (usize, MatchableValue<'input>, usize), + __4: (usize, Box>, usize), + __5: (usize, Token<'input>, usize), +) -> Box> +{ + let __start0 = __5.2.clone(); + let __end0 = __5.2.clone(); + let __temp0 = __action48( + input, + errors, + validator, + &__start0, + &__end0, + ); + let __temp0 = (__start0, __temp0, __end0); + __action63( + input, + errors, + validator, + __0, + __1, + __2, + __3, + __4, + __5, + __temp0, + ) +} + +#[allow(unused_variables)] +fn __action70< + 'err, + 'input, + 'v, >( input: &'input str, errors: &'err mut Vec, ParserError>>, @@ -4073,14 +4258,14 @@ fn __action66< { let __start0 = __5.0.clone(); let __end0 = __5.2.clone(); - let __temp0 = __action45( + let __temp0 = __action49( input, errors, validator, __5, ); let __temp0 = (__start0, __temp0, __end0); - __action61( + __action65( input, errors, validator, @@ -4095,7 +4280,7 @@ fn __action66< } #[allow(unused_variables)] -fn __action67< +fn __action71< 'err, 'input, 'v, @@ -4113,7 +4298,7 @@ fn __action67< { let __start0 = __4.2.clone(); let __end0 = __5.0.clone(); - let __temp0 = __action46( + let __temp0 = __action50( input, errors, validator, @@ -4121,7 +4306,7 @@ fn __action67< &__end0, ); let __temp0 = (__start0, __temp0, __end0); - __action61( + __action65( input, errors, validator, diff --git a/crates/air-parser/src/parser/air_parser.rs b/crates/air-parser/src/parser/air_parser.rs index 713e26e8..54a54d68 100644 --- a/crates/air-parser/src/parser/air_parser.rs +++ b/crates/air-parser/src/parser/air_parser.rs @@ -148,7 +148,7 @@ fn lexical_error_to_label(file_id: usize, error: LexerError) -> Label { IsNotAlphanumeric(start, end) => { Label::primary(file_id, start..end).with_message(error.to_string()) } - EmptyAccName(start, end) => { + EmptyStreamName(start, end) => { Label::primary(file_id, start..end).with_message(error.to_string()) } EmptyVariableOrConst(start, end) => { @@ -175,16 +175,6 @@ fn lexical_error_to_label(file_id: usize, error: LexerError) -> Label { } } -pub(super) fn into_variable_and_path(str: &str, pos: usize, should_flatten: bool) -> (&str, &str) { - let json_path = if should_flatten { - &str[pos + 1..str.len() - 1] - } else { - &str[pos + 1..] - }; - - (&str[0..pos], json_path) -} - pub(super) fn make_flattened_error( start_pos: usize, token: Token<'_>, diff --git a/crates/air-parser/src/parser/ast.rs b/crates/air-parser/src/parser/ast.rs index f9cf286b..e1a1254f 100644 --- a/crates/air-parser/src/parser/ast.rs +++ b/crates/air-parser/src/parser/ast.rs @@ -17,6 +17,7 @@ mod traits; pub use crate::parser::lexer::Number; +pub use crate::parser::lexer::Variable; use serde::Deserialize; use serde::Serialize; @@ -62,9 +63,9 @@ pub struct Call<'i> { pub enum CallInstrValue<'i> { InitPeerId, Literal(&'i str), - Variable(&'i str), + Variable(Variable<'i>), JsonPath { - variable: &'i str, + variable: Variable<'i>, path: &'i str, should_flatten: bool, }, @@ -77,9 +78,9 @@ pub enum CallInstrArgValue<'i> { Literal(&'i str), Number(Number), Boolean(bool), - Variable(&'i str), + Variable(Variable<'i>), JsonPath { - variable: &'i str, + variable: Variable<'i>, path: &'i str, should_flatten: bool, }, @@ -87,9 +88,9 @@ pub enum CallInstrArgValue<'i> { #[derive(Debug, PartialEq, Clone, Serialize, Deserialize)] pub enum IterableValue<'i> { - Variable(&'i str), + Variable(Variable<'i>), JsonPath { - variable: &'i str, + variable: Variable<'i>, path: &'i str, should_flatten: bool, }, @@ -100,9 +101,9 @@ pub enum MatchableValue<'i> { Literal(&'i str), Number(Number), Boolean(bool), - Variable(&'i str), + Variable(Variable<'i>), JsonPath { - variable: &'i str, + variable: Variable<'i>, path: &'i str, should_flatten: bool, }, @@ -110,8 +111,7 @@ pub enum MatchableValue<'i> { #[derive(Serialize, Debug, PartialEq, Clone)] pub enum CallOutputValue<'i> { - Scalar(&'i str), - Accumulator(&'i str), + Variable(Variable<'i>), None, } diff --git a/crates/air-parser/src/parser/ast/traits.rs b/crates/air-parser/src/parser/ast/traits.rs index d8c5a60d..83bd924c 100644 --- a/crates/air-parser/src/parser/ast/traits.rs +++ b/crates/air-parser/src/parser/ast/traits.rs @@ -38,8 +38,8 @@ impl fmt::Display for CallInstrArgValue<'_> { } } -fn print_json_path( - variable: &str, +fn print_json_path<'a>( + variable: &Variable<'a>, path: &str, should_flatten: &bool, f: &mut fmt::Formatter, @@ -104,8 +104,7 @@ impl fmt::Display for CallOutputValue<'_> { use CallOutputValue::*; match self { - Scalar(str) => write!(f, "{}", str), - Accumulator(str) => write!(f, "{}[]", str), + Variable(variable) => write!(f, "{}", variable), None => Ok(()), } } diff --git a/crates/air-parser/src/parser/lexer/air_lexer.rs b/crates/air-parser/src/parser/lexer/air_lexer.rs index f20a070a..ebeb2a0a 100644 --- a/crates/air-parser/src/parser/lexer/air_lexer.rs +++ b/crates/air-parser/src/parser/lexer/air_lexer.rs @@ -15,7 +15,6 @@ */ use super::errors::LexerError; -use super::is_aqua_alphanumeric; use super::token::Token; use super::LexerResult; @@ -191,31 +190,10 @@ fn string_to_token(input: &str, start_pos: usize) -> LexerResult { TRUE_VALUE => Ok(Token::Boolean(true)), FALSE_VALUE => Ok(Token::Boolean(false)), - str if str.ends_with(ACC_END_TAG) => try_parse_accumulator(str, start_pos), str => super::call_variable_parser::try_parse_call_variable(str, start_pos), } } -fn try_parse_accumulator(maybe_acc: &str, start: usize) -> LexerResult { - const ACC_END_TAG_SIZE: usize = 2; - - let str_len = maybe_acc.len(); - if str_len == ACC_END_TAG_SIZE { - return Err(LexerError::EmptyAccName(start, start)); - } - - // this slice is safe here because str's been checked for ending with "[]" - let maybe_acc = &maybe_acc[0..str_len - ACC_END_TAG_SIZE]; - - for (pos, ch) in maybe_acc.chars().enumerate() { - if !is_aqua_alphanumeric(ch) { - return Err(LexerError::IsNotAlphanumeric(start + pos, start + pos)); - } - } - - Ok(Token::Accumulator(maybe_acc)) -} - const CALL_INSTR: &str = "call"; const SEQ_INSTR: &str = "seq"; const PAR_INSTR: &str = "par"; @@ -231,5 +209,3 @@ const LAST_ERROR: &str = "%last_error%"; const TRUE_VALUE: &str = "true"; const FALSE_VALUE: &str = "false"; - -const ACC_END_TAG: &str = "[]"; diff --git a/crates/air-parser/src/parser/lexer/call_variable_parser.rs b/crates/air-parser/src/parser/lexer/call_variable_parser.rs index 38b5e5a5..7807b07a 100644 --- a/crates/air-parser/src/parser/lexer/call_variable_parser.rs +++ b/crates/air-parser/src/parser/lexer/call_variable_parser.rs @@ -17,6 +17,7 @@ use super::LexerError; use super::LexerResult; use super::Token; +use super::Variable; use std::convert::TryInto; use std::iter::Peekable; @@ -36,6 +37,7 @@ struct ParserState { pub(self) digit_met: bool, pub(self) flattening_met: bool, pub(self) is_first_char: bool, + pub(self) is_first_stream_tag: bool, pub(self) current_char: char, pub(self) current_pos: usize, } @@ -61,6 +63,7 @@ impl<'input> CallVariableParser<'input> { digit_met: false, flattening_met: false, is_first_char: true, + is_first_stream_tag: false, current_char, current_pos, }; @@ -164,7 +167,7 @@ impl<'input> CallVariableParser<'input> { } fn try_parse_as_variable(&mut self) -> LexerResult<()> { - if self.try_parse_as_json_path_start()? { + if self.try_parse_as_stream_start()? || self.try_parse_as_json_path_start()? { return Ok(()); } else if self.is_json_path_started() { self.try_parse_as_json_path()?; @@ -175,6 +178,20 @@ impl<'input> CallVariableParser<'input> { Ok(()) } + fn try_parse_as_stream_start(&mut self) -> LexerResult { + if self.current_pos() == 0 && self.current_char() == STREAM_START_TAG { + if self.string_to_parse.len() == 1 { + let error_pos = self.pos_in_string_to_parse(); + return Err(LexerError::EmptyStreamName(error_pos, error_pos)); + } + + self.state.is_first_stream_tag = true; + return Ok(true); + } + + Ok(false) + } + fn try_parse_as_json_path_start(&mut self) -> LexerResult { self.try_parse_first_met_dot() } @@ -253,6 +270,15 @@ impl<'input> CallVariableParser<'input> { self.current_pos() == self.string_to_parse.len() - 1 } + fn to_variable<'v>(&self, variable_name: &'v str) -> Variable<'v> { + if self.state.is_first_stream_tag { + // TODO: cut the stream tag after the refactoring. + Variable::Stream(variable_name) + } else { + Variable::Scalar(variable_name) + } + } + fn to_token(&self) -> LexerResult> { use super::token::UnparsedNumber; @@ -267,12 +293,42 @@ impl<'input> CallVariableParser<'input> { let number: super::Number = number.try_into()?; Ok(number.into()) } - (false, false) => Ok(Token::Alphanumeric(self.string_to_parse)), - (false, true) => Ok(Token::JsonPath( - self.string_to_parse, - self.state.first_dot_met_pos.unwrap(), - self.state.flattening_met, - )), + (false, false) => { + if self.state.is_first_stream_tag { + Ok(Token::Stream(&self.string_to_parse)) + } else { + Ok(Token::Alphanumeric(&self.string_to_parse)) + } + } + (false, true) => { + let json_path_start_pos = self.state.first_dot_met_pos.unwrap(); + let should_flatten = self.state.flattening_met; + let (variable, json_path) = to_variable_and_path( + &self.string_to_parse, + json_path_start_pos, + should_flatten, + ); + let variable = self.to_variable(variable); + + Ok(Token::VariableWithJsonPath( + variable, + json_path, + should_flatten, + )) + } } } } + +const STREAM_START_TAG: char = '$'; + +fn to_variable_and_path(str: &str, pos: usize, should_flatten: bool) -> (&str, &str) { + let json_path = if should_flatten { + // -1 to not include the flattening symbol ! to the resulted json path + &str[pos + 1..str.len() - 1] + } else { + &str[pos + 1..] + }; + + (&str[0..pos], json_path) +} diff --git a/crates/air-parser/src/parser/lexer/errors.rs b/crates/air-parser/src/parser/lexer/errors.rs index ad1fc5ea..51f4d2c8 100644 --- a/crates/air-parser/src/parser/lexer/errors.rs +++ b/crates/air-parser/src/parser/lexer/errors.rs @@ -30,8 +30,8 @@ pub enum LexerError { #[error("only alphanumeric, '_', and '-' characters are allowed in this position")] IsNotAlphanumeric(usize, usize), - #[error("an accumulator name should be non empty")] - EmptyAccName(usize, usize), + #[error("a stream name should be non empty")] + EmptyStreamName(usize, usize), #[error("this variable or constant shouldn't have empty name")] EmptyVariableOrConst(usize, usize), diff --git a/crates/air-parser/src/parser/lexer/mod.rs b/crates/air-parser/src/parser/lexer/mod.rs index 7b1fcbd4..77016d86 100644 --- a/crates/air-parser/src/parser/lexer/mod.rs +++ b/crates/air-parser/src/parser/lexer/mod.rs @@ -27,6 +27,7 @@ pub use air_lexer::AIRLexer; pub use errors::LexerError; pub use token::Number; pub use token::Token; +pub use token::Variable; pub(super) type LexerResult = std::result::Result; diff --git a/crates/air-parser/src/parser/lexer/tests.rs b/crates/air-parser/src/parser/lexer/tests.rs index afa2c751..903ddff4 100644 --- a/crates/air-parser/src/parser/lexer/tests.rs +++ b/crates/air-parser/src/parser/lexer/tests.rs @@ -19,6 +19,7 @@ use super::AIRLexer; use super::LexerError; use super::Number; use super::Token; +use super::Variable; fn run_lexer(input: &str) -> Vec, usize, LexerError>> { let lexer = AIRLexer::new(input); @@ -152,17 +153,10 @@ fn init_peer_id() { } #[test] -fn accumulator() { - const ACC: &str = "accumulator____asdasd[]"; +fn stream() { + const STREAM: &str = "$stream____asdasd"; - lexer_test( - ACC, - Single(Ok(( - 0, - Token::Accumulator(&ACC[0..ACC.len() - 2]), - ACC.len(), - ))), - ); + lexer_test(STREAM, Single(Ok((0, Token::Stream(STREAM), STREAM.len())))); } #[test] @@ -268,14 +262,15 @@ fn too_big_float_number() { #[test] fn json_path() { - // this json path contains all allowed in json path charactes + // this json path contains all allowed in json path characters const JSON_PATH: &str = r#"value.$[$@[]():?.*,"]"#; + let variable = Variable::Scalar("value"); lexer_test( JSON_PATH, Single(Ok(( 0, - Token::JsonPath(JSON_PATH, 5, false), + Token::VariableWithJsonPath(variable, r#"$[$@[]():?.*,"]"#, false), JSON_PATH.len(), ))), ); diff --git a/crates/air-parser/src/parser/lexer/token.rs b/crates/air-parser/src/parser/lexer/token.rs index 416e2a07..4fe7838e 100644 --- a/crates/air-parser/src/parser/lexer/token.rs +++ b/crates/air-parser/src/parser/lexer/token.rs @@ -17,7 +17,7 @@ use serde::Deserialize; use serde::Serialize; -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub enum Token<'input> { OpenRoundBracket, CloseRoundBracket, @@ -26,8 +26,8 @@ pub enum Token<'input> { StringLiteral(&'input str), Alphanumeric(&'input str), - JsonPath(&'input str, usize, bool), - Accumulator(&'input str), + Stream(&'input str), + VariableWithJsonPath(Variable<'input>, &'input str, bool), Number(Number), Boolean(bool), @@ -45,6 +45,12 @@ pub enum Token<'input> { MisMatch, } +#[derive(Debug, Clone, PartialEq, Hash, Serialize, Deserialize)] +pub enum Variable<'input> { + Scalar(&'input str), + Stream(&'input str), +} + #[derive(Debug, PartialEq, Clone, Serialize, Deserialize)] pub enum Number { Int(i64), @@ -64,6 +70,17 @@ impl fmt::Display for Number { } } +impl fmt::Display for Variable<'_> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + use Variable::*; + + match self { + Scalar(name) => write!(f, "{}", name), + Stream(name) => write!(f, "&{}", name), + } + } +} + impl From for Token<'_> { fn from(value: Number) -> Self { Token::Number(value) diff --git a/crates/air-parser/src/parser/tests.rs b/crates/air-parser/src/parser/tests.rs index 0ddb21e0..c42f297f 100644 --- a/crates/air-parser/src/parser/tests.rs +++ b/crates/air-parser/src/parser/tests.rs @@ -17,7 +17,12 @@ use crate::ast; use crate::parser::AIRParser; use crate::parser::ParserError; +use ast::Call; +use ast::CallInstrArgValue; +use ast::CallInstrValue; use ast::Instruction; +use ast::Variable::Scalar; +use ast::Variable::Stream; use fstrings::f; use lalrpop_util::ParseError; @@ -32,15 +37,12 @@ fn parse(source_code: &str) -> Instruction { let mut validator = crate::parser::VariableValidator::new(); parser .parse(source_code, &mut errors, &mut validator, lexer) - .expect("parsing should be successfull") + .expect("parsing should be successful") }) } #[test] fn parse_seq() { - use ast::Call; - use ast::CallInstrArgValue; - use ast::CallInstrValue; use ast::CallOutputValue::*; use ast::FunctionPart::*; use ast::PeerPart::*; @@ -54,17 +56,17 @@ fn parse_seq() { let instruction = parse(source_code); let expected = seq( Instruction::Call(Call { - peer_part: PeerPk(CallInstrValue::Variable("peerid")), - function_part: FuncName(CallInstrValue::Variable("function")), + peer_part: PeerPk(CallInstrValue::Variable(Scalar("peerid"))), + function_part: FuncName(CallInstrValue::Variable(Scalar("function"))), args: Rc::new(vec![]), - output: Scalar("output"), + output: Variable(Scalar("output")), }), Instruction::Call(Call { peer_part: PeerPk(CallInstrValue::Literal("id")), function_part: FuncName(CallInstrValue::Literal("f")), args: Rc::new(vec![ CallInstrArgValue::Literal("hello"), - CallInstrArgValue::Variable("name"), + CallInstrArgValue::Variable(Scalar("name")), ]), output: None, }), @@ -74,9 +76,6 @@ fn parse_seq() { #[test] fn parse_seq_seq() { - use ast::Call; - use ast::CallInstrArgValue; - use ast::CallInstrValue; use ast::CallOutputValue::*; use ast::FunctionPart::*; use ast::PeerPart::*; @@ -87,26 +86,26 @@ fn parse_seq_seq() { (call peerid function []) (call (peerid serviceA) ("serviceB" function) []) ) - (call "id" "f" ["hello" name] output[]) + (call "id" "f" ["hello" name] $output) ) "#; let instruction = parse(source_code); let expected = seq( seq( Instruction::Call(Call { - peer_part: PeerPk(CallInstrValue::Variable("peerid")), - function_part: FuncName(CallInstrValue::Variable("function")), + peer_part: PeerPk(CallInstrValue::Variable(Scalar("peerid"))), + function_part: FuncName(CallInstrValue::Variable(Scalar("function"))), args: Rc::new(vec![]), output: None, }), Instruction::Call(Call { peer_part: PeerPkWithServiceId( - CallInstrValue::Variable("peerid"), - CallInstrValue::Variable("serviceA"), + CallInstrValue::Variable(Scalar("peerid")), + CallInstrValue::Variable(Scalar("serviceA")), ), function_part: ServiceIdWithFuncName( CallInstrValue::Literal("serviceB"), - CallInstrValue::Variable("function"), + CallInstrValue::Variable(Scalar("function")), ), args: Rc::new(vec![]), output: None, @@ -117,9 +116,9 @@ fn parse_seq_seq() { function_part: FuncName(CallInstrValue::Literal("f")), args: Rc::new(vec![ CallInstrArgValue::Literal("hello"), - CallInstrArgValue::Variable("name"), + CallInstrArgValue::Variable(Scalar("name")), ]), - output: Accumulator("output"), + output: Variable(Stream("$output")), }), ); assert_eq!(instruction, expected); @@ -127,29 +126,26 @@ fn parse_seq_seq() { #[test] fn parse_json_path() { - use ast::Call; - use ast::CallInstrArgValue; - use ast::CallInstrValue; use ast::CallOutputValue::*; use ast::FunctionPart::*; use ast::PeerPart::*; let source_code = r#" - (call id.$.a! "f" ["hello" name] void[]) + (call id.$.a! "f" ["hello" name] $void) "#; let instruction = parse(source_code); let expected = Instruction::Call(Call { peer_part: PeerPk(CallInstrValue::JsonPath { - variable: "id", + variable: Scalar("id"), path: "$.a", should_flatten: true, }), function_part: FuncName(CallInstrValue::Literal("f")), args: Rc::new(vec![ CallInstrArgValue::Literal("hello"), - CallInstrArgValue::Variable("name"), + CallInstrArgValue::Variable(Scalar("name")), ]), - output: Accumulator("void"), + output: Variable(Stream("$void")), }); assert_eq!(instruction, expected); } @@ -157,7 +153,7 @@ fn parse_json_path() { #[test] fn parse_undefined_variable() { let source_code = r#" - (call id.$.a "f" ["hello" name] void[]) + (call id.$.a "f" ["hello" name] $void) "#; let lexer = crate::AIRLexer::new(source_code); @@ -190,7 +186,7 @@ fn parse_undefined_iterable() { (call "" ("" "") [] iterable) (fold iterable i (seq - (call "" ("" "") ["hello" ""] void[]) + (call "" ("" "") ["hello" ""] $void) (next j) ) ) @@ -221,8 +217,6 @@ fn parse_undefined_iterable() { #[test] fn parse_json_path_complex() { - use ast::Call; - use ast::CallInstrValue; use ast::CallOutputValue::*; use ast::FunctionPart::*; use ast::PeerPart::*; @@ -237,23 +231,23 @@ fn parse_json_path_complex() { let expected = seq( Instruction::Call(Call { peer_part: PeerPk(CallInstrValue::JsonPath { - variable: "m", + variable: Scalar("m"), path: "$.[1]", should_flatten: true, }), function_part: FuncName(CallInstrValue::Literal("f")), args: Rc::new(vec![]), - output: Scalar("void"), + output: Variable(Scalar("void")), }), Instruction::Call(Call { peer_part: PeerPk(CallInstrValue::JsonPath { - variable: "m", + variable: Scalar("m"), path: r#"$.abc["c"].cde[a][0].cde["bcd"]"#, should_flatten: true, }), function_part: FuncName(CallInstrValue::Literal("f")), args: Rc::new(vec![]), - output: Scalar("void"), + output: Variable(Scalar("void")), }), ); assert_eq!(instruction, expected); @@ -261,20 +255,17 @@ fn parse_json_path_complex() { #[test] fn json_path_square_braces() { - use ast::Call; - use ast::CallInstrArgValue; - use ast::CallInstrValue; use ast::CallOutputValue::*; use ast::FunctionPart::*; use ast::PeerPart::*; let source_code = r#" - (call u.$["peer_id"]! ("return" "") [u.$["peer_id"].cde[0]["abc"].abc u.$["name"]] void[]) + (call u.$["peer_id"]! ("return" "") [u.$["peer_id"].cde[0]["abc"].abc u.$["name"]] $void) "#; let instruction = parse(source_code); let expected = Instruction::Call(Call { peer_part: PeerPk(CallInstrValue::JsonPath { - variable: "u", + variable: Scalar("u"), path: r#"$["peer_id"]"#, should_flatten: true, }), @@ -284,17 +275,17 @@ fn json_path_square_braces() { ), args: Rc::new(vec![ CallInstrArgValue::JsonPath { - variable: "u", + variable: Scalar("u"), path: r#"$["peer_id"].cde[0]["abc"].abc"#, should_flatten: false, }, CallInstrArgValue::JsonPath { - variable: "u", + variable: Scalar("u"), path: r#"$["name"]"#, should_flatten: false, }, ]), - output: Accumulator("void"), + output: Variable(Stream("$void")), }); assert_eq!(instruction, expected); @@ -344,8 +335,12 @@ fn parse_fold() { (null) ) "#; - let instruction = parse(source_code); - let expected = fold(ast::IterableValue::Variable("iterable"), "i", null()); + let instruction = parse(&source_code); + let expected = fold( + ast::IterableValue::Variable(Scalar("iterable")), + "i", + null(), + ); assert_eq!(instruction, expected); } @@ -358,8 +353,8 @@ fn parse_match() { (null) ) "#; - let instruction = parse(source_code); - let expected = match_(Variable("v1"), Variable("v2"), null()); + let instruction = parse(&source_code); + let expected = match_(Variable(Scalar("v1")), Variable(Scalar("v2")), null()); assert_eq!(instruction, expected); } @@ -372,8 +367,8 @@ fn parse_mismatch() { (null) ) "#; - let instruction = parse(source_code); - let expected = mismatch(Variable("v1"), Variable("v2"), null()); + let instruction = parse(&source_code); + let expected = mismatch(Variable(Scalar("v1")), Variable(Scalar("v2")), null()); assert_eq!(instruction, expected); } @@ -389,7 +384,7 @@ fn parse_fold_with_xor_par_seq() { let instruction = parse(&source_code); let instr = binary_instruction(*name); let expected = fold( - ast::IterableValue::Variable("iterable"), + ast::IterableValue::Variable(Scalar("iterable")), "i", instr(null(), null()), ); @@ -505,7 +500,7 @@ fn seq_par_call() { CallInstrValue::Literal("local_fn_name"), ), args: Rc::new(vec![]), - output: Scalar("result_1"), + output: Variable(Scalar("result_1")), }), Instruction::Call(Call { peer_part: PeerPk(CallInstrValue::Literal(&peer_id)), @@ -514,7 +509,7 @@ fn seq_par_call() { CallInstrValue::Literal("fn_name"), ), args: Rc::new(vec![]), - output: Scalar("g"), + output: Variable(Scalar("g")), }), ), Instruction::Call(Call { @@ -524,7 +519,7 @@ fn seq_par_call() { CallInstrValue::Literal("local_fn_name"), ), args: Rc::new(vec![]), - output: Scalar("result_2"), + output: Variable(Scalar("result_2")), }), ); @@ -572,7 +567,7 @@ fn seq_with_empty_and_dash() { CallInstrValue::Literal(""), ), args: Rc::new(vec![CallInstrArgValue::Literal("module-bytes")]), - output: Scalar("module-bytes"), + output: Variable(Scalar("module-bytes")), }), Instruction::Call(Call { peer_part: PeerPk(CallInstrValue::Literal("set_variables")), @@ -581,7 +576,7 @@ fn seq_with_empty_and_dash() { CallInstrValue::Literal(""), ), args: Rc::new(vec![CallInstrArgValue::Literal("module_config")]), - output: Scalar("module_config"), + output: Variable(Scalar("module_config")), }), ), Instruction::Call(Call { @@ -591,7 +586,7 @@ fn seq_with_empty_and_dash() { CallInstrValue::Literal(""), ), args: Rc::new(vec![CallInstrArgValue::Literal("blueprint")]), - output: Scalar("blueprint"), + output: Variable(Scalar("blueprint")), }), ), seq( @@ -602,10 +597,10 @@ fn seq_with_empty_and_dash() { CallInstrValue::Literal(""), ), args: Rc::new(vec![ - CallInstrArgValue::Variable("module-bytes"), - CallInstrArgValue::Variable("module_config"), + CallInstrArgValue::Variable(Scalar("module-bytes")), + CallInstrArgValue::Variable(Scalar("module_config")), ]), - output: Scalar("module"), + output: Variable(Scalar("module")), }), seq( Instruction::Call(Call { @@ -614,8 +609,8 @@ fn seq_with_empty_and_dash() { CallInstrValue::Literal("add_blueprint"), CallInstrValue::Literal(""), ), - args: Rc::new(vec![CallInstrArgValue::Variable("blueprint")]), - output: Scalar("blueprint_id"), + args: Rc::new(vec![CallInstrArgValue::Variable(Scalar("blueprint"))]), + output: Variable(Scalar("blueprint_id")), }), seq( Instruction::Call(Call { @@ -624,8 +619,8 @@ fn seq_with_empty_and_dash() { CallInstrValue::Literal("create"), CallInstrValue::Literal(""), ), - args: Rc::new(vec![CallInstrArgValue::Variable("blueprint_id")]), - output: Scalar("service_id"), + args: Rc::new(vec![CallInstrArgValue::Variable(Scalar("blueprint_id"))]), + output: Variable(Scalar("service_id")), }), Instruction::Call(Call { peer_part: PeerPk(CallInstrValue::Literal("remote_peer_id")), @@ -633,8 +628,8 @@ fn seq_with_empty_and_dash() { CallInstrValue::Literal(""), CallInstrValue::Literal(""), ), - args: Rc::new(vec![CallInstrArgValue::Variable("service_id")]), - output: Scalar("client_result"), + args: Rc::new(vec![CallInstrArgValue::Variable(Scalar("service_id"))]), + output: Variable(Scalar("client_result")), }), ), ), @@ -654,7 +649,7 @@ fn match_with_bool() { ) "#; - let left_value = Variable("isOnline"); + let left_value = Variable(Scalar("isOnline")); let right_value = Boolean(true); let null = null(); let expected = match_(left_value, right_value, null); @@ -674,7 +669,7 @@ fn mismatch_with_bool() { "#; let left_value = Boolean(true); - let right_value = Variable("isOnline"); + let right_value = Variable(Scalar("isOnline")); let null = null(); let expected = mismatch(left_value, right_value, null); @@ -695,10 +690,10 @@ fn no_output() { "#; let instruction = parse(source_code); let expected = Instruction::Call(Call { - peer_part: PeerPk(CallInstrValue::Variable("peer")), + peer_part: PeerPk(CallInstrValue::Variable(Scalar("peer"))), function_part: ServiceIdWithFuncName( - CallInstrValue::Variable("service"), - CallInstrValue::Variable("fname"), + CallInstrValue::Variable(Scalar("service")), + CallInstrValue::Variable(Scalar("fname")), ), args: Rc::new(vec![]), output: None, @@ -719,7 +714,7 @@ fn fold_json_path() { let instruction = parse(source_code); let expected = Instruction::Fold(Fold { iterable: JsonPath { - variable: "members", + variable: Scalar("members"), path: "$.[\"users\"]", should_flatten: false, }, @@ -742,7 +737,7 @@ fn comments() { let instruction = parse(source_code); let expected = Instruction::Fold(Fold { iterable: JsonPath { - variable: "members", + variable: Scalar("members"), path: "$.[\"users\"]", should_flatten: false, }, diff --git a/crates/air-parser/src/parser/validator.rs b/crates/air-parser/src/parser/validator.rs index f51c0e2b..77ea4ec2 100644 --- a/crates/air-parser/src/parser/validator.rs +++ b/crates/air-parser/src/parser/validator.rs @@ -143,7 +143,12 @@ impl<'i> VariableValidator<'i> { } } - fn met_variable(&mut self, name: &'i str, span: Span) { + fn met_variable(&mut self, variable: &Variable<'i>, span: Span) { + let name = match variable { + Variable::Scalar(name) => name, + Variable::Stream(name) => name, + }; + if !self.contains_variable(name, span) { self.unresolved_variables.insert(name, span); } @@ -168,8 +173,8 @@ impl<'i> VariableValidator<'i> { use std::collections::hash_map::Entry; let variable_name = match call_output { - CallOutputValue::Scalar(variable) => variable, - CallOutputValue::Accumulator(accumulator) => accumulator, + CallOutputValue::Variable(Variable::Scalar(name)) => name, + CallOutputValue::Variable(Variable::Stream(name)) => name, CallOutputValue::None => return, }; diff --git a/interpreter-lib/Cargo.toml b/interpreter-lib/Cargo.toml index f7cdce29..af52c6fc 100644 --- a/interpreter-lib/Cargo.toml +++ b/interpreter-lib/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "interpreter-lib" -version = "0.7.0" +version = "0.8.0" authors = ["Fluence Labs"] edition = "2018" diff --git a/interpreter-lib/benches/chat_benchmark.rs b/interpreter-lib/benches/chat_benchmark.rs index c84b5720..6b23fcd4 100644 --- a/interpreter-lib/benches/chat_benchmark.rs +++ b/interpreter-lib/benches/chat_benchmark.rs @@ -35,16 +35,16 @@ fn chat_sent_message_benchmark() -> Result { JValueRef(ResolvedCallResult), - JValueAccumulatorRef(RefCell>), + JValueStreamRef(RefCell>), JValueFoldCursor(FoldState<'i>), } @@ -42,9 +42,9 @@ impl<'i> Display for AValue<'i> { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { match self { AValue::JValueRef(value) => write!(f, "{:?}", value)?, - AValue::JValueAccumulatorRef(acc) => { + AValue::JValueStreamRef(stream) => { write!(f, "[ ")?; - for value in acc.borrow().iter() { + for value in stream.borrow().iter() { write!(f, "{:?} ", value)?; } write!(f, "]")?; diff --git a/interpreter-lib/src/contexts/execution_trace_context.rs b/interpreter-lib/src/contexts/execution_trace_context.rs index 4d21b294..ca279c2c 100644 --- a/interpreter-lib/src/contexts/execution_trace_context.rs +++ b/interpreter-lib/src/contexts/execution_trace_context.rs @@ -26,18 +26,18 @@ use std::fmt::Formatter; pub type ExecutionTrace = std::collections::VecDeque; -/// Encapsulates all necessary state regarding to the call pathes1. +/// Encapsulates all necessary state regarding to the call paths. #[derive(Debug, Clone, Default, Serialize, Deserialize)] pub(crate) struct ExecutionTraceCtx { /// Contains trace (serialized tree of states) after merging current and previous data, - /// interpreter used it to realize which instructions've been already executed. + /// interpreter used it to realize which instructions have been already executed. pub(crate) current_trace: ExecutionTrace, /// Size of a current considered subtree inside current path. pub(crate) current_subtree_size: usize, // TODO: consider change it to Vec for optimization - /// Accumulator for resulted path produced by the interpreter after execution. + /// Stream for resulted path produced by the interpreter after execution. pub(crate) new_trace: ExecutionTrace, } diff --git a/interpreter-lib/src/execution/air/call/triplet.rs b/interpreter-lib/src/execution/air/call/triplet.rs index 6f2d9cae..c43b37da 100644 --- a/interpreter-lib/src/execution/air/call/triplet.rs +++ b/interpreter-lib/src/execution/air/call/triplet.rs @@ -79,12 +79,14 @@ impl<'a, 'i> Triplet<'a, 'i> { /// Resolve value to string by either resolving variable from `ExecutionCtx`, taking literal value, or etc. // TODO: return Rc to avoid excess cloning fn resolve_to_string<'i>(value: &CallInstrValue<'i>, ctx: &ExecutionCtx<'i>) -> ExecutionResult { + use crate::execution::utils::get_variable_name; use crate::execution::utils::resolve_to_jvaluable; let resolved = match value { CallInstrValue::InitPeerId => ctx.init_peer_id.clone(), CallInstrValue::Literal(value) => value.to_string(), - CallInstrValue::Variable(name) => { + CallInstrValue::Variable(variable) => { + let name = get_variable_name(variable); let resolved = resolve_to_jvaluable(name, ctx)?; let jvalue = resolved.into_jvalue(); jvalue_to_string(jvalue)? @@ -97,7 +99,9 @@ fn resolve_to_string<'i>(value: &CallInstrValue<'i>, ctx: &ExecutionCtx<'i>) -> // this is checked on the parsing stage debug_assert!(*should_flatten); - let resolved = resolve_to_jvaluable(variable, ctx)?; + let name = get_variable_name(variable); + + let resolved = resolve_to_jvaluable(name, ctx)?; let resolved = resolved.apply_json_path(path)?; vec_to_string(resolved, path)? } diff --git a/interpreter-lib/src/execution/air/call/utils.rs b/interpreter-lib/src/execution/air/call/utils.rs index e84f03a5..368a01ab 100644 --- a/interpreter-lib/src/execution/air/call/utils.rs +++ b/interpreter-lib/src/execution/air/call/utils.rs @@ -20,6 +20,7 @@ use super::ExecutionResult; use crate::contexts::execution::ResolvedCallResult; use crate::contexts::execution_trace::*; use crate::exec_err; +use crate::execution::Variable; use crate::log_targets::EXECUTED_STATE_CHANGING; use crate::JValue; @@ -43,7 +44,7 @@ pub(super) fn set_local_call_result<'i>( let executed_result = ResolvedCallResult { result, triplet }; match output { - CallOutputValue::Scalar(name) => { + CallOutputValue::Variable(Variable::Scalar(name)) => { if let Some(fold_block_name) = exec_ctx.met_folds.back() { let fold_state = match exec_ctx.data_cache.get_mut(*fold_block_name) { Some(AValue::JValueFoldCursor(fold_state)) => fold_state, @@ -74,15 +75,15 @@ pub(super) fn set_local_call_result<'i>( } }; } - CallOutputValue::Accumulator(name) => { + CallOutputValue::Variable(Variable::Stream(name)) => { match exec_ctx.data_cache.entry(name.to_string()) { Occupied(mut entry) => match entry.get_mut() { // if result is an array, insert result to the end of the array - AValue::JValueAccumulatorRef(values) => values.borrow_mut().push(executed_result), + AValue::JValueStreamRef(values) => values.borrow_mut().push(executed_result), v => return exec_err!(IncompatibleAValueType(format!("{}", v), String::from("Array"))), }, Vacant(entry) => { - entry.insert(AValue::JValueAccumulatorRef(RefCell::new(vec![executed_result]))); + entry.insert(AValue::JValueStreamRef(RefCell::new(vec![executed_result]))); } }; } diff --git a/interpreter-lib/src/execution/air/compare_matchable/compare_matchable.rs b/interpreter-lib/src/execution/air/compare_matchable/compare_matchable.rs index 95517bf8..1cf9eda3 100644 --- a/interpreter-lib/src/execution/air/compare_matchable/compare_matchable.rs +++ b/interpreter-lib/src/execution/air/compare_matchable/compare_matchable.rs @@ -16,6 +16,7 @@ use crate::contexts::execution::ExecutionCtx; use crate::execution::air::ExecutionResult; +use crate::execution::utils::get_variable_name; use crate::execution::utils::resolve_to_jvaluable; use crate::JValue; @@ -41,10 +42,12 @@ pub(crate) fn are_matchable_eq<'ctx>( (Number(value), matchable) => compare_matchable(matchable, exec_ctx, make_number_comparator(value)), (matchable, Number(value)) => compare_matchable(matchable, exec_ctx, make_number_comparator(value)), - (Variable(left_name), Variable(right_name)) => { + (Variable(left_variable), Variable(right_variable)) => { + let left_name = get_variable_name(left_variable); let left_jvaluable = resolve_to_jvaluable(left_name, exec_ctx)?; let left_value = left_jvaluable.as_jvalue(); + let right_name = get_variable_name(right_variable); let right_jvaluable = resolve_to_jvaluable(right_name, exec_ctx)?; let right_value = right_jvaluable.as_jvalue(); @@ -67,10 +70,12 @@ pub(crate) fn are_matchable_eq<'ctx>( return Ok(false); } - let left_jvaluable = resolve_to_jvaluable(lv, exec_ctx)?; + let left_name = get_variable_name(lv); + let left_jvaluable = resolve_to_jvaluable(left_name, exec_ctx)?; let left_value = left_jvaluable.apply_json_path(lp)?; - let right_jvaluable = resolve_to_jvaluable(rv, exec_ctx)?; + let right_name = get_variable_name(rv); + let right_jvaluable = resolve_to_jvaluable(right_name, exec_ctx)?; let right_value = right_jvaluable.apply_json_path(rp)?; Ok(left_value == right_value) @@ -102,7 +107,8 @@ fn compare_matchable<'ctx>( let jvalue = (*bool).into(); Ok(comparator(Cow::Owned(jvalue))) } - Variable(name) => { + Variable(variable) => { + let name = get_variable_name(variable); let jvaluable = resolve_to_jvaluable(name, exec_ctx)?; let jvalue = jvaluable.as_jvalue(); Ok(comparator(jvalue)) @@ -112,7 +118,8 @@ fn compare_matchable<'ctx>( path, should_flatten, } => { - let jvaluable = resolve_to_jvaluable(variable, exec_ctx)?; + let var_name = get_variable_name(variable); + let jvaluable = resolve_to_jvaluable(var_name, exec_ctx)?; let jvalues = jvaluable.apply_json_path(path)?; let jvalue = if *should_flatten { diff --git a/interpreter-lib/src/execution/air/fold.rs b/interpreter-lib/src/execution/air/fold.rs index 37d74e6f..5050645d 100644 --- a/interpreter-lib/src/execution/air/fold.rs +++ b/interpreter-lib/src/execution/air/fold.rs @@ -186,7 +186,7 @@ mod tests { (call "set_variable" ("" "") [] Iterable) (fold Iterable i (seq - (call "A" ("" "") [i] acc[]) + (call "A" ("" "") [i] $acc) (next i) ) ) @@ -220,7 +220,7 @@ mod tests { (fold Iterable i (seq (next i) - (call "A" ("" "") [i] acc[]) + (call "A" ("" "") [i] $acc) ) ) )"#, @@ -257,7 +257,7 @@ mod tests { (seq (fold Iterable2 j (seq - (call "A" ("" "") [i] acc[]) + (call "A" ("" "") [i] $acc) (next j) ) ) @@ -300,7 +300,7 @@ mod tests { (seq (fold Iterable2 i (seq - (call "A" ("" "") [i] acc[]) + (call "A" ("" "") [i] $acc) (next i) ) ) @@ -329,7 +329,7 @@ mod tests { (call "set_variable" ("" "") [] Iterable) (fold Iterable i (seq - (call "A" ("" "") [i] acc[]) + (call "A" ("" "") [i] $acc) (next i) ) ) @@ -358,7 +358,7 @@ mod tests { (call "unknown_peer" ("" "") [] lazy_def_variable) (fold iterable i (seq - (call "A" ("" "") [lazy_def_variable.$.hash!] acc[]) + (call "A" ("" "") [lazy_def_variable.$.hash!] $acc) (next i) ) ) @@ -390,7 +390,7 @@ mod tests { (call "set_variable" ("" "") [] iterable) (fold iterable.$.array! i (seq - (call "A" ("" "") [i] acc[]) + (call "A" ("" "") [i] $acc) (next i) ) ) diff --git a/interpreter-lib/src/execution/air/fold/utils.rs b/interpreter-lib/src/execution/air/fold/utils.rs index 7949a51f..28a4ecac 100644 --- a/interpreter-lib/src/execution/air/fold/utils.rs +++ b/interpreter-lib/src/execution/air/fold/utils.rs @@ -16,6 +16,7 @@ use super::*; use crate::exec_err; +use crate::execution::utils::get_variable_name; use crate::JValue; use crate::ResolvedTriplet; use crate::SecurityTetraplet; @@ -36,12 +37,18 @@ pub(super) fn construct_iterable_value<'ctx>( exec_ctx: &ExecutionCtx<'ctx>, ) -> ExecutionResult> { match ast_iterable { - ast::IterableValue::Variable(name) => handle_instruction_variable(exec_ctx, name), + ast::IterableValue::Variable(variable) => { + let name = get_variable_name(variable); + handle_instruction_variable(exec_ctx, name) + } ast::IterableValue::JsonPath { variable, path, should_flatten, - } => handle_instruction_json_path(exec_ctx, variable, path, *should_flatten), + } => { + let name = get_variable_name(variable); + handle_instruction_json_path(exec_ctx, name, path, *should_flatten) + } } } @@ -51,13 +58,13 @@ fn handle_instruction_variable<'ctx>( ) -> ExecutionResult> { let iterable: Option = match exec_ctx.data_cache.get(variable_name) { Some(AValue::JValueRef(call_result)) => from_call_result(call_result.clone())?, - Some(AValue::JValueAccumulatorRef(acc)) => { - let acc = acc.borrow(); - if acc.is_empty() { + Some(AValue::JValueStreamRef(stream)) => { + let stream = stream.borrow(); + if stream.is_empty() { return Ok(None); } - let call_results = acc.iter().cloned().collect::>(); + let call_results = stream.iter().cloned().collect::>(); let foldable = IterableVecResolvedCall::init(call_results); Some(Box::new(foldable)) } @@ -103,28 +110,28 @@ fn handle_instruction_json_path<'ctx>( json_path: &str, should_flatten: bool, ) -> ExecutionResult> { - use ExecutionError::JValueAccJsonPathError; + use ExecutionError::JValueStreamJsonPathError; match exec_ctx.data_cache.get(variable_name) { Some(AValue::JValueRef(variable)) => { let jvalues = apply_json_path(&variable.result, json_path)?; from_jvalues(jvalues, variable.triplet.clone(), json_path, should_flatten) } - Some(AValue::JValueAccumulatorRef(acc)) => { - let acc = acc.borrow(); - if acc.is_empty() { + Some(AValue::JValueStreamRef(stream)) => { + let stream = stream.borrow(); + if stream.is_empty() { return Ok(None); } - let acc_iter = acc.iter().map(|v| v.result.deref()); + let acc_iter = stream.iter().map(|v| v.result.deref()); let (jvalues, tetraplet_indices) = select_with_iter(acc_iter, &json_path) - .map_err(|e| JValueAccJsonPathError(acc.clone(), json_path.to_string(), e))?; + .map_err(|e| JValueStreamJsonPathError(stream.clone(), json_path.to_string(), e))?; let jvalues = construct_iterable_jvalues(jvalues, should_flatten)?; let tetraplets = tetraplet_indices .into_iter() .map(|id| SecurityTetraplet { - triplet: acc[id].triplet.clone(), + triplet: stream[id].triplet.clone(), json_path: json_path.to_string(), }) .collect::>(); diff --git a/interpreter-lib/src/execution/air/mod.rs b/interpreter-lib/src/execution/air/mod.rs index 5c0f3de0..8be0e7ec 100644 --- a/interpreter-lib/src/execution/air/mod.rs +++ b/interpreter-lib/src/execution/air/mod.rs @@ -196,8 +196,8 @@ fn is_joinable_error_type(exec_error: &ExecutionError) -> bool { log_join!(" waiting for an argument with path '{}' on jvalue '{:?}'", json_path, value); true } - JValueAccJsonPathError(acc, json_path, _) => { - log_join!(" waiting for an argument with path '{}' on accumulator '{:?}'", json_path, acc); + JValueStreamJsonPathError(stream, json_path, _) => { + log_join!(" waiting for an argument with path '{}' on stream '{:?}'", json_path, stream); true } _ => false, diff --git a/interpreter-lib/src/execution/boxed_value/iterable/vec_json_path_result.rs b/interpreter-lib/src/execution/boxed_value/iterable/vec_json_path_result.rs index 883ef2ef..75856b29 100644 --- a/interpreter-lib/src/execution/boxed_value/iterable/vec_json_path_result.rs +++ b/interpreter-lib/src/execution/boxed_value/iterable/vec_json_path_result.rs @@ -21,7 +21,7 @@ use crate::foldable_prev; use crate::JValue; use crate::SecurityTetraplet; -/// Used for iterating over a result of applied to an accumulator json path. +/// Used for iterating over a result of applied to an stream json path. #[derive(Clone, Debug, Eq, PartialEq)] pub(crate) struct IterableVecJsonPathResult { pub(crate) jvalues: Vec, diff --git a/interpreter-lib/src/execution/boxed_value/iterable/vec_resolved_call.rs b/interpreter-lib/src/execution/boxed_value/iterable/vec_resolved_call.rs index 7caaf47e..64a65e6d 100644 --- a/interpreter-lib/src/execution/boxed_value/iterable/vec_resolved_call.rs +++ b/interpreter-lib/src/execution/boxed_value/iterable/vec_resolved_call.rs @@ -21,7 +21,7 @@ use crate::foldable_next; use crate::foldable_prev; use crate::SecurityTetraplet; -/// Used for iterating over accumulator with JValues. +/// Used for iterating over stream with JValues. #[derive(Clone, Debug, Eq, PartialEq)] pub(crate) struct IterableVecResolvedCall { pub(crate) call_results: Vec, diff --git a/interpreter-lib/src/execution/boxed_value/jvaluable/cell_vec_resolved_call_result.rs b/interpreter-lib/src/execution/boxed_value/jvaluable/cell_vec_resolved_call_result.rs index 363c26d0..e52d26f7 100644 --- a/interpreter-lib/src/execution/boxed_value/jvaluable/cell_vec_resolved_call_result.rs +++ b/interpreter-lib/src/execution/boxed_value/jvaluable/cell_vec_resolved_call_result.rs @@ -14,7 +14,7 @@ * limitations under the License. */ -use super::ExecutionError::JValueAccJsonPathError; +use super::ExecutionError::JValueStreamJsonPathError; use super::ExecutionResult; use super::JValuable; use crate::contexts::execution::ResolvedCallResult; @@ -29,8 +29,9 @@ use std::ops::Deref; impl JValuable for std::cell::Ref<'_, Vec> { fn apply_json_path(&self, json_path: &str) -> ExecutionResult> { let acc_iter = self.iter().map(|r| r.result.deref()); - let (selected_values, _) = select_with_iter(acc_iter, json_path) - .map_err(|e| JValueAccJsonPathError(self.iter().cloned().collect::>(), json_path.to_string(), e))?; + let (selected_values, _) = select_with_iter(acc_iter, json_path).map_err(|e| { + JValueStreamJsonPathError(self.iter().cloned().collect::>(), json_path.to_string(), e) + })?; Ok(selected_values) } @@ -41,8 +42,9 @@ impl JValuable for std::cell::Ref<'_, Vec> { ) -> ExecutionResult<(Vec<&JValue>, Vec)> { let acc_iter = self.iter().map(|r| r.result.deref()); - let (selected_values, tetraplet_indices) = select_with_iter(acc_iter, json_path) - .map_err(|e| JValueAccJsonPathError(self.iter().cloned().collect::>(), json_path.to_string(), e))?; + let (selected_values, tetraplet_indices) = select_with_iter(acc_iter, json_path).map_err(|e| { + JValueStreamJsonPathError(self.iter().cloned().collect::>(), json_path.to_string(), e) + })?; let tetraplets = tetraplet_indices .into_iter() diff --git a/interpreter-lib/src/execution/errors.rs b/interpreter-lib/src/execution/errors.rs index 3bcb68df..19a55bf6 100644 --- a/interpreter-lib/src/execution/errors.rs +++ b/interpreter-lib/src/execution/errors.rs @@ -52,9 +52,9 @@ pub(crate) enum ExecutionError { #[error("variable with path '{1}' not found in '{0}' with an error: '{2}'")] JValueJsonPathError(JValue, String, JsonPathError), - /// An error occurred while trying to apply json path to this accumulator with JValue's. + /// An error occurred while trying to apply json path to this stream with JValue's. #[error("variable with path '{1}' not found in '{0:?}' with error: '{2}'")] - JValueAccJsonPathError(Vec, String, JsonPathError), + JValueStreamJsonPathError(Vec, String, JsonPathError), /// Provided JValue has incompatible with target type. #[error("expected JValue type '{1}', but got '{0}' JValue")] @@ -108,7 +108,7 @@ impl ExecutionError { VariableNotFound(_) => 4, MultipleVariablesFound(_) => 5, JValueJsonPathError(..) => 6, - JValueAccJsonPathError(..) => 7, + JValueStreamJsonPathError(..) => 7, IncompatibleJValueType(..) => 8, IncompatibleAValueType(..) => 9, MultipleValuesInJsonPath(_) => 10, diff --git a/interpreter-lib/src/execution/mod.rs b/interpreter-lib/src/execution/mod.rs index a4426682..bcc18444 100644 --- a/interpreter-lib/src/execution/mod.rs +++ b/interpreter-lib/src/execution/mod.rs @@ -26,6 +26,7 @@ pub(super) use errors::ExecutionError; use std::rc::Rc; pub(self) type ExecutionResult = std::result::Result>; +pub(self) use air_parser::ast::Variable; #[macro_export] macro_rules! exec_err { diff --git a/interpreter-lib/src/execution/utils/mod.rs b/interpreter-lib/src/execution/utils/mod.rs index 0b2f64b6..6e417bcc 100644 --- a/interpreter-lib/src/execution/utils/mod.rs +++ b/interpreter-lib/src/execution/utils/mod.rs @@ -16,5 +16,6 @@ mod resolve; +pub(crate) use resolve::get_variable_name; pub(crate) use resolve::resolve_to_args; pub(crate) use resolve::resolve_to_jvaluable; diff --git a/interpreter-lib/src/execution/utils/resolve.rs b/interpreter-lib/src/execution/utils/resolve.rs index 2f92203f..04ef0318 100644 --- a/interpreter-lib/src/execution/utils/resolve.rs +++ b/interpreter-lib/src/execution/utils/resolve.rs @@ -35,12 +35,18 @@ pub(crate) fn resolve_to_args<'i>( CallInstrArgValue::Literal(value) => prepare_consts(value.to_string(), ctx), CallInstrArgValue::Boolean(value) => prepare_consts(*value, ctx), CallInstrArgValue::Number(value) => prepare_consts(value, ctx), - CallInstrArgValue::Variable(name) => prepare_variable(name, ctx), + CallInstrArgValue::Variable(variable) => { + let name = get_variable_name(variable); + prepare_variable(name, ctx) + } CallInstrArgValue::JsonPath { variable, path, should_flatten, - } => prepare_json_path(variable, path, *should_flatten, ctx), + } => { + let name = get_variable_name(variable); + prepare_json_path(name, path, *should_flatten, ctx) + } } } @@ -121,10 +127,19 @@ pub(crate) fn resolve_to_jvaluable<'name, 'i, 'ctx>( match value { AValue::JValueRef(value) => Ok(Box::new(value.clone())), - AValue::JValueAccumulatorRef(acc) => Ok(Box::new(acc.borrow())), + AValue::JValueStreamRef(stream) => Ok(Box::new(stream.borrow())), AValue::JValueFoldCursor(fold_state) => { let peeked_value = fold_state.iterable.peek().unwrap(); Ok(Box::new(peeked_value)) } } } + +use air_parser::ast::Variable; + +pub(crate) fn get_variable_name<'a>(variable: &'a Variable<'_>) -> &'a str { + match variable { + Variable::Scalar(name) => name, + Variable::Stream(name) => name, + } +} diff --git a/interpreter-lib/tests/call_evidence_basic.rs b/interpreter-lib/tests/call_evidence_basic.rs index 5d731bc9..740a1ddf 100644 --- a/interpreter-lib/tests/call_evidence_basic.rs +++ b/interpreter-lib/tests/call_evidence_basic.rs @@ -254,7 +254,7 @@ fn executed_trace_par_seq_fold_call() { (call "some_peer_id_1" ("local_service_id" "local_fn_name") [] IterableResultPeer1) (fold IterableResultPeer1 i (par - (call "some_peer_id_2" ("local_service_id" "local_fn_name") [i] acc[]) + (call "some_peer_id_2" ("local_service_id" "local_fn_name") [i] $acc) (next i) ) ) @@ -330,7 +330,7 @@ fn executed_trace_par_seq_fold_in_cycle_call() { (call "some_peer_id_1" ("local_service_id" "local_fn_name") [] IterableResultPeer1) (fold IterableResultPeer1 i (par - (call "some_peer_id_2" ("local_service_id" "local_fn_name") [i] acc[]) + (call "some_peer_id_2" ("local_service_id" "local_fn_name") [i] $acc) (next i) ) ) diff --git a/interpreter-lib/tests/data_merge.rs b/interpreter-lib/tests/data_merge.rs index 3d8e4458..8ab873bf 100644 --- a/interpreter-lib/tests/data_merge.rs +++ b/interpreter-lib/tests/data_merge.rs @@ -51,19 +51,19 @@ fn data_merge() { (seq (fold neighborhood i (par - (call i ("add_provider" "") [] void[]) + (call i ("add_provider" "") [] $void) (next i) ) ) (fold neighborhood i (par - (call i ("get_providers" "") [] providers[]) + (call i ("get_providers" "") [] $providers) (next i) ) ) ) (seq - (call "A" ("identity" "") [] void[]) + (call "A" ("identity" "") [] $void) (call "B" ("" "") [] none) ) ) @@ -189,16 +189,16 @@ fn acc_merge() { let script = String::from( r#" (seq - (call "A" ("add_provider" "") [] void[]) + (call "A" ("add_provider" "") [] $void) (seq - (call "A" ("add_provider" "") [] void[]) + (call "A" ("add_provider" "") [] $void) (seq - (call "A" ("get_providers" "") [] providers[]) + (call "A" ("get_providers" "") [] $providers) (seq - (call "A" ("get_providers" "") [] providers[]) + (call "A" ("get_providers" "") [] $providers) (seq - (call "B" ("" "2") [providers] void[]) - (call "B" ("" "3") [void] void[]) + (call "B" ("" "2") [$providers] $void) + (call "B" ("" "3") [$void] $void) ) ) ) diff --git a/interpreter-lib/tests/flattening.rs b/interpreter-lib/tests/flattening.rs index 172eefc0..b00753ff 100644 --- a/interpreter-lib/tests/flattening.rs +++ b/interpreter-lib/tests/flattening.rs @@ -130,12 +130,12 @@ fn flattening_streams() { (seq (seq (seq - (call "{0}" ("" "") [] stream[]) - (call "{0}" ("" "") [] stream[]) + (call "{0}" ("" "") [] $stream) + (call "{0}" ("" "") [] $stream) ) - (call "{0}" ("" "") [] stream[]) + (call "{0}" ("" "") [] $stream) ) - (fold stream.$.[0,1,2] v + (fold $stream.$.[0,1,2] v (seq (call v.$.peer_id! (v.$.service_id! v.$.function_name!) [v.$.args[0]! v.$.args[1]!]) (next v) @@ -180,12 +180,12 @@ fn test_handling_non_flattening_values() { (seq (seq (seq - (call "{0}" ("" "") [] stream[]) - (call "{0}" ("" "") [] stream[]) + (call "{0}" ("" "") [] $stream) + (call "{0}" ("" "") [] $stream) ) - (call "{0}" ("" "") [] stream[]) + (call "{0}" ("" "") [] $stream) ) - (fold stream.$.[0,1,2]! v + (fold $stream.$.[0,1,2]! v (seq (call v.$.peer_id! (v.$.service_id! v.$.function_name!) [v.$.args[0]! v.$.args[1]!]) (next v) diff --git a/interpreter-lib/tests/join.rs b/interpreter-lib/tests/join.rs index 7c39dc10..df73af83 100644 --- a/interpreter-lib/tests/join.rs +++ b/interpreter-lib/tests/join.rs @@ -49,16 +49,16 @@ fn join_chat() { let script = String::from( r#" (seq - (call "Relay1" ("identity" "") [] void1[]) + (call "Relay1" ("identity" "") [] $void1) (seq - (call "Remote" ("552196ea-b9b2-4761-98d4-8e7dba77fac4" "add") [] void2[]) + (call "Remote" ("552196ea-b9b2-4761-98d4-8e7dba77fac4" "add") [] $void2) (seq (call "Remote" ("920e3ba3-cbdf-4ae3-8972-0fa2f31fffd9" "get_users") [] members) (fold members m (par (seq - (call m.$.[1]! ("identity" "") [] void[]) - (call m.$.[0]! ("fgemb3" "add") [] void3[]) + (call m.$.[1]! ("identity" "") [] $void) + (call m.$.[0]! ("fgemb3" "add") [] $void3) ) (next m) ) @@ -210,14 +210,14 @@ fn join() { let script = String::from( r#" (seq - (call "Relay1" ("identity" "") [] void1[]) + (call "Relay1" ("identity" "") [] $void1) (seq (call "Remote" ("920e3ba3-cbdf-4ae3-8972-0fa2f31fffd9" "get_users") [] members) (fold members m (par (seq - (call "Relay1" ("identity" "") [] void[]) - (call "A" ("fgemb3" "add") [m] void3[]) + (call "Relay1" ("identity" "") [] $void) + (call "A" ("fgemb3" "add") [m] $void3) ) (next m) ) diff --git a/interpreter-lib/tests/scripts/create_service_with_xor.clj b/interpreter-lib/tests/scripts/create_service_with_xor.clj index 4728aa75..04e40034 100644 --- a/interpreter-lib/tests/scripts/create_service_with_xor.clj +++ b/interpreter-lib/tests/scripts/create_service_with_xor.clj @@ -18,7 +18,7 @@ ) ) (seq - (call "{1}" ("op" "identity") ["XOR: create_greeting_service failed"] fail[]) + (call "{1}" ("op" "identity") ["XOR: create_greeting_service failed"] $fail) (call "{2}" ("return" "") [%last_error%]) ) ) diff --git a/interpreter-lib/tests/scripts/network_explore.clj b/interpreter-lib/tests/scripts/network_explore.clj index 634535d1..cfff62bc 100644 --- a/interpreter-lib/tests/scripts/network_explore.clj +++ b/interpreter-lib/tests/scripts/network_explore.clj @@ -8,15 +8,15 @@ (seq (fold neighs_top n (seq - (call n ("dht" "neighborhood") [n] neighs_inner[]) + (call n ("dht" "neighborhood") [n] $neighs_inner) (next n) ) ) - (fold neighs_inner ns + (fold $neighs_inner ns (seq (fold ns n (seq - (call n ("op" "identify") [] services[]) + (call n ("op" "identify") [] $services) (next n) ) ) diff --git a/interpreter-lib/tests/security_tetraplets.rs b/interpreter-lib/tests/security_tetraplets.rs index 2dd70f37..2aa5994a 100644 --- a/interpreter-lib/tests/security_tetraplets.rs +++ b/interpreter-lib/tests/security_tetraplets.rs @@ -81,7 +81,7 @@ fn simple_fold() { (call "{}" ("{}" "{}") [] IterableResultPeer1) (fold IterableResultPeer1 i (par - (call i ("local_service_id" "local_fn_name") [i "some_text_literal"] acc[]) + (call i ("local_service_id" "local_fn_name") [i "some_text_literal"] $acc) (next i) ) ) @@ -155,7 +155,7 @@ fn fold_json_path() { (call "{}" ("{}" "{}") [] IterableResultPeer1) (fold IterableResultPeer1.$.arg i (par - (call "{}" ("local_service_id" "local_fn_name") [i "some_text_literal"] acc[]) + (call "{}" ("local_service_id" "local_fn_name") [i "some_text_literal"] $acc) (next i) ) ) diff --git a/interpreter/Cargo.toml b/interpreter/Cargo.toml index defe66cc..74d170b9 100644 --- a/interpreter/Cargo.toml +++ b/interpreter/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "aquamarine" -version = "0.7.0" +version = "0.8.0" authors = ["Fluence Labs"] edition = "2018"