From 1141c8e42a81f84732d5c825352e769cd55f08c9 Mon Sep 17 00:00:00 2001 From: Mike Voronov Date: Mon, 13 Dec 2021 15:54:10 +0300 Subject: [PATCH] Fix empty array parsing in match/mismatch instructions (#190) --- .../air-lib/air-parser/src/parser/air.lalrpop | 5 +- crates/air-lib/air-parser/src/parser/air.rs | 378 +++++++++--------- .../air-parser/src/parser/lexer/air_lexer.rs | 20 +- .../air-parser/src/parser/lexer/tests.rs | 18 + .../air-parser/src/parser/lexer/token.rs | 1 - .../air-lib/air-parser/src/parser/tests/ap.rs | 12 + .../air-parser/src/parser/tests/match_.rs | 62 +++ 7 files changed, 291 insertions(+), 205 deletions(-) diff --git a/crates/air-lib/air-parser/src/parser/air.lalrpop b/crates/air-lib/air-parser/src/parser/air.lalrpop index 51223e7d..35b64b86 100644 --- a/crates/air-lib/air-parser/src/parser/air.lalrpop +++ b/crates/air-lib/air-parser/src/parser/air.lalrpop @@ -159,7 +159,7 @@ Value: Value<'input> = { => Value::Literal(l), => Value::Number(n), => Value::Boolean(b), - EmptyArray => Value::EmptyArray, + "[" "]" => Value::EmptyArray, => Value::Variable(VariableWithLambda::scalar(scalar.0, scalar.1)), => Value::Variable(VariableWithLambda::scalar_wl(scalar.0, scalar.1, scalar.2)), => Value::Variable(VariableWithLambda::stream(stream.0, stream.1)), @@ -172,7 +172,7 @@ ApArgument: ApArgument<'input> = { => ApArgument::Literal(l), => ApArgument::Number(n), => ApArgument::Boolean(b), - EmptyArray => ApArgument::EmptyArray, + "[" "]" => ApArgument::EmptyArray, => ApArgument::Scalar(ScalarWithLambda::new(scalar.0, None, scalar.1)), => ApArgument::Scalar(ScalarWithLambda::new(scalar.0, Some(scalar.1), scalar.2)), } @@ -186,7 +186,6 @@ extern { ")" => Token::CloseRoundBracket, "[" => Token::OpenSquareBracket, "]" => Token::CloseSquareBracket, - EmptyArray => Token::SquareBrackets, Literal => Token::StringLiteral(<&'input str>), Scalar => Token::Scalar { name:<&'input str>, position: }, diff --git a/crates/air-lib/air-parser/src/parser/air.rs b/crates/air-lib/air-parser/src/parser/air.rs index 0f144698..c0e86178 100644 --- a/crates/air-lib/air-parser/src/parser/air.rs +++ b/crates/air-lib/air-parser/src/parser/air.rs @@ -1,5 +1,5 @@ // auto-generated: "lalrpop 0.19.6" -// sha3: abe1e42a369b4cdc8b69ac7534dbe660e63d7624d7ed97b7c6983c96bfa9a129 +// sha3: 4054b676e3a83f623b634293743f612b76813d6f88d9afc39708a598f997e use crate::ast::*; use crate::parser::ParserError; use crate::parser::VariableValidator; @@ -68,220 +68,224 @@ mod __parse__AIR { } const __ACTION: &[i8] = &[ // State 0 - 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, + 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, // State 1 - 0, 0, 0, 0, 37, 38, 39, 40, 41, 42, 43, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 37, 0, 38, 39, 40, 41, 42, 43, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 2 - 13, 0, 0, 0, 0, 0, 47, 0, 48, 0, 49, 50, 51, 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 13, 0, 0, 0, 0, 47, 0, 48, 0, 49, 50, 51, 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 3 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 55, 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 55, 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 4 - 0, 0, 0, 0, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 11 - 21, 0, 0, 0, 0, 0, 47, 0, 48, 0, 49, 50, 51, 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 21, 0, 0, 0, 0, 47, 0, 48, 0, 49, 50, 51, 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 12 - 0, 0, 0, 0, 0, 0, 47, 0, 48, 0, 49, 50, 51, 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 47, 0, 48, 0, 49, 50, 51, 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 13 - 0, 0, 0, 0, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 57, 0, 58, 59, 60, 61, 62, 63, 64, 65, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 14 - 0, 0, 0, 0, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 57, 0, 58, 59, 60, 61, 62, 63, 64, 65, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 15 - 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, + 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, // State 16 - 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, + 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, // State 17 - 33, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, // State 24 - 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, + 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, // State 25 - 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, + 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, // State 26 - 0, 93, 0, 0, 0, 0, 0, 0, 0, 0, 67, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 95, 0, 0, 0, 0, 0, 0, 0, 67, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 27 - 0, 0, 0, 96, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 57, 98, 58, 59, 60, 61, 62, 63, 64, 65, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 28 - 0, 0, 0, 0, 0, 0, 47, 0, 48, 0, 49, 50, 51, 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 47, 0, 48, 0, 49, 50, 51, 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 29 - 0, 0, 0, 105, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 57, 107, 58, 59, 60, 61, 62, 63, 64, 65, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 43 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -16, 0, -16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, -16, 0, -16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 44 - -49, 0, 0, 0, 0, 0, -49, 0, -49, 0, -49, -49, -49, -49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + -49, 0, 0, 0, 0, -49, 0, -49, 0, -49, -49, -49, -49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 45 - -50, 0, 0, 0, 0, 0, -50, 0, -50, 0, -50, -50, -50, -50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + -50, 0, 0, 0, 0, -50, 0, -50, 0, -50, -50, -50, -50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 46 - -21, -21, -21, 0, 0, 0, -21, 0, -21, 0, -21, -21, -21, -21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + -21, -21, -21, 0, 0, -21, 0, -21, 0, -21, -21, -21, -21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 47 - -22, -22, -22, 0, 0, 0, -22, 0, -22, 0, -22, -22, -22, -22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + -22, -22, -22, 0, 0, -22, 0, -22, 0, -22, -22, -22, -22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 48 - -23, -23, -23, 0, 0, 0, -23, 0, -23, 0, -23, -23, -23, -23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + -23, -23, -23, 0, 0, -23, 0, -23, 0, -23, -23, -23, -23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 49 - -24, -24, -24, 0, 0, 0, -24, 0, -24, 0, -24, -24, -24, -24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + -24, -24, -24, 0, 0, -24, 0, -24, 0, -24, -24, -24, -24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 50 - -25, -25, -25, 0, 0, 0, -25, 0, -25, 0, -25, -25, -25, -25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + -25, -25, -25, 0, 0, -25, 0, -25, 0, -25, -25, -25, -25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 51 - -26, -26, -26, 0, 0, 0, -26, 0, -26, 0, -26, -26, -26, -26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + -26, -26, -26, 0, 0, -26, 0, -26, 0, -26, -26, -26, -26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 52 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 53 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, -32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 54 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, -33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 55 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 56 - -59, 0, 0, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -59, + 0, 0, 0, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 57 - -60, 0, 0, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -60, + -59, 0, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -59, // State 58 - -55, 0, 0, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -55, + -55, 0, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -55, // State 59 - -56, 0, 0, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -56, + -56, 0, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -56, // State 60 - -57, 0, 0, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -57, + -57, 0, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -57, // State 61 - -58, 0, 0, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -58, + -58, 0, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -58, // State 62 - -61, 0, 0, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -61, + -61, 0, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -61, // State 63 - -62, 0, 0, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -62, + -62, 0, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -62, // State 64 - -63, 0, 0, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -63, + -63, 0, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -63, // State 65 - -64, 0, 0, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -64, + -64, 0, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -64, // State 66 - -52, -52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -52, + -52, -52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -52, // State 67 - -53, -53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -53, + -53, -53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -53, // State 68 - 0, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 75 - -44, -44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -44, + -60, 0, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -60, // State 76 - 0, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 89, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 77 - 0, 89, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + -44, -44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -44, // State 78 - 0, 90, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 90, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 79 - -37, -37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -37, + 0, 91, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 80 - 0, -54, 0, 0, 0, 0, -54, 0, -54, 0, -54, -54, -54, -54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 81 - 0, 98, 0, 0, 0, 0, 0, 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, 0, 0, 0, -37, // State 82 - 0, 99, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, -54, 0, 0, 0, -54, 0, -54, 0, -54, -54, -54, -54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 83 - 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 84 - 0, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 85 - 0, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 86 - -41, -41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -41, + 0, 103, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 87 - -39, -39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -39, + 0, 104, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 88 - -38, -38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -38, + -41, -41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -41, // State 89 - -45, -45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -45, + -39, -39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -39, // State 90 - 0, 103, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + -38, -38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -38, // State 91 - 0, -27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + -45, -45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -45, // State 92 - -36, -36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -36, + 0, 105, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 93 - 0, 0, 0, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, -27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 94 - 0, 0, 0, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, 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, 0, 0, 0, -36, // State 95 - 0, -19, 0, 0, 0, 0, 0, 0, 0, 0, -19, 0, -19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 96 - 0, 106, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 97 - -51, 0, 0, 0, 0, 0, -51, 0, -51, 0, -51, -51, -51, -51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, -19, 0, 0, 0, 0, 0, 0, 0, -19, 0, -19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 98 - -42, -42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -42, + 0, 108, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 99 - -43, -43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -43, + -51, 0, 0, 0, 0, -51, 0, -51, 0, -51, -51, -51, -51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // State 100 - -46, -46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -46, + -42, -42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -42, // State 101 - -47, -47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -47, + -43, -43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -43, // State 102 - -35, -35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -35, + -46, -46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -46, // State 103 - 0, 0, 0, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + -47, -47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -47, // State 104 - 0, -20, 0, 0, 0, 0, 0, 0, 0, 0, -20, 0, -20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + -35, -35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -35, // State 105 - 0, 0, -31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 106 + 0, -20, 0, 0, 0, 0, 0, 0, 0, -20, 0, -20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // State 107 + 0, 0, -31, 0, 0, 0, 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) * 26 + integer] + __ACTION[(state as usize) * 25 + integer] } const __EOF_ACTION: &[i8] = &[ // State 0 @@ -435,19 +439,19 @@ mod __parse__AIR { // State 74 0, // State 75 - -44, + 0, // State 76 0, // State 77 - 0, + -44, // State 78 0, // State 79 - -37, + 0, // State 80 0, // State 81 - 0, + -37, // State 82 0, // State 83 @@ -457,23 +461,23 @@ mod __parse__AIR { // State 85 0, // State 86 - -41, + 0, // State 87 - -39, + 0, // State 88 - -38, + -41, // State 89 - -45, + -39, // State 90 - 0, + -38, // State 91 - 0, + -45, // State 92 - -36, + 0, // State 93 0, // State 94 - 0, + -36, // State 95 0, // State 96 @@ -481,21 +485,25 @@ mod __parse__AIR { // State 97 0, // State 98 - -42, + 0, // State 99 - -43, + 0, // State 100 - -46, + -42, // State 101 - -47, + -43, // State 102 - -35, + -46, // State 103 - 0, + -47, // State 104 - 0, + -35, // State 105 0, + // State 106 + 0, + // State 107 + 0, ]; fn __goto(state: i8, nt: usize) -> i8 { match nt { @@ -504,34 +512,34 @@ mod __parse__AIR { 6 => 10, 7 => 70, 8 => match state { - 29 => 103, - _ => 93, + 29 => 105, + _ => 95, }, 9 => 26, 10 => match state { - 11 | 28 => 72, - 20..=21 => 80, + 11 | 28 => 73, + 20..=21 => 82, _ => 44, }, - 11 => 90, + 11 => 92, 13 => 19, 14 => 52, 15 => match state { - 28 => 96, - _ => 73, + 28 => 98, + _ => 74, }, 16 => match state { 8 => 17, 9 => 18, 0 => 31, - 15 => 74, - 16 => 76, - 17 => 77, - 18 => 78, - 22 => 82, - 23 => 83, - 24 => 84, - 25 => 85, + 15 => 76, + 16 => 78, + 17 => 79, + 18 => 80, + 22 => 84, + 23 => 85, + 24 => 86, + 25 => 87, _ => 16, }, 17 => match state { @@ -541,11 +549,11 @@ mod __parse__AIR { 18 => 11, 19 => match state { 10 => 71, - 26 => 91, + 26 => 93, _ => 15, }, 20 => match state { - 21 => 81, + 21 => 83, _ => 28, }, 21 => match state { @@ -553,7 +561,7 @@ mod __parse__AIR { 5 => 14, 13 => 24, 14 => 25, - _ => 94, + _ => 96, }, _ => 0, } @@ -565,7 +573,6 @@ mod __parse__AIR { r###""[""###, r###""]""###, r###"Boolean"###, - r###"EmptyArray"###, r###"InitPeerId"###, r###"LastError"###, r###"Literal"###, @@ -639,7 +646,7 @@ mod __parse__AIR { #[inline] fn error_action(&self, state: i8) -> i8 { - __action(state, 26 - 1) + __action(state, 25 - 1) } #[inline] @@ -711,26 +718,25 @@ mod __parse__AIR { Token::OpenSquareBracket if true => Some(2), Token::CloseSquareBracket if true => Some(3), Token::Boolean(_) if true => Some(4), - Token::SquareBrackets if true => Some(5), - Token::InitPeerId if true => Some(6), - Token::LastError(_) if true => Some(7), - Token::StringLiteral(_) if true => Some(8), - Token::Number(_) if true => Some(9), - Token::Scalar { name: _, position: _ } if true => Some(10), - Token::ScalarWithLambda { name: _, lambda: _, position: _ } if true => Some(11), - Token::Stream { name: _, position: _ } if true => Some(12), - Token::StreamWithLambda { name: _, lambda: _, position: _ } if true => Some(13), - Token::Ap if true => Some(14), - Token::Call if true => Some(15), - Token::Fold if true => Some(16), - Token::Match if true => Some(17), - Token::MisMatch if true => Some(18), - Token::New if true => Some(19), - Token::Next if true => Some(20), - Token::Null if true => Some(21), - Token::Par if true => Some(22), - Token::Seq if true => Some(23), - Token::Xor if true => Some(24), + Token::InitPeerId if true => Some(5), + Token::LastError(_) if true => Some(6), + Token::StringLiteral(_) if true => Some(7), + Token::Number(_) if true => Some(8), + Token::Scalar { name: _, position: _ } if true => Some(9), + Token::ScalarWithLambda { name: _, lambda: _, position: _ } if true => Some(10), + Token::Stream { name: _, position: _ } if true => Some(11), + Token::StreamWithLambda { name: _, lambda: _, position: _ } if true => Some(12), + Token::Ap if true => Some(13), + Token::Call if true => Some(14), + Token::Fold if true => Some(15), + Token::Match if true => Some(16), + Token::MisMatch if true => Some(17), + Token::New if true => Some(18), + Token::Next if true => Some(19), + Token::Null if true => Some(20), + Token::Par if true => Some(21), + Token::Seq if true => Some(22), + Token::Xor if true => Some(23), _ => None, } } @@ -745,28 +751,28 @@ mod __parse__AIR { ) -> __Symbol<'input> { match __token_index { - 0 | 1 | 2 | 3 | 5 | 6 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 => __Symbol::Variant0(__token), + 0 | 1 | 2 | 3 | 5 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 => __Symbol::Variant0(__token), 4 => match __token { Token::Boolean(__tok0) if true => __Symbol::Variant1(__tok0), _ => unreachable!(), }, - 7 => match __token { + 6 => match __token { Token::LastError(__tok0) if true => __Symbol::Variant2(__tok0), _ => unreachable!(), }, - 8 => match __token { + 7 => match __token { Token::StringLiteral(__tok0) if true => __Symbol::Variant3(__tok0), _ => unreachable!(), }, - 9 => match __token { + 8 => match __token { Token::Number(__tok0) if true => __Symbol::Variant4(__tok0), _ => unreachable!(), }, - 10 | 12 => match __token { + 9 | 11 => match __token { Token::Scalar { name: __tok0, position: __tok1 } | Token::Stream { name: __tok0, position: __tok1 } if true => __Symbol::Variant5((__tok0, __tok1)), _ => unreachable!(), }, - 11 | 13 => match __token { + 10 | 12 => match __token { Token::ScalarWithLambda { name: __tok0, lambda: __tok1, position: __tok2 } | Token::StreamWithLambda { name: __tok0, lambda: __tok1, position: __tok2 } if true => __Symbol::Variant6((__tok0, __tok1, __tok2)), _ => unreachable!(), }, @@ -866,7 +872,7 @@ mod __parse__AIR { } 13 => { __state_machine::SimulatedReduce::Reduce { - states_to_pop: 1, + states_to_pop: 2, nonterminal_produced: 6, } } @@ -1142,7 +1148,7 @@ mod __parse__AIR { } 59 => { __state_machine::SimulatedReduce::Reduce { - states_to_pop: 1, + states_to_pop: 2, nonterminal_produced: 21, } } @@ -1985,13 +1991,15 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // ApArgument = EmptyArray => ActionFn(51); + // ApArgument = "[", "]" => ActionFn(51); + assert!(__symbols.len() >= 2); + let __sym1 = __pop_Variant0(__symbols); let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0.clone(); - let __end = __sym0.2.clone(); - let __nt = super::__action51::<>(input, errors, validator, __sym0); + let __end = __sym1.2.clone(); + let __nt = super::__action51::<>(input, errors, validator, __sym0, __sym1); __symbols.push((__start, __Symbol::Variant12(__nt), __end)); - (1, 6) + (2, 6) } pub(crate) fn __reduce14< 'err, @@ -3032,13 +3040,15 @@ mod __parse__AIR { _: core::marker::PhantomData<(&'err (), &'input (), &'v ())>, ) -> (usize, usize) { - // Value = EmptyArray => ActionFn(41); + // Value = "[", "]" => ActionFn(41); + assert!(__symbols.len() >= 2); + let __sym1 = __pop_Variant0(__symbols); let __sym0 = __pop_Variant0(__symbols); let __start = __sym0.0.clone(); - let __end = __sym0.2.clone(); - let __nt = super::__action41::<>(input, errors, validator, __sym0); + let __end = __sym1.2.clone(); + let __nt = super::__action41::<>(input, errors, validator, __sym0, __sym1); __symbols.push((__start, __Symbol::Variant8(__nt), __end)); - (1, 21) + (2, 21) } pub(crate) fn __reduce60< 'err, @@ -3895,6 +3905,7 @@ fn __action41< errors: &'err mut Vec, ParserError>>, validator: &'v mut VariableValidator<'input>, (_, __0, _): (usize, Token<'input>, usize), + (_, __1, _): (usize, Token<'input>, usize), ) -> Value<'input> { Value::EmptyArray @@ -4045,6 +4056,7 @@ fn __action51< errors: &'err mut Vec, ParserError>>, validator: &'v mut VariableValidator<'input>, (_, __0, _): (usize, Token<'input>, usize), + (_, __1, _): (usize, Token<'input>, usize), ) -> ApArgument<'input> { ApArgument::EmptyArray diff --git a/crates/air-lib/air-parser/src/parser/lexer/air_lexer.rs b/crates/air-lib/air-parser/src/parser/lexer/air_lexer.rs index d91bec4c..9d542174 100644 --- a/crates/air-lib/air-parser/src/parser/lexer/air_lexer.rs +++ b/crates/air-lib/air-parser/src/parser/lexer/air_lexer.rs @@ -26,7 +26,6 @@ pub type Spanned = Result<(Loc, Token, Loc), Error>; pub struct AIRLexer<'input> { input: &'input str, - open_square_bracket_met: bool, chars: Peekable>, } @@ -42,7 +41,6 @@ impl<'input> AIRLexer<'input> { pub fn new(input: &'input str) -> Self { Self { input, - open_square_bracket_met: false, chars: input.char_indices().peekable(), } } @@ -53,18 +51,8 @@ impl<'input> AIRLexer<'input> { '(' => return Some(Ok((start_pos, Token::OpenRoundBracket, start_pos + 1))), ')' => return Some(Ok((start_pos, Token::CloseRoundBracket, start_pos + 1))), - '[' => { - return if !self.open_square_bracket_met { - self.open_square_bracket_met = true; - Some(Ok((start_pos, Token::OpenSquareBracket, start_pos + 1))) - } else { - self.tokenize_string(start_pos, true) - } - } - ']' => { - self.open_square_bracket_met = false; - return Some(Ok((start_pos, Token::CloseSquareBracket, start_pos + 1))); - } + '[' => return Some(Ok((start_pos, Token::OpenSquareBracket, start_pos + 1))), + ']' => return Some(Ok((start_pos, Token::CloseSquareBracket, start_pos + 1))), ';' => self.skip_comment(), @@ -200,8 +188,6 @@ fn string_to_token(input: &str, start_pos: usize) -> LexerResult { MATCH_INSTR => Ok(Token::Match), MISMATCH_INSTR => Ok(Token::MisMatch), - SQUARE_BRACKETS => Ok(Token::SquareBrackets), - INIT_PEER_ID => Ok(Token::InitPeerId), _ if input.starts_with(LAST_ERROR) => parse_last_error(input, start_pos), @@ -249,7 +235,5 @@ const MISMATCH_INSTR: &str = "mismatch"; const INIT_PEER_ID: &str = "%init_peer_id%"; const LAST_ERROR: &str = "%last_error%"; -const SQUARE_BRACKETS: &str = "[]"; - const TRUE_VALUE: &str = "true"; const FALSE_VALUE: &str = "false"; diff --git a/crates/air-lib/air-parser/src/parser/lexer/tests.rs b/crates/air-lib/air-parser/src/parser/lexer/tests.rs index 8b8005f4..06530e20 100644 --- a/crates/air-lib/air-parser/src/parser/lexer/tests.rs +++ b/crates/air-lib/air-parser/src/parser/lexer/tests.rs @@ -467,3 +467,21 @@ fn booleans() { ))), ); } + +#[test] +fn match_with_empty_array__() { + const MATCH_WITH_EMPTY_ARRAY: &str = "(match scalar [] + (null) + )"; + + lexer_test( + MATCH_WITH_EMPTY_ARRAY, + Some( + vec![3, 4], + vec![ + Ok((14, Token::OpenSquareBracket, 15)), + Ok((15, Token::CloseSquareBracket, 16)), + ], + ), + ); +} diff --git a/crates/air-lib/air-parser/src/parser/lexer/token.rs b/crates/air-lib/air-parser/src/parser/lexer/token.rs index 3806a2c2..d8b675dd 100644 --- a/crates/air-lib/air-parser/src/parser/lexer/token.rs +++ b/crates/air-lib/air-parser/src/parser/lexer/token.rs @@ -29,7 +29,6 @@ pub enum Token<'input> { CloseRoundBracket, OpenSquareBracket, CloseSquareBracket, - SquareBrackets, // [] symbolize empty array, it's possible to have it only in an argument position StringLiteral(&'input str), Scalar { diff --git a/crates/air-lib/air-parser/src/parser/tests/ap.rs b/crates/air-lib/air-parser/src/parser/tests/ap.rs index 98f5a0f5..a9c3ad5d 100644 --- a/crates/air-lib/air-parser/src/parser/tests/ap.rs +++ b/crates/air-lib/air-parser/src/parser/tests/ap.rs @@ -74,3 +74,15 @@ fn ap_with_last_error() { assert_eq!(actual, expected); } + +#[test] +fn ap_with_empty_array() { + let source_code = r#" + (ap [] $stream) + "#; + + let actual = parse(source_code); + let expected = ap(ApArgument::EmptyArray, Variable::stream("$stream", 16)); + + assert_eq!(actual, expected); +} diff --git a/crates/air-lib/air-parser/src/parser/tests/match_.rs b/crates/air-lib/air-parser/src/parser/tests/match_.rs index 66b9f695..6bef96e3 100644 --- a/crates/air-lib/air-parser/src/parser/tests/match_.rs +++ b/crates/air-lib/air-parser/src/parser/tests/match_.rs @@ -99,3 +99,65 @@ fn mismatch_with_bool() { let instruction = parse(source_code); assert_eq!(expected, instruction); } + +#[test] +fn match_with_empty_array() { + let source_code = r#" + (match variable [] + (null) + ) + "#; + + let left_value = Value::Variable(VariableWithLambda::scalar("variable", 17)); + let right_value = Value::EmptyArray; + let instr = null(); + let expected = match_(left_value, right_value, instr); + + let instruction = parse(source_code); + assert_eq!(expected, instruction); + + let source_code = r#" + (match [] variable + (null) + ) + "#; + + let left_value = Value::EmptyArray; + let right_value = Value::Variable(VariableWithLambda::scalar("variable", 20)); + let instr = null(); + let expected = match_(left_value, right_value, instr); + + let instruction = parse(source_code); + assert_eq!(expected, instruction); +} + +#[test] +fn mismatch_with_empty_array() { + let source_code = r#" + (mismatch variable [] + (null) + ) + "#; + + let left_value = Value::Variable(VariableWithLambda::scalar("variable", 20)); + let right_value = Value::EmptyArray; + let instr = null(); + let expected = mismatch(left_value, right_value, instr); + + let instruction = parse(source_code); + assert_eq!(expected, instruction); + + let source_code = r#" + (mismatch [] variable + (null) + ) + "#; + + let left_value = Value::EmptyArray; + let right_value = Value::Variable(VariableWithLambda::scalar("variable", 23)); + let instr = null(); + let expected = mismatch(left_value, right_value, instr); + + let instruction = parse(source_code); + assert_eq!(expected, instruction); +}