diff --git a/Cargo.lock b/Cargo.lock index 4a9b954136..78811942d1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -145,9 +145,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.57" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f9b8508dccb7687a1d6c4ce66b2b0ecef467c94667de27d8d7fe1f8d2a9cdc" +checksum = "bb07d2053ccdbe10e2af2995a2f116c1330396493dc1269f6a91d0ae82e19704" [[package]] name = "arrayref" @@ -897,12 +897,6 @@ version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" -[[package]] -name = "hashbrown" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" - [[package]] name = "hashbrown" version = "0.12.1" @@ -1026,12 +1020,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.8.2" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6012d540c5baa3589337a98ce73408de9b5a25ec9fc2c6fd6be8f0d39e0ca5a" +checksum = "6c6392766afd7964e2531940894cffe4bd8d7d17dbc3c1c4857040fd4b33bdb3" dependencies = [ "autocfg", - "hashbrown 0.11.2", + "hashbrown", "serde", ] @@ -2148,7 +2142,7 @@ dependencies = [ "curl", "derivative", "digest", - "hashbrown 0.12.1", + "hashbrown", "hex", "itertools", "lazy_static", diff --git a/Cargo.toml b/Cargo.toml index 0285203ab5..9e14f1aef7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -74,7 +74,7 @@ version = "0.15.0" version = "4.0.0" [dependencies.indexmap] -version = "1.8" +version = "1.9" features = ["serde"] [dependencies.lazy_static] diff --git a/compiler/ast/src/expressions/binary.rs b/compiler/ast/src/expressions/binary.rs index 062618a4cb..73ac31558e 100644 --- a/compiler/ast/src/expressions/binary.rs +++ b/compiler/ast/src/expressions/binary.rs @@ -97,7 +97,7 @@ impl BinaryOperation { sym::nand => Self::Nand, sym::neq => Self::Neq, sym::nor => Self::Nor, - sym::or => Self::Or, + sym::or => Self::BitwiseOr, sym::pow => Self::Pow, sym::pow_wrapped => Self::PowWrapped, sym::shl => Self::Shl, diff --git a/compiler/parser/src/parser/expression.rs b/compiler/parser/src/parser/expression.rs index 84cf262635..ead48134c5 100644 --- a/compiler/parser/src/parser/expression.rs +++ b/compiler/parser/src/parser/expression.rs @@ -57,16 +57,16 @@ impl ParserContext<'_> { /// Returns an [`Expression`] AST node if the next tokens represent /// a ternary expression. May or may not include circuit init expressions. /// - /// Otherwise, tries to parse the next token using [`parse_disjunctive_expression`]. + /// Otherwise, tries to parse the next token using [`parse_boolean_or_expression`]. pub(super) fn parse_conditional_expression(&mut self) -> Result { // Try to parse the next expression. Try BinaryOperation::Or. - let mut expr = self.parse_disjunctive_expression()?; + let mut expr = self.parse_boolean_or_expression()?; // Parse the rest of the ternary expression. if self.eat(&Token::Question) { let if_true = self.parse_expression()?; self.expect(&Token::Colon)?; - let if_false = self.parse_conditional_expression()?; + let if_false = self.parse_expression()?; expr = Expression::Ternary(TernaryExpression { span: expr.span() + if_false.span(), condition: Box::new(expr), @@ -101,28 +101,20 @@ impl ParserContext<'_> { Ok(expr) } - /// Returns an [`Expression`] AST node if the next tokens represent - /// a binary OR expression. - /// - /// Otherwise, tries to parse the next token using [`parse_conjunctive_expression`]. - fn parse_disjunctive_expression(&mut self) -> Result { - self.parse_bin_expr(&[Token::Or], Self::parse_conjunctive_expression) - } - /// Returns an [`Expression`] AST node if the next tokens represent a /// binary AND expression. /// /// Otherwise, tries to parse the next token using [`parse_equality_expression`]. - fn parse_conjunctive_expression(&mut self) -> Result { - self.parse_bin_expr(&[Token::And], Self::parse_shift_expression) + fn parse_boolean_and_expression(&mut self) -> Result { + self.parse_bin_expr(&[Token::And], Self::parse_equality_expression) } - /// Returns an [`Expression`] AST node if the next tokens represent a - /// shift left or a shift right expression. + /// Returns an [`Expression`] AST node if the next tokens represent + /// a binary OR expression. /// - /// Otherwise, tries to parse the next token using [`parse_equality_expression`]. - fn parse_shift_expression(&mut self) -> Result { - self.parse_bin_expr(&[Token::Shl, Token::Shr], Self::parse_equality_expression) + /// Otherwise, tries to parse the next token using [`parse_boolean_and_expression`]. + fn parse_boolean_or_expression(&mut self) -> Result { + self.parse_bin_expr(&[Token::Or], Self::parse_boolean_and_expression) } /// Eats one of binary operators matching any in `tokens`. @@ -145,10 +137,24 @@ impl ParserContext<'_> { Token::Exp => BinaryOperation::Pow, Token::Shl => BinaryOperation::Shl, Token::Shr => BinaryOperation::Shr, + Token::Xor => BinaryOperation::Xor, _ => unreachable!("`eat_bin_op` shouldn't produce this"), }) } + /// Returns an [`Expression`] AST node if the next tokens represent a + /// binary relational expression: less than, less than or equals, greater than, greater than or equals. + /// + /// Otherwise, tries to parse the next token using [`parse_additive_expression`]. + fn parse_ordering_expression(&mut self) -> Result { + let mut expr = self.parse_bitwise_exclusive_or_expression()?; + if let Some(op) = self.eat_bin_op(&[Token::Lt, Token::LtEq, Token::Gt, Token::GtEq]) { + let right = self.parse_bitwise_exclusive_or_expression()?; + expr = Self::bin_expr(expr, right, op); + } + Ok(expr) + } + /// Returns an [`Expression`] AST node if the next tokens represent a /// binary equals or not equals expression. /// @@ -163,16 +169,35 @@ impl ParserContext<'_> { } /// Returns an [`Expression`] AST node if the next tokens represent a - /// binary relational expression: less than, less than or equals, greater than, greater than or equals. + /// bitwise exclusive or expression. + /// + /// Otherwise, tries to parse the next token using [`parse_bitwise_inclusive_or_expression`]. + fn parse_bitwise_exclusive_or_expression(&mut self) -> Result { + self.parse_bin_expr(&[Token::Xor], Self::parse_bitwise_inclusive_or_expression) + } + + /// Returns an [`Expression`] AST node if the next tokens represent a + /// bitwise inclusive or expression. + /// + /// Otherwise, tries to parse the next token using [`parse_bitwise_and_expression`]. + fn parse_bitwise_inclusive_or_expression(&mut self) -> Result { + self.parse_bin_expr(&[Token::BitwiseOr], Self::parse_bitwise_and_expression) + } + + /// Returns an [`Expression`] AST node if the next tokens represent a + /// bitwise and expression. + /// + /// Otherwise, tries to parse the next token using [`parse_shift_expression`]. + fn parse_bitwise_and_expression(&mut self) -> Result { + self.parse_bin_expr(&[Token::BitwiseAnd], Self::parse_shift_expression) + } + + /// Returns an [`Expression`] AST node if the next tokens represent a + /// shift left or a shift right expression. /// /// Otherwise, tries to parse the next token using [`parse_additive_expression`]. - fn parse_ordering_expression(&mut self) -> Result { - let mut expr = self.parse_additive_expression()?; - if let Some(op) = self.eat_bin_op(&[Token::Lt, Token::LtEq, Token::Gt, Token::GtEq]) { - let right = self.parse_additive_expression()?; - expr = Self::bin_expr(expr, right, op); - } - Ok(expr) + fn parse_shift_expression(&mut self) -> Result { + self.parse_bin_expr(&[Token::Shl, Token::Shr], Self::parse_additive_expression) } /// Returns an [`Expression`] AST node if the next tokens represent a @@ -241,18 +266,18 @@ impl ParserContext<'_> { let (mut args, _, span) = self.parse_expr_tuple()?; let span = receiver.span() + span; - if let ([], Some(operator)) = (&*args, UnaryOperation::from_symbol(method.name)) { + if let (true, Some(op)) = (args.is_empty(), UnaryOperation::from_symbol(method.name)) { // Found an unary operator and the argument list is empty. Ok(Expression::Unary(UnaryExpression { span, - op: operator, + op, receiver: Box::new(receiver), })) - } else if let (true, Some(operator)) = (args.len() == 1, BinaryOperation::from_symbol(method.name)) { + } else if let (1, Some(op)) = (args.len(), BinaryOperation::from_symbol(method.name)) { // Found a binary operator and the argument list contains a single argument. Ok(Expression::Binary(BinaryExpression { span, - op: operator, + op, left: Box::new(receiver), right: Box::new(args.swap_remove(0)), })) @@ -308,20 +333,23 @@ impl ParserContext<'_> { let mut expr = self.parse_primary_expression()?; loop { if self.eat(&Token::Dot) { + // Eat a method call on a type expr = self.parse_method_call_expression(expr)? } else if self.eat(&Token::DoubleColon) { expr = self.parse_static_access_expression(expr)?; + } else if self.check(&Token::LeftParen) { + // Parse a function call that's by itself. + let (arguments, _, span) = self.parse_paren_comma_list(|p| p.parse_expression().map(Some))?; + expr = Expression::Call(CallExpression { + span: expr.span() + span, + function: Box::new(expr), + arguments, + }); } - if !self.check(&Token::LeftParen) { + // Check if next token is a dot to see if we are calling recursive method. + if !self.check(&Token::Dot) { break; } - - let (arguments, _, span) = self.parse_expr_tuple()?; - expr = Expression::Call(CallExpression { - span: expr.span() + span, - function: Box::new(expr), - arguments, - }); } Ok(expr) } @@ -422,7 +450,9 @@ impl ParserContext<'_> { /// circuit initialization expression. /// let foo = Foo { x: 1u8 }; pub fn parse_circuit_expression(&mut self, identifier: Identifier) -> Result { - let (members, _, end) = self.parse_list(Delimiter::Brace, Some(Token::Comma), |p| p.parse_circuit_member().map(Some))?; + let (members, _, end) = self.parse_list(Delimiter::Brace, Some(Token::Comma), |p| { + p.parse_circuit_member().map(Some) + })?; Ok(Expression::CircuitInit(CircuitInitExpression { span: identifier.span + end, diff --git a/compiler/parser/src/parser/file.rs b/compiler/parser/src/parser/file.rs index 13725059d2..d9bd453bd0 100644 --- a/compiler/parser/src/parser/file.rs +++ b/compiler/parser/src/parser/file.rs @@ -166,7 +166,7 @@ impl ParserContext<'_> { // CAUTION: function members are unstable for testnet3. let function = self.parse_function()?; - return Err(ParserError::circuit_functions_unstable(function.1.span()).into()) + return Err(ParserError::circuit_functions_unstable(function.1.span()).into()); // Ok(CircuitMember::CircuitFunction(Box::new(function.1))) } else { return Err(Self::unexpected_item(&self.token).into()); diff --git a/compiler/parser/src/tokenizer/lexer.rs b/compiler/parser/src/tokenizer/lexer.rs index 21b1e389f8..c50905356b 100644 --- a/compiler/parser/src/tokenizer/lexer.rs +++ b/compiler/parser/src/tokenizer/lexer.rs @@ -300,6 +300,7 @@ impl Token { '{' => return single(&mut input, Token::LeftCurly), '}' => return single(&mut input, Token::RightCurly), '|' => return followed_by(&mut input, '|', Token::Or, Token::BitwiseOr), + '^' => return single(&mut input, Token::Xor), _ => (), } if let Some(ident) = eat_identifier(&mut input) { diff --git a/compiler/parser/src/tokenizer/token.rs b/compiler/parser/src/tokenizer/token.rs index e3ddc3a5a1..22c56d32d4 100644 --- a/compiler/parser/src/tokenizer/token.rs +++ b/compiler/parser/src/tokenizer/token.rs @@ -69,6 +69,7 @@ pub enum Token { Shl, Shr, Underscore, + Xor, // Syntactic Grammar // Types @@ -248,6 +249,7 @@ impl fmt::Display for Token { Shl => write!(f, "<<"), Shr => write!(f, ">>"), Underscore => write!(f, "_"), + Xor => write!(f, "^"), Address => write!(f, "address"), Bool => write!(f, "bool"), diff --git a/compiler/passes/src/symbol_table/table.rs b/compiler/passes/src/symbol_table/table.rs index 76dea81bbf..cb49fe5d58 100644 --- a/compiler/passes/src/symbol_table/table.rs +++ b/compiler/passes/src/symbol_table/table.rs @@ -60,7 +60,7 @@ impl<'a> SymbolTable<'a> { pub fn insert_circuit(&mut self, symbol: Symbol, insert: &'a Circuit) -> Result<()> { if self.circuits.contains_key(&symbol) { // Return an error if the circuit name has already been inserted. - return Err(AstError::shadowed_circuit(symbol, insert.span).into()) + return Err(AstError::shadowed_circuit(symbol, insert.span).into()); } self.circuits.insert(symbol, insert); Ok(()) diff --git a/compiler/passes/src/type_checker/check_expressions.rs b/compiler/passes/src/type_checker/check_expressions.rs index 9773f88244..2ea8af291d 100644 --- a/compiler/passes/src/type_checker/check_expressions.rs +++ b/compiler/passes/src/type_checker/check_expressions.rs @@ -66,7 +66,11 @@ impl<'a> ExpressionVisitorDirector<'a> for Director<'a> { fn visit_identifier(&mut self, input: &'a Identifier, expected: &Self::AdditionalInput) -> Option { if let VisitResult::VisitChildren = self.visitor.visit_identifier(input) { return if let Some(circuit) = self.visitor.symbol_table.clone().lookup_circuit(&input.name) { - Some(self.visitor.assert_expected_option(Type::Identifier(circuit.identifier.clone()), expected, circuit.span())) + Some(self.visitor.assert_expected_option( + Type::Identifier(circuit.identifier.clone()), + expected, + circuit.span(), + )) } else if let Some(var) = self.visitor.symbol_table.clone().lookup_variable(&input.name) { Some(self.visitor.assert_expected_option(*var.type_, expected, var.span)) } else { @@ -463,7 +467,7 @@ impl<'a> ExpressionVisitorDirector<'a> for Director<'a> { let t1 = self.visit_expression(&input.left, destination); // Assert right type is a magnitude (u8, u16, u32). - let t2 = self.visit_expression(&input.left, &None); + let t2 = self.visit_expression(&input.right, &None); self.visitor.assert_magnitude_type(&t2, input.right.span()); return_incorrect_type(t1, t2, destination) @@ -606,7 +610,9 @@ impl<'a> ExpressionVisitorDirector<'a> for Director<'a> { ) -> Option { if let Some(circ) = self.visitor.symbol_table.clone().lookup_circuit(&input.name.name) { // Check circuit type name. - let ret = self.visitor.assert_expected_circuit(circ.identifier, additional, input.name.span()); + let ret = self + .visitor + .assert_expected_circuit(circ.identifier, additional, input.name.span()); // Check number of circuit members. if circ.members.len() != input.members.len() { @@ -616,7 +622,7 @@ impl<'a> ExpressionVisitorDirector<'a> for Director<'a> { input.members.len(), input.span(), ) - .into(), + .into(), ); } // Check circuit member types @@ -630,7 +636,7 @@ impl<'a> ExpressionVisitorDirector<'a> for Director<'a> { self.visit_expression(expr, &Some(*type_)); } } - _ => {/* Circuit functions cannot be inside circuit init expressions */} + _ => { /* Circuit functions cannot be inside circuit init expressions */ } } }); diff --git a/docs/grammar/abnf-grammar.txt b/docs/grammar/abnf-grammar.txt index 360d854c7d..ba7e197f79 100644 --- a/docs/grammar/abnf-grammar.txt +++ b/docs/grammar/abnf-grammar.txt @@ -248,7 +248,17 @@ function-call = identifier function-arguments function-arguments = "(" [ expression *( "," expression ) [ "," ] ] ")" -unary-expression = primary-expression +postfix-expression = primary-expression + / operator-call + +operator-call = unary-operator-call / binary-operator-call + +unary-operator-call = postfix-expression "." identifier "(" ")" + +binary-operator-call = + postfix-expression "." identifier "(" expression [ "," ] ")" + +unary-expression = postfix-expression / "!" unary-expression / "-" unary-expression @@ -263,23 +273,39 @@ additive-expression = multiplicative-expression / additive-expression "+" multiplicative-expression / additive-expression "-" multiplicative-expression -ordering-expression = additive-expression - / additive-expression "<" additive-expression - / additive-expression ">" additive-expression - / additive-expression "<=" additive-expression - / additive-expression ">=" additive-expression +shift-expression = additive-expression + / shift-expression "<<" additive-expression + / shift-expression ">>" additive-expression + +bitwise-and-expression = shift-expression + / bitwise-and-expression "&" shift-expression + +bitwise-inclusive-or-expression = + bitwise-and-expression + / bitwise-inclusive-or-expression "|" bitwise-and-expression + +bitwise-exclusive-or-expression = + bitwise-inclusive-or-expression + / bitwise-exclusive-or-expression "^" bitwise-inclusive-or-expression + +ordering-expression = + bitwise-exclusive-or-expression + / bitwise-exclusive-or-expression "<" bitwise-exclusive-or-expression + / bitwise-exclusive-or-expression ">" bitwise-exclusive-or-expression + / bitwise-exclusive-or-expression "<=" bitwise-exclusive-or-expression + / bitwise-exclusive-or-expression ">=" bitwise-exclusive-or-expression equality-expression = ordering-expression / ordering-expression "==" ordering-expression / ordering-expression "!=" ordering-expression -conjunctive-expression = equality-expression - / conjunctive-expression "&&" equality-expression +boolean-and-expression = equality-expression + / boolean-and-expression "&&" equality-expression -disjunctive-expression = conjunctive-expression - / disjunctive-expression "||" conjunctive-expression +boolean-or-expression = boolean-and-expression + / boolean-or-expression "||" boolean-and-expression -binary-expression = disjunctive-expression +binary-expression = boolean-or-expression conditional-expression = binary-expression / binary-expression "?" expression ":" expression diff --git a/leo/package/Cargo.toml b/leo/package/Cargo.toml index a72f91e562..53c5479d22 100644 --- a/leo/package/Cargo.toml +++ b/leo/package/Cargo.toml @@ -23,7 +23,7 @@ path = "../errors" version = "1.5.3" [dependencies.indexmap] -version = "1.8" +version = "1.9" features = ["serde"] [dependencies.serde] diff --git a/tests/compiler/address/binary.leo b/tests/compiler/address/binary.leo new file mode 100644 index 0000000000..afecd9fdb1 --- /dev/null +++ b/tests/compiler/address/binary.leo @@ -0,0 +1,13 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/address1.in +*/ + + +function main (x: address) -> bool { + let a: address = aleo1fj982yqchhy973kz7e9jk6er7t6qd6jm9anplnlprem507w6lv9spwvfxx; + let b: bool = x.eq(a); + let c: bool = x.neq(a); + return c; +} \ No newline at end of file diff --git a/tests/compiler/boolean/operator_methods.leo b/tests/compiler/boolean/operator_methods.leo new file mode 100644 index 0000000000..e562a2cdf6 --- /dev/null +++ b/tests/compiler/boolean/operator_methods.leo @@ -0,0 +1,25 @@ +/* +namespace: Compile +expectation: Pass +input_file: + - inputs/false_false.in + - inputs/false_true.in + - inputs/true_false.in + - inputs/true_true.in +*/ + +function main(a: bool, b: bool) -> bool { + // unary + let h: bool = a.not(); + + // binary + let l: bool = a.and(b); + let o: bool = a.eq(b); + let v: bool = a.nand(b); + let w: bool = a.neq(b); + let x: bool = a.nor(b); + let y: bool = a.or(b); + let ar: bool = a.xor(b); + + return h; +} \ No newline at end of file diff --git a/tests/compiler/core/account/compute_key.leo b/tests/compiler/core/account/compute_key.leo index 4e649aa5e3..cb9593d908 100644 --- a/tests/compiler/core/account/compute_key.leo +++ b/tests/compiler/core/account/compute_key.leo @@ -1,9 +1,9 @@ /* namespace: Compile -expectation: Pass +expectation: Fail */ - +// todo: rewrite this test so it properly tests a compute key. function main(public compute_key: ComputeKey, a: bool) -> bool { return a; } diff --git a/tests/compiler/core/account/private_key.leo b/tests/compiler/core/account/private_key.leo index 19f9ac179a..4ba61bdfdb 100644 --- a/tests/compiler/core/account/private_key.leo +++ b/tests/compiler/core/account/private_key.leo @@ -1,8 +1,9 @@ /* namespace: Compile -expectation: Pass +expectation: Fail */ +// todo: rewrite this test so it properly tests a private key. function main(public private_key: PrivateKey, a: bool) -> bool { return a; } diff --git a/tests/compiler/core/account/record.leo b/tests/compiler/core/account/record.leo index 744c4a712f..833c61127b 100644 --- a/tests/compiler/core/account/record.leo +++ b/tests/compiler/core/account/record.leo @@ -1,9 +1,9 @@ /* namespace: Compile -expectation: Pass +expectation: Fail */ - +// todo: rewrite this test so it properly tests a record type. function main(public record: Record, a: bool) -> bool { return a; } diff --git a/tests/compiler/core/account/signature.leo b/tests/compiler/core/account/signature.leo index dd6346b65e..2b8c578ed1 100644 --- a/tests/compiler/core/account/signature.leo +++ b/tests/compiler/core/account/signature.leo @@ -1,8 +1,9 @@ /* namespace: Compile -expectation: Pass +expectation: Fail */ +// todo: rewrite this test so it properly tests a signature. function main(public signature: Signature, a: bool) -> bool { return a; } diff --git a/tests/compiler/core/account/view_key.leo b/tests/compiler/core/account/view_key.leo index f5e3c59946..ce62b86a83 100644 --- a/tests/compiler/core/account/view_key.leo +++ b/tests/compiler/core/account/view_key.leo @@ -1,8 +1,9 @@ /* namespace: Compile -expectation: Pass +expectation: Fail */ +// todo: rewrite this test so it properly tests a view key. function main(public view_key: ViewKey, a: bool) -> bool { return a; } diff --git a/tests/compiler/core/algorithms/poseidon.leo b/tests/compiler/core/algorithms/poseidon.leo index 620da29139..10e271e9a0 100644 --- a/tests/compiler/core/algorithms/poseidon.leo +++ b/tests/compiler/core/algorithms/poseidon.leo @@ -1,8 +1,9 @@ /* namespace: Compile -expectation: Pass +expectation: Fail */ +// todo: rewrite this test so it properly tests poseidon hash functions. function main(public poseidon: Poseidon, a: bool) -> bool { return a; } diff --git a/tests/compiler/core/invalid_input_ident_fail.leo b/tests/compiler/core/invalid_input_ident_fail.leo deleted file mode 100644 index 038fb03502..0000000000 --- a/tests/compiler/core/invalid_input_ident_fail.leo +++ /dev/null @@ -1,9 +0,0 @@ -/* -namespace: Compile -expectation: Fail -*/ - - -function main(public dne: DNE, a: bool) -> bool { - return a; -} diff --git a/tests/compiler/field/operator_methods.leo b/tests/compiler/field/operator_methods.leo new file mode 100644 index 0000000000..285eb8d4dd --- /dev/null +++ b/tests/compiler/field/operator_methods.leo @@ -0,0 +1,28 @@ +/* +namespace: Compile +expectation: Pass +input_file: + - inputs/fields.in +*/ + +function main(a: field, b: field) -> bool { + // unary + let f: field = a.inv(); + let g: field = a.neg(); + let i: field = a.square(); + let j: field = a.sqrt(); + + // binary + let k: field = a.add(b); + let m: field = a.div(b); + let o: bool = a.eq(b); + let p: bool = a.ge(b); + let q: bool = a.gt(b); + let r: bool = a.le(b); + let s: bool = a.lt(b); + let t: field = a.mul(b); + let w: bool = a.neq(b); + let z: field = a.pow(b); + + return w; +} \ No newline at end of file diff --git a/tests/compiler/group/operator_methods.leo b/tests/compiler/group/operator_methods.leo new file mode 100644 index 0000000000..3567d3bf5e --- /dev/null +++ b/tests/compiler/group/operator_methods.leo @@ -0,0 +1,20 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/three.in +*/ + +function main(a: group, b: group) -> bool { + // unary + let e: group = a.double(); + let g: group = a.neg(); + + // binary + let j: group = a.add(b); + let o: bool = a.eq(b); + let t: group = a.mul(2scalar); + let q: group = 2scalar.mul(a); + let w: bool = a.neq(b); + + return a == b; +} \ No newline at end of file diff --git a/tests/compiler/integers/i128/and.leo b/tests/compiler/integers/i128/and.leo new file mode 100644 index 0000000000..64c552f202 --- /dev/null +++ b/tests/compiler/integers/i128/and.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: i128, b: i128, c: i128) -> bool { + return a & b == c; +} diff --git a/tests/compiler/integers/i128/operator_methods.leo b/tests/compiler/integers/i128/operator_methods.leo new file mode 100644 index 0000000000..f3b318b35d --- /dev/null +++ b/tests/compiler/integers/i128/operator_methods.leo @@ -0,0 +1,50 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: i128, b: i128) -> bool { + // unary + let c: i128 = a.abs(); + let d: i128 = a.abs_wrapped(); + let g: i128 = a.neg(); + let h: i128 = a.not(); + + // binary + let j: i128 = a.add(b); + let k: i128 = a.add_wrapped(b); + let l: i128 = a.and(b); + let m: i128 = a.div(b); + let n: i128 = a.div_wrapped(b); + let o: bool = a.eq(b); + let p: bool = a.ge(b); + let q: bool = a.gt(b); + let r: bool = a.le(b); + let s: bool = a.lt(b); + let t: i128 = a.mul(b); + let u: i128 = a.mul_wrapped(b); + let w: bool = a.neq(b); + let y: i128 = a.or(b); + let z: i128 = a.pow(2u8); + let aa: i128 = a.pow(2u16); + let ab: i128 = a.pow(2u32); + let ac: i128 = a.pow_wrapped(2u8); + let ad: i128 = a.pow_wrapped(2u16); + let ae: i128 = a.pow_wrapped(2u32); + let af: i128 = a.shl(2u8); + let ag: i128 = a.shl(2u16); + let ah: i128 = a.shl(2u32); + let ai: i128 = a.shl_wrapped(2u8); + let aj: i128 = a.shl_wrapped(2u16); + let ak: i128 = a.shl_wrapped(2u32); + let al: i128 = a.shr(2u8); + let am: i128 = a.shr(2u16); + let an: i128 = a.shr(2u32); + let ao: i128 = a.shr_wrapped(2u8); + let ap: i128 = a.shr_wrapped(2u16); + let aq: i128 = a.shr_wrapped(2u32); + let ar: i128 = a.xor(b); + + return a == b; +} \ No newline at end of file diff --git a/tests/compiler/integers/i128/or.leo b/tests/compiler/integers/i128/or.leo new file mode 100644 index 0000000000..73a4d949d6 --- /dev/null +++ b/tests/compiler/integers/i128/or.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: i128, b: i128, c: i128) -> bool { + return a | b == c; +} diff --git a/tests/compiler/integers/i128/pow_fail.leo b/tests/compiler/integers/i128/pow.leo similarity index 60% rename from tests/compiler/integers/i128/pow_fail.leo rename to tests/compiler/integers/i128/pow.leo index b99bfa4434..4b09bf3e37 100644 --- a/tests/compiler/integers/i128/pow_fail.leo +++ b/tests/compiler/integers/i128/pow.leo @@ -1,9 +1,9 @@ /* namespace: Compile -expectation: Fail +expectation: Pass input_file: inputs/pow.in */ function main(a: i128, b: i128, c: i128) -> bool { - return a ** b == c; + return a ** 2u8 == a ** 2u16 && a ** 2u32 == c; } diff --git a/tests/compiler/integers/i128/shl.leo b/tests/compiler/integers/i128/shl.leo new file mode 100644 index 0000000000..5548d48f74 --- /dev/null +++ b/tests/compiler/integers/i128/shl.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: i128, b: i128, c: i128) -> bool { + return a << 2u8 == a << 2u16 && a << 2u32 == c; +} diff --git a/tests/compiler/integers/i128/shr.leo b/tests/compiler/integers/i128/shr.leo new file mode 100644 index 0000000000..31d2f1b1b7 --- /dev/null +++ b/tests/compiler/integers/i128/shr.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: i128, b: i128, c: i128) -> bool { + return a >> 2u8 == a >> 2u16 && a >> 2u32 == c; +} diff --git a/tests/compiler/integers/i128/xor.leo b/tests/compiler/integers/i128/xor.leo new file mode 100644 index 0000000000..7378a89a0b --- /dev/null +++ b/tests/compiler/integers/i128/xor.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: i128, b: i128, c: i128) -> bool { + return a ^ 2u8 == a ^ 2u16 && a ^ 2u32 == c; +} diff --git a/tests/compiler/integers/i16/and.leo b/tests/compiler/integers/i16/and.leo new file mode 100644 index 0000000000..ada82d3d9b --- /dev/null +++ b/tests/compiler/integers/i16/and.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: i16, b: i16, c: i16) -> bool { + return a & b == c; +} diff --git a/tests/compiler/integers/i16/operator_methods.leo b/tests/compiler/integers/i16/operator_methods.leo new file mode 100644 index 0000000000..3dc0db57fa --- /dev/null +++ b/tests/compiler/integers/i16/operator_methods.leo @@ -0,0 +1,50 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: i16, b: i16) -> bool { + // unary + let c: i16 = a.abs(); + let d: i16 = a.abs_wrapped(); + let g: i16 = a.neg(); + let h: i16 = a.not(); + + // binary + let j: i16 = a.add(b); + let k: i16 = a.add_wrapped(b); + let l: i16 = a.and(b); + let m: i16 = a.div(b); + let n: i16 = a.div_wrapped(b); + let o: bool = a.eq(b); + let p: bool = a.ge(b); + let q: bool = a.gt(b); + let r: bool = a.le(b); + let s: bool = a.lt(b); + let t: i16 = a.mul(b); + let u: i16 = a.mul_wrapped(b); + let w: bool = a.neq(b); + let y: i16 = a.or(b); + let z: i16 = a.pow(2u8); + let aa: i16 = a.pow(2u16); + let ab: i16 = a.pow(2u32); + let ac: i16 = a.pow_wrapped(2u8); + let ad: i16 = a.pow_wrapped(2u16); + let ae: i16 = a.pow_wrapped(2u32); + let af: i16 = a.shl(2u8); + let ag: i16 = a.shl(2u16); + let ah: i16 = a.shl(2u32); + let ai: i16 = a.shl_wrapped(2u8); + let aj: i16 = a.shl_wrapped(2u16); + let ak: i16 = a.shl_wrapped(2u32); + let al: i16 = a.shr(2u8); + let am: i16 = a.shr(2u16); + let an: i16 = a.shr(2u32); + let ao: i16 = a.shr_wrapped(2u8); + let ap: i16 = a.shr_wrapped(2u16); + let aq: i16 = a.shr_wrapped(2u32); + let ar: i16 = a.xor(b); + + return a == b; +} \ No newline at end of file diff --git a/tests/compiler/integers/i16/or.leo b/tests/compiler/integers/i16/or.leo new file mode 100644 index 0000000000..b36860ee3a --- /dev/null +++ b/tests/compiler/integers/i16/or.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: i16, b: i16, c: i16) -> bool { + return a | b == c; +} diff --git a/tests/compiler/integers/i16/pow_fail.leo b/tests/compiler/integers/i16/pow.leo similarity index 59% rename from tests/compiler/integers/i16/pow_fail.leo rename to tests/compiler/integers/i16/pow.leo index 5b89c8c83b..6bf65e690c 100644 --- a/tests/compiler/integers/i16/pow_fail.leo +++ b/tests/compiler/integers/i16/pow.leo @@ -1,9 +1,9 @@ /* namespace: Compile -expectation: Fail +expectation: Pass input_file: inputs/pow.in */ function main(a: i16, b: i16, c: i16) -> bool { - return a ** b == c; + return a ** 2u8 == a ** 2u16 && a ** 2u32 == c; } diff --git a/tests/compiler/integers/i16/shl.leo b/tests/compiler/integers/i16/shl.leo new file mode 100644 index 0000000000..b1122a1c39 --- /dev/null +++ b/tests/compiler/integers/i16/shl.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: i16, b: i16, c: i16) -> bool { + return a << 2u8 == a << 2u16 && a << 2u32 == c; +} diff --git a/tests/compiler/integers/i16/shr.leo b/tests/compiler/integers/i16/shr.leo new file mode 100644 index 0000000000..a4373d4e80 --- /dev/null +++ b/tests/compiler/integers/i16/shr.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: i16, b: i16, c: i16) -> bool { + return a >> 2u8 == a >> 2u16 && a >> 2u32 == c; +} diff --git a/tests/compiler/integers/i16/xor.leo b/tests/compiler/integers/i16/xor.leo new file mode 100644 index 0000000000..1a71f4844e --- /dev/null +++ b/tests/compiler/integers/i16/xor.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: i16, b: i16, c: i16) -> bool { + return a ^ 2u8 == a ^ 2u16 && a ^ 2u32 == c; +} diff --git a/tests/compiler/integers/i32/and.leo b/tests/compiler/integers/i32/and.leo new file mode 100644 index 0000000000..3d91ea229d --- /dev/null +++ b/tests/compiler/integers/i32/and.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: i32, b: i32, c: i32) -> bool { + return a & b == c; +} diff --git a/tests/compiler/integers/i32/operator_methods.leo b/tests/compiler/integers/i32/operator_methods.leo new file mode 100644 index 0000000000..5c2951c6ea --- /dev/null +++ b/tests/compiler/integers/i32/operator_methods.leo @@ -0,0 +1,50 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: i32, b: i32) -> bool { + // unary + let c: i32 = a.abs(); + let d: i32 = a.abs_wrapped(); + let g: i32 = a.neg(); + let h: i32 = a.not(); + + // binary + let j: i32 = a.add(b); + let k: i32 = a.add_wrapped(b); + let l: i32 = a.and(b); + let m: i32 = a.div(b); + let n: i32 = a.div_wrapped(b); + let o: bool = a.eq(b); + let p: bool = a.ge(b); + let q: bool = a.gt(b); + let r: bool = a.le(b); + let s: bool = a.lt(b); + let t: i32 = a.mul(b); + let u: i32 = a.mul_wrapped(b); + let w: bool = a.neq(b); + let y: i32 = a.or(b); + let z: i32 = a.pow(2u8); + let aa: i32 = a.pow(2u16); + let ab: i32 = a.pow(2u32); + let ac: i32 = a.pow_wrapped(2u8); + let ad: i32 = a.pow_wrapped(2u16); + let ae: i32 = a.pow_wrapped(2u32); + let af: i32 = a.shl(2u8); + let ag: i32 = a.shl(2u16); + let ah: i32 = a.shl(2u32); + let ai: i32 = a.shl_wrapped(2u8); + let aj: i32 = a.shl_wrapped(2u16); + let ak: i32 = a.shl_wrapped(2u32); + let al: i32 = a.shr(2u8); + let am: i32 = a.shr(2u16); + let an: i32 = a.shr(2u32); + let ao: i32 = a.shr_wrapped(2u8); + let ap: i32 = a.shr_wrapped(2u16); + let aq: i32 = a.shr_wrapped(2u32); + let ar: i32 = a.xor(b); + + return a == b; +} \ No newline at end of file diff --git a/tests/compiler/integers/i32/or.leo b/tests/compiler/integers/i32/or.leo new file mode 100644 index 0000000000..1eb01be891 --- /dev/null +++ b/tests/compiler/integers/i32/or.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: i32, b: i32, c: i32) -> bool { + return a | b == c; +} diff --git a/tests/compiler/integers/i32/pow_fail.leo b/tests/compiler/integers/i32/pow.leo similarity index 59% rename from tests/compiler/integers/i32/pow_fail.leo rename to tests/compiler/integers/i32/pow.leo index f23f39c719..f0ef3237c5 100644 --- a/tests/compiler/integers/i32/pow_fail.leo +++ b/tests/compiler/integers/i32/pow.leo @@ -1,9 +1,9 @@ /* namespace: Compile -expectation: Fail +expectation: Pass input_file: inputs/pow.in */ function main(a: i32, b: i32, c: i32) -> bool { - return a ** b == c; + return a ** 2u8 == a ** 2u16 && a ** 2u32 == c; } diff --git a/tests/compiler/integers/i32/shl.leo b/tests/compiler/integers/i32/shl.leo new file mode 100644 index 0000000000..244af4ffed --- /dev/null +++ b/tests/compiler/integers/i32/shl.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: i32, b: i32, c: i32) -> bool { + return a << 2u8 == a << 2u16 && a << 2u32 == c; +} diff --git a/tests/compiler/integers/i32/shr.leo b/tests/compiler/integers/i32/shr.leo new file mode 100644 index 0000000000..8118366c96 --- /dev/null +++ b/tests/compiler/integers/i32/shr.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: i32, b: i32, c: i32) -> bool { + return a >> 2u8 == a >> 2u16 && a >> 2u32 == c; +} diff --git a/tests/compiler/integers/i32/xor.leo b/tests/compiler/integers/i32/xor.leo new file mode 100644 index 0000000000..e85dfa4ae5 --- /dev/null +++ b/tests/compiler/integers/i32/xor.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: i32, b: i32, c: i32) -> bool { + return a ^ 2u8 == a ^ 2u16 && a ^ 2u32 == c; +} diff --git a/tests/compiler/integers/i64/and.leo b/tests/compiler/integers/i64/and.leo new file mode 100644 index 0000000000..beaeb6262e --- /dev/null +++ b/tests/compiler/integers/i64/and.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: i64, b: i64, c: i64) -> bool { + return a & b == c; +} diff --git a/tests/compiler/integers/i64/operator_methods.leo b/tests/compiler/integers/i64/operator_methods.leo new file mode 100644 index 0000000000..3d53b1ea8f --- /dev/null +++ b/tests/compiler/integers/i64/operator_methods.leo @@ -0,0 +1,50 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: i64, b: i64) -> bool { + // unary + let c: i64 = a.abs(); + let d: i64 = a.abs_wrapped(); + let g: i64 = a.neg(); + let h: i64 = a.not(); + + // binary + let j: i64 = a.add(b); + let k: i64 = a.add_wrapped(b); + let l: i64 = a.and(b); + let m: i64 = a.div(b); + let n: i64 = a.div_wrapped(b); + let o: bool = a.eq(b); + let p: bool = a.ge(b); + let q: bool = a.gt(b); + let r: bool = a.le(b); + let s: bool = a.lt(b); + let t: i64 = a.mul(b); + let u: i64 = a.mul_wrapped(b); + let w: bool = a.neq(b); + let y: i64 = a.or(b); + let z: i64 = a.pow(2u8); + let aa: i64 = a.pow(2u16); + let ab: i64 = a.pow(2u32); + let ac: i64 = a.pow_wrapped(2u8); + let ad: i64 = a.pow_wrapped(2u16); + let ae: i64 = a.pow_wrapped(2u32); + let af: i64 = a.shl(2u8); + let ag: i64 = a.shl(2u16); + let ah: i64 = a.shl(2u32); + let ai: i64 = a.shl_wrapped(2u8); + let aj: i64 = a.shl_wrapped(2u16); + let ak: i64 = a.shl_wrapped(2u32); + let al: i64 = a.shr(2u8); + let am: i64 = a.shr(2u16); + let an: i64 = a.shr(2u32); + let ao: i64 = a.shr_wrapped(2u8); + let ap: i64 = a.shr_wrapped(2u16); + let aq: i64 = a.shr_wrapped(2u32); + let ar: i64 = a.xor(b); + + return a == b; +} \ No newline at end of file diff --git a/tests/compiler/integers/i64/or.leo b/tests/compiler/integers/i64/or.leo new file mode 100644 index 0000000000..fed735f8ee --- /dev/null +++ b/tests/compiler/integers/i64/or.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: i64, b: i64, c: i64) -> bool { + return a | b == c; +} diff --git a/tests/compiler/integers/i64/pow_fail.leo b/tests/compiler/integers/i64/pow.leo similarity index 59% rename from tests/compiler/integers/i64/pow_fail.leo rename to tests/compiler/integers/i64/pow.leo index 9c39be76a4..f328c8c9ea 100644 --- a/tests/compiler/integers/i64/pow_fail.leo +++ b/tests/compiler/integers/i64/pow.leo @@ -1,9 +1,9 @@ /* namespace: Compile -expectation: Fail +expectation: Pass input_file: inputs/pow.in */ function main(a: i64, b: i64, c: i64) -> bool { - return a ** b == c; + return a ** 2u8 == a ** 2u16 && a ** 2u32 == c; } diff --git a/tests/compiler/integers/i64/shl.leo b/tests/compiler/integers/i64/shl.leo new file mode 100644 index 0000000000..ec5a5d2e96 --- /dev/null +++ b/tests/compiler/integers/i64/shl.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: i64, b: i64, c: i64) -> bool { + return a << 2u8 == a << 2u16 && a << 2u32 == c; +} diff --git a/tests/compiler/integers/i64/shr.leo b/tests/compiler/integers/i64/shr.leo new file mode 100644 index 0000000000..f5dcd8a119 --- /dev/null +++ b/tests/compiler/integers/i64/shr.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: i64, b: i64, c: i64) -> bool { + return a >> 2u8 == a >> 2u16 && a >> 2u32 == c; +} diff --git a/tests/compiler/integers/i64/xor.leo b/tests/compiler/integers/i64/xor.leo new file mode 100644 index 0000000000..6596c18648 --- /dev/null +++ b/tests/compiler/integers/i64/xor.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: i64, b: i64, c: i64) -> bool { + return a ^ 2u8 == a ^ 2u16 && a ^ 2u32 == c; +} diff --git a/tests/compiler/integers/i8/and.leo b/tests/compiler/integers/i8/and.leo new file mode 100644 index 0000000000..6be6c0a92d --- /dev/null +++ b/tests/compiler/integers/i8/and.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: i8, b: i8, c: i8) -> bool { + return a & b == c; +} diff --git a/tests/compiler/integers/i8/operator_methods.leo b/tests/compiler/integers/i8/operator_methods.leo new file mode 100644 index 0000000000..af1aabc780 --- /dev/null +++ b/tests/compiler/integers/i8/operator_methods.leo @@ -0,0 +1,50 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: i8, b: i8) -> bool { + // unary + let c: i8 = a.abs(); + let d: i8 = a.abs_wrapped(); + let g: i8 = a.neg(); + let h: i8 = a.not(); + + // binary + let j: i8 = a.add(b); + let k: i8 = a.add_wrapped(b); + let l: i8 = a.and(b); + let m: i8 = a.div(b); + let n: i8 = a.div_wrapped(b); + let o: bool = a.eq(b); + let p: bool = a.ge(b); + let q: bool = a.gt(b); + let r: bool = a.le(b); + let s: bool = a.lt(b); + let t: i8 = a.mul(b); + let u: i8 = a.mul_wrapped(b); + let w: bool = a.neq(b); + let y: i8 = a.or(b); + let z: i8 = a.pow(2u8); + let aa: i8 = a.pow(2u16); + let ab: i8 = a.pow(2u32); + let ac: i8 = a.pow_wrapped(2u8); + let ad: i8 = a.pow_wrapped(2u16); + let ae: i8 = a.pow_wrapped(2u32); + let af: i8 = a.shl(2u8); + let ag: i8 = a.shl(2u16); + let ah: i8 = a.shl(2u32); + let ai: i8 = a.shl_wrapped(2u8); + let aj: i8 = a.shl_wrapped(2u16); + let ak: i8 = a.shl_wrapped(2u32); + let al: i8 = a.shr(2u8); + let am: i8 = a.shr(2u16); + let an: i8 = a.shr(2u32); + let ao: i8 = a.shr_wrapped(2u8); + let ap: i8 = a.shr_wrapped(2u16); + let aq: i8 = a.shr_wrapped(2u32); + let ar: i8 = a.xor(b); + + return a == b; +} \ No newline at end of file diff --git a/tests/compiler/integers/i8/or.leo b/tests/compiler/integers/i8/or.leo new file mode 100644 index 0000000000..cd640c8218 --- /dev/null +++ b/tests/compiler/integers/i8/or.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: i8, b: i8, c: i8) -> bool { + return a | b == c; +} diff --git a/tests/compiler/integers/i8/pow_fail.leo b/tests/compiler/integers/i8/pow.leo similarity index 58% rename from tests/compiler/integers/i8/pow_fail.leo rename to tests/compiler/integers/i8/pow.leo index a91751332a..b3bb8b65f4 100644 --- a/tests/compiler/integers/i8/pow_fail.leo +++ b/tests/compiler/integers/i8/pow.leo @@ -1,9 +1,9 @@ /* namespace: Compile -expectation: Fail +expectation: Pass input_file: inputs/pow.in */ function main(a: i8, b: i8, c: i8) -> bool { - return a ** b == c; + return a ** 2u8 == a ** 2u16 && a ** 2u32 == c; } diff --git a/tests/compiler/integers/i8/shl.leo b/tests/compiler/integers/i8/shl.leo new file mode 100644 index 0000000000..8cb700bf36 --- /dev/null +++ b/tests/compiler/integers/i8/shl.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: i8, b: i8, c: i8) -> bool { + return a << 2u8 == a << 2u16 && a << 2u32 == c; +} diff --git a/tests/compiler/integers/i8/shr.leo b/tests/compiler/integers/i8/shr.leo new file mode 100644 index 0000000000..89aec1f726 --- /dev/null +++ b/tests/compiler/integers/i8/shr.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: i8, b: i8, c: i8) -> bool { + return a >> 2u8 == a >> 2u16 && a >> 2u32 == c; +} diff --git a/tests/compiler/integers/i8/xor.leo b/tests/compiler/integers/i8/xor.leo new file mode 100644 index 0000000000..84c8526c4a --- /dev/null +++ b/tests/compiler/integers/i8/xor.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: i8, b: i8, c: i8) -> bool { + return a ^ 2u8 == a ^ 2u16 && a ^ 2u32 == c; +} diff --git a/tests/compiler/integers/u128/and.leo b/tests/compiler/integers/u128/and.leo new file mode 100644 index 0000000000..ce59956a52 --- /dev/null +++ b/tests/compiler/integers/u128/and.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: u128, b: u128, c: u128) -> bool { + return a & b == c; +} diff --git a/tests/compiler/integers/u128/operator_methods.leo b/tests/compiler/integers/u128/operator_methods.leo new file mode 100644 index 0000000000..808ca46c94 --- /dev/null +++ b/tests/compiler/integers/u128/operator_methods.leo @@ -0,0 +1,49 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: u128, b: u128) -> bool { + // unary + let c: u128 = a.abs(); + let d: u128 = a.abs_wrapped(); + let h: u128 = a.not(); + + // binary + let j: u128 = a.add(b); + let k: u128 = a.add_wrapped(b); + let l: u128 = a.and(b); + let m: u128 = a.div(b); + let n: u128 = a.div_wrapped(b); + let o: bool = a.eq(b); + let p: bool = a.ge(b); + let q: bool = a.gt(b); + let r: bool = a.le(b); + let s: bool = a.lt(b); + let t: u128 = a.mul(b); + let u: u128 = a.mul_wrapped(b); + let w: bool = a.neq(b); + let y: u128 = a.or(b); + let z: u128 = a.pow(2u8); + let aa: u128 = a.pow(2u16); + let ab: u128 = a.pow(2u32); + let ac: u128 = a.pow_wrapped(2u8); + let ad: u128 = a.pow_wrapped(2u16); + let ae: u128 = a.pow_wrapped(2u32); + let af: u128 = a.shl(2u8); + let ag: u128 = a.shl(2u16); + let ah: u128 = a.shl(2u32); + let ai: u128 = a.shl_wrapped(2u8); + let aj: u128 = a.shl_wrapped(2u16); + let ak: u128 = a.shl_wrapped(2u32); + let al: u128 = a.shr(2u8); + let am: u128 = a.shr(2u16); + let an: u128 = a.shr(2u32); + let ao: u128 = a.shr_wrapped(2u8); + let ap: u128 = a.shr_wrapped(2u16); + let aq: u128 = a.shr_wrapped(2u32); + let ar: u128 = a.xor(b); + + return a == b; +} \ No newline at end of file diff --git a/tests/compiler/integers/u128/or.leo b/tests/compiler/integers/u128/or.leo new file mode 100644 index 0000000000..a8cdad36fc --- /dev/null +++ b/tests/compiler/integers/u128/or.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: u128, b: u128, c: u128) -> bool { + return a | b == c; +} diff --git a/tests/compiler/integers/u128/pow.leo b/tests/compiler/integers/u128/pow.leo index a9a3b007b3..e309762440 100644 --- a/tests/compiler/integers/u128/pow.leo +++ b/tests/compiler/integers/u128/pow.leo @@ -1,10 +1,10 @@ /* namespace: Compile -expectation: Fail +expectation: Pass # The exponent must be u8, u16, or u32 */ function main(a: u128, b: u128, c: u128) -> bool { - return a ** b == c; + return a ** 2u8 == a ** 2u16 && a ** 2u32 == c; } diff --git a/tests/compiler/integers/u128/shl.leo b/tests/compiler/integers/u128/shl.leo new file mode 100644 index 0000000000..cb7a758c7b --- /dev/null +++ b/tests/compiler/integers/u128/shl.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: u128, b: u128, c: u128) -> bool { + return a << 2u8 == a << 2u16 && a << 2u32 == c; +} diff --git a/tests/compiler/integers/u128/shr.leo b/tests/compiler/integers/u128/shr.leo new file mode 100644 index 0000000000..334dc5c997 --- /dev/null +++ b/tests/compiler/integers/u128/shr.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: u128, b: u128, c: u128) -> bool { + return a >> 2u8 == a >> 2u16 && a >> 2u32 == c; +} diff --git a/tests/compiler/integers/u128/xor.leo b/tests/compiler/integers/u128/xor.leo new file mode 100644 index 0000000000..cc67772bbc --- /dev/null +++ b/tests/compiler/integers/u128/xor.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: u128, b: u128, c: u128) -> bool { + return a ^ 2u8 == a ^ 2u16 && a ^ 2u32 == c; +} diff --git a/tests/compiler/integers/u16/and.leo b/tests/compiler/integers/u16/and.leo new file mode 100644 index 0000000000..700dfa2b20 --- /dev/null +++ b/tests/compiler/integers/u16/and.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: u16, b: u16, c: u16) -> bool { + return a & b == c; +} diff --git a/tests/compiler/integers/u16/operator_methods.leo b/tests/compiler/integers/u16/operator_methods.leo new file mode 100644 index 0000000000..fe7f2f4ceb --- /dev/null +++ b/tests/compiler/integers/u16/operator_methods.leo @@ -0,0 +1,55 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: u16, b: u16) -> bool { + // unary + let c: u16 = a.abs(); + let d: u16 = a.abs_wrapped(); + let h: u16 = a.not(); + + // binary + let j: u16 = a.add(b); + let k: u16 = a.add_wrapped(b); + let l: u16 = a.and(b); + let m: u16 = a.div(b); + let n: u16 = a.div_wrapped(b); + let o: bool = a.eq(b); + let p: bool = a.ge(b); + let q: bool = a.gt(b); + let r: bool = a.le(b); + let s: bool = a.lt(b); + let t: u16 = a.mul(b); + let u: u16 = a.mul_wrapped(b); + let w: bool = a.neq(b); + let y: u16 = a.or(b); + let z: u16 = a.pow(2u8); + let aa: u16 = a.pow(b); + let ab: u16 = a.pow(2u32); + let ac: u16 = a.pow_wrapped(2u8); + let ad: u16 = a.pow_wrapped(b); + let ae: u16 = a.pow_wrapped(2u32); + let af: u16 = a.shl(2u8); + let ag: u16 = a.shl(b); + let ah: u16 = a.shl(2u32); + let ai: u16 = a.shl_wrapped(2u8); + let aj: u16 = a.shl_wrapped(b); + let ak: u16 = a.shl_wrapped(2u32); + let al: u16 = a.shr(2u8); + let am: u16 = a.shr(b); + let an: u16 = a.shr(2u32); + let ao: u16 = a.shr_wrapped(2u8); + let ap: u16 = a.shr_wrapped(b); + let aq: u16 = a.shr_wrapped(2u32); + let ar: u16 = a.xor(b); + + return a == b; +} \ No newline at end of file diff --git a/tests/compiler/integers/u16/or.leo b/tests/compiler/integers/u16/or.leo new file mode 100644 index 0000000000..68f3d1a1ce --- /dev/null +++ b/tests/compiler/integers/u16/or.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: u16, b: u16, c: u16) -> bool { + return a | b == c; +} diff --git a/tests/compiler/integers/u16/pow.leo b/tests/compiler/integers/u16/pow.leo index 2613958578..9df044714b 100644 --- a/tests/compiler/integers/u16/pow.leo +++ b/tests/compiler/integers/u16/pow.leo @@ -5,5 +5,5 @@ input_file: inputs/pow.in */ function main(a: u16, b: u16, c: u16) -> bool { - return a ** b == c; + return a ** 2u8 == a ** b && a ** 2u32 == c; } diff --git a/tests/compiler/integers/u16/shl.leo b/tests/compiler/integers/u16/shl.leo new file mode 100644 index 0000000000..01182113cd --- /dev/null +++ b/tests/compiler/integers/u16/shl.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: u16, b: u16, c: u16) -> bool { + return a << 2u8 == a << b && a << 2u32 == c; +} diff --git a/tests/compiler/integers/u16/shr.leo b/tests/compiler/integers/u16/shr.leo new file mode 100644 index 0000000000..e1a3612c8f --- /dev/null +++ b/tests/compiler/integers/u16/shr.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: u16, b: u16, c: u16) -> bool { + return a >> 2u8 == a >> b && a >> 2u32 == c; +} diff --git a/tests/compiler/integers/u16/xor.leo b/tests/compiler/integers/u16/xor.leo new file mode 100644 index 0000000000..b20730e793 --- /dev/null +++ b/tests/compiler/integers/u16/xor.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: u16, b: u16, c: u16) -> bool { + return a ^ 2u8 == a ^ b && a ^ 2u32 == c; +} diff --git a/tests/compiler/integers/u32/and.leo b/tests/compiler/integers/u32/and.leo new file mode 100644 index 0000000000..dbc1bd81ff --- /dev/null +++ b/tests/compiler/integers/u32/and.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: u32, b: u32, c: u32) -> bool { + return a & b == c; +} diff --git a/tests/compiler/integers/u32/operator_methods.leo b/tests/compiler/integers/u32/operator_methods.leo new file mode 100644 index 0000000000..be82efbc70 --- /dev/null +++ b/tests/compiler/integers/u32/operator_methods.leo @@ -0,0 +1,55 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: u32, b: u32) -> bool { + // unary + let c: u32 = a.abs(); + let d: u32 = a.abs_wrapped(); + let h: u32 = a.not(); + + // binary + let j: u32 = a.add(b); + let k: u32 = a.add_wrapped(b); + let l: u32 = a.and(b); + let m: u32 = a.div(b); + let n: u32 = a.div_wrapped(b); + let o: bool = a.eq(b); + let p: bool = a.ge(b); + let q: bool = a.gt(b); + let r: bool = a.le(b); + let s: bool = a.lt(b); + let t: u32 = a.mul(b); + let u: u32 = a.mul_wrapped(b); + let w: bool = a.neq(b); + let y: u32 = a.or(b); + let z: u32 = a.pow(2u8); + let aa: u32 = a.pow(2u16); + let ab: u32 = a.pow(b); + let ac: u32 = a.pow_wrapped(2u8); + let ad: u32 = a.pow_wrapped(2u16); + let ae: u32 = a.pow_wrapped(b); + let af: u32 = a.shl(2u8); + let ag: u32 = a.shl(2u16); + let ah: u32 = a.shl(b); + let ai: u32 = a.shl_wrapped(2u8); + let aj: u32 = a.shl_wrapped(2u16); + let ak: u32 = a.shl_wrapped(b); + let al: u32 = a.shr(2u8); + let am: u32 = a.shr(2u16); + let an: u32 = a.shr(b); + let ao: u32 = a.shr_wrapped(2u8); + let ap: u32 = a.shr_wrapped(2u16); + let aq: u32 = a.shr_wrapped(b); + let ar: u32 = a.xor(b); + + return a == b; +} \ No newline at end of file diff --git a/tests/compiler/integers/u32/or.leo b/tests/compiler/integers/u32/or.leo new file mode 100644 index 0000000000..61000fb572 --- /dev/null +++ b/tests/compiler/integers/u32/or.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: u32, b: u32, c: u32) -> bool { + return a | b == c; +} diff --git a/tests/compiler/integers/u32/pow.leo b/tests/compiler/integers/u32/pow.leo index ee514c8186..b5e7e63a7d 100644 --- a/tests/compiler/integers/u32/pow.leo +++ b/tests/compiler/integers/u32/pow.leo @@ -8,5 +8,5 @@ input_file: inputs/pow.in */ function main(a: u32, b: u32, c: u32) -> bool { - return a ** b == c; + return a ** 2u8 == a ** 2u16 && a ** b == c; } diff --git a/tests/compiler/integers/u32/shl.leo b/tests/compiler/integers/u32/shl.leo new file mode 100644 index 0000000000..be8d53a340 --- /dev/null +++ b/tests/compiler/integers/u32/shl.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: u32, b: u32, c: u32) -> bool { + return a << 2u8 == a << 2u16 && a << b == c; +} diff --git a/tests/compiler/integers/u32/shr.leo b/tests/compiler/integers/u32/shr.leo new file mode 100644 index 0000000000..4d71c793a1 --- /dev/null +++ b/tests/compiler/integers/u32/shr.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: u32, b: u32, c: u32) -> bool { + return a >> 2u8 == a >> 2u16 && a >> b == c; +} diff --git a/tests/compiler/integers/u32/xor.leo b/tests/compiler/integers/u32/xor.leo new file mode 100644 index 0000000000..08aaea24ae --- /dev/null +++ b/tests/compiler/integers/u32/xor.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: u32, b: u32, c: u32) -> bool { + return a ^ 2u8 == a ^ 2u16 && a ^ b == c; +} diff --git a/tests/compiler/integers/u64/and.leo b/tests/compiler/integers/u64/and.leo new file mode 100644 index 0000000000..6949dbd2fb --- /dev/null +++ b/tests/compiler/integers/u64/and.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: u64, b: u64, c: u64) -> bool { + return a & b == c; +} diff --git a/tests/compiler/integers/u64/operator_methods.leo b/tests/compiler/integers/u64/operator_methods.leo new file mode 100644 index 0000000000..e6aa5cc887 --- /dev/null +++ b/tests/compiler/integers/u64/operator_methods.leo @@ -0,0 +1,49 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: u64, b: u64) -> bool { + // unary + let c: u64 = a.abs(); + let d: u64 = a.abs_wrapped(); + let h: u64 = a.not(); + + // binary + let j: u64 = a.add(b); + let k: u64 = a.add_wrapped(b); + let l: u64 = a.and(b); + let m: u64 = a.div(b); + let n: u64 = a.div_wrapped(b); + let o: bool = a.eq(b); + let p: bool = a.ge(b); + let q: bool = a.gt(b); + let r: bool = a.le(b); + let s: bool = a.lt(b); + let t: u64 = a.mul(b); + let u: u64 = a.mul_wrapped(b); + let w: bool = a.neq(b); + let y: u64 = a.or(b); + let z: u64 = a.pow(2u8); + let aa: u64 = a.pow(2u16); + let ab: u64 = a.pow(2u32); + let ac: u64 = a.pow_wrapped(2u8); + let ad: u64 = a.pow_wrapped(2u16); + let ae: u64 = a.pow_wrapped(2u32); + let af: u64 = a.shl(2u8); + let ag: u64 = a.shl(2u16); + let ah: u64 = a.shl(2u32); + let ai: u64 = a.shl_wrapped(2u8); + let aj: u64 = a.shl_wrapped(2u16); + let ak: u64 = a.shl_wrapped(2u32); + let al: u64 = a.shr(2u8); + let am: u64 = a.shr(2u16); + let an: u64 = a.shr(2u32); + let ao: u64 = a.shr_wrapped(2u8); + let ap: u64 = a.shr_wrapped(2u16); + let aq: u64 = a.shr_wrapped(2u32); + let ar: u64 = a.xor(b); + + return a == b; +} \ No newline at end of file diff --git a/tests/compiler/integers/u64/or.leo b/tests/compiler/integers/u64/or.leo new file mode 100644 index 0000000000..e4ac79e056 --- /dev/null +++ b/tests/compiler/integers/u64/or.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: u64, b: u64, c: u64) -> bool { + return a | b == c; +} diff --git a/tests/compiler/integers/u64/pow.leo b/tests/compiler/integers/u64/pow.leo index 0ec120791b..b31d582540 100644 --- a/tests/compiler/integers/u64/pow.leo +++ b/tests/compiler/integers/u64/pow.leo @@ -1,11 +1,11 @@ /* namespace: Compile -expectation: Fail +expectation: Pass input_file: inputs/pow.in # The exponent must be u8, u16, or u32 */ function main(a: u64, b: u64, c: u64) -> bool { - return a ** b == c; + return a ** 2u8 == a ** 2u16 && a ** 2u32 == c; } diff --git a/tests/compiler/integers/u64/shl.leo b/tests/compiler/integers/u64/shl.leo new file mode 100644 index 0000000000..d1b7cdc08d --- /dev/null +++ b/tests/compiler/integers/u64/shl.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: u64, b: u64, c: u64) -> bool { + return a << 2u8 == a << 2u16 && a << 2u32 == c; +} diff --git a/tests/compiler/integers/u64/shr.leo b/tests/compiler/integers/u64/shr.leo new file mode 100644 index 0000000000..e24b0b8e38 --- /dev/null +++ b/tests/compiler/integers/u64/shr.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: u64, b: u64, c: u64) -> bool { + return a >> 2u8 == a >> 2u16 && a >> 2u32 == c; +} diff --git a/tests/compiler/integers/u64/xor.leo b/tests/compiler/integers/u64/xor.leo new file mode 100644 index 0000000000..4aee47abf1 --- /dev/null +++ b/tests/compiler/integers/u64/xor.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: u64, b: u64, c: u64) -> bool { + return a ^ 2u8 == a ^ 2u16 && a ^ 2u32 == c; +} diff --git a/tests/compiler/integers/u8/and.leo b/tests/compiler/integers/u8/and.leo new file mode 100644 index 0000000000..87ccc56348 --- /dev/null +++ b/tests/compiler/integers/u8/and.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: u8, b: u8, c: u8) -> bool { + return a & b == c; +} diff --git a/tests/compiler/integers/u8/operator_methods.leo b/tests/compiler/integers/u8/operator_methods.leo new file mode 100644 index 0000000000..8a67d7c588 --- /dev/null +++ b/tests/compiler/integers/u8/operator_methods.leo @@ -0,0 +1,49 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: u8, b: u8) -> bool { + // unary + let c: u8 = a.abs(); + let d: u8 = a.abs_wrapped(); + let h: u8 = a.not(); + + // binary + let j: u8 = a.add(b); + let k: u8 = a.add_wrapped(b); + let l: u8 = a.and(b); + let m: u8 = a.div(b); + let n: u8 = a.div_wrapped(b); + let o: bool = a.eq(b); + let p: bool = a.ge(b); + let q: bool = a.gt(b); + let r: bool = a.le(b); + let s: bool = a.lt(b); + let t: u8 = a.mul(b); + let u: u8 = a.mul_wrapped(b); + let w: bool = a.neq(b); + let y: u8 = a.or(b); + let z: u8 = a.pow(b); + let aa: u8 = a.pow(2u16); + let ab: u8 = a.pow(2u32); + let ac: u8 = a.pow_wrapped(b); + let ad: u8 = a.pow_wrapped(2u16); + let ae: u8 = a.pow_wrapped(2u32); + let af: u8 = a.shl(b); + let ag: u8 = a.shl(2u16); + let ah: u8 = a.shl(2u32); + let ai: u8 = a.shl_wrapped(b); + let aj: u8 = a.shl_wrapped(2u16); + let ak: u8 = a.shl_wrapped(2u32); + let al: u8 = a.shr(b); + let am: u8 = a.shr(2u16); + let an: u8 = a.shr(2u32); + let ao: u8 = a.shr_wrapped(b); + let ap: u8 = a.shr_wrapped(2u16); + let aq: u8 = a.shr_wrapped(2u32); + let ar: u8 = a.xor(b); + + return a == b; +} \ No newline at end of file diff --git a/tests/compiler/integers/u8/or.leo b/tests/compiler/integers/u8/or.leo new file mode 100644 index 0000000000..0b39175af6 --- /dev/null +++ b/tests/compiler/integers/u8/or.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: u8, b: u8, c: u8) -> bool { + return a | b == c; +} diff --git a/tests/compiler/integers/u8/pow.leo b/tests/compiler/integers/u8/pow.leo index 20581cb74e..dcdd9d19d8 100644 --- a/tests/compiler/integers/u8/pow.leo +++ b/tests/compiler/integers/u8/pow.leo @@ -5,5 +5,5 @@ input_file: inputs/pow.in */ function main(a: u8, b: u8, c: u8) -> bool { - return a ** b == c; + return a ** b == a ** 2u16 && a ** 2u32 == c; } diff --git a/tests/compiler/integers/u8/shl.leo b/tests/compiler/integers/u8/shl.leo new file mode 100644 index 0000000000..48803f2953 --- /dev/null +++ b/tests/compiler/integers/u8/shl.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: u8, b: u8, c: u8) -> bool { + return a << b == a << 2u16 && a << 2u32 == c; +} diff --git a/tests/compiler/integers/u8/shr.leo b/tests/compiler/integers/u8/shr.leo new file mode 100644 index 0000000000..d1071dea17 --- /dev/null +++ b/tests/compiler/integers/u8/shr.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: u8, b: u8, c: u8) -> bool { + return a >> b == a >> 2u16 && a >> 2u32 == c; +} diff --git a/tests/compiler/integers/u8/xor.leo b/tests/compiler/integers/u8/xor.leo new file mode 100644 index 0000000000..eb24068a86 --- /dev/null +++ b/tests/compiler/integers/u8/xor.leo @@ -0,0 +1,9 @@ +/* +namespace: Compile +expectation: Pass +input_file: inputs/add.in +*/ + +function main(a: u8, b: u8, c: u8) -> bool { + return a ^ b == a ^ 2u16 && a ^ 2u32 == c; +} diff --git a/tests/compiler/scalar/operator_methods.leo b/tests/compiler/scalar/operator_methods.leo new file mode 100644 index 0000000000..986d9a2530 --- /dev/null +++ b/tests/compiler/scalar/operator_methods.leo @@ -0,0 +1,24 @@ +/* +namespace: Compile +expectation: Pass +input_file: + - inputs/scalars.in +*/ + +function main(a: scalar, b: scalar) -> bool { + // unary + let i: scalar = a.sqrt(); + + // binary + let j: scalar = a.add(b); + let o: bool = a.eq(b); + let p: bool = a.ge(b); + let q: bool = a.gt(b); + let r: bool = a.le(b); + let s: bool = a.lt(b); + let t: group = 2group.mul(b); + let u: group = a.mul(2group); + let w: bool = a.neq(b); + + return a == b; +} \ No newline at end of file diff --git a/tests/expectations/compiler/compiler/address/binary.out b/tests/expectations/compiler/compiler/address/binary.out new file mode 100644 index 0000000000..26aec21813 --- /dev/null +++ b/tests/expectations/compiler/compiler/address/binary.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: ed65ff9337fc5a00cd28d780a985bcb05de7d0e5fe02b555774984552f0c14e8 + initial_ast: c920b653c76c858673ef791ad9f7b42bd8b70e9ddc2c9bd80c48c531f654334f + symbol_table: b736692dc7bdc91c5a808a20a3965f4c8ed2c46c212696d33fc6dd4cfc9a5844 diff --git a/tests/expectations/compiler/compiler/boolean/operator_methods.out b/tests/expectations/compiler/compiler/boolean/operator_methods.out new file mode 100644 index 0000000000..48f7cbfe07 --- /dev/null +++ b/tests/expectations/compiler/compiler/boolean/operator_methods.out @@ -0,0 +1,11 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: b60204e9191bfb24680632af160fc62316e8b8043c0e3908c157855cc5547eb3 + - initial_input_ast: 023263dbb2c455cbc5507aa39f8de80d8d1dbdce22e979302f29046261206ee4 + - initial_input_ast: a4ec20e71f9401cb0f085770a98cbafb7ca39b4606215cd044ab413790653294 + - initial_input_ast: a90726f08c89ae8eeb4becffd30d13acaa925902d2a29b59842dfc9ee8dc2e3a + initial_ast: b8707d1d3f6c111db2515d4093d15b4739765bfb9e114ed345ebedce0c04024d + symbol_table: e6f7abfd330837d1c643b6b7465c02333b1c895e3e6f624085e8e956ab6e5fe5 diff --git a/tests/expectations/compiler/compiler/core/account/compute_key.out b/tests/expectations/compiler/compiler/core/account/compute_key.out index eca162d447..8f8339579a 100644 --- a/tests/expectations/compiler/compiler/core/account/compute_key.out +++ b/tests/expectations/compiler/compiler/core/account/compute_key.out @@ -1,8 +1,5 @@ --- namespace: Compile -expectation: Pass +expectation: Fail outputs: - - output: - - initial_input_ast: no input - initial_ast: 0d3f6d046e06638ff0a22e142982cc29c349117dcbd722cb6334cd66c2be3219 - symbol_table: 533169a9c16acf0947feb73f24400d339173893e0691d7d6bc262f9a3cc6dcce + - "Error [ETYC0372013]: The type ComputeKey is a reserved core type name.\n --> compiler-test:4:35\n |\n 4 | function main(public compute_key: ComputeKey, a: bool) -> bool {\n | ^^^^^^^^^^\n" diff --git a/tests/expectations/compiler/compiler/core/account/private_key.out b/tests/expectations/compiler/compiler/core/account/private_key.out index 5afbd342f2..a1dd5e85e9 100644 --- a/tests/expectations/compiler/compiler/core/account/private_key.out +++ b/tests/expectations/compiler/compiler/core/account/private_key.out @@ -1,8 +1,5 @@ --- namespace: Compile -expectation: Pass +expectation: Fail outputs: - - output: - - initial_input_ast: no input - initial_ast: c4b937afc608d8a4aeab6a0daba79a66e651237ca6268d0fc4a183092ee8908b - symbol_table: d2e68d11f0c2bacb8e8dc3e2131c8ce8ed3246b2f2798d24666080ae1c8de2bb + - "Error [ETYC0372013]: The type PrivateKey is a reserved core type name.\n --> compiler-test:4:35\n |\n 4 | function main(public private_key: PrivateKey, a: bool) -> bool {\n | ^^^^^^^^^^\n" diff --git a/tests/expectations/compiler/compiler/core/account/record.out b/tests/expectations/compiler/compiler/core/account/record.out index 0d7228b33e..85d7722c8b 100644 --- a/tests/expectations/compiler/compiler/core/account/record.out +++ b/tests/expectations/compiler/compiler/core/account/record.out @@ -1,8 +1,5 @@ --- namespace: Compile -expectation: Pass +expectation: Fail outputs: - - output: - - initial_input_ast: no input - initial_ast: bc3f30018bab5d022864d1e9224600af6a1601e362392831f2df670d28757626 - symbol_table: c97101911c52e7e13511a056edbbfbb45a7460b70d9eb40787790d96e9759881 + - "Error [ETYC0372013]: The type Record is a reserved core type name.\n --> compiler-test:4:30\n |\n 4 | function main(public record: Record, a: bool) -> bool {\n | ^^^^^^\n" diff --git a/tests/expectations/compiler/compiler/core/account/signature.out b/tests/expectations/compiler/compiler/core/account/signature.out index fc9441a654..9a2e59b789 100644 --- a/tests/expectations/compiler/compiler/core/account/signature.out +++ b/tests/expectations/compiler/compiler/core/account/signature.out @@ -1,8 +1,5 @@ --- namespace: Compile -expectation: Pass +expectation: Fail outputs: - - output: - - initial_input_ast: no input - initial_ast: 7e9b3271337d1985002f48c9f6798650414b5bbd2a3f3b3fb6af450568c3261e - symbol_table: 951448c8c85b3ea9013ca01d10acf398b733c871e0283af29493620db422c83e + - "Error [ETYC0372013]: The type Signature is a reserved core type name.\n --> compiler-test:4:33\n |\n 4 | function main(public signature: Signature, a: bool) -> bool {\n | ^^^^^^^^^\n" diff --git a/tests/expectations/compiler/compiler/core/account/view_key.out b/tests/expectations/compiler/compiler/core/account/view_key.out index ea08b4178e..6e4052e5c6 100644 --- a/tests/expectations/compiler/compiler/core/account/view_key.out +++ b/tests/expectations/compiler/compiler/core/account/view_key.out @@ -1,8 +1,5 @@ --- namespace: Compile -expectation: Pass +expectation: Fail outputs: - - output: - - initial_input_ast: no input - initial_ast: ccfb34b6626d3a257fdd09a912ee7ac12550e75f7a14950cc9e1ae3867bc1b12 - symbol_table: 6a2947d1d7af5c250ea9e5f02c70b08143d840377d3f4794bb6e605236d477e5 + - "Error [ETYC0372013]: The type ViewKey is a reserved core type name.\n --> compiler-test:4:32\n |\n 4 | function main(public view_key: ViewKey, a: bool) -> bool {\n | ^^^^^^^\n" diff --git a/tests/expectations/compiler/compiler/core/algorithms/poseidon.out b/tests/expectations/compiler/compiler/core/algorithms/poseidon.out index 57450ece00..ccfdc144da 100644 --- a/tests/expectations/compiler/compiler/core/algorithms/poseidon.out +++ b/tests/expectations/compiler/compiler/core/algorithms/poseidon.out @@ -1,8 +1,5 @@ --- namespace: Compile -expectation: Pass +expectation: Fail outputs: - - output: - - initial_input_ast: no input - initial_ast: ffea1f8b75a3b70278c4a5c44e73229a094f173cedb289425a72222b84ec289d - symbol_table: 60346efb6af3df0487aa077b29387e80e2be0c429e831460100cfea88f9877e6 + - "Error [ETYC0372013]: The type Poseidon is a reserved core type name.\n --> compiler-test:4:32\n |\n 4 | function main(public poseidon: Poseidon, a: bool) -> bool {\n | ^^^^^^^^\n" diff --git a/tests/expectations/compiler/compiler/core/invalid_input_ident_fail.out b/tests/expectations/compiler/compiler/core/invalid_input_ident_fail.out deleted file mode 100644 index f6c5b1b7ef..0000000000 --- a/tests/expectations/compiler/compiler/core/invalid_input_ident_fail.out +++ /dev/null @@ -1,5 +0,0 @@ ---- -namespace: Compile -expectation: Fail -outputs: - - "Error [ETYC0372012]: The type DNE is not a valid built in type.\n --> compiler-test:4:27\n |\n 4 | function main(public dne: DNE, a: bool) -> bool {\n | ^^^\n" diff --git a/tests/expectations/compiler/compiler/field/operator_methods.out b/tests/expectations/compiler/compiler/field/operator_methods.out new file mode 100644 index 0000000000..59c7c82992 --- /dev/null +++ b/tests/expectations/compiler/compiler/field/operator_methods.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: cc78266144cc2fdacfb889d6ba0a50451578e11d8f8efbe820549bdd05aa3472 + initial_ast: dea0c171d2cbdb4349018a625eab2389f91154dc687e8de8f3865c08ba3e90a3 + symbol_table: 73661b66aa63ee7f3124d2df47f0bfa52c9cfe4fae1b25ae2a8a26ff1f6b2a6a diff --git a/tests/expectations/compiler/compiler/function/duplicate_parameter_fail.out b/tests/expectations/compiler/compiler/function/duplicate_parameter_fail.out index 3663d75963..987fc6757d 100644 --- a/tests/expectations/compiler/compiler/function/duplicate_parameter_fail.out +++ b/tests/expectations/compiler/compiler/function/duplicate_parameter_fail.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - "Error [EAST0372015]: variable `a` shadowed by\n --> compiler-test:3:23\n |\n 3 | function main(a: u32, a: u32) -> u32 {\n | ^\n" + - "Error [EAST0372016]: variable `a` shadowed by\n --> compiler-test:3:23\n |\n 3 | function main(a: u32, a: u32) -> u32 {\n | ^\n" diff --git a/tests/expectations/compiler/compiler/function/no_return_fail.out b/tests/expectations/compiler/compiler/function/no_return_fail.out index 5d353c4f04..a58d48cd6f 100644 --- a/tests/expectations/compiler/compiler/function/no_return_fail.out +++ b/tests/expectations/compiler/compiler/function/no_return_fail.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - "Error [ETYC0372013]: The function main has no return statement.\n --> compiler-test:3:1\n |\n 3 | function main() -> u8 {}\n | ^^^^^^^^^^^^^^^^^^^^^^^^\n" + - "Error [ETYC0372014]: The function main has no return statement.\n --> compiler-test:3:1\n |\n 3 | function main() -> u8 {}\n | ^^^^^^^^^^^^^^^^^^^^^^^^\n" diff --git a/tests/expectations/compiler/compiler/group/operator_methods.out b/tests/expectations/compiler/compiler/group/operator_methods.out new file mode 100644 index 0000000000..6632353f38 --- /dev/null +++ b/tests/expectations/compiler/compiler/group/operator_methods.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: 2b6895ba1627e6a4dc444f814e2f6a0134ffdde243017e8dd23009081a15c95b + initial_ast: d454c467150c28dce64eb09e55df07e9467d34ce819e768414e8b101d174ae3b + symbol_table: 3eec749e9dd6f72ae053f0af3753be405331fdf01739a80df8b1a90c03923d27 diff --git a/tests/expectations/compiler/compiler/integers/i128/and.out b/tests/expectations/compiler/compiler/integers/i128/and.out new file mode 100644 index 0000000000..da7a9b40ab --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/i128/and.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: bc7b8f4d7b989dc43d4fd55b9682cc77d2984e841678f57fdf605ff2c168861e + initial_ast: 210dcc0f1e9522a7a7ada3b633f1ce0401f8c53ad0acf3e59f60772b51f35899 + symbol_table: a742e82f32759705a4d3a5c60b8e8301572b7a27ba98cabb65cf62ac928502f0 diff --git a/tests/expectations/compiler/compiler/integers/i128/operator_methods.out b/tests/expectations/compiler/compiler/integers/i128/operator_methods.out new file mode 100644 index 0000000000..7cb0ee2ce8 --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/i128/operator_methods.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: 93ebda249fd3f7ed822b3f8a630b12ee2465ae102ccba3ed821a1a70141c9697 + initial_ast: c869053a16c87e6570f234792e77746cd5e71789c2217ecbc09e9fc5e0322a84 + symbol_table: e0389ea48a5437967637260b107904a13a0def80df3f92f68a7893232ae1d99a diff --git a/tests/expectations/compiler/compiler/integers/i128/or.out b/tests/expectations/compiler/compiler/integers/i128/or.out new file mode 100644 index 0000000000..c24bd0de81 --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/i128/or.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: bc7b8f4d7b989dc43d4fd55b9682cc77d2984e841678f57fdf605ff2c168861e + initial_ast: da3f6e496c8765a7fd3bc91bac882ad9ff142b05b78d437161de77cfa9e93d77 + symbol_table: fe91fa1a007ec9cd5db787e4678cf1aac51c6ac51b6ca6645534abde9273edb4 diff --git a/tests/expectations/compiler/compiler/integers/i128/pow.out b/tests/expectations/compiler/compiler/integers/i128/pow.out new file mode 100644 index 0000000000..8f52288ebf --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/i128/pow.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: 2541083a0309b49344e174e6d28afa2addbd74bd9c8f4a2d3da6bea22d798fda + initial_ast: eaa2b21cde3ee02bbe6401967b4baf77eea6a3d7904441945622762482b1f2f9 + symbol_table: a9b558f0e2976996dd11291b7b0417e89ca69178d2d8e24986ce85017dcd989b diff --git a/tests/expectations/compiler/compiler/integers/i128/pow_fail.out b/tests/expectations/compiler/compiler/integers/i128/pow_fail.out deleted file mode 100644 index f75370206a..0000000000 --- a/tests/expectations/compiler/compiler/integers/i128/pow_fail.out +++ /dev/null @@ -1,5 +0,0 @@ ---- -namespace: Compile -expectation: Fail -outputs: - - "Error [ETYC0372008]: Expected one type from `u8,u16,u32,`, but got `i128`\n --> compiler-test:4:17\n |\n 4 | return a ** b == c;\n | ^\n" diff --git a/tests/expectations/compiler/compiler/integers/i128/shl.out b/tests/expectations/compiler/compiler/integers/i128/shl.out new file mode 100644 index 0000000000..8de0090aad --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/i128/shl.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: f2cac6fc26b770ccf03fdb678a381319df95ce9f5fc5f49fb829fd45d16ba5e5 + initial_ast: ddf5e8442b1734f638a82b4a95b34c515821bd445bcff361d2ccffbddd5df040 + symbol_table: a0949da0c6778c10242222140af0733f59e494055a5dc9b3aa6178ceae66956c diff --git a/tests/expectations/compiler/compiler/integers/i128/shr.out b/tests/expectations/compiler/compiler/integers/i128/shr.out new file mode 100644 index 0000000000..104220fb66 --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/i128/shr.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: f2cac6fc26b770ccf03fdb678a381319df95ce9f5fc5f49fb829fd45d16ba5e5 + initial_ast: 180642efebd46e136e15acc3970cc593fdbf72e7c816a4d5dea72bc611500e16 + symbol_table: 0dd642732eec4756c401a3188bf743b6ad84f7591664c93c560e7b3757cb0b11 diff --git a/tests/expectations/compiler/compiler/integers/i128/xor.out b/tests/expectations/compiler/compiler/integers/i128/xor.out new file mode 100644 index 0000000000..11f25e7f7b --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/i128/xor.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: f014569ea5b8d40f24c94a0fa30a981445b6edeb8a3bac3f8792267a3c5d6f23 + initial_ast: 2b791453ca66ed85ec706be5554436a41fef9f2c52474b413c1edca6414b1b25 + symbol_table: b49663ae6742a54b2adce3f351d27741a069818b5de03c406088b81922898595 diff --git a/tests/expectations/compiler/compiler/integers/i16/and.out b/tests/expectations/compiler/compiler/integers/i16/and.out new file mode 100644 index 0000000000..e128491976 --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/i16/and.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: 8f8a36339feb052e94e5c5d0bc21e9591c972c331794a9b5ce050d66f9e8ac08 + initial_ast: 809452097bde742b77243261863cd9d5b404f9e87f271ff0c3a51d024d7a3277 + symbol_table: bdb224fe4c5a6958985b649494b834a44ca9f6dfa500ff68490a0e710beb63ad diff --git a/tests/expectations/compiler/compiler/integers/i16/operator_methods.out b/tests/expectations/compiler/compiler/integers/i16/operator_methods.out new file mode 100644 index 0000000000..b82e858084 --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/i16/operator_methods.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: 1b57889f4cb20708dae67ca8d03a31ebb1bb64e698a5107d5cbe059676efca70 + initial_ast: 58649ac58b7e5ab9d00a3806bad056e5202bee6f69503accac767c7a6dae620c + symbol_table: da54e87473b2e414e01b8bf38f5fa6bbf77d557299fe79537d8546faff22fa05 diff --git a/tests/expectations/compiler/compiler/integers/i16/or.out b/tests/expectations/compiler/compiler/integers/i16/or.out new file mode 100644 index 0000000000..5740c01bb5 --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/i16/or.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: 8f8a36339feb052e94e5c5d0bc21e9591c972c331794a9b5ce050d66f9e8ac08 + initial_ast: 50e3321589352a7adf53fee57319185cc20f0acaa43282637b79baab19b4f6a8 + symbol_table: 4c080bfc407c55cf4496518c1d2fb958dc9ffbc0cb7d01b9960444c388715f85 diff --git a/tests/expectations/compiler/compiler/integers/i16/pow.out b/tests/expectations/compiler/compiler/integers/i16/pow.out new file mode 100644 index 0000000000..6cf4a39500 --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/i16/pow.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: bd8fd2a123ed9d64e1000b4702a82b198ff7e5ce984edebdb48c5f52f843fea1 + initial_ast: ab20a912c1d1eeed2e7fdfb2e39693b784eb672acd8f1bf658b065e0c00b8931 + symbol_table: 5f363580c69b6f35f4460104e76b74cd57f75f5aa514d81cd8235883f790404c diff --git a/tests/expectations/compiler/compiler/integers/i16/pow_fail.out b/tests/expectations/compiler/compiler/integers/i16/pow_fail.out deleted file mode 100644 index 6a0e90b5a1..0000000000 --- a/tests/expectations/compiler/compiler/integers/i16/pow_fail.out +++ /dev/null @@ -1,5 +0,0 @@ ---- -namespace: Compile -expectation: Fail -outputs: - - "Error [ETYC0372008]: Expected one type from `u8,u16,u32,`, but got `i16`\n --> compiler-test:4:17\n |\n 4 | return a ** b == c;\n | ^\n" diff --git a/tests/expectations/compiler/compiler/integers/i16/shl.out b/tests/expectations/compiler/compiler/integers/i16/shl.out new file mode 100644 index 0000000000..cd530b4999 --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/i16/shl.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: 7423a113e495e28b919d241f3cf0630902e6b5db2dc26a6f64fdcd170d6daea9 + initial_ast: 3e7e67c5d3694252e31dcb3a7673b923cc9609e2dd4266f2f09deee7f5feedad + symbol_table: 5574b67bf196f90fb3e7ce012c4320a543e9830f42b13de6f5e145e0e2b936db diff --git a/tests/expectations/compiler/compiler/integers/i16/shr.out b/tests/expectations/compiler/compiler/integers/i16/shr.out new file mode 100644 index 0000000000..d81f5c8903 --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/i16/shr.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: 7423a113e495e28b919d241f3cf0630902e6b5db2dc26a6f64fdcd170d6daea9 + initial_ast: 858055be50637d9a3db4f8784f0ad09203dc02096cffb33a909c64778646962e + symbol_table: efb3351576d42c09fb29e8c984728fd35ef8984702d7165b0ae3894da819370b diff --git a/tests/expectations/compiler/compiler/integers/i16/xor.out b/tests/expectations/compiler/compiler/integers/i16/xor.out new file mode 100644 index 0000000000..490b9d1054 --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/i16/xor.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: dce56a3bac1ab9f4672d8e43967ee56a1dd6fadf190428661cf70a34012858f5 + initial_ast: 9514a238ed53e679514b2be30e0c62170888431a98bfb9d64ddae8dd73aa52ec + symbol_table: c2db740a844a64e84fadd06da77a78f0982571524f6840ef904d11c41fe2e4ee diff --git a/tests/expectations/compiler/compiler/integers/i32/and.out b/tests/expectations/compiler/compiler/integers/i32/and.out new file mode 100644 index 0000000000..8b7f7485f4 --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/i32/and.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: eb41a21f5a0b0cea9589243a858fdc66f91774a1e30f9769384c5ffcc82d3748 + initial_ast: 58eae139e14d45468ac3f8aa2de8eebec731aca1649fb9249ac572f0400c9f4b + symbol_table: 5945590d46e7452c54d441148a22fd5ee8cf29b01a147c0b9483e0c4d5c322fe diff --git a/tests/expectations/compiler/compiler/integers/i32/operator_methods.out b/tests/expectations/compiler/compiler/integers/i32/operator_methods.out new file mode 100644 index 0000000000..e8c7321f4a --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/i32/operator_methods.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: 186316438d6152e5b5317511eaea7cb31bc7e361c6a9451a737f0f19a5b20854 + initial_ast: 541b3d8ea7ab6663ea5ab4e5a9b902224a6e1bdd899ed502d775879b1140a6a5 + symbol_table: a353733198faed7b411c2eda3d359c1b00e6a5ef7c3790bd75639acaced6a43d diff --git a/tests/expectations/compiler/compiler/integers/i32/or.out b/tests/expectations/compiler/compiler/integers/i32/or.out new file mode 100644 index 0000000000..4d327f611a --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/i32/or.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: eb41a21f5a0b0cea9589243a858fdc66f91774a1e30f9769384c5ffcc82d3748 + initial_ast: b4cb63dabed4bfc41eef6b18928a7daa040c785a7b492322b71d88262a6277a5 + symbol_table: 59b8df1d2b1c065535bb67a608b3b7eceed7a2491a7451bbe1c2177fb71f072b diff --git a/tests/expectations/compiler/compiler/integers/i32/pow.out b/tests/expectations/compiler/compiler/integers/i32/pow.out new file mode 100644 index 0000000000..c5b6e032d1 --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/i32/pow.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: a3d1612ebb16aed1d40ebaa5def6be231d1f583569276d2ae1420531cbbe44fa + initial_ast: 013bdabaae4935bf41ec4dfbe15a895de9b0d3cb3440fe52e94a2c49ece728ba + symbol_table: 83972ea7ed0bfd3b836c5b53798fbc7c6d404e1121bd40a7db08f059a8e7d915 diff --git a/tests/expectations/compiler/compiler/integers/i32/pow_fail.out b/tests/expectations/compiler/compiler/integers/i32/pow_fail.out deleted file mode 100644 index b5ed1e71b0..0000000000 --- a/tests/expectations/compiler/compiler/integers/i32/pow_fail.out +++ /dev/null @@ -1,5 +0,0 @@ ---- -namespace: Compile -expectation: Fail -outputs: - - "Error [ETYC0372008]: Expected one type from `u8,u16,u32,`, but got `i32`\n --> compiler-test:4:17\n |\n 4 | return a ** b == c;\n | ^\n" diff --git a/tests/expectations/compiler/compiler/integers/i32/shl.out b/tests/expectations/compiler/compiler/integers/i32/shl.out new file mode 100644 index 0000000000..31e7e3dcaf --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/i32/shl.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: 100d7f81cba1cd3165089581885d76633e0022383d45da966eb2386c195c8a2a + initial_ast: 2e55a2aebc1c19e7007d531e8e92881a0dbe33188b99ed9fa23e65eb1436d918 + symbol_table: 607cd600389cd0202baa01e0998904f44134d7db10f64bd52ae584a11dddb83d diff --git a/tests/expectations/compiler/compiler/integers/i32/shr.out b/tests/expectations/compiler/compiler/integers/i32/shr.out new file mode 100644 index 0000000000..49c410844b --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/i32/shr.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: 100d7f81cba1cd3165089581885d76633e0022383d45da966eb2386c195c8a2a + initial_ast: d9722b441e605c96ca960551602f0161c57d7ffd1e2c89b6e7291c8bfc847ae8 + symbol_table: 62eec7410246d20c43271d5ba0c2031d0b08de9540ea4c3f159c5f26ad96b190 diff --git a/tests/expectations/compiler/compiler/integers/i32/xor.out b/tests/expectations/compiler/compiler/integers/i32/xor.out new file mode 100644 index 0000000000..106baa54e3 --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/i32/xor.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: 15c7eaf593e6f0ac457dad948ba56c0c089685597763659745ee49a496554a12 + initial_ast: c91d94532b5fb331d581fee3b370007c38714c9886555278d797f030a0acdb69 + symbol_table: 58d9e8a43638ca94e50faef51a13093beefe5de977bf76d703b3e1d8e7e758a2 diff --git a/tests/expectations/compiler/compiler/integers/i64/and.out b/tests/expectations/compiler/compiler/integers/i64/and.out new file mode 100644 index 0000000000..ff4a58c4a6 --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/i64/and.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: 6e966811e2bf235a62319227398ea147c7a5f92fbbf2bee2393d245e6567d269 + initial_ast: e1fb9bd3be54e70a0856609f8843c639bd83cd4d8abda812d3b2fb229582fb2f + symbol_table: d423b9dc3ebe537a9188ce0da8d0c596bfb17824230173e9803e7a91948ea613 diff --git a/tests/expectations/compiler/compiler/integers/i64/operator_methods.out b/tests/expectations/compiler/compiler/integers/i64/operator_methods.out new file mode 100644 index 0000000000..b5109991bf --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/i64/operator_methods.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: ec07a11fc89aaf21ce5b3f20e09a8930bbf68114a1e89862e6f8d7ed34e5fff8 + initial_ast: 04adb5eb78c8097b4bafe37b79f9797219aeaa9d248c8a9defdb3c4b91f80a4f + symbol_table: 0c204022097d753b6f6d7f8eec9ae1f694f31460aca6879c44bfba2f8a1768c3 diff --git a/tests/expectations/compiler/compiler/integers/i64/or.out b/tests/expectations/compiler/compiler/integers/i64/or.out new file mode 100644 index 0000000000..ba152fa447 --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/i64/or.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: 6e966811e2bf235a62319227398ea147c7a5f92fbbf2bee2393d245e6567d269 + initial_ast: c64fc87cc51f5307039246c26df461e6cb7e5d0a656f30bfdbce8fb4333dac87 + symbol_table: ec1f05e4e4537931602996337765e494f0d466ac049d4ed7b475c5fa2ad2b978 diff --git a/tests/expectations/compiler/compiler/integers/i64/pow.out b/tests/expectations/compiler/compiler/integers/i64/pow.out new file mode 100644 index 0000000000..135092c250 --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/i64/pow.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: 730ab4f25d09c3da598f4f1c1aa07b674ab0457bc05164ac9e6633b249f97e72 + initial_ast: c34c7e1ecf01ce3f6d931783a65cff12f43dc2d28a067a706b3bbd43f6248d72 + symbol_table: 69ea41f99bf6d0d9f5cce394165ac417c9be15e48e398fd8a4d2d096ad517dc8 diff --git a/tests/expectations/compiler/compiler/integers/i64/pow_fail.out b/tests/expectations/compiler/compiler/integers/i64/pow_fail.out deleted file mode 100644 index 6f6365b32c..0000000000 --- a/tests/expectations/compiler/compiler/integers/i64/pow_fail.out +++ /dev/null @@ -1,5 +0,0 @@ ---- -namespace: Compile -expectation: Fail -outputs: - - "Error [ETYC0372008]: Expected one type from `u8,u16,u32,`, but got `i64`\n --> compiler-test:4:17\n |\n 4 | return a ** b == c;\n | ^\n" diff --git a/tests/expectations/compiler/compiler/integers/i64/shl.out b/tests/expectations/compiler/compiler/integers/i64/shl.out new file mode 100644 index 0000000000..8509845589 --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/i64/shl.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: bc5acd37d5e0906b2d82691064f8e57584f8fbdd2594e112bb6a819856383320 + initial_ast: 5597ef43b299151d520e440815761ca306e10cfbdc766b0fc5f3160ddabdddaf + symbol_table: 4754d412e2e5773a714d1f940a2ac6d8bf11839dd42841fbd2d5e6d1155e6506 diff --git a/tests/expectations/compiler/compiler/integers/i64/shr.out b/tests/expectations/compiler/compiler/integers/i64/shr.out new file mode 100644 index 0000000000..4213c81985 --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/i64/shr.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: bc5acd37d5e0906b2d82691064f8e57584f8fbdd2594e112bb6a819856383320 + initial_ast: 53c00ade08df81895433acc31edd195b50848c46758a2d9275fcbc6ea373786c + symbol_table: 830c2a358e1b256afc5295b5145311b952811103ce18e402b6f171165317ee8a diff --git a/tests/expectations/compiler/compiler/integers/i64/xor.out b/tests/expectations/compiler/compiler/integers/i64/xor.out new file mode 100644 index 0000000000..36593d2c8b --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/i64/xor.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: 199be3d1b8ce7041809cb1c7e64ef28373855e97d82671ac3cd95c6323995586 + initial_ast: 39b4acc71e412b470bce7ad9e4288723599edb2832732fa465039a294bf19ec2 + symbol_table: 313c0f810508fdc05ed5b1a9c75ff06b932a71f64fd7887200b81c3c687afb70 diff --git a/tests/expectations/compiler/compiler/integers/i8/and.out b/tests/expectations/compiler/compiler/integers/i8/and.out new file mode 100644 index 0000000000..9369c285ec --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/i8/and.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: 0a6f670f5dabbe16296ccdfb83366c2ae59432059003c64d1e6141e658f49cc3 + initial_ast: 22143f41f383a6b56f36b26ea4bf59a204dd083cd7ba7746ae6089b68b506cbb + symbol_table: b2781521776404f87ded730bffe858f59999b1bb841aef2e67f88a4ff9414ca5 diff --git a/tests/expectations/compiler/compiler/integers/i8/operator_methods.out b/tests/expectations/compiler/compiler/integers/i8/operator_methods.out new file mode 100644 index 0000000000..85f292a9f4 --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/i8/operator_methods.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: dc5f7cab0e9f520e9ea0fe03e2aca2c5bb93589dc8acf7a41b468381ac66b654 + initial_ast: 9e25ce5233f6ccf3ed7841cacbcb7d830b6d64748deb8c966e916e01f799e471 + symbol_table: 0b2ad811cdc7addac91c0f2845d19511860654c574be056b914e63401a1ca1f0 diff --git a/tests/expectations/compiler/compiler/integers/i8/or.out b/tests/expectations/compiler/compiler/integers/i8/or.out new file mode 100644 index 0000000000..1b7cb32c5a --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/i8/or.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: 0a6f670f5dabbe16296ccdfb83366c2ae59432059003c64d1e6141e658f49cc3 + initial_ast: 18cfbf8e9f363d7477ee0c7509fd909c7f4929ffa2b4c2f46113d85c0f2b481d + symbol_table: 5266cce1cdf8224771fcdd2e36dfadd30d9f3f5bc9722db2316670a5ed83b0b1 diff --git a/tests/expectations/compiler/compiler/integers/i8/pow.out b/tests/expectations/compiler/compiler/integers/i8/pow.out new file mode 100644 index 0000000000..4eeb141f41 --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/i8/pow.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: 413e126974e63dfec28e4f1ec6071bd29d474f07c7a405230808acd58eda96a7 + initial_ast: f5b76f3e30f823f7665bd5f23d839137f0c268beb542c4d1d5296c5b3a7a7f6a + symbol_table: 9c77abb7b704660e85bd78e304db4d62efb80051fbd4e07c5a8afd72ddec24b4 diff --git a/tests/expectations/compiler/compiler/integers/i8/pow_fail.out b/tests/expectations/compiler/compiler/integers/i8/pow_fail.out deleted file mode 100644 index 31cf3f2682..0000000000 --- a/tests/expectations/compiler/compiler/integers/i8/pow_fail.out +++ /dev/null @@ -1,5 +0,0 @@ ---- -namespace: Compile -expectation: Fail -outputs: - - "Error [ETYC0372008]: Expected one type from `u8,u16,u32,`, but got `i8`\n --> compiler-test:4:17\n |\n 4 | return a ** b == c;\n | ^\n" diff --git a/tests/expectations/compiler/compiler/integers/i8/shl.out b/tests/expectations/compiler/compiler/integers/i8/shl.out new file mode 100644 index 0000000000..c97a6f4e60 --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/i8/shl.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: 49cd0987e4ab36528e5152adaca808575cdb2402dc21c50356d949738870b530 + initial_ast: 38bcd35d40169c9d0ca63f233109ed621d187e3cce5e907dc934b781e8c9c692 + symbol_table: 25693a7adb577f7419c27015fb097fc96fe95f71762343d9e8d7053422973a3e diff --git a/tests/expectations/compiler/compiler/integers/i8/shr.out b/tests/expectations/compiler/compiler/integers/i8/shr.out new file mode 100644 index 0000000000..aedaea0b8d --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/i8/shr.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: 49cd0987e4ab36528e5152adaca808575cdb2402dc21c50356d949738870b530 + initial_ast: a1ae97a033a61be26e9daf1825a3687a504a41377944b135ca9bbd2838680763 + symbol_table: 33aea3edb28878ab9a2a87d0c534e7b8d89492d1f142321fa1b6d3aa089e075f diff --git a/tests/expectations/compiler/compiler/integers/i8/xor.out b/tests/expectations/compiler/compiler/integers/i8/xor.out new file mode 100644 index 0000000000..210499d1e7 --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/i8/xor.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: b4d08a13171c39f38e23d189530dcc25f769e097b226f48af75b7e8e86e6a228 + initial_ast: c8178b78bafab09fa6e45faa931459431b730c0e03008f5317a7050a6a6b2de0 + symbol_table: 76e82cf351d3ca832c6a4feee4df18b1c01d445d5fd727f317199ea7e2cd172f diff --git a/tests/expectations/compiler/compiler/integers/u128/and.out b/tests/expectations/compiler/compiler/integers/u128/and.out new file mode 100644 index 0000000000..8d0c90854d --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/u128/and.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: bd72282f194aa1e65c9cdbd5d50e314383be002be40a8254a9c5c1a798f2d159 + initial_ast: d09e17e06ecf81563bcf4cd91f0b1ff31683f7e76717aa9dbae3a38b6b0093cc + symbol_table: 8633b857bc63a9594822c85c3059ef6a3549c714292105afab1fd5bacc037704 diff --git a/tests/expectations/compiler/compiler/integers/u128/operator_methods.out b/tests/expectations/compiler/compiler/integers/u128/operator_methods.out new file mode 100644 index 0000000000..03c38c522c --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/u128/operator_methods.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: b6f2382216bfe7949ee0ed790a48e75981e34b55b43b52eac985b69cd4ec35e5 + initial_ast: ea651fe0a2f671f1ad00d0ba1adc137983c9b1d9ca33f5e6b76c039e973ab9b2 + symbol_table: 01cf24571bc1891336e94dab4d156b21b33dcf4e7dbb74cbb12f059cf4a442ae diff --git a/tests/expectations/compiler/compiler/integers/u128/or.out b/tests/expectations/compiler/compiler/integers/u128/or.out new file mode 100644 index 0000000000..a7df731660 --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/u128/or.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: bd72282f194aa1e65c9cdbd5d50e314383be002be40a8254a9c5c1a798f2d159 + initial_ast: 6532d8f436c711698a26f08331718f5cb61dfe1e3d41120d91b4039a5b7db683 + symbol_table: c8842d9700fabf587fd28f5019bae7e5abf4e75bebeb57cdde89c43cb795da4a diff --git a/tests/expectations/compiler/compiler/integers/u128/pow.out b/tests/expectations/compiler/compiler/integers/u128/pow.out index 6d152e6fc4..671ba5ffca 100644 --- a/tests/expectations/compiler/compiler/integers/u128/pow.out +++ b/tests/expectations/compiler/compiler/integers/u128/pow.out @@ -1,5 +1,8 @@ --- namespace: Compile -expectation: Fail +expectation: Pass outputs: - - "Error [ETYC0372008]: Expected one type from `u8,u16,u32,`, but got `u128`\n --> compiler-test:4:17\n |\n 4 | return a ** b == c;\n | ^\n" + - output: + - initial_input_ast: no input + initial_ast: 4f2b576858996601c710fa81eaae1663e0b507a6721708c15051b6a4dfc7d150 + symbol_table: 3369bb224fc76977901bd0c162932d08760213d30a0f1ccdf06fd25c45610ade diff --git a/tests/expectations/compiler/compiler/integers/u128/shl.out b/tests/expectations/compiler/compiler/integers/u128/shl.out new file mode 100644 index 0000000000..bee056cc7e --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/u128/shl.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: c6de099f1f55a87c32ef691862a36dcefe3351e6dc68b590265c37beaf65a681 + initial_ast: 911517a9c54745f3085c9f28bb96910bf1b0c726ca1c233b097fe34ac31f316f + symbol_table: 08a662c9b3bb0ca82bc79e01a43ac513e20b86c32051d8b14af5a715602f91d0 diff --git a/tests/expectations/compiler/compiler/integers/u128/shr.out b/tests/expectations/compiler/compiler/integers/u128/shr.out new file mode 100644 index 0000000000..573e01fe34 --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/u128/shr.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: c6de099f1f55a87c32ef691862a36dcefe3351e6dc68b590265c37beaf65a681 + initial_ast: 75667fbd5d85a72eff17f1a8936367350a572472c8cb31deaa8199eab96cb347 + symbol_table: 2e776b56f9f9d121e5a78ae302c8990b1862c59a893d2302559673ca2f9a1abd diff --git a/tests/expectations/compiler/compiler/integers/u128/xor.out b/tests/expectations/compiler/compiler/integers/u128/xor.out new file mode 100644 index 0000000000..ac8f542c9e --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/u128/xor.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: 6a9074c22d78138bf25ec1dd3e06de3570f0c0c8eddf07a1d3efb77d19cb8780 + initial_ast: 962b44d83c680a5b4e71b5e4d05b8c93f0a87ff58cbea8054df9681ea4d5cd92 + symbol_table: 7b8962271b265ff5b02b7fe8b0dbd12f483911779de605258ad1f31b56c56810 diff --git a/tests/expectations/compiler/compiler/integers/u16/and.out b/tests/expectations/compiler/compiler/integers/u16/and.out new file mode 100644 index 0000000000..f10a10aee2 --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/u16/and.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: 2c4fbe74ef1df386b47eaf5b4718c33fc6702684839494bec4c37df973c8842b + initial_ast: 520b6831317851ecf843501a2d1424b63829404ea50b0318b96045fda54bef1c + symbol_table: 26a3b1e6e09b0ddd05be6ce9c92593f6721faaced757eb395fd0923516c652c4 diff --git a/tests/expectations/compiler/compiler/integers/u16/operator_methods.out b/tests/expectations/compiler/compiler/integers/u16/operator_methods.out new file mode 100644 index 0000000000..e5a69c00f7 --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/u16/operator_methods.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: 83cfba0c6e80aa0128aec20775c00686bfee37bb64b7c6d5f19214f4b8c85632 + initial_ast: 7e11815e825f7d9c42bbcd284c31bf107db00fad576d8641b2b35304931d6358 + symbol_table: f6cda1bd2ed32fa4f2b4e5d7a825ff8e5ecc67170c280952a5e196316caa75d5 diff --git a/tests/expectations/compiler/compiler/integers/u16/or.out b/tests/expectations/compiler/compiler/integers/u16/or.out new file mode 100644 index 0000000000..bcc7c9d067 --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/u16/or.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: 2c4fbe74ef1df386b47eaf5b4718c33fc6702684839494bec4c37df973c8842b + initial_ast: b4885ba3ede33a33d77dd109dadd3eeedb830964f2c2be6342e1181b7a91642c + symbol_table: 5c0ca24cef788d1986846c082bb05fe137660e3d0886fa56a6bbcef6f9c5adbe diff --git a/tests/expectations/compiler/compiler/integers/u16/pow.out b/tests/expectations/compiler/compiler/integers/u16/pow.out index fa5d8fede9..66fc34137d 100644 --- a/tests/expectations/compiler/compiler/integers/u16/pow.out +++ b/tests/expectations/compiler/compiler/integers/u16/pow.out @@ -3,6 +3,6 @@ namespace: Compile expectation: Pass outputs: - output: - - initial_input_ast: 0fc24d373b31b114b4798569c7cc9312cb7978ebb6520b4d1b53cd6e379ddca3 - initial_ast: adff33d9b32d6ae4f6bef29637b0b20e6d85aa52d15d88f148032e044e14f7fc - symbol_table: 395e10aaca24280476a805c4d4160422e77a230b3679ac74465fee5ffdd1a080 + - initial_input_ast: 11821573c2c3f78e4a668ea098194ea4d73d7ab2cb8dc7fdf4c873db61889c35 + initial_ast: 0451103c76b3f89c45e2732f4c56cebd3d7b6ea7a0ddda878ed8b8fe888a82f0 + symbol_table: 768253f26147ac3a4f966c3264e1ce2c82170f332d5933f479a3fbbaace09ccf diff --git a/tests/expectations/compiler/compiler/integers/u16/shl.out b/tests/expectations/compiler/compiler/integers/u16/shl.out new file mode 100644 index 0000000000..d4e9e22be4 --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/u16/shl.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: 892045a2f7dfa644eb11f85e012f6192d858b6b617d6456c9f797839123e1588 + initial_ast: b49560259f0bdf45a13ca0b1619428c2e00cc5196cef0cb91bbd691ed06cbe5f + symbol_table: e1d220cecf6e52f6d651bd26f9894a629d820aec555cf867610da5d80da9525c diff --git a/tests/expectations/compiler/compiler/integers/u16/shr.out b/tests/expectations/compiler/compiler/integers/u16/shr.out new file mode 100644 index 0000000000..2939205f11 --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/u16/shr.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: 892045a2f7dfa644eb11f85e012f6192d858b6b617d6456c9f797839123e1588 + initial_ast: 21f74e9b3fd57b2223e631e9089b0e0879ba2ab7af08815bcc1e9e5b91f866c7 + symbol_table: ddc0f90ff6ea32630dd3916ad8169767379c75677a54210c48efae577e59490e diff --git a/tests/expectations/compiler/compiler/integers/u16/xor.out b/tests/expectations/compiler/compiler/integers/u16/xor.out new file mode 100644 index 0000000000..6462434611 --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/u16/xor.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: 9cd6034cb366bcd4b071a0b2da8f17c1a831331763e8b12f8e26d2cc48a3efaa + initial_ast: 9005288983e3789578671a592827412a815cbccd10644d71619352acfe027537 + symbol_table: 709b12a2dedc742eb14c7e6b612970af873982c55e0bd4e840932f662ca1b120 diff --git a/tests/expectations/compiler/compiler/integers/u32/and.out b/tests/expectations/compiler/compiler/integers/u32/and.out new file mode 100644 index 0000000000..cd0357ffba --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/u32/and.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: 5a66314f73ac7bda280528133158cf040e9c4c49628ddf12007cc03a1bb2be53 + initial_ast: daa2a43799f16cb796d6b97c170c600e42b550ac37a9494edc30b52612843358 + symbol_table: 3342cc5fa728477225d5c52b0c8279b13aac977506fbfddb8bb16536f0114751 diff --git a/tests/expectations/compiler/compiler/integers/u32/operator_methods.out b/tests/expectations/compiler/compiler/integers/u32/operator_methods.out new file mode 100644 index 0000000000..c15c4a208a --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/u32/operator_methods.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: 4b30218dff8ce730a3955c1ba3a64ec83669d0751b72b9f9b89ceb4be579cd85 + initial_ast: 2bfa21b756691e051e9e194c7ffd5b51856becd7b43d3b21c8ad2558aae88e07 + symbol_table: f74952bad4f239a84e310ae0aa3f5bfddf2697387cd0b361b7cafae68bd25745 diff --git a/tests/expectations/compiler/compiler/integers/u32/or.out b/tests/expectations/compiler/compiler/integers/u32/or.out new file mode 100644 index 0000000000..21aeba5fb9 --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/u32/or.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: 5a66314f73ac7bda280528133158cf040e9c4c49628ddf12007cc03a1bb2be53 + initial_ast: 135d3a6df58371792424ff8dc87d24b7938aef33f4e13cb016a39de0c9aba20f + symbol_table: 7316cf87c3e4cd5d44d718539c5157363ad2660b240f622e7822d46b9914f408 diff --git a/tests/expectations/compiler/compiler/integers/u32/pow.out b/tests/expectations/compiler/compiler/integers/u32/pow.out index f9422fcfeb..2ca208e77e 100644 --- a/tests/expectations/compiler/compiler/integers/u32/pow.out +++ b/tests/expectations/compiler/compiler/integers/u32/pow.out @@ -3,6 +3,6 @@ namespace: Compile expectation: Pass outputs: - output: - - initial_input_ast: f9febc6a7e8f4c36c6878e06f30eb30808f02ab434ea7dc520407bb15eb8c37b - initial_ast: ffe1c1283a61572b6f31aa59f827f814df7a88e8d1811a20c30a044ef2471878 - symbol_table: 6bc8cb105449c94886d662abced73603cdd16e838f664617e826dcd607726807 + - initial_input_ast: 74c6b3574ec41bf0cee6aa84237e9ab7d7d48cef9345633b90a6a20fcbaa7706 + initial_ast: 48ff8ad86e8110a064a013622635627e6c8350201c0246dc21c6c9b8d62a8ee7 + symbol_table: de3c502b4c82d434663028637ad0351867b493e3e7e956dba308cc190ba0611a diff --git a/tests/expectations/compiler/compiler/integers/u32/shl.out b/tests/expectations/compiler/compiler/integers/u32/shl.out new file mode 100644 index 0000000000..081561abbf --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/u32/shl.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: aea5931cda1ca223b2ed0310d9e244cbd327aa5c9d6ddbacbc0358931653deb1 + initial_ast: 4eb3b7b964b344e73953066f4e193076c989465d743eb7d667f832fea7e1b928 + symbol_table: fb3d46fc3d95e6bce11f9a9d750413003af5be754309e7815c09c812daa84041 diff --git a/tests/expectations/compiler/compiler/integers/u32/shr.out b/tests/expectations/compiler/compiler/integers/u32/shr.out new file mode 100644 index 0000000000..d3f85b8265 --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/u32/shr.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: aea5931cda1ca223b2ed0310d9e244cbd327aa5c9d6ddbacbc0358931653deb1 + initial_ast: 3ac36286953e0c69e5d6351ddc0c0cdd1a159a00860e5714d7b7c8d433ca02ea + symbol_table: 4314d90f85efdfdd0a99a45b775f6b032a4872bd2f02501a1a71f5f531c827e9 diff --git a/tests/expectations/compiler/compiler/integers/u32/xor.out b/tests/expectations/compiler/compiler/integers/u32/xor.out new file mode 100644 index 0000000000..6167ade665 --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/u32/xor.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: a58c9810088fa26dd3148dee70773f791e9c381060df3886495fd15853f8af82 + initial_ast: 3907b37d74cb37fa419f282a4a94c4e4a19493ffdfd7cd6ba39d5c794d36531d + symbol_table: c835424abfefaf8edb53c1b6f7d136300eb8b931a185655cb218cdacf8ff5e0b diff --git a/tests/expectations/compiler/compiler/integers/u64/and.out b/tests/expectations/compiler/compiler/integers/u64/and.out new file mode 100644 index 0000000000..5330c40200 --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/u64/and.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: d93ab26059e10b206e200fd34ec7df2c003ae0d456f7cc1cc4c7dcc55584b789 + initial_ast: 17d5fbf0845373e1b8b4dad54571cfc95015715414cb1b11e89ec0b3e2e2116d + symbol_table: 32c1bbb7840d0c5c96608bc6dd048086efce8887e9461e17c0ffc98fde7c9e55 diff --git a/tests/expectations/compiler/compiler/integers/u64/operator_methods.out b/tests/expectations/compiler/compiler/integers/u64/operator_methods.out new file mode 100644 index 0000000000..ad29772998 --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/u64/operator_methods.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: bfd5a3bd075cda5c6ebcd6e2708e693f90813cf9103a06a680c12a217c479759 + initial_ast: 1f1f0469d03ac4917e1e0c17b5f5b50a4141d41d839b8bf689522713abb578f2 + symbol_table: 14bda17d4237b8c0afa6b368d2785403283400c324010b97794745b6225d426f diff --git a/tests/expectations/compiler/compiler/integers/u64/or.out b/tests/expectations/compiler/compiler/integers/u64/or.out new file mode 100644 index 0000000000..1ead01090e --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/u64/or.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: d93ab26059e10b206e200fd34ec7df2c003ae0d456f7cc1cc4c7dcc55584b789 + initial_ast: f9763d0d8b774b35e807316ae6dd33dbe858881d7e4c45f80d05639c4c0c46bb + symbol_table: 3d9bd800d0eeb02a21244f25c48d2e02c67853888ddb7bc13e7c47b368026375 diff --git a/tests/expectations/compiler/compiler/integers/u64/pow.out b/tests/expectations/compiler/compiler/integers/u64/pow.out index 7f2d42bcda..9b87531317 100644 --- a/tests/expectations/compiler/compiler/integers/u64/pow.out +++ b/tests/expectations/compiler/compiler/integers/u64/pow.out @@ -1,5 +1,8 @@ --- namespace: Compile -expectation: Fail +expectation: Pass outputs: - - "Error [ETYC0372008]: Expected one type from `u8,u16,u32,`, but got `u64`\n --> compiler-test:4:17\n |\n 4 | return a ** b == c;\n | ^\n" + - output: + - initial_input_ast: 626806a8e0a363efa01ae3e2741fb4b7576e6b1ded5604c757db258e4b12c875 + initial_ast: 70bb12884894eaa2a8064fbfbe56f75675d41353be7e530c09ad9acc719f3bee + symbol_table: 9840b73b2785a5a0d6322b8d207d8f3d4880513273154bfe32889e4a3768e959 diff --git a/tests/expectations/compiler/compiler/integers/u64/shl.out b/tests/expectations/compiler/compiler/integers/u64/shl.out new file mode 100644 index 0000000000..8cf030f7e9 --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/u64/shl.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: d6755d17963b368f9579dff7fec94bd36c378dbe6a2e470eed1a3c23d66cb519 + initial_ast: 79dde7ec4b79d58718beccb64f959b933f9cd27857fceeacec084ca16f87b5e8 + symbol_table: f4fc8f466567de01cd926560fdd1a26ec1ddf5d280126336bf029d999966ff7b diff --git a/tests/expectations/compiler/compiler/integers/u64/shr.out b/tests/expectations/compiler/compiler/integers/u64/shr.out new file mode 100644 index 0000000000..e7eece75f7 --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/u64/shr.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: d6755d17963b368f9579dff7fec94bd36c378dbe6a2e470eed1a3c23d66cb519 + initial_ast: 7973b80d2ab399e9a1941cb6e23620dafccda3a041c999e2f8a6e5dfe83713db + symbol_table: 9efa7be40daba50719633d0ec23d04b63afa10f24b0bbd864309396a5d86a9bd diff --git a/tests/expectations/compiler/compiler/integers/u64/xor.out b/tests/expectations/compiler/compiler/integers/u64/xor.out new file mode 100644 index 0000000000..949f22558e --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/u64/xor.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: 476a5f9d30b511236eea315ffc91836830f65190e6aec58911e1f21d67becdc8 + initial_ast: 5e733c23b4b959a6de4341c85f413c773a4a70eff38c9b2824cf1c746d067d22 + symbol_table: 73c4f0bf85a47b6bcef8d0c21de8614fc5099721e37af3a4b2f671b60076b9a5 diff --git a/tests/expectations/compiler/compiler/integers/u8/and.out b/tests/expectations/compiler/compiler/integers/u8/and.out new file mode 100644 index 0000000000..ed07ab8a67 --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/u8/and.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: abd4649ea1f9d2960c57f7fb8642eb89a379d26391180e415c4bd696fc6f734a + initial_ast: 988ae827a3cfcadeb7c89bf40a4c2c37f78ed97fe9e76dfb3aa74270f056b8ea + symbol_table: e5594ea4ca289b1917552239e0d1525a22397275f07add8f2aa838af53605360 diff --git a/tests/expectations/compiler/compiler/integers/u8/operator_methods.out b/tests/expectations/compiler/compiler/integers/u8/operator_methods.out new file mode 100644 index 0000000000..d65def21a2 --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/u8/operator_methods.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: 100e24373d817ea339956a770ab5baacdb9b31d7083b352b788814984e915541 + initial_ast: fc43de032e99caf141920dc04e3ca63e4b5b80c144c8a8ce9ec0e540d01a1f65 + symbol_table: 5b479875161904828d1f2e82199b9f8e9f389ba36911dcddcdec2dec0362d73f diff --git a/tests/expectations/compiler/compiler/integers/u8/or.out b/tests/expectations/compiler/compiler/integers/u8/or.out new file mode 100644 index 0000000000..7440af35de --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/u8/or.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: abd4649ea1f9d2960c57f7fb8642eb89a379d26391180e415c4bd696fc6f734a + initial_ast: a45e30bb089e822608fa0c82be0139e781161e182dfe0e526b5d3aa4f74fb3e6 + symbol_table: fb02db931f2fd4691a2266919cd4c8d7be076334ce1fe8feefd160d6754b4c48 diff --git a/tests/expectations/compiler/compiler/integers/u8/pow.out b/tests/expectations/compiler/compiler/integers/u8/pow.out index 9ca4a9ac0d..8f28ef8301 100644 --- a/tests/expectations/compiler/compiler/integers/u8/pow.out +++ b/tests/expectations/compiler/compiler/integers/u8/pow.out @@ -3,6 +3,6 @@ namespace: Compile expectation: Pass outputs: - output: - - initial_input_ast: cd3e477685a41ff749bf03ddcd0de7c2ac32a2cf1ce991451e760fc48d0dd7d5 - initial_ast: acb9d3096cc847ed8c6d5a64993f344d7bcc29fab834ae68e11400720c37fd35 - symbol_table: 10d10aa7233b8e9c5438f9cba3ea87f64bfef043e4d4b226d686cf3de204ca28 + - initial_input_ast: 07f28c85836861f253a1a38c498828baffa439a24b7bb5e3a60f5526fd14334a + initial_ast: bbe46a973d16e1fecb9e46ad07582abea36382a2dc5822cbd5861d75fc998ac4 + symbol_table: df935d0411cd3e398557aa7dbb0adbbef2cf13619f1a240a508822186c731bbc diff --git a/tests/expectations/compiler/compiler/integers/u8/shl.out b/tests/expectations/compiler/compiler/integers/u8/shl.out new file mode 100644 index 0000000000..05377a187b --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/u8/shl.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: bd0ce5e5810d666ea1d75e5d3c96a17a199301edf24a95b89c587a85af18bc28 + initial_ast: 9f2c98d5de16e4842a3279ee02735bc6bd2f31a2edc27c7e16bb7b3fed7b8e45 + symbol_table: 0dcb0e6a28f02796446718e8f14671a57393c5bf183d41f13e793df6cd75a259 diff --git a/tests/expectations/compiler/compiler/integers/u8/shr.out b/tests/expectations/compiler/compiler/integers/u8/shr.out new file mode 100644 index 0000000000..595fa9a6cf --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/u8/shr.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: bd0ce5e5810d666ea1d75e5d3c96a17a199301edf24a95b89c587a85af18bc28 + initial_ast: b6d327b88184cd433875734a6a53ed7f871a35b5a6ad5dbfa46114e834212177 + symbol_table: 4ddf03d578dbc3f96c1b265bbce3b76f5ca3f34c86715ee73ca998cfc0ec3c50 diff --git a/tests/expectations/compiler/compiler/integers/u8/xor.out b/tests/expectations/compiler/compiler/integers/u8/xor.out new file mode 100644 index 0000000000..46a743fc1d --- /dev/null +++ b/tests/expectations/compiler/compiler/integers/u8/xor.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: 36d7e018ac49ebf2f8bbcf24cc05a8e0b5fb63896e00a71657b36929c60cb111 + initial_ast: 50090fc3a25155e2ac75594c9b214d6dc680ff8d409e13d5053fbc1c88de2e5c + symbol_table: ebb277c7719a564957a2e1942a6e9880e5b0c5a04dedd6ac58c14cb30d3fefd2 diff --git a/tests/expectations/compiler/compiler/scalar/operator_methods.out b/tests/expectations/compiler/compiler/scalar/operator_methods.out new file mode 100644 index 0000000000..f12eff57d8 --- /dev/null +++ b/tests/expectations/compiler/compiler/scalar/operator_methods.out @@ -0,0 +1,8 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: c608e32decc0d3c8074a6c776e23785daa17e44ded554f0c257d54ca291b485c + initial_ast: a63a71494a1657fc140e13ee3dc4704849f4119b361633b6196360418e590ea3 + symbol_table: b18031ce0fcf83f776b77337d4b3104f0e26893747526af5f9348e5db830666e diff --git a/tests/expectations/compiler/compiler/statements/duplicate_variable.out b/tests/expectations/compiler/compiler/statements/duplicate_variable.out index b804c241a8..a41efa1fdc 100644 --- a/tests/expectations/compiler/compiler/statements/duplicate_variable.out +++ b/tests/expectations/compiler/compiler/statements/duplicate_variable.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - "Error [EAST0372015]: variable `x` shadowed by\n --> compiler-test:5:4\n |\n 5 | \tlet x: bool = true;\n | ^^^^^^^^^^^^^^^^^^\n" + - "Error [EAST0372016]: variable `x` shadowed by\n --> compiler-test:5:4\n |\n 5 | \tlet x: bool = true;\n | ^^^^^^^^^^^^^^^^^^\n" diff --git a/tests/expectations/parser/parser/expression/binary/add.out b/tests/expectations/parser/parser/expression/binary/add.out index 71ab19c8db..599eb9e88f 100644 --- a/tests/expectations/parser/parser/expression/binary/add.out +++ b/tests/expectations/parser/parser/expression/binary/add.out @@ -240,3 +240,242 @@ outputs: span: lo: 0 hi: 33 + - Unary: + receiver: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Add + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 1 + hi: 10 + op: Not + span: + lo: 0 + hi: 10 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" + op: Add + span: + lo: 0 + hi: 8 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":13,\\\"hi\\\":14}\"}" + op: Add + span: + lo: 0 + hi: 15 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":20,\\\"hi\\\":21}\"}" + op: Add + span: + lo: 0 + hi: 22 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Add + span: + lo: 1 + hi: 9 + op: Negate + span: + lo: 0 + hi: 9 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Negate + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":9,\\\"hi\\\":10}\"}" + op: Add + span: + lo: 1 + hi: 11 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Add + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 0 + hi: 10 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Add + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 1 + hi: 10 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: Add + span: + lo: 1 + hi: 18 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Add + span: + lo: 1 + hi: 9 + op: Not + span: + lo: 0 + hi: 9 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":9,\\\"hi\\\":10}\"}" + op: Add + span: + lo: 1 + hi: 11 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Add + span: + lo: 2 + hi: 10 + op: Not + span: + lo: 0 + hi: 10 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Add + span: + lo: 2 + hi: 10 + op: Not + span: + lo: 1 + hi: 10 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: Add + span: + lo: 1 + hi: 18 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Add + span: + lo: 1 + hi: 9 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":12,\\\"hi\\\":13}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":18,\\\"hi\\\":19}\"}" + op: Add + span: + lo: 12 + hi: 20 + op: Add + span: + lo: 1 + hi: 20 + right: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":26,\\\"hi\\\":27}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":32,\\\"hi\\\":33}\"}" + op: Add + span: + lo: 26 + hi: 34 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":37,\\\"hi\\\":38}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":43,\\\"hi\\\":44}\"}" + op: Add + span: + lo: 37 + hi: 45 + op: Add + span: + lo: 26 + hi: 45 + op: Add + span: + lo: 1 + hi: 46 diff --git a/tests/expectations/parser/parser/expression/binary/add_wrapped.out b/tests/expectations/parser/parser/expression/binary/add_wrapped.out new file mode 100644 index 0000000000..c5c7cb64ba --- /dev/null +++ b/tests/expectations/parser/parser/expression/binary/add_wrapped.out @@ -0,0 +1,243 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Unary: + receiver: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: AddWrapped + span: + lo: 2 + hi: 18 + op: Negate + span: + lo: 1 + hi: 18 + op: Not + span: + lo: 0 + hi: 18 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":14,\\\"hi\\\":15}\"}" + op: AddWrapped + span: + lo: 0 + hi: 16 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":29,\\\"hi\\\":30}\"}" + op: AddWrapped + span: + lo: 0 + hi: 31 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":44,\\\"hi\\\":45}\"}" + op: AddWrapped + span: + lo: 0 + hi: 46 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":15,\\\"hi\\\":16}\"}" + op: AddWrapped + span: + lo: 1 + hi: 17 + op: Negate + span: + lo: 0 + hi: 17 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Negate + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":17,\\\"hi\\\":18}\"}" + op: AddWrapped + span: + lo: 1 + hi: 19 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: AddWrapped + span: + lo: 2 + hi: 18 + op: Negate + span: + lo: 0 + hi: 18 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: AddWrapped + span: + lo: 2 + hi: 18 + op: Negate + span: + lo: 1 + hi: 18 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":32,\\\"hi\\\":33}\"}" + op: AddWrapped + span: + lo: 1 + hi: 34 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":15,\\\"hi\\\":16}\"}" + op: AddWrapped + span: + lo: 1 + hi: 17 + op: Not + span: + lo: 0 + hi: 17 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":17,\\\"hi\\\":18}\"}" + op: AddWrapped + span: + lo: 1 + hi: 19 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: AddWrapped + span: + lo: 2 + hi: 18 + op: Not + span: + lo: 0 + hi: 18 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: AddWrapped + span: + lo: 2 + hi: 18 + op: Not + span: + lo: 1 + hi: 18 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":32,\\\"hi\\\":33}\"}" + op: AddWrapped + span: + lo: 1 + hi: 34 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":15,\\\"hi\\\":16}\"}" + op: AddWrapped + span: + lo: 1 + hi: 17 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":20,\\\"hi\\\":21}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":34,\\\"hi\\\":35}\"}" + op: AddWrapped + span: + lo: 20 + hi: 36 + op: Add + span: + lo: 1 + hi: 36 + right: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":50,\\\"hi\\\":51}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":64,\\\"hi\\\":65}\"}" + op: AddWrapped + span: + lo: 50 + hi: 66 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":69,\\\"hi\\\":70}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":83,\\\"hi\\\":84}\"}" + op: AddWrapped + span: + lo: 69 + hi: 85 + op: Add + span: + lo: 50 + hi: 85 + op: AddWrapped + span: + lo: 1 + hi: 86 diff --git a/tests/expectations/parser/parser/expression/binary/and.out b/tests/expectations/parser/parser/expression/binary/and.out index 89a8d1500e..4bf9e5ef6c 100644 --- a/tests/expectations/parser/parser/expression/binary/and.out +++ b/tests/expectations/parser/parser/expression/binary/and.out @@ -72,3 +72,242 @@ outputs: span: lo: 0 hi: 17 + - Unary: + receiver: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: BitwiseAnd + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 1 + hi: 10 + op: Not + span: + lo: 0 + hi: 10 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" + op: BitwiseAnd + span: + lo: 0 + hi: 8 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":13,\\\"hi\\\":14}\"}" + op: BitwiseAnd + span: + lo: 0 + hi: 15 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":20,\\\"hi\\\":21}\"}" + op: BitwiseAnd + span: + lo: 0 + hi: 22 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: BitwiseAnd + span: + lo: 1 + hi: 9 + op: Negate + span: + lo: 0 + hi: 9 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Negate + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":9,\\\"hi\\\":10}\"}" + op: BitwiseAnd + span: + lo: 1 + hi: 11 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: BitwiseAnd + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 0 + hi: 10 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: BitwiseAnd + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 1 + hi: 10 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: BitwiseAnd + span: + lo: 1 + hi: 18 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: BitwiseAnd + span: + lo: 1 + hi: 9 + op: Not + span: + lo: 0 + hi: 9 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":9,\\\"hi\\\":10}\"}" + op: BitwiseAnd + span: + lo: 1 + hi: 11 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: BitwiseAnd + span: + lo: 2 + hi: 10 + op: Not + span: + lo: 0 + hi: 10 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: BitwiseAnd + span: + lo: 2 + hi: 10 + op: Not + span: + lo: 1 + hi: 10 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: BitwiseAnd + span: + lo: 1 + hi: 18 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: BitwiseAnd + span: + lo: 1 + hi: 9 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":12,\\\"hi\\\":13}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":18,\\\"hi\\\":19}\"}" + op: BitwiseAnd + span: + lo: 12 + hi: 20 + op: Add + span: + lo: 1 + hi: 20 + right: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":26,\\\"hi\\\":27}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":32,\\\"hi\\\":33}\"}" + op: BitwiseAnd + span: + lo: 26 + hi: 34 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":37,\\\"hi\\\":38}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":43,\\\"hi\\\":44}\"}" + op: BitwiseAnd + span: + lo: 37 + hi: 45 + op: Add + span: + lo: 26 + hi: 45 + op: BitwiseAnd + span: + lo: 1 + hi: 46 diff --git a/tests/expectations/parser/parser/expression/binary/bit_and.out b/tests/expectations/parser/parser/expression/binary/bit_and.out new file mode 100644 index 0000000000..4f88dd45a2 --- /dev/null +++ b/tests/expectations/parser/parser/expression/binary/bit_and.out @@ -0,0 +1,481 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Binary: + left: + Value: + Integer: + - U8 + - "1" + - span: + lo: 0 + hi: 3 + right: + Value: + Integer: + - U8 + - "1" + - span: + lo: 6 + hi: 9 + op: BitwiseAnd + span: + lo: 0 + hi: 9 + - Binary: + left: + Value: + Integer: + - U8 + - "2" + - span: + lo: 0 + hi: 3 + right: + Value: + Integer: + - U8 + - "3" + - span: + lo: 4 + hi: 7 + op: BitwiseAnd + span: + lo: 0 + hi: 7 + - Binary: + left: + Binary: + left: + Value: + Integer: + - U8 + - "1" + - span: + lo: 0 + hi: 3 + right: + Value: + Integer: + - U8 + - "2" + - span: + lo: 6 + hi: 9 + op: BitwiseAnd + span: + lo: 0 + hi: 9 + right: + Value: + Integer: + - U8 + - "3" + - span: + lo: 12 + hi: 15 + op: BitwiseAnd + span: + lo: 0 + hi: 15 + - Binary: + left: + Binary: + left: + Value: + Integer: + - U8 + - "1" + - span: + lo: 0 + hi: 3 + right: + Binary: + left: + Value: + Integer: + - U8 + - "2" + - span: + lo: 6 + hi: 9 + right: + Value: + Integer: + - U8 + - "3" + - span: + lo: 12 + hi: 15 + op: BitwiseAnd + span: + lo: 6 + hi: 15 + op: BitwiseOr + span: + lo: 0 + hi: 15 + right: + Value: + Integer: + - U8 + - "4" + - span: + lo: 18 + hi: 21 + op: BitwiseOr + span: + lo: 0 + hi: 21 + - Binary: + left: + Binary: + left: + Value: + Integer: + - U8 + - "1" + - span: + lo: 0 + hi: 3 + right: + Value: + Integer: + - U8 + - "2" + - span: + lo: 6 + hi: 9 + op: BitwiseAnd + span: + lo: 0 + hi: 9 + right: + Value: + Integer: + - U8 + - "3" + - span: + lo: 12 + hi: 15 + op: BitwiseAnd + span: + lo: 0 + hi: 15 + - Binary: + left: + Binary: + left: + Binary: + left: + Value: + Integer: + - U8 + - "1" + - span: + lo: 0 + hi: 3 + right: + Binary: + left: + Value: + Integer: + - U8 + - "2" + - span: + lo: 6 + hi: 9 + right: + Value: + Integer: + - U8 + - "3" + - span: + lo: 12 + hi: 15 + op: BitwiseAnd + span: + lo: 6 + hi: 15 + op: BitwiseOr + span: + lo: 0 + hi: 15 + right: + Binary: + left: + Value: + Integer: + - U8 + - "4" + - span: + lo: 18 + hi: 21 + right: + Value: + Integer: + - U8 + - "5" + - span: + lo: 24 + hi: 27 + op: BitwiseAnd + span: + lo: 18 + hi: 27 + op: BitwiseOr + span: + lo: 0 + hi: 27 + right: + Value: + Integer: + - U8 + - "6" + - span: + lo: 30 + hi: 33 + op: BitwiseOr + span: + lo: 0 + hi: 33 + - Unary: + receiver: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: BitwiseAnd + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 1 + hi: 10 + op: Not + span: + lo: 0 + hi: 10 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" + op: BitwiseAnd + span: + lo: 0 + hi: 8 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":13,\\\"hi\\\":14}\"}" + op: BitwiseAnd + span: + lo: 0 + hi: 15 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":20,\\\"hi\\\":21}\"}" + op: BitwiseAnd + span: + lo: 0 + hi: 22 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: BitwiseAnd + span: + lo: 1 + hi: 9 + op: Negate + span: + lo: 0 + hi: 9 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Negate + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":9,\\\"hi\\\":10}\"}" + op: BitwiseAnd + span: + lo: 1 + hi: 11 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: BitwiseAnd + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 0 + hi: 10 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: BitwiseAnd + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 1 + hi: 10 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: BitwiseAnd + span: + lo: 1 + hi: 18 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: BitwiseAnd + span: + lo: 1 + hi: 9 + op: Not + span: + lo: 0 + hi: 9 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":9,\\\"hi\\\":10}\"}" + op: BitwiseAnd + span: + lo: 1 + hi: 11 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: BitwiseAnd + span: + lo: 2 + hi: 10 + op: Not + span: + lo: 0 + hi: 10 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: BitwiseAnd + span: + lo: 2 + hi: 10 + op: Not + span: + lo: 1 + hi: 10 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: BitwiseAnd + span: + lo: 1 + hi: 18 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: BitwiseAnd + span: + lo: 1 + hi: 9 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":12,\\\"hi\\\":13}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":18,\\\"hi\\\":19}\"}" + op: BitwiseAnd + span: + lo: 12 + hi: 20 + op: BitwiseAnd + span: + lo: 1 + hi: 20 + right: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":26,\\\"hi\\\":27}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":32,\\\"hi\\\":33}\"}" + op: BitwiseAnd + span: + lo: 26 + hi: 34 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":37,\\\"hi\\\":38}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":43,\\\"hi\\\":44}\"}" + op: BitwiseAnd + span: + lo: 37 + hi: 45 + op: BitwiseAnd + span: + lo: 26 + hi: 45 + op: BitwiseAnd + span: + lo: 1 + hi: 46 diff --git a/tests/expectations/parser/parser/expression/binary/bit_or.out b/tests/expectations/parser/parser/expression/binary/bit_or.out new file mode 100644 index 0000000000..0239f4e808 --- /dev/null +++ b/tests/expectations/parser/parser/expression/binary/bit_or.out @@ -0,0 +1,481 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Binary: + left: + Value: + Integer: + - U8 + - "1" + - span: + lo: 0 + hi: 3 + right: + Value: + Integer: + - U8 + - "1" + - span: + lo: 6 + hi: 9 + op: BitwiseOr + span: + lo: 0 + hi: 9 + - Binary: + left: + Value: + Integer: + - U8 + - "2" + - span: + lo: 0 + hi: 3 + right: + Value: + Integer: + - U8 + - "3" + - span: + lo: 4 + hi: 7 + op: BitwiseOr + span: + lo: 0 + hi: 7 + - Binary: + left: + Binary: + left: + Value: + Integer: + - U8 + - "1" + - span: + lo: 0 + hi: 3 + right: + Value: + Integer: + - U8 + - "2" + - span: + lo: 6 + hi: 9 + op: BitwiseOr + span: + lo: 0 + hi: 9 + right: + Value: + Integer: + - U8 + - "3" + - span: + lo: 12 + hi: 15 + op: BitwiseOr + span: + lo: 0 + hi: 15 + - Binary: + left: + Binary: + left: + Value: + Integer: + - U8 + - "1" + - span: + lo: 0 + hi: 3 + right: + Binary: + left: + Value: + Integer: + - U8 + - "2" + - span: + lo: 6 + hi: 9 + right: + Value: + Integer: + - U8 + - "3" + - span: + lo: 12 + hi: 15 + op: BitwiseOr + span: + lo: 6 + hi: 15 + op: Xor + span: + lo: 0 + hi: 15 + right: + Value: + Integer: + - U8 + - "4" + - span: + lo: 18 + hi: 21 + op: Xor + span: + lo: 0 + hi: 21 + - Binary: + left: + Binary: + left: + Value: + Integer: + - U8 + - "1" + - span: + lo: 0 + hi: 3 + right: + Value: + Integer: + - U8 + - "2" + - span: + lo: 6 + hi: 9 + op: BitwiseOr + span: + lo: 0 + hi: 9 + right: + Value: + Integer: + - U8 + - "3" + - span: + lo: 12 + hi: 15 + op: BitwiseOr + span: + lo: 0 + hi: 15 + - Binary: + left: + Binary: + left: + Binary: + left: + Value: + Integer: + - U8 + - "1" + - span: + lo: 0 + hi: 3 + right: + Binary: + left: + Value: + Integer: + - U8 + - "2" + - span: + lo: 6 + hi: 9 + right: + Value: + Integer: + - U8 + - "3" + - span: + lo: 12 + hi: 15 + op: BitwiseOr + span: + lo: 6 + hi: 15 + op: Xor + span: + lo: 0 + hi: 15 + right: + Binary: + left: + Value: + Integer: + - U8 + - "4" + - span: + lo: 18 + hi: 21 + right: + Value: + Integer: + - U8 + - "5" + - span: + lo: 24 + hi: 27 + op: BitwiseOr + span: + lo: 18 + hi: 27 + op: Xor + span: + lo: 0 + hi: 27 + right: + Value: + Integer: + - U8 + - "6" + - span: + lo: 30 + hi: 33 + op: Xor + span: + lo: 0 + hi: 33 + - Unary: + receiver: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: BitwiseOr + span: + lo: 2 + hi: 9 + op: Negate + span: + lo: 1 + hi: 9 + op: Not + span: + lo: 0 + hi: 9 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":5,\\\"hi\\\":6}\"}" + op: BitwiseOr + span: + lo: 0 + hi: 7 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":11,\\\"hi\\\":12}\"}" + op: BitwiseOr + span: + lo: 0 + hi: 13 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":17,\\\"hi\\\":18}\"}" + op: BitwiseOr + span: + lo: 0 + hi: 19 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" + op: BitwiseOr + span: + lo: 1 + hi: 8 + op: Negate + span: + lo: 0 + hi: 8 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Negate + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: BitwiseOr + span: + lo: 1 + hi: 10 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: BitwiseOr + span: + lo: 2 + hi: 9 + op: Negate + span: + lo: 0 + hi: 9 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: BitwiseOr + span: + lo: 2 + hi: 9 + op: Negate + span: + lo: 1 + hi: 9 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":14,\\\"hi\\\":15}\"}" + op: BitwiseOr + span: + lo: 1 + hi: 16 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" + op: BitwiseOr + span: + lo: 1 + hi: 8 + op: Not + span: + lo: 0 + hi: 8 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: BitwiseOr + span: + lo: 1 + hi: 10 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: BitwiseOr + span: + lo: 2 + hi: 9 + op: Not + span: + lo: 0 + hi: 9 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: BitwiseOr + span: + lo: 2 + hi: 9 + op: Not + span: + lo: 1 + hi: 9 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":14,\\\"hi\\\":15}\"}" + op: BitwiseOr + span: + lo: 1 + hi: 16 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" + op: BitwiseOr + span: + lo: 1 + hi: 8 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":11,\\\"hi\\\":12}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: BitwiseOr + span: + lo: 11 + hi: 18 + op: BitwiseOr + span: + lo: 1 + hi: 18 + right: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":23,\\\"hi\\\":24}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":28,\\\"hi\\\":29}\"}" + op: BitwiseOr + span: + lo: 23 + hi: 30 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":33,\\\"hi\\\":34}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":38,\\\"hi\\\":39}\"}" + op: BitwiseOr + span: + lo: 33 + hi: 40 + op: BitwiseOr + span: + lo: 23 + hi: 40 + op: BitwiseOr + span: + lo: 1 + hi: 41 diff --git a/tests/expectations/parser/parser/expression/binary/bit_xor.out b/tests/expectations/parser/parser/expression/binary/bit_xor.out new file mode 100644 index 0000000000..7fc1fc0b85 --- /dev/null +++ b/tests/expectations/parser/parser/expression/binary/bit_xor.out @@ -0,0 +1,481 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Binary: + left: + Value: + Integer: + - U8 + - "1" + - span: + lo: 0 + hi: 3 + right: + Value: + Integer: + - U8 + - "1" + - span: + lo: 6 + hi: 9 + op: Xor + span: + lo: 0 + hi: 9 + - Binary: + left: + Value: + Integer: + - U8 + - "2" + - span: + lo: 0 + hi: 3 + right: + Value: + Integer: + - U8 + - "3" + - span: + lo: 4 + hi: 7 + op: Xor + span: + lo: 0 + hi: 7 + - Binary: + left: + Binary: + left: + Value: + Integer: + - U8 + - "1" + - span: + lo: 0 + hi: 3 + right: + Value: + Integer: + - U8 + - "2" + - span: + lo: 6 + hi: 9 + op: Xor + span: + lo: 0 + hi: 9 + right: + Value: + Integer: + - U8 + - "3" + - span: + lo: 12 + hi: 15 + op: Xor + span: + lo: 0 + hi: 15 + - Binary: + left: + Binary: + left: + Value: + Integer: + - U8 + - "1" + - span: + lo: 0 + hi: 3 + right: + Value: + Integer: + - U8 + - "2" + - span: + lo: 6 + hi: 9 + op: BitwiseAnd + span: + lo: 0 + hi: 9 + right: + Binary: + left: + Value: + Integer: + - U8 + - "3" + - span: + lo: 12 + hi: 15 + right: + Value: + Integer: + - U8 + - "4" + - span: + lo: 18 + hi: 21 + op: BitwiseAnd + span: + lo: 12 + hi: 21 + op: Xor + span: + lo: 0 + hi: 21 + - Binary: + left: + Binary: + left: + Value: + Integer: + - U8 + - "1" + - span: + lo: 0 + hi: 3 + right: + Value: + Integer: + - U8 + - "2" + - span: + lo: 6 + hi: 9 + op: Xor + span: + lo: 0 + hi: 9 + right: + Value: + Integer: + - U8 + - "3" + - span: + lo: 12 + hi: 15 + op: Xor + span: + lo: 0 + hi: 15 + - Binary: + left: + Binary: + left: + Binary: + left: + Value: + Integer: + - U8 + - "1" + - span: + lo: 0 + hi: 3 + right: + Value: + Integer: + - U8 + - "2" + - span: + lo: 6 + hi: 9 + op: BitwiseAnd + span: + lo: 0 + hi: 9 + right: + Binary: + left: + Value: + Integer: + - U8 + - "3" + - span: + lo: 12 + hi: 15 + right: + Value: + Integer: + - U8 + - "4" + - span: + lo: 18 + hi: 21 + op: BitwiseAnd + span: + lo: 12 + hi: 21 + op: Xor + span: + lo: 0 + hi: 21 + right: + Binary: + left: + Value: + Integer: + - U8 + - "5" + - span: + lo: 24 + hi: 27 + right: + Value: + Integer: + - U8 + - "6" + - span: + lo: 30 + hi: 33 + op: BitwiseAnd + span: + lo: 24 + hi: 33 + op: Xor + span: + lo: 0 + hi: 33 + - Unary: + receiver: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Xor + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 1 + hi: 10 + op: Not + span: + lo: 0 + hi: 10 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" + op: Xor + span: + lo: 0 + hi: 8 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":13,\\\"hi\\\":14}\"}" + op: Xor + span: + lo: 0 + hi: 15 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":20,\\\"hi\\\":21}\"}" + op: Xor + span: + lo: 0 + hi: 22 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Xor + span: + lo: 1 + hi: 9 + op: Negate + span: + lo: 0 + hi: 9 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Negate + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":9,\\\"hi\\\":10}\"}" + op: Xor + span: + lo: 1 + hi: 11 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Xor + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 0 + hi: 10 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Xor + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 1 + hi: 10 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: Xor + span: + lo: 1 + hi: 18 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Xor + span: + lo: 1 + hi: 9 + op: Not + span: + lo: 0 + hi: 9 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":9,\\\"hi\\\":10}\"}" + op: Xor + span: + lo: 1 + hi: 11 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Xor + span: + lo: 2 + hi: 10 + op: Not + span: + lo: 0 + hi: 10 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Xor + span: + lo: 2 + hi: 10 + op: Not + span: + lo: 1 + hi: 10 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: Xor + span: + lo: 1 + hi: 18 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Xor + span: + lo: 1 + hi: 9 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":12,\\\"hi\\\":13}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":18,\\\"hi\\\":19}\"}" + op: Xor + span: + lo: 12 + hi: 20 + op: Xor + span: + lo: 1 + hi: 20 + right: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":26,\\\"hi\\\":27}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":32,\\\"hi\\\":33}\"}" + op: Xor + span: + lo: 26 + hi: 34 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":37,\\\"hi\\\":38}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":43,\\\"hi\\\":44}\"}" + op: Xor + span: + lo: 37 + hi: 45 + op: Xor + span: + lo: 26 + hi: 45 + op: Xor + span: + lo: 1 + hi: 46 diff --git a/tests/expectations/parser/parser/expression/binary/div.out b/tests/expectations/parser/parser/expression/binary/div.out index 4b5f6a19dd..1fc3d48002 100644 --- a/tests/expectations/parser/parser/expression/binary/div.out +++ b/tests/expectations/parser/parser/expression/binary/div.out @@ -128,3 +128,242 @@ outputs: span: lo: 0 hi: 23 + - Unary: + receiver: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Div + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 1 + hi: 10 + op: Not + span: + lo: 0 + hi: 10 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" + op: Div + span: + lo: 0 + hi: 8 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":13,\\\"hi\\\":14}\"}" + op: Div + span: + lo: 0 + hi: 15 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":20,\\\"hi\\\":21}\"}" + op: Div + span: + lo: 0 + hi: 22 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Div + span: + lo: 1 + hi: 9 + op: Negate + span: + lo: 0 + hi: 9 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Negate + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":9,\\\"hi\\\":10}\"}" + op: Div + span: + lo: 1 + hi: 11 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Div + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 0 + hi: 10 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Div + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 1 + hi: 10 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: Div + span: + lo: 1 + hi: 18 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Div + span: + lo: 1 + hi: 9 + op: Not + span: + lo: 0 + hi: 9 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":9,\\\"hi\\\":10}\"}" + op: Div + span: + lo: 1 + hi: 11 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Div + span: + lo: 2 + hi: 10 + op: Not + span: + lo: 0 + hi: 10 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Div + span: + lo: 2 + hi: 10 + op: Not + span: + lo: 1 + hi: 10 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: Div + span: + lo: 1 + hi: 18 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Div + span: + lo: 1 + hi: 9 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":12,\\\"hi\\\":13}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":18,\\\"hi\\\":19}\"}" + op: Div + span: + lo: 12 + hi: 20 + op: Div + span: + lo: 1 + hi: 20 + right: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":26,\\\"hi\\\":27}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":32,\\\"hi\\\":33}\"}" + op: Div + span: + lo: 26 + hi: 34 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":37,\\\"hi\\\":38}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":43,\\\"hi\\\":44}\"}" + op: Div + span: + lo: 37 + hi: 45 + op: Div + span: + lo: 26 + hi: 45 + op: Div + span: + lo: 1 + hi: 46 diff --git a/tests/expectations/parser/parser/expression/binary/div_wrapped.out b/tests/expectations/parser/parser/expression/binary/div_wrapped.out new file mode 100644 index 0000000000..f0c2bdfb82 --- /dev/null +++ b/tests/expectations/parser/parser/expression/binary/div_wrapped.out @@ -0,0 +1,243 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Unary: + receiver: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Div + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 1 + hi: 10 + op: Not + span: + lo: 0 + hi: 10 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" + op: Div + span: + lo: 0 + hi: 8 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":13,\\\"hi\\\":14}\"}" + op: Div + span: + lo: 0 + hi: 15 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":20,\\\"hi\\\":21}\"}" + op: Div + span: + lo: 0 + hi: 22 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Div + span: + lo: 1 + hi: 9 + op: Negate + span: + lo: 0 + hi: 9 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Negate + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":9,\\\"hi\\\":10}\"}" + op: Div + span: + lo: 1 + hi: 11 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Div + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 0 + hi: 10 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Div + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 1 + hi: 10 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: Div + span: + lo: 1 + hi: 18 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Div + span: + lo: 1 + hi: 9 + op: Not + span: + lo: 0 + hi: 9 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":9,\\\"hi\\\":10}\"}" + op: Div + span: + lo: 1 + hi: 11 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Div + span: + lo: 2 + hi: 10 + op: Not + span: + lo: 0 + hi: 10 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Div + span: + lo: 2 + hi: 10 + op: Not + span: + lo: 1 + hi: 10 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: Div + span: + lo: 1 + hi: 18 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Div + span: + lo: 1 + hi: 9 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":12,\\\"hi\\\":13}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":18,\\\"hi\\\":19}\"}" + op: Div + span: + lo: 12 + hi: 20 + op: Div + span: + lo: 1 + hi: 20 + right: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":26,\\\"hi\\\":27}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":32,\\\"hi\\\":33}\"}" + op: Div + span: + lo: 26 + hi: 34 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":37,\\\"hi\\\":38}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":43,\\\"hi\\\":44}\"}" + op: Div + span: + lo: 37 + hi: 45 + op: Div + span: + lo: 26 + hi: 45 + op: Div + span: + lo: 1 + hi: 46 diff --git a/tests/expectations/parser/parser/expression/binary/eq.out b/tests/expectations/parser/parser/expression/binary/eq.out index 408c1c0541..64802bf254 100644 --- a/tests/expectations/parser/parser/expression/binary/eq.out +++ b/tests/expectations/parser/parser/expression/binary/eq.out @@ -198,3 +198,242 @@ outputs: span: lo: 0 hi: 48 + - Unary: + receiver: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Eq + span: + lo: 2 + hi: 9 + op: Negate + span: + lo: 1 + hi: 9 + op: Not + span: + lo: 0 + hi: 9 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":5,\\\"hi\\\":6}\"}" + op: Eq + span: + lo: 0 + hi: 7 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":11,\\\"hi\\\":12}\"}" + op: Eq + span: + lo: 0 + hi: 13 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":17,\\\"hi\\\":18}\"}" + op: Eq + span: + lo: 0 + hi: 19 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" + op: Eq + span: + lo: 1 + hi: 8 + op: Negate + span: + lo: 0 + hi: 8 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Negate + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Eq + span: + lo: 1 + hi: 10 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Eq + span: + lo: 2 + hi: 9 + op: Negate + span: + lo: 0 + hi: 9 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Eq + span: + lo: 2 + hi: 9 + op: Negate + span: + lo: 1 + hi: 9 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":14,\\\"hi\\\":15}\"}" + op: Eq + span: + lo: 1 + hi: 16 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" + op: Eq + span: + lo: 1 + hi: 8 + op: Not + span: + lo: 0 + hi: 8 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Eq + span: + lo: 1 + hi: 10 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Eq + span: + lo: 2 + hi: 9 + op: Not + span: + lo: 0 + hi: 9 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Eq + span: + lo: 2 + hi: 9 + op: Not + span: + lo: 1 + hi: 9 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":14,\\\"hi\\\":15}\"}" + op: Eq + span: + lo: 1 + hi: 16 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" + op: Eq + span: + lo: 1 + hi: 8 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":12,\\\"hi\\\":13}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":17,\\\"hi\\\":18}\"}" + op: Eq + span: + lo: 12 + hi: 19 + op: Eq + span: + lo: 1 + hi: 19 + right: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":24,\\\"hi\\\":25}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":29,\\\"hi\\\":30}\"}" + op: Eq + span: + lo: 24 + hi: 31 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":35,\\\"hi\\\":36}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":40,\\\"hi\\\":41}\"}" + op: Eq + span: + lo: 35 + hi: 42 + op: Eq + span: + lo: 24 + hi: 42 + op: Eq + span: + lo: 1 + hi: 43 diff --git a/tests/expectations/parser/parser/expression/binary/exp.out b/tests/expectations/parser/parser/expression/binary/exp.out deleted file mode 100644 index b6204be6a4..0000000000 --- a/tests/expectations/parser/parser/expression/binary/exp.out +++ /dev/null @@ -1,81 +0,0 @@ ---- -namespace: ParseExpression -expectation: Pass -outputs: - - Binary: - left: - Value: - Integer: - - U8 - - "1" - - span: - lo: 0 - hi: 3 - right: - Value: - Integer: - - U8 - - "1" - - span: - lo: 7 - hi: 10 - op: Pow - span: - lo: 0 - hi: 10 - - Binary: - left: - Value: - Integer: - - U8 - - "2" - - span: - lo: 0 - hi: 3 - right: - Value: - Integer: - - U8 - - "3" - - span: - lo: 5 - hi: 8 - op: Pow - span: - lo: 0 - hi: 8 - - Binary: - left: - Value: - Integer: - - U8 - - "1" - - span: - lo: 0 - hi: 3 - right: - Binary: - left: - Value: - Integer: - - U8 - - "2" - - span: - lo: 7 - hi: 10 - right: - Value: - Integer: - - U8 - - "3" - - span: - lo: 14 - hi: 17 - op: Pow - span: - lo: 7 - hi: 17 - op: Pow - span: - lo: 0 - hi: 17 diff --git a/tests/expectations/parser/parser/expression/binary/ge.out b/tests/expectations/parser/parser/expression/binary/ge.out new file mode 100644 index 0000000000..4db8b84893 --- /dev/null +++ b/tests/expectations/parser/parser/expression/binary/ge.out @@ -0,0 +1,334 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Binary: + left: + Value: + Integer: + - U8 + - "1" + - span: + lo: 0 + hi: 3 + right: + Value: + Integer: + - U8 + - "1" + - span: + lo: 7 + hi: 10 + op: Ge + span: + lo: 0 + hi: 10 + - Binary: + left: + Value: + Integer: + - U8 + - "2" + - span: + lo: 0 + hi: 3 + right: + Value: + Integer: + - U8 + - "3" + - span: + lo: 7 + hi: 10 + op: Ge + span: + lo: 0 + hi: 10 + - Binary: + left: + Binary: + left: + Value: + Integer: + - U8 + - "1" + - span: + lo: 0 + hi: 3 + right: + Value: + Integer: + - U8 + - "2" + - span: + lo: 6 + hi: 9 + op: Add + span: + lo: 0 + hi: 9 + right: + Binary: + left: + Value: + Integer: + - U8 + - "3" + - span: + lo: 13 + hi: 16 + right: + Value: + Integer: + - U8 + - "4" + - span: + lo: 19 + hi: 22 + op: Add + span: + lo: 13 + hi: 22 + op: Ge + span: + lo: 0 + hi: 22 + - Unary: + receiver: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Ge + span: + lo: 2 + hi: 9 + op: Negate + span: + lo: 1 + hi: 9 + op: Not + span: + lo: 0 + hi: 9 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":5,\\\"hi\\\":6}\"}" + op: Ge + span: + lo: 0 + hi: 7 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":11,\\\"hi\\\":12}\"}" + op: Ge + span: + lo: 0 + hi: 13 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":17,\\\"hi\\\":18}\"}" + op: Ge + span: + lo: 0 + hi: 19 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" + op: Ge + span: + lo: 1 + hi: 8 + op: Negate + span: + lo: 0 + hi: 8 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Negate + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Ge + span: + lo: 1 + hi: 10 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Ge + span: + lo: 2 + hi: 9 + op: Negate + span: + lo: 0 + hi: 9 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Ge + span: + lo: 2 + hi: 9 + op: Negate + span: + lo: 1 + hi: 9 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":14,\\\"hi\\\":15}\"}" + op: Ge + span: + lo: 1 + hi: 16 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" + op: Ge + span: + lo: 1 + hi: 8 + op: Not + span: + lo: 0 + hi: 8 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Ge + span: + lo: 1 + hi: 10 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Ge + span: + lo: 2 + hi: 9 + op: Not + span: + lo: 0 + hi: 9 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Ge + span: + lo: 2 + hi: 9 + op: Not + span: + lo: 1 + hi: 9 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":14,\\\"hi\\\":15}\"}" + op: Ge + span: + lo: 1 + hi: 16 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" + op: Ge + span: + lo: 1 + hi: 8 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":12,\\\"hi\\\":13}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":17,\\\"hi\\\":18}\"}" + op: Ge + span: + lo: 12 + hi: 19 + op: Ge + span: + lo: 1 + hi: 19 + right: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":24,\\\"hi\\\":25}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":29,\\\"hi\\\":30}\"}" + op: Ge + span: + lo: 24 + hi: 31 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":35,\\\"hi\\\":36}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":40,\\\"hi\\\":41}\"}" + op: Ge + span: + lo: 35 + hi: 42 + op: Ge + span: + lo: 24 + hi: 42 + op: Ge + span: + lo: 1 + hi: 43 diff --git a/tests/expectations/parser/parser/expression/binary/gte_fail.out b/tests/expectations/parser/parser/expression/binary/ge_fail.out similarity index 100% rename from tests/expectations/parser/parser/expression/binary/gte_fail.out rename to tests/expectations/parser/parser/expression/binary/ge_fail.out diff --git a/tests/expectations/parser/parser/expression/binary/gt.out b/tests/expectations/parser/parser/expression/binary/gt.out index 75751a693e..564ae31473 100644 --- a/tests/expectations/parser/parser/expression/binary/gt.out +++ b/tests/expectations/parser/parser/expression/binary/gt.out @@ -93,3 +93,242 @@ outputs: span: lo: 0 hi: 21 + - Unary: + receiver: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Gt + span: + lo: 2 + hi: 9 + op: Negate + span: + lo: 1 + hi: 9 + op: Not + span: + lo: 0 + hi: 9 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":5,\\\"hi\\\":6}\"}" + op: Gt + span: + lo: 0 + hi: 7 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":11,\\\"hi\\\":12}\"}" + op: Gt + span: + lo: 0 + hi: 13 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":17,\\\"hi\\\":18}\"}" + op: Gt + span: + lo: 0 + hi: 19 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" + op: Gt + span: + lo: 1 + hi: 8 + op: Negate + span: + lo: 0 + hi: 8 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Negate + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Gt + span: + lo: 1 + hi: 10 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Gt + span: + lo: 2 + hi: 9 + op: Negate + span: + lo: 0 + hi: 9 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Gt + span: + lo: 2 + hi: 9 + op: Negate + span: + lo: 1 + hi: 9 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":14,\\\"hi\\\":15}\"}" + op: Gt + span: + lo: 1 + hi: 16 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" + op: Gt + span: + lo: 1 + hi: 8 + op: Not + span: + lo: 0 + hi: 8 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Gt + span: + lo: 1 + hi: 10 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Gt + span: + lo: 2 + hi: 9 + op: Not + span: + lo: 0 + hi: 9 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Gt + span: + lo: 2 + hi: 9 + op: Not + span: + lo: 1 + hi: 9 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":14,\\\"hi\\\":15}\"}" + op: Gt + span: + lo: 1 + hi: 16 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" + op: Gt + span: + lo: 1 + hi: 8 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":11,\\\"hi\\\":12}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: Gt + span: + lo: 11 + hi: 18 + op: Gt + span: + lo: 1 + hi: 18 + right: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":23,\\\"hi\\\":24}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":28,\\\"hi\\\":29}\"}" + op: Gt + span: + lo: 23 + hi: 30 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":33,\\\"hi\\\":34}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":38,\\\"hi\\\":39}\"}" + op: Gt + span: + lo: 33 + hi: 40 + op: Gt + span: + lo: 23 + hi: 40 + op: Gt + span: + lo: 1 + hi: 41 diff --git a/tests/expectations/parser/parser/expression/binary/gte.out b/tests/expectations/parser/parser/expression/binary/gte.out deleted file mode 100644 index 9d5605c449..0000000000 --- a/tests/expectations/parser/parser/expression/binary/gte.out +++ /dev/null @@ -1,95 +0,0 @@ ---- -namespace: ParseExpression -expectation: Pass -outputs: - - Binary: - left: - Value: - Integer: - - U8 - - "1" - - span: - lo: 0 - hi: 3 - right: - Value: - Integer: - - U8 - - "1" - - span: - lo: 7 - hi: 10 - op: Ge - span: - lo: 0 - hi: 10 - - Binary: - left: - Value: - Integer: - - U8 - - "2" - - span: - lo: 0 - hi: 3 - right: - Value: - Integer: - - U8 - - "3" - - span: - lo: 7 - hi: 10 - op: Ge - span: - lo: 0 - hi: 10 - - Binary: - left: - Binary: - left: - Value: - Integer: - - U8 - - "1" - - span: - lo: 0 - hi: 3 - right: - Value: - Integer: - - U8 - - "2" - - span: - lo: 6 - hi: 9 - op: Add - span: - lo: 0 - hi: 9 - right: - Binary: - left: - Value: - Integer: - - U8 - - "3" - - span: - lo: 13 - hi: 16 - right: - Value: - Integer: - - U8 - - "4" - - span: - lo: 19 - hi: 22 - op: Add - span: - lo: 13 - hi: 22 - op: Ge - span: - lo: 0 - hi: 22 diff --git a/tests/expectations/parser/parser/expression/binary/le.out b/tests/expectations/parser/parser/expression/binary/le.out new file mode 100644 index 0000000000..87e3c62d4e --- /dev/null +++ b/tests/expectations/parser/parser/expression/binary/le.out @@ -0,0 +1,334 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Binary: + left: + Value: + Integer: + - U8 + - "1" + - span: + lo: 0 + hi: 3 + right: + Value: + Integer: + - U8 + - "1" + - span: + lo: 7 + hi: 10 + op: Le + span: + lo: 0 + hi: 10 + - Binary: + left: + Value: + Integer: + - U8 + - "2" + - span: + lo: 0 + hi: 3 + right: + Value: + Integer: + - U8 + - "3" + - span: + lo: 7 + hi: 10 + op: Le + span: + lo: 0 + hi: 10 + - Binary: + left: + Binary: + left: + Value: + Integer: + - U8 + - "1" + - span: + lo: 0 + hi: 3 + right: + Value: + Integer: + - U8 + - "2" + - span: + lo: 6 + hi: 9 + op: Add + span: + lo: 0 + hi: 9 + right: + Binary: + left: + Value: + Integer: + - U8 + - "3" + - span: + lo: 13 + hi: 16 + right: + Value: + Integer: + - U8 + - "4" + - span: + lo: 19 + hi: 22 + op: Add + span: + lo: 13 + hi: 22 + op: Le + span: + lo: 0 + hi: 22 + - Unary: + receiver: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Le + span: + lo: 2 + hi: 9 + op: Negate + span: + lo: 1 + hi: 9 + op: Not + span: + lo: 0 + hi: 9 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":5,\\\"hi\\\":6}\"}" + op: Le + span: + lo: 0 + hi: 7 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":11,\\\"hi\\\":12}\"}" + op: Le + span: + lo: 0 + hi: 13 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":17,\\\"hi\\\":18}\"}" + op: Le + span: + lo: 0 + hi: 19 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" + op: Le + span: + lo: 1 + hi: 8 + op: Negate + span: + lo: 0 + hi: 8 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Negate + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Le + span: + lo: 1 + hi: 10 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Le + span: + lo: 2 + hi: 9 + op: Negate + span: + lo: 0 + hi: 9 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Le + span: + lo: 2 + hi: 9 + op: Negate + span: + lo: 1 + hi: 9 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":14,\\\"hi\\\":15}\"}" + op: Le + span: + lo: 1 + hi: 16 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" + op: Le + span: + lo: 1 + hi: 8 + op: Not + span: + lo: 0 + hi: 8 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Le + span: + lo: 1 + hi: 10 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Le + span: + lo: 2 + hi: 9 + op: Not + span: + lo: 0 + hi: 9 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Le + span: + lo: 2 + hi: 9 + op: Not + span: + lo: 1 + hi: 9 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":14,\\\"hi\\\":15}\"}" + op: Le + span: + lo: 1 + hi: 16 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" + op: Le + span: + lo: 1 + hi: 8 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":12,\\\"hi\\\":13}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":17,\\\"hi\\\":18}\"}" + op: Le + span: + lo: 12 + hi: 19 + op: Le + span: + lo: 1 + hi: 19 + right: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":24,\\\"hi\\\":25}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":29,\\\"hi\\\":30}\"}" + op: Le + span: + lo: 24 + hi: 31 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":35,\\\"hi\\\":36}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":40,\\\"hi\\\":41}\"}" + op: Le + span: + lo: 35 + hi: 42 + op: Le + span: + lo: 24 + hi: 42 + op: Le + span: + lo: 1 + hi: 43 diff --git a/tests/expectations/parser/parser/expression/binary/lte_fail.out b/tests/expectations/parser/parser/expression/binary/le_fail.out similarity index 100% rename from tests/expectations/parser/parser/expression/binary/lte_fail.out rename to tests/expectations/parser/parser/expression/binary/le_fail.out diff --git a/tests/expectations/parser/parser/expression/binary/lt.out b/tests/expectations/parser/parser/expression/binary/lt.out index 1bca128da0..6208496dff 100644 --- a/tests/expectations/parser/parser/expression/binary/lt.out +++ b/tests/expectations/parser/parser/expression/binary/lt.out @@ -93,3 +93,242 @@ outputs: span: lo: 0 hi: 21 + - Unary: + receiver: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Lt + span: + lo: 2 + hi: 9 + op: Negate + span: + lo: 1 + hi: 9 + op: Not + span: + lo: 0 + hi: 9 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":5,\\\"hi\\\":6}\"}" + op: Lt + span: + lo: 0 + hi: 7 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":11,\\\"hi\\\":12}\"}" + op: Lt + span: + lo: 0 + hi: 13 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":17,\\\"hi\\\":18}\"}" + op: Lt + span: + lo: 0 + hi: 19 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" + op: Lt + span: + lo: 1 + hi: 8 + op: Negate + span: + lo: 0 + hi: 8 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Negate + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Lt + span: + lo: 1 + hi: 10 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Lt + span: + lo: 2 + hi: 9 + op: Negate + span: + lo: 0 + hi: 9 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Lt + span: + lo: 2 + hi: 9 + op: Negate + span: + lo: 1 + hi: 9 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":14,\\\"hi\\\":15}\"}" + op: Lt + span: + lo: 1 + hi: 16 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" + op: Lt + span: + lo: 1 + hi: 8 + op: Not + span: + lo: 0 + hi: 8 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Lt + span: + lo: 1 + hi: 10 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Lt + span: + lo: 2 + hi: 9 + op: Not + span: + lo: 0 + hi: 9 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Lt + span: + lo: 2 + hi: 9 + op: Not + span: + lo: 1 + hi: 9 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":14,\\\"hi\\\":15}\"}" + op: Lt + span: + lo: 1 + hi: 16 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" + op: Lt + span: + lo: 1 + hi: 8 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":11,\\\"hi\\\":12}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: Lt + span: + lo: 11 + hi: 18 + op: Lt + span: + lo: 1 + hi: 18 + right: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":23,\\\"hi\\\":24}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":28,\\\"hi\\\":29}\"}" + op: Lt + span: + lo: 23 + hi: 30 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":33,\\\"hi\\\":34}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":38,\\\"hi\\\":39}\"}" + op: Lt + span: + lo: 33 + hi: 40 + op: Lt + span: + lo: 23 + hi: 40 + op: Lt + span: + lo: 1 + hi: 41 diff --git a/tests/expectations/parser/parser/expression/binary/lte.out b/tests/expectations/parser/parser/expression/binary/lte.out deleted file mode 100644 index def6beb966..0000000000 --- a/tests/expectations/parser/parser/expression/binary/lte.out +++ /dev/null @@ -1,95 +0,0 @@ ---- -namespace: ParseExpression -expectation: Pass -outputs: - - Binary: - left: - Value: - Integer: - - U8 - - "1" - - span: - lo: 0 - hi: 3 - right: - Value: - Integer: - - U8 - - "1" - - span: - lo: 7 - hi: 10 - op: Le - span: - lo: 0 - hi: 10 - - Binary: - left: - Value: - Integer: - - U8 - - "2" - - span: - lo: 0 - hi: 3 - right: - Value: - Integer: - - U8 - - "3" - - span: - lo: 7 - hi: 10 - op: Le - span: - lo: 0 - hi: 10 - - Binary: - left: - Binary: - left: - Value: - Integer: - - U8 - - "1" - - span: - lo: 0 - hi: 3 - right: - Value: - Integer: - - U8 - - "2" - - span: - lo: 6 - hi: 9 - op: Add - span: - lo: 0 - hi: 9 - right: - Binary: - left: - Value: - Integer: - - U8 - - "3" - - span: - lo: 13 - hi: 16 - right: - Value: - Integer: - - U8 - - "4" - - span: - lo: 19 - hi: 22 - op: Add - span: - lo: 13 - hi: 22 - op: Le - span: - lo: 0 - hi: 22 diff --git a/tests/expectations/parser/parser/expression/binary/mul.out b/tests/expectations/parser/parser/expression/binary/mul.out index 96fdc78684..a7867f7e13 100644 --- a/tests/expectations/parser/parser/expression/binary/mul.out +++ b/tests/expectations/parser/parser/expression/binary/mul.out @@ -205,3 +205,242 @@ outputs: span: lo: 0 hi: 36 + - Unary: + receiver: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Mul + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 1 + hi: 10 + op: Not + span: + lo: 0 + hi: 10 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" + op: Mul + span: + lo: 0 + hi: 8 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":13,\\\"hi\\\":14}\"}" + op: Mul + span: + lo: 0 + hi: 15 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":20,\\\"hi\\\":21}\"}" + op: Mul + span: + lo: 0 + hi: 22 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Mul + span: + lo: 1 + hi: 9 + op: Negate + span: + lo: 0 + hi: 9 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Negate + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":9,\\\"hi\\\":10}\"}" + op: Mul + span: + lo: 1 + hi: 11 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Mul + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 0 + hi: 10 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Mul + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 1 + hi: 10 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: Mul + span: + lo: 1 + hi: 18 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Mul + span: + lo: 1 + hi: 9 + op: Not + span: + lo: 0 + hi: 9 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":9,\\\"hi\\\":10}\"}" + op: Mul + span: + lo: 1 + hi: 11 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Mul + span: + lo: 2 + hi: 10 + op: Not + span: + lo: 0 + hi: 10 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Mul + span: + lo: 2 + hi: 10 + op: Not + span: + lo: 1 + hi: 10 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: Mul + span: + lo: 1 + hi: 18 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Mul + span: + lo: 1 + hi: 9 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":12,\\\"hi\\\":13}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":18,\\\"hi\\\":19}\"}" + op: Mul + span: + lo: 12 + hi: 20 + op: Mul + span: + lo: 1 + hi: 20 + right: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":26,\\\"hi\\\":27}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":32,\\\"hi\\\":33}\"}" + op: Mul + span: + lo: 26 + hi: 34 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":37,\\\"hi\\\":38}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":43,\\\"hi\\\":44}\"}" + op: Mul + span: + lo: 37 + hi: 45 + op: Mul + span: + lo: 26 + hi: 45 + op: Mul + span: + lo: 1 + hi: 46 diff --git a/tests/expectations/parser/parser/expression/binary/mul_wrapped.out b/tests/expectations/parser/parser/expression/binary/mul_wrapped.out new file mode 100644 index 0000000000..e9e0dcb376 --- /dev/null +++ b/tests/expectations/parser/parser/expression/binary/mul_wrapped.out @@ -0,0 +1,243 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Unary: + receiver: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: MulWrapped + span: + lo: 2 + hi: 18 + op: Negate + span: + lo: 1 + hi: 18 + op: Not + span: + lo: 0 + hi: 18 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":14,\\\"hi\\\":15}\"}" + op: MulWrapped + span: + lo: 0 + hi: 16 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":29,\\\"hi\\\":30}\"}" + op: MulWrapped + span: + lo: 0 + hi: 31 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":44,\\\"hi\\\":45}\"}" + op: MulWrapped + span: + lo: 0 + hi: 46 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":15,\\\"hi\\\":16}\"}" + op: MulWrapped + span: + lo: 1 + hi: 17 + op: Negate + span: + lo: 0 + hi: 17 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Negate + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":17,\\\"hi\\\":18}\"}" + op: MulWrapped + span: + lo: 1 + hi: 19 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: MulWrapped + span: + lo: 2 + hi: 18 + op: Negate + span: + lo: 0 + hi: 18 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: MulWrapped + span: + lo: 2 + hi: 18 + op: Negate + span: + lo: 1 + hi: 18 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":32,\\\"hi\\\":33}\"}" + op: MulWrapped + span: + lo: 1 + hi: 34 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":15,\\\"hi\\\":16}\"}" + op: MulWrapped + span: + lo: 1 + hi: 17 + op: Not + span: + lo: 0 + hi: 17 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":17,\\\"hi\\\":18}\"}" + op: MulWrapped + span: + lo: 1 + hi: 19 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: MulWrapped + span: + lo: 2 + hi: 18 + op: Not + span: + lo: 0 + hi: 18 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: MulWrapped + span: + lo: 2 + hi: 18 + op: Not + span: + lo: 1 + hi: 18 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":32,\\\"hi\\\":33}\"}" + op: MulWrapped + span: + lo: 1 + hi: 34 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":15,\\\"hi\\\":16}\"}" + op: MulWrapped + span: + lo: 1 + hi: 17 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":20,\\\"hi\\\":21}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":34,\\\"hi\\\":35}\"}" + op: MulWrapped + span: + lo: 20 + hi: 36 + op: Mul + span: + lo: 1 + hi: 36 + right: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":50,\\\"hi\\\":51}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":64,\\\"hi\\\":65}\"}" + op: MulWrapped + span: + lo: 50 + hi: 66 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":69,\\\"hi\\\":70}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":83,\\\"hi\\\":84}\"}" + op: MulWrapped + span: + lo: 69 + hi: 85 + op: Mul + span: + lo: 50 + hi: 85 + op: MulWrapped + span: + lo: 1 + hi: 86 diff --git a/tests/expectations/parser/parser/expression/binary/nand.out b/tests/expectations/parser/parser/expression/binary/nand.out new file mode 100644 index 0000000000..4062b297dd --- /dev/null +++ b/tests/expectations/parser/parser/expression/binary/nand.out @@ -0,0 +1,243 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Unary: + receiver: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":9,\\\"hi\\\":10}\"}" + op: Nand + span: + lo: 2 + hi: 11 + op: Negate + span: + lo: 1 + hi: 11 + op: Not + span: + lo: 0 + hi: 11 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Nand + span: + lo: 0 + hi: 9 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":15,\\\"hi\\\":16}\"}" + op: Nand + span: + lo: 0 + hi: 17 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":23,\\\"hi\\\":24}\"}" + op: Nand + span: + lo: 0 + hi: 25 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Nand + span: + lo: 1 + hi: 10 + op: Negate + span: + lo: 0 + hi: 10 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Negate + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":10,\\\"hi\\\":11}\"}" + op: Nand + span: + lo: 1 + hi: 12 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":9,\\\"hi\\\":10}\"}" + op: Nand + span: + lo: 2 + hi: 11 + op: Negate + span: + lo: 0 + hi: 11 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":9,\\\"hi\\\":10}\"}" + op: Nand + span: + lo: 2 + hi: 11 + op: Negate + span: + lo: 1 + hi: 11 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":18,\\\"hi\\\":19}\"}" + op: Nand + span: + lo: 1 + hi: 20 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Nand + span: + lo: 1 + hi: 10 + op: Not + span: + lo: 0 + hi: 10 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":10,\\\"hi\\\":11}\"}" + op: Nand + span: + lo: 1 + hi: 12 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":9,\\\"hi\\\":10}\"}" + op: Nand + span: + lo: 2 + hi: 11 + op: Not + span: + lo: 0 + hi: 11 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":9,\\\"hi\\\":10}\"}" + op: Nand + span: + lo: 2 + hi: 11 + op: Not + span: + lo: 1 + hi: 11 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":18,\\\"hi\\\":19}\"}" + op: Nand + span: + lo: 1 + hi: 20 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Nand + span: + lo: 1 + hi: 10 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":13,\\\"hi\\\":14}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":20,\\\"hi\\\":21}\"}" + op: Nand + span: + lo: 13 + hi: 22 + op: BitwiseAnd + span: + lo: 1 + hi: 22 + right: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":29,\\\"hi\\\":30}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":36,\\\"hi\\\":37}\"}" + op: Nand + span: + lo: 29 + hi: 38 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":41,\\\"hi\\\":42}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":48,\\\"hi\\\":49}\"}" + op: Nand + span: + lo: 41 + hi: 50 + op: BitwiseAnd + span: + lo: 29 + hi: 50 + op: Nand + span: + lo: 1 + hi: 51 diff --git a/tests/expectations/parser/parser/expression/binary/ne.out b/tests/expectations/parser/parser/expression/binary/ne.out deleted file mode 100644 index bef6f5fe14..0000000000 --- a/tests/expectations/parser/parser/expression/binary/ne.out +++ /dev/null @@ -1,200 +0,0 @@ ---- -namespace: ParseExpression -expectation: Pass -outputs: - - Binary: - left: - Value: - Integer: - - U8 - - "1" - - span: - lo: 0 - hi: 3 - right: - Value: - Integer: - - U8 - - "1" - - span: - lo: 7 - hi: 10 - op: Neq - span: - lo: 0 - hi: 10 - - Binary: - left: - Value: - Integer: - - U8 - - "2" - - span: - lo: 0 - hi: 3 - right: - Value: - Integer: - - U8 - - "3" - - span: - lo: 5 - hi: 8 - op: Neq - span: - lo: 0 - hi: 8 - - Binary: - left: - Binary: - left: - Value: - Integer: - - U8 - - "1" - - span: - lo: 0 - hi: 3 - right: - Value: - Integer: - - U8 - - "2" - - span: - lo: 6 - hi: 9 - op: Lt - span: - lo: 0 - hi: 9 - right: - Binary: - left: - Value: - Integer: - - U8 - - "3" - - span: - lo: 13 - hi: 16 - right: - Value: - Integer: - - U8 - - "4" - - span: - lo: 19 - hi: 22 - op: Lt - span: - lo: 13 - hi: 22 - op: Neq - span: - lo: 0 - hi: 22 - - Binary: - left: - Binary: - left: - Binary: - left: - Value: - Integer: - - U8 - - "1" - - span: - lo: 0 - hi: 3 - right: - Value: - Integer: - - U8 - - "2" - - span: - lo: 6 - hi: 9 - op: Lt - span: - lo: 0 - hi: 9 - right: - Binary: - left: - Value: - Integer: - - U8 - - "3" - - span: - lo: 13 - hi: 16 - right: - Value: - Integer: - - U8 - - "4" - - span: - lo: 19 - hi: 22 - op: Lt - span: - lo: 13 - hi: 22 - op: Neq - span: - lo: 0 - hi: 22 - right: - Binary: - left: - Binary: - left: - Value: - Integer: - - U8 - - "3" - - span: - lo: 26 - hi: 29 - right: - Value: - Integer: - - U8 - - "4" - - span: - lo: 32 - hi: 35 - op: Lt - span: - lo: 26 - hi: 35 - right: - Binary: - left: - Value: - Integer: - - U8 - - "5" - - span: - lo: 39 - hi: 42 - right: - Value: - Integer: - - U8 - - "6" - - span: - lo: 45 - hi: 48 - op: Lt - span: - lo: 39 - hi: 48 - op: Neq - span: - lo: 26 - hi: 48 - op: Or - span: - lo: 0 - hi: 48 diff --git a/tests/expectations/parser/parser/expression/binary/neq.out b/tests/expectations/parser/parser/expression/binary/neq.out new file mode 100644 index 0000000000..e54085d698 --- /dev/null +++ b/tests/expectations/parser/parser/expression/binary/neq.out @@ -0,0 +1,439 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Binary: + left: + Value: + Integer: + - U8 + - "1" + - span: + lo: 0 + hi: 3 + right: + Value: + Integer: + - U8 + - "1" + - span: + lo: 7 + hi: 10 + op: Neq + span: + lo: 0 + hi: 10 + - Binary: + left: + Value: + Integer: + - U8 + - "2" + - span: + lo: 0 + hi: 3 + right: + Value: + Integer: + - U8 + - "3" + - span: + lo: 5 + hi: 8 + op: Neq + span: + lo: 0 + hi: 8 + - Binary: + left: + Binary: + left: + Value: + Integer: + - U8 + - "1" + - span: + lo: 0 + hi: 3 + right: + Value: + Integer: + - U8 + - "2" + - span: + lo: 6 + hi: 9 + op: Lt + span: + lo: 0 + hi: 9 + right: + Binary: + left: + Value: + Integer: + - U8 + - "3" + - span: + lo: 13 + hi: 16 + right: + Value: + Integer: + - U8 + - "4" + - span: + lo: 19 + hi: 22 + op: Lt + span: + lo: 13 + hi: 22 + op: Neq + span: + lo: 0 + hi: 22 + - Binary: + left: + Binary: + left: + Binary: + left: + Value: + Integer: + - U8 + - "1" + - span: + lo: 0 + hi: 3 + right: + Value: + Integer: + - U8 + - "2" + - span: + lo: 6 + hi: 9 + op: Lt + span: + lo: 0 + hi: 9 + right: + Binary: + left: + Value: + Integer: + - U8 + - "3" + - span: + lo: 13 + hi: 16 + right: + Value: + Integer: + - U8 + - "4" + - span: + lo: 19 + hi: 22 + op: Lt + span: + lo: 13 + hi: 22 + op: Neq + span: + lo: 0 + hi: 22 + right: + Binary: + left: + Binary: + left: + Value: + Integer: + - U8 + - "3" + - span: + lo: 26 + hi: 29 + right: + Value: + Integer: + - U8 + - "4" + - span: + lo: 32 + hi: 35 + op: Lt + span: + lo: 26 + hi: 35 + right: + Binary: + left: + Value: + Integer: + - U8 + - "5" + - span: + lo: 39 + hi: 42 + right: + Value: + Integer: + - U8 + - "6" + - span: + lo: 45 + hi: 48 + op: Lt + span: + lo: 39 + hi: 48 + op: Neq + span: + lo: 26 + hi: 48 + op: Or + span: + lo: 0 + hi: 48 + - Unary: + receiver: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Neq + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 1 + hi: 10 + op: Not + span: + lo: 0 + hi: 10 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" + op: Neq + span: + lo: 0 + hi: 8 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":13,\\\"hi\\\":14}\"}" + op: Neq + span: + lo: 0 + hi: 15 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":20,\\\"hi\\\":21}\"}" + op: Neq + span: + lo: 0 + hi: 22 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Neq + span: + lo: 1 + hi: 9 + op: Negate + span: + lo: 0 + hi: 9 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Negate + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":9,\\\"hi\\\":10}\"}" + op: Neq + span: + lo: 1 + hi: 11 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Neq + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 0 + hi: 10 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Neq + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 1 + hi: 10 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: Neq + span: + lo: 1 + hi: 18 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Neq + span: + lo: 1 + hi: 9 + op: Not + span: + lo: 0 + hi: 9 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":9,\\\"hi\\\":10}\"}" + op: Neq + span: + lo: 1 + hi: 11 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Neq + span: + lo: 2 + hi: 10 + op: Not + span: + lo: 0 + hi: 10 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Neq + span: + lo: 2 + hi: 10 + op: Not + span: + lo: 1 + hi: 10 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: Neq + span: + lo: 1 + hi: 18 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Neq + span: + lo: 1 + hi: 9 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":13,\\\"hi\\\":14}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":19,\\\"hi\\\":20}\"}" + op: Neq + span: + lo: 13 + hi: 21 + op: Neq + span: + lo: 1 + hi: 21 + right: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":27,\\\"hi\\\":28}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":33,\\\"hi\\\":34}\"}" + op: Neq + span: + lo: 27 + hi: 35 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":39,\\\"hi\\\":40}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":45,\\\"hi\\\":46}\"}" + op: Neq + span: + lo: 39 + hi: 47 + op: Neq + span: + lo: 27 + hi: 47 + op: Neq + span: + lo: 1 + hi: 48 diff --git a/tests/expectations/parser/parser/expression/binary/ne_fail.out b/tests/expectations/parser/parser/expression/binary/neq_fail.out similarity index 100% rename from tests/expectations/parser/parser/expression/binary/ne_fail.out rename to tests/expectations/parser/parser/expression/binary/neq_fail.out diff --git a/tests/expectations/parser/parser/expression/binary/nor.out b/tests/expectations/parser/parser/expression/binary/nor.out new file mode 100644 index 0000000000..7523b7b32c --- /dev/null +++ b/tests/expectations/parser/parser/expression/binary/nor.out @@ -0,0 +1,243 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Unary: + receiver: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Nor + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 1 + hi: 10 + op: Not + span: + lo: 0 + hi: 10 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" + op: Nor + span: + lo: 0 + hi: 8 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":13,\\\"hi\\\":14}\"}" + op: Nor + span: + lo: 0 + hi: 15 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":20,\\\"hi\\\":21}\"}" + op: Nor + span: + lo: 0 + hi: 22 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Nor + span: + lo: 1 + hi: 9 + op: Negate + span: + lo: 0 + hi: 9 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Negate + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":9,\\\"hi\\\":10}\"}" + op: Nor + span: + lo: 1 + hi: 11 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Nor + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 0 + hi: 10 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Nor + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 1 + hi: 10 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: Nor + span: + lo: 1 + hi: 18 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Nor + span: + lo: 1 + hi: 9 + op: Not + span: + lo: 0 + hi: 9 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":9,\\\"hi\\\":10}\"}" + op: Nor + span: + lo: 1 + hi: 11 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Nor + span: + lo: 2 + hi: 10 + op: Not + span: + lo: 0 + hi: 10 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Nor + span: + lo: 2 + hi: 10 + op: Not + span: + lo: 1 + hi: 10 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: Nor + span: + lo: 1 + hi: 18 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Nor + span: + lo: 1 + hi: 9 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":13,\\\"hi\\\":14}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":19,\\\"hi\\\":20}\"}" + op: Nor + span: + lo: 13 + hi: 21 + op: Neq + span: + lo: 1 + hi: 21 + right: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":27,\\\"hi\\\":28}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":33,\\\"hi\\\":34}\"}" + op: Nor + span: + lo: 27 + hi: 35 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":39,\\\"hi\\\":40}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":45,\\\"hi\\\":46}\"}" + op: Nor + span: + lo: 39 + hi: 47 + op: Neq + span: + lo: 27 + hi: 47 + op: Nor + span: + lo: 1 + hi: 48 diff --git a/tests/expectations/parser/parser/expression/binary/or.out b/tests/expectations/parser/parser/expression/binary/or.out index 8c9e33ae3e..1d1adb9768 100644 --- a/tests/expectations/parser/parser/expression/binary/or.out +++ b/tests/expectations/parser/parser/expression/binary/or.out @@ -5,164 +5,73 @@ outputs: - Binary: left: Value: - Integer: - - U8 - - "1" + Boolean: + - "true" - span: lo: 0 - hi: 3 + hi: 4 right: Value: - Integer: - - U8 - - "1" + Boolean: + - "true" - span: - lo: 6 - hi: 9 - op: Add + lo: 8 + hi: 12 + op: Or span: lo: 0 - hi: 9 + hi: 12 - Binary: left: Value: - Integer: - - U8 - - "2" + Boolean: + - "false" - span: lo: 0 - hi: 3 + hi: 5 right: Value: - Integer: - - U16 - - "3" + Boolean: + - "true" - span: - lo: 4 - hi: 8 - op: Add + lo: 7 + hi: 11 + op: Or span: lo: 0 - hi: 8 + hi: 11 - Binary: left: Binary: left: Value: - Integer: - - U8 - - "1" + Boolean: + - "true" - span: lo: 0 - hi: 3 + hi: 4 right: Value: - Integer: - - U8 - - "2" + Boolean: + - "false" - span: lo: 6 - hi: 9 - op: Add + hi: 11 + op: Or span: lo: 0 - hi: 9 + hi: 11 right: Value: - Integer: - - U8 - - "3" + Boolean: + - "false" - span: - lo: 12 - hi: 15 - op: Add + lo: 15 + hi: 20 + op: Or span: lo: 0 - hi: 15 - - Binary: - left: - Binary: - left: - Value: - Integer: - - U8 - - "1" - - span: - lo: 0 - hi: 3 - right: - Value: - Integer: - - U8 - - "2" - - span: - lo: 6 - hi: 9 - op: Mul - span: - lo: 0 - hi: 9 - right: - Binary: - left: - Value: - Integer: - - U8 - - "3" - - span: - lo: 12 - hi: 15 - right: - Value: - Integer: - - U8 - - "4" - - span: - lo: 18 - hi: 21 - op: Mul - span: - lo: 12 - hi: 21 - op: Add - span: - lo: 0 - hi: 21 - - Binary: - left: - Binary: - left: - Value: - Integer: - - I8 - - "1" - - span: - lo: 0 - hi: 3 - right: - Value: - Integer: - - I8 - - "2" - - span: - lo: 6 - hi: 9 - op: Add - span: - lo: 0 - hi: 9 - right: - Value: - Integer: - - I8 - - "3" - - span: - lo: 12 - hi: 15 - op: Sub - span: - lo: 0 - hi: 15 + hi: 20 - Binary: left: Binary: @@ -170,73 +79,86 @@ outputs: Binary: left: Value: - Integer: - - U8 - - "1" + Boolean: + - "true" - span: lo: 0 - hi: 3 + hi: 4 right: Value: - Integer: - - U8 - - "2" + Boolean: + - "false" - span: - lo: 6 - hi: 9 - op: Mul + lo: 8 + hi: 13 + op: Or span: lo: 0 - hi: 9 + hi: 13 right: - Binary: - left: - Value: - Integer: - - U8 - - "3" - - span: - lo: 12 - hi: 15 - right: - Value: - Integer: - - U8 - - "4" - - span: - lo: 18 - hi: 21 - op: Mul - span: - lo: 12 - hi: 21 - op: Add + Value: + Boolean: + - "true" + - span: + lo: 17 + hi: 21 + op: Or span: lo: 0 hi: 21 right: + Value: + Boolean: + - "false" + - span: + lo: 25 + hi: 30 + op: Or + span: + lo: 0 + hi: 30 + - Binary: + left: Binary: left: Value: - Integer: - - U8 - - "5" + Boolean: + - "true" - span: - lo: 24 - hi: 27 + lo: 0 + hi: 4 right: - Value: - Integer: - - U8 - - "6" - - span: - lo: 30 - hi: 33 - op: Mul + Binary: + left: + Value: + Boolean: + - "true" + - span: + lo: 9 + hi: 13 + right: + Value: + Boolean: + - "false" + - span: + lo: 17 + hi: 22 + op: Or + span: + lo: 9 + hi: 22 + op: Or span: - lo: 24 - hi: 33 - op: Sub + lo: 0 + hi: 22 + right: + Value: + Boolean: + - "true" + - span: + lo: 27 + hi: 31 + op: Or span: lo: 0 - hi: 33 + hi: 31 diff --git a/tests/expectations/parser/parser/expression/binary/pow.out b/tests/expectations/parser/parser/expression/binary/pow.out new file mode 100644 index 0000000000..6f384c01e5 --- /dev/null +++ b/tests/expectations/parser/parser/expression/binary/pow.out @@ -0,0 +1,320 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Binary: + left: + Value: + Integer: + - U8 + - "1" + - span: + lo: 0 + hi: 3 + right: + Value: + Integer: + - U8 + - "1" + - span: + lo: 7 + hi: 10 + op: Pow + span: + lo: 0 + hi: 10 + - Binary: + left: + Value: + Integer: + - U8 + - "2" + - span: + lo: 0 + hi: 3 + right: + Value: + Integer: + - U8 + - "3" + - span: + lo: 5 + hi: 8 + op: Pow + span: + lo: 0 + hi: 8 + - Binary: + left: + Value: + Integer: + - U8 + - "1" + - span: + lo: 0 + hi: 3 + right: + Binary: + left: + Value: + Integer: + - U8 + - "2" + - span: + lo: 7 + hi: 10 + right: + Value: + Integer: + - U8 + - "3" + - span: + lo: 14 + hi: 17 + op: Pow + span: + lo: 7 + hi: 17 + op: Pow + span: + lo: 0 + hi: 17 + - Unary: + receiver: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Pow + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 1 + hi: 10 + op: Not + span: + lo: 0 + hi: 10 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" + op: Pow + span: + lo: 0 + hi: 8 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":13,\\\"hi\\\":14}\"}" + op: Pow + span: + lo: 0 + hi: 15 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":20,\\\"hi\\\":21}\"}" + op: Pow + span: + lo: 0 + hi: 22 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Pow + span: + lo: 1 + hi: 9 + op: Negate + span: + lo: 0 + hi: 9 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Negate + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":9,\\\"hi\\\":10}\"}" + op: Pow + span: + lo: 1 + hi: 11 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Pow + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 0 + hi: 10 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Pow + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 1 + hi: 10 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: Pow + span: + lo: 1 + hi: 18 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Pow + span: + lo: 1 + hi: 9 + op: Not + span: + lo: 0 + hi: 9 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":9,\\\"hi\\\":10}\"}" + op: Pow + span: + lo: 1 + hi: 11 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Pow + span: + lo: 2 + hi: 10 + op: Not + span: + lo: 0 + hi: 10 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Pow + span: + lo: 2 + hi: 10 + op: Not + span: + lo: 1 + hi: 10 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: Pow + span: + lo: 1 + hi: 18 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Pow + span: + lo: 1 + hi: 9 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":13,\\\"hi\\\":14}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":19,\\\"hi\\\":20}\"}" + op: Pow + span: + lo: 13 + hi: 21 + op: Pow + span: + lo: 1 + hi: 21 + right: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":27,\\\"hi\\\":28}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":33,\\\"hi\\\":34}\"}" + op: Pow + span: + lo: 27 + hi: 35 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":39,\\\"hi\\\":40}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":45,\\\"hi\\\":46}\"}" + op: Pow + span: + lo: 39 + hi: 47 + op: Pow + span: + lo: 27 + hi: 47 + op: Pow + span: + lo: 1 + hi: 48 diff --git a/tests/expectations/parser/parser/expression/binary/pow_wrapped.out b/tests/expectations/parser/parser/expression/binary/pow_wrapped.out new file mode 100644 index 0000000000..223a91ff76 --- /dev/null +++ b/tests/expectations/parser/parser/expression/binary/pow_wrapped.out @@ -0,0 +1,243 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Unary: + receiver: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: PowWrapped + span: + lo: 2 + hi: 18 + op: Negate + span: + lo: 1 + hi: 18 + op: Not + span: + lo: 0 + hi: 18 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":14,\\\"hi\\\":15}\"}" + op: PowWrapped + span: + lo: 0 + hi: 16 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":29,\\\"hi\\\":30}\"}" + op: PowWrapped + span: + lo: 0 + hi: 31 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":44,\\\"hi\\\":45}\"}" + op: PowWrapped + span: + lo: 0 + hi: 46 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":15,\\\"hi\\\":16}\"}" + op: PowWrapped + span: + lo: 1 + hi: 17 + op: Negate + span: + lo: 0 + hi: 17 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Negate + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":17,\\\"hi\\\":18}\"}" + op: PowWrapped + span: + lo: 1 + hi: 19 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: PowWrapped + span: + lo: 2 + hi: 18 + op: Negate + span: + lo: 0 + hi: 18 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: PowWrapped + span: + lo: 2 + hi: 18 + op: Negate + span: + lo: 1 + hi: 18 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":32,\\\"hi\\\":33}\"}" + op: PowWrapped + span: + lo: 1 + hi: 34 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":15,\\\"hi\\\":16}\"}" + op: PowWrapped + span: + lo: 1 + hi: 17 + op: Not + span: + lo: 0 + hi: 17 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":17,\\\"hi\\\":18}\"}" + op: PowWrapped + span: + lo: 1 + hi: 19 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: PowWrapped + span: + lo: 2 + hi: 18 + op: Not + span: + lo: 0 + hi: 18 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: PowWrapped + span: + lo: 2 + hi: 18 + op: Not + span: + lo: 1 + hi: 18 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":32,\\\"hi\\\":33}\"}" + op: PowWrapped + span: + lo: 1 + hi: 34 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":15,\\\"hi\\\":16}\"}" + op: PowWrapped + span: + lo: 1 + hi: 17 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":21,\\\"hi\\\":22}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":35,\\\"hi\\\":36}\"}" + op: PowWrapped + span: + lo: 21 + hi: 37 + op: Pow + span: + lo: 1 + hi: 37 + right: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":51,\\\"hi\\\":52}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":65,\\\"hi\\\":66}\"}" + op: PowWrapped + span: + lo: 51 + hi: 67 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":71,\\\"hi\\\":72}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":85,\\\"hi\\\":86}\"}" + op: PowWrapped + span: + lo: 71 + hi: 87 + op: Pow + span: + lo: 51 + hi: 87 + op: PowWrapped + span: + lo: 1 + hi: 88 diff --git a/tests/expectations/parser/parser/expression/binary/shl.out b/tests/expectations/parser/parser/expression/binary/shl.out new file mode 100644 index 0000000000..76d786cc1e --- /dev/null +++ b/tests/expectations/parser/parser/expression/binary/shl.out @@ -0,0 +1,481 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Binary: + left: + Value: + Integer: + - U8 + - "1" + - span: + lo: 0 + hi: 3 + right: + Value: + Integer: + - U8 + - "1" + - span: + lo: 7 + hi: 10 + op: Shl + span: + lo: 0 + hi: 10 + - Binary: + left: + Value: + Integer: + - U8 + - "2" + - span: + lo: 0 + hi: 3 + right: + Value: + Integer: + - U8 + - "3" + - span: + lo: 5 + hi: 8 + op: Shl + span: + lo: 0 + hi: 8 + - Binary: + left: + Binary: + left: + Value: + Integer: + - U8 + - "1" + - span: + lo: 0 + hi: 3 + right: + Value: + Integer: + - U8 + - "2" + - span: + lo: 7 + hi: 10 + op: Shl + span: + lo: 0 + hi: 10 + right: + Value: + Integer: + - U8 + - "3" + - span: + lo: 14 + hi: 17 + op: Shl + span: + lo: 0 + hi: 17 + - Binary: + left: + Binary: + left: + Value: + Integer: + - U8 + - "1" + - span: + lo: 0 + hi: 3 + right: + Value: + Integer: + - U8 + - "2" + - span: + lo: 6 + hi: 9 + op: Add + span: + lo: 0 + hi: 9 + right: + Binary: + left: + Value: + Integer: + - U8 + - "3" + - span: + lo: 13 + hi: 16 + right: + Value: + Integer: + - U8 + - "4" + - span: + lo: 19 + hi: 22 + op: Add + span: + lo: 13 + hi: 22 + op: Shl + span: + lo: 0 + hi: 22 + - Binary: + left: + Binary: + left: + Value: + Integer: + - U8 + - "1" + - span: + lo: 0 + hi: 3 + right: + Value: + Integer: + - U8 + - "2" + - span: + lo: 7 + hi: 10 + op: Shl + span: + lo: 0 + hi: 10 + right: + Value: + Integer: + - U8 + - "3" + - span: + lo: 14 + hi: 17 + op: Shl + span: + lo: 0 + hi: 17 + - Binary: + left: + Binary: + left: + Binary: + left: + Value: + Integer: + - U8 + - "1" + - span: + lo: 0 + hi: 3 + right: + Value: + Integer: + - U8 + - "2" + - span: + lo: 6 + hi: 9 + op: Add + span: + lo: 0 + hi: 9 + right: + Binary: + left: + Value: + Integer: + - U8 + - "3" + - span: + lo: 13 + hi: 16 + right: + Value: + Integer: + - U8 + - "4" + - span: + lo: 19 + hi: 22 + op: Add + span: + lo: 13 + hi: 22 + op: Shl + span: + lo: 0 + hi: 22 + right: + Binary: + left: + Value: + Integer: + - U8 + - "5" + - span: + lo: 26 + hi: 29 + right: + Value: + Integer: + - U8 + - "6" + - span: + lo: 32 + hi: 35 + op: Add + span: + lo: 26 + hi: 35 + op: Shl + span: + lo: 0 + hi: 35 + - Unary: + receiver: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Shl + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 1 + hi: 10 + op: Not + span: + lo: 0 + hi: 10 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" + op: Shl + span: + lo: 0 + hi: 8 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":13,\\\"hi\\\":14}\"}" + op: Shl + span: + lo: 0 + hi: 15 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":20,\\\"hi\\\":21}\"}" + op: Shl + span: + lo: 0 + hi: 22 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Shl + span: + lo: 1 + hi: 9 + op: Negate + span: + lo: 0 + hi: 9 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Negate + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":9,\\\"hi\\\":10}\"}" + op: Shl + span: + lo: 1 + hi: 11 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Shl + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 0 + hi: 10 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Shl + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 1 + hi: 10 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: Shl + span: + lo: 1 + hi: 18 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Shl + span: + lo: 1 + hi: 9 + op: Not + span: + lo: 0 + hi: 9 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":9,\\\"hi\\\":10}\"}" + op: Shl + span: + lo: 1 + hi: 11 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Shl + span: + lo: 2 + hi: 10 + op: Not + span: + lo: 0 + hi: 10 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Shl + span: + lo: 2 + hi: 10 + op: Not + span: + lo: 1 + hi: 10 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: Shl + span: + lo: 1 + hi: 18 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Shl + span: + lo: 1 + hi: 9 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":13,\\\"hi\\\":14}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":19,\\\"hi\\\":20}\"}" + op: Shl + span: + lo: 13 + hi: 21 + op: Shl + span: + lo: 1 + hi: 21 + right: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":27,\\\"hi\\\":28}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":33,\\\"hi\\\":34}\"}" + op: Shl + span: + lo: 27 + hi: 35 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":39,\\\"hi\\\":40}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":45,\\\"hi\\\":46}\"}" + op: Shl + span: + lo: 39 + hi: 47 + op: Shl + span: + lo: 27 + hi: 47 + op: Shl + span: + lo: 1 + hi: 48 diff --git a/tests/expectations/parser/parser/expression/binary/shl_wrapped.out b/tests/expectations/parser/parser/expression/binary/shl_wrapped.out new file mode 100644 index 0000000000..478abf1ade --- /dev/null +++ b/tests/expectations/parser/parser/expression/binary/shl_wrapped.out @@ -0,0 +1,243 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Unary: + receiver: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: ShlWrapped + span: + lo: 2 + hi: 18 + op: Negate + span: + lo: 1 + hi: 18 + op: Not + span: + lo: 0 + hi: 18 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":14,\\\"hi\\\":15}\"}" + op: ShlWrapped + span: + lo: 0 + hi: 16 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":29,\\\"hi\\\":30}\"}" + op: ShlWrapped + span: + lo: 0 + hi: 31 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":44,\\\"hi\\\":45}\"}" + op: ShlWrapped + span: + lo: 0 + hi: 46 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":15,\\\"hi\\\":16}\"}" + op: ShlWrapped + span: + lo: 1 + hi: 17 + op: Negate + span: + lo: 0 + hi: 17 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Negate + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":17,\\\"hi\\\":18}\"}" + op: ShlWrapped + span: + lo: 1 + hi: 19 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: ShlWrapped + span: + lo: 2 + hi: 18 + op: Negate + span: + lo: 0 + hi: 18 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: ShlWrapped + span: + lo: 2 + hi: 18 + op: Negate + span: + lo: 1 + hi: 18 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":32,\\\"hi\\\":33}\"}" + op: ShlWrapped + span: + lo: 1 + hi: 34 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":15,\\\"hi\\\":16}\"}" + op: ShlWrapped + span: + lo: 1 + hi: 17 + op: Not + span: + lo: 0 + hi: 17 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":17,\\\"hi\\\":18}\"}" + op: ShlWrapped + span: + lo: 1 + hi: 19 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: ShlWrapped + span: + lo: 2 + hi: 18 + op: Not + span: + lo: 0 + hi: 18 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: ShlWrapped + span: + lo: 2 + hi: 18 + op: Not + span: + lo: 1 + hi: 18 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":32,\\\"hi\\\":33}\"}" + op: ShlWrapped + span: + lo: 1 + hi: 34 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":15,\\\"hi\\\":16}\"}" + op: ShlWrapped + span: + lo: 1 + hi: 17 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":21,\\\"hi\\\":22}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":35,\\\"hi\\\":36}\"}" + op: ShlWrapped + span: + lo: 21 + hi: 37 + op: Shl + span: + lo: 1 + hi: 37 + right: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":51,\\\"hi\\\":52}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":65,\\\"hi\\\":66}\"}" + op: ShlWrapped + span: + lo: 51 + hi: 67 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":71,\\\"hi\\\":72}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":85,\\\"hi\\\":86}\"}" + op: ShlWrapped + span: + lo: 71 + hi: 87 + op: Shl + span: + lo: 51 + hi: 87 + op: ShlWrapped + span: + lo: 1 + hi: 88 diff --git a/tests/expectations/parser/parser/expression/binary/shr.out b/tests/expectations/parser/parser/expression/binary/shr.out new file mode 100644 index 0000000000..5d1993aeb5 --- /dev/null +++ b/tests/expectations/parser/parser/expression/binary/shr.out @@ -0,0 +1,481 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Binary: + left: + Value: + Integer: + - U8 + - "1" + - span: + lo: 0 + hi: 3 + right: + Value: + Integer: + - U8 + - "1" + - span: + lo: 7 + hi: 10 + op: Shr + span: + lo: 0 + hi: 10 + - Binary: + left: + Value: + Integer: + - U8 + - "2" + - span: + lo: 0 + hi: 3 + right: + Value: + Integer: + - U8 + - "3" + - span: + lo: 5 + hi: 8 + op: Shr + span: + lo: 0 + hi: 8 + - Binary: + left: + Binary: + left: + Value: + Integer: + - U8 + - "1" + - span: + lo: 0 + hi: 3 + right: + Value: + Integer: + - U8 + - "2" + - span: + lo: 7 + hi: 10 + op: Shr + span: + lo: 0 + hi: 10 + right: + Value: + Integer: + - U8 + - "3" + - span: + lo: 14 + hi: 17 + op: Shr + span: + lo: 0 + hi: 17 + - Binary: + left: + Binary: + left: + Value: + Integer: + - U8 + - "1" + - span: + lo: 0 + hi: 3 + right: + Value: + Integer: + - U8 + - "2" + - span: + lo: 6 + hi: 9 + op: Add + span: + lo: 0 + hi: 9 + right: + Binary: + left: + Value: + Integer: + - U8 + - "3" + - span: + lo: 13 + hi: 16 + right: + Value: + Integer: + - U8 + - "4" + - span: + lo: 19 + hi: 22 + op: Add + span: + lo: 13 + hi: 22 + op: Shr + span: + lo: 0 + hi: 22 + - Binary: + left: + Binary: + left: + Value: + Integer: + - U8 + - "1" + - span: + lo: 0 + hi: 3 + right: + Value: + Integer: + - U8 + - "2" + - span: + lo: 7 + hi: 10 + op: Shr + span: + lo: 0 + hi: 10 + right: + Value: + Integer: + - U8 + - "3" + - span: + lo: 14 + hi: 17 + op: Shr + span: + lo: 0 + hi: 17 + - Binary: + left: + Binary: + left: + Binary: + left: + Value: + Integer: + - U8 + - "1" + - span: + lo: 0 + hi: 3 + right: + Value: + Integer: + - U8 + - "2" + - span: + lo: 6 + hi: 9 + op: Add + span: + lo: 0 + hi: 9 + right: + Binary: + left: + Value: + Integer: + - U8 + - "3" + - span: + lo: 13 + hi: 16 + right: + Value: + Integer: + - U8 + - "4" + - span: + lo: 19 + hi: 22 + op: Add + span: + lo: 13 + hi: 22 + op: Shr + span: + lo: 0 + hi: 22 + right: + Binary: + left: + Value: + Integer: + - U8 + - "5" + - span: + lo: 26 + hi: 29 + right: + Value: + Integer: + - U8 + - "6" + - span: + lo: 32 + hi: 35 + op: Add + span: + lo: 26 + hi: 35 + op: Shr + span: + lo: 0 + hi: 35 + - Unary: + receiver: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Shr + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 1 + hi: 10 + op: Not + span: + lo: 0 + hi: 10 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" + op: Shr + span: + lo: 0 + hi: 8 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":13,\\\"hi\\\":14}\"}" + op: Shr + span: + lo: 0 + hi: 15 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":20,\\\"hi\\\":21}\"}" + op: Shr + span: + lo: 0 + hi: 22 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Shr + span: + lo: 1 + hi: 9 + op: Negate + span: + lo: 0 + hi: 9 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Negate + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":9,\\\"hi\\\":10}\"}" + op: Shr + span: + lo: 1 + hi: 11 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Shr + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 0 + hi: 10 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Shr + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 1 + hi: 10 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: Shr + span: + lo: 1 + hi: 18 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Shr + span: + lo: 1 + hi: 9 + op: Not + span: + lo: 0 + hi: 9 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":9,\\\"hi\\\":10}\"}" + op: Shr + span: + lo: 1 + hi: 11 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Shr + span: + lo: 2 + hi: 10 + op: Not + span: + lo: 0 + hi: 10 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Shr + span: + lo: 2 + hi: 10 + op: Not + span: + lo: 1 + hi: 10 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: Shr + span: + lo: 1 + hi: 18 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Shr + span: + lo: 1 + hi: 9 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":13,\\\"hi\\\":14}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":19,\\\"hi\\\":20}\"}" + op: Shr + span: + lo: 13 + hi: 21 + op: Shr + span: + lo: 1 + hi: 21 + right: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":27,\\\"hi\\\":28}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":33,\\\"hi\\\":34}\"}" + op: Shr + span: + lo: 27 + hi: 35 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":39,\\\"hi\\\":40}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":45,\\\"hi\\\":46}\"}" + op: Shr + span: + lo: 39 + hi: 47 + op: Shr + span: + lo: 27 + hi: 47 + op: Shr + span: + lo: 1 + hi: 48 diff --git a/tests/expectations/parser/parser/expression/binary/shr_wrapped.out b/tests/expectations/parser/parser/expression/binary/shr_wrapped.out new file mode 100644 index 0000000000..fca601254b --- /dev/null +++ b/tests/expectations/parser/parser/expression/binary/shr_wrapped.out @@ -0,0 +1,243 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Unary: + receiver: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: ShrWrapped + span: + lo: 2 + hi: 18 + op: Negate + span: + lo: 1 + hi: 18 + op: Not + span: + lo: 0 + hi: 18 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":14,\\\"hi\\\":15}\"}" + op: ShrWrapped + span: + lo: 0 + hi: 16 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":29,\\\"hi\\\":30}\"}" + op: ShrWrapped + span: + lo: 0 + hi: 31 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":44,\\\"hi\\\":45}\"}" + op: ShrWrapped + span: + lo: 0 + hi: 46 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":15,\\\"hi\\\":16}\"}" + op: ShrWrapped + span: + lo: 1 + hi: 17 + op: Negate + span: + lo: 0 + hi: 17 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Negate + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":17,\\\"hi\\\":18}\"}" + op: ShrWrapped + span: + lo: 1 + hi: 19 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: ShrWrapped + span: + lo: 2 + hi: 18 + op: Negate + span: + lo: 0 + hi: 18 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: ShrWrapped + span: + lo: 2 + hi: 18 + op: Negate + span: + lo: 1 + hi: 18 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":32,\\\"hi\\\":33}\"}" + op: ShrWrapped + span: + lo: 1 + hi: 34 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":15,\\\"hi\\\":16}\"}" + op: ShrWrapped + span: + lo: 1 + hi: 17 + op: Not + span: + lo: 0 + hi: 17 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":17,\\\"hi\\\":18}\"}" + op: ShrWrapped + span: + lo: 1 + hi: 19 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: ShrWrapped + span: + lo: 2 + hi: 18 + op: Not + span: + lo: 0 + hi: 18 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: ShrWrapped + span: + lo: 2 + hi: 18 + op: Not + span: + lo: 1 + hi: 18 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":32,\\\"hi\\\":33}\"}" + op: ShrWrapped + span: + lo: 1 + hi: 34 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":15,\\\"hi\\\":16}\"}" + op: ShrWrapped + span: + lo: 1 + hi: 17 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":21,\\\"hi\\\":22}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":35,\\\"hi\\\":36}\"}" + op: ShrWrapped + span: + lo: 21 + hi: 37 + op: Shr + span: + lo: 1 + hi: 37 + right: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":51,\\\"hi\\\":52}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":65,\\\"hi\\\":66}\"}" + op: ShrWrapped + span: + lo: 51 + hi: 67 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":71,\\\"hi\\\":72}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":85,\\\"hi\\\":86}\"}" + op: ShrWrapped + span: + lo: 71 + hi: 87 + op: Shr + span: + lo: 51 + hi: 87 + op: ShrWrapped + span: + lo: 1 + hi: 88 diff --git a/tests/expectations/parser/parser/expression/binary/sub.out b/tests/expectations/parser/parser/expression/binary/sub.out index 66ece742d6..3459baf117 100644 --- a/tests/expectations/parser/parser/expression/binary/sub.out +++ b/tests/expectations/parser/parser/expression/binary/sub.out @@ -128,3 +128,242 @@ outputs: span: lo: 0 hi: 24 + - Unary: + receiver: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Sub + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 1 + hi: 10 + op: Not + span: + lo: 0 + hi: 10 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":6,\\\"hi\\\":7}\"}" + op: Sub + span: + lo: 0 + hi: 8 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":13,\\\"hi\\\":14}\"}" + op: Sub + span: + lo: 0 + hi: 15 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":20,\\\"hi\\\":21}\"}" + op: Sub + span: + lo: 0 + hi: 22 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Sub + span: + lo: 1 + hi: 9 + op: Negate + span: + lo: 0 + hi: 9 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Negate + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":9,\\\"hi\\\":10}\"}" + op: Sub + span: + lo: 1 + hi: 11 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Sub + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 0 + hi: 10 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Sub + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 1 + hi: 10 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: Sub + span: + lo: 1 + hi: 18 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Sub + span: + lo: 1 + hi: 9 + op: Not + span: + lo: 0 + hi: 9 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":9,\\\"hi\\\":10}\"}" + op: Sub + span: + lo: 1 + hi: 11 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Sub + span: + lo: 2 + hi: 10 + op: Not + span: + lo: 0 + hi: 10 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":8,\\\"hi\\\":9}\"}" + op: Sub + span: + lo: 2 + hi: 10 + op: Not + span: + lo: 1 + hi: 10 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: Sub + span: + lo: 1 + hi: 18 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":7,\\\"hi\\\":8}\"}" + op: Sub + span: + lo: 1 + hi: 9 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":13,\\\"hi\\\":14}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":19,\\\"hi\\\":20}\"}" + op: Sub + span: + lo: 13 + hi: 21 + op: Shl + span: + lo: 1 + hi: 21 + right: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":27,\\\"hi\\\":28}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":33,\\\"hi\\\":34}\"}" + op: Sub + span: + lo: 27 + hi: 35 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":39,\\\"hi\\\":40}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":45,\\\"hi\\\":46}\"}" + op: Sub + span: + lo: 39 + hi: 47 + op: Shl + span: + lo: 27 + hi: 47 + op: Sub + span: + lo: 1 + hi: 48 diff --git a/tests/expectations/parser/parser/expression/binary/sub_wrapped.out b/tests/expectations/parser/parser/expression/binary/sub_wrapped.out new file mode 100644 index 0000000000..accd061554 --- /dev/null +++ b/tests/expectations/parser/parser/expression/binary/sub_wrapped.out @@ -0,0 +1,243 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Unary: + receiver: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: SubWrapped + span: + lo: 2 + hi: 18 + op: Negate + span: + lo: 1 + hi: 18 + op: Not + span: + lo: 0 + hi: 18 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":14,\\\"hi\\\":15}\"}" + op: SubWrapped + span: + lo: 0 + hi: 16 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":29,\\\"hi\\\":30}\"}" + op: SubWrapped + span: + lo: 0 + hi: 31 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":44,\\\"hi\\\":45}\"}" + op: SubWrapped + span: + lo: 0 + hi: 46 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":15,\\\"hi\\\":16}\"}" + op: SubWrapped + span: + lo: 1 + hi: 17 + op: Negate + span: + lo: 0 + hi: 17 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Negate + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":17,\\\"hi\\\":18}\"}" + op: SubWrapped + span: + lo: 1 + hi: 19 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: SubWrapped + span: + lo: 2 + hi: 18 + op: Negate + span: + lo: 0 + hi: 18 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: SubWrapped + span: + lo: 2 + hi: 18 + op: Negate + span: + lo: 1 + hi: 18 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":32,\\\"hi\\\":33}\"}" + op: SubWrapped + span: + lo: 1 + hi: 34 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":15,\\\"hi\\\":16}\"}" + op: SubWrapped + span: + lo: 1 + hi: 17 + op: Not + span: + lo: 0 + hi: 17 + - Binary: + left: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 1 + hi: 3 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":17,\\\"hi\\\":18}\"}" + op: SubWrapped + span: + lo: 1 + hi: 19 + - Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: SubWrapped + span: + lo: 2 + hi: 18 + op: Not + span: + lo: 0 + hi: 18 + - Binary: + left: + Unary: + receiver: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":16,\\\"hi\\\":17}\"}" + op: SubWrapped + span: + lo: 2 + hi: 18 + op: Not + span: + lo: 1 + hi: 18 + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":32,\\\"hi\\\":33}\"}" + op: SubWrapped + span: + lo: 1 + hi: 34 + - Binary: + left: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":15,\\\"hi\\\":16}\"}" + op: SubWrapped + span: + lo: 1 + hi: 17 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":21,\\\"hi\\\":22}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":35,\\\"hi\\\":36}\"}" + op: SubWrapped + span: + lo: 21 + hi: 37 + op: Shl + span: + lo: 1 + hi: 37 + right: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":51,\\\"hi\\\":52}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":65,\\\"hi\\\":66}\"}" + op: SubWrapped + span: + lo: 51 + hi: 67 + right: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":71,\\\"hi\\\":72}\"}" + right: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"lo\\\":85,\\\"hi\\\":86}\"}" + op: SubWrapped + span: + lo: 71 + hi: 87 + op: Shl + span: + lo: 51 + hi: 87 + op: SubWrapped + span: + lo: 1 + hi: 88 diff --git a/tests/expectations/parser/parser/expression/circuit_init_fail.out b/tests/expectations/parser/parser/expression/circuit_init_fail.out index 06b5f3baa6..f94b936705 100644 --- a/tests/expectations/parser/parser/expression/circuit_init_fail.out +++ b/tests/expectations/parser/parser/expression/circuit_init_fail.out @@ -2,15 +2,15 @@ namespace: ParseExpression expectation: Fail outputs: - - "Error [EPAR0370005]: expected { -- got ''\n --> test:1:3\n |\n 1 | x {\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got ''\n --> test:1:3\n |\n 1 | x {\n | ^" - "did not consume all input: '}' @ 1:3-4\n" - - "Error [EPAR0370005]: expected { -- got ','\n --> test:1:4\n |\n 1 | x {,}\n | ^" - - "Error [EPAR0370005]: expected { -- got ','\n --> test:1:5\n |\n 1 | x { , }\n | ^" - - "Error [EPAR0370005]: expected { -- got ','\n --> test:1:4\n |\n 1 | x {,,,}\n | ^" - - "Error [EPAR0370005]: expected { -- got 'x'\n --> test:1:4\n |\n 1 | x {x,,}\n | ^" - - "Error [EPAR0370005]: expected { -- got ','\n --> test:1:4\n |\n 1 | x {,,x}\n | ^" - - "Error [EPAR0370005]: expected { -- got ','\n --> test:1:4\n |\n 1 | x {,x}\n | ^" - - "Error [EPAR0370005]: expected { -- got 'x'\n --> test:1:4\n |\n 1 | x {x:y,,}\n | ^" - - "Error [EPAR0370005]: expected { -- got ','\n --> test:1:4\n |\n 1 | x {,,x:y}\n | ^" - - "Error [EPAR0370005]: expected { -- got ','\n --> test:1:4\n |\n 1 | x {,x:y}\n | ^" - - "Error [EPAR0370005]: expected { -- got 'x'\n --> test:1:4\n |\n 1 | x {x:}\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:4\n |\n 1 | x {,}\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:5\n |\n 1 | x { , }\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:4\n |\n 1 | x {,,,}\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:6\n |\n 1 | x {x,,}\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:4\n |\n 1 | x {,,x}\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:4\n |\n 1 | x {,x}\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:8\n |\n 1 | x {x:y,,}\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:4\n |\n 1 | x {,,x:y}\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:4\n |\n 1 | x {,x:y}\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '}'\n --> test:1:6\n |\n 1 | x {x:}\n | ^" diff --git a/tests/expectations/parser/parser/expression/token_format.out b/tests/expectations/parser/parser/expression/token_format.out index fa1afb7906..c3f91a1e76 100644 --- a/tests/expectations/parser/parser/expression/token_format.out +++ b/tests/expectations/parser/parser/expression/token_format.out @@ -42,7 +42,7 @@ outputs: - "Error [EPAR0370009]: unexpected string: expected 'expression', got '..'\n --> test:1:1\n |\n 1 | ...\n | ^^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ';'\n --> test:1:1\n |\n 1 | ;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ':'\n --> test:1:1\n |\n 1 | :\n | ^" - - "did not consume all input: ':' @ 1:2-3\n':' @ 1:3-4\n" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got ''\n --> test:1:2\n |\n 1 | h::\n | ^^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '?'\n --> test:1:1\n |\n 1 | ?\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '->'\n --> test:1:1\n |\n 1 | ->\n | ^^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '_'\n --> test:1:1\n |\n 1 | _\n | ^" diff --git a/tests/expectations/parser/parser/expression/unary/abs.out b/tests/expectations/parser/parser/expression/unary/abs.out new file mode 100644 index 0000000000..5d95459b3f --- /dev/null +++ b/tests/expectations/parser/parser/expression/unary/abs.out @@ -0,0 +1,146 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + op: Abs + span: + lo: 0 + hi: 7 + - Unary: + receiver: + Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + op: Abs + span: + lo: 0 + hi: 7 + op: Abs + span: + lo: 0 + hi: 13 + op: Abs + span: + lo: 0 + hi: 19 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + op: Abs + span: + lo: 1 + hi: 8 + op: Negate + span: + lo: 0 + hi: 8 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Negate + span: + lo: 1 + hi: 3 + op: Abs + span: + lo: 1 + hi: 10 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Abs + span: + lo: 2 + hi: 9 + op: Negate + span: + lo: 0 + hi: 9 + - Unary: + receiver: + Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Abs + span: + lo: 2 + hi: 9 + op: Negate + span: + lo: 1 + hi: 9 + op: Abs + span: + lo: 1 + hi: 16 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + op: Abs + span: + lo: 1 + hi: 8 + op: Not + span: + lo: 0 + hi: 8 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 1 + hi: 3 + op: Abs + span: + lo: 1 + hi: 10 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Abs + span: + lo: 2 + hi: 9 + op: Not + span: + lo: 0 + hi: 9 + - Unary: + receiver: + Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Abs + span: + lo: 2 + hi: 9 + op: Not + span: + lo: 1 + hi: 9 + op: Abs + span: + lo: 1 + hi: 16 diff --git a/tests/expectations/parser/parser/expression/unary/abs_wrapped.out b/tests/expectations/parser/parser/expression/unary/abs_wrapped.out new file mode 100644 index 0000000000..5433c93542 --- /dev/null +++ b/tests/expectations/parser/parser/expression/unary/abs_wrapped.out @@ -0,0 +1,146 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + op: AbsWrapped + span: + lo: 0 + hi: 15 + - Unary: + receiver: + Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + op: AbsWrapped + span: + lo: 0 + hi: 15 + op: AbsWrapped + span: + lo: 0 + hi: 29 + op: AbsWrapped + span: + lo: 0 + hi: 43 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + op: AbsWrapped + span: + lo: 1 + hi: 16 + op: Negate + span: + lo: 0 + hi: 16 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Negate + span: + lo: 1 + hi: 3 + op: AbsWrapped + span: + lo: 1 + hi: 18 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: AbsWrapped + span: + lo: 2 + hi: 17 + op: Negate + span: + lo: 0 + hi: 17 + - Unary: + receiver: + Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: AbsWrapped + span: + lo: 2 + hi: 17 + op: Negate + span: + lo: 1 + hi: 17 + op: AbsWrapped + span: + lo: 1 + hi: 32 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + op: AbsWrapped + span: + lo: 1 + hi: 16 + op: Not + span: + lo: 0 + hi: 16 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 1 + hi: 3 + op: AbsWrapped + span: + lo: 1 + hi: 18 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: AbsWrapped + span: + lo: 2 + hi: 17 + op: Not + span: + lo: 0 + hi: 17 + - Unary: + receiver: + Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: AbsWrapped + span: + lo: 2 + hi: 17 + op: Not + span: + lo: 1 + hi: 17 + op: AbsWrapped + span: + lo: 1 + hi: 32 diff --git a/tests/expectations/parser/parser/expression/unary/double.out b/tests/expectations/parser/parser/expression/unary/double.out new file mode 100644 index 0000000000..f3dbdaaed1 --- /dev/null +++ b/tests/expectations/parser/parser/expression/unary/double.out @@ -0,0 +1,146 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + op: Double + span: + lo: 0 + hi: 10 + - Unary: + receiver: + Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + op: Double + span: + lo: 0 + hi: 10 + op: Double + span: + lo: 0 + hi: 19 + op: Double + span: + lo: 0 + hi: 28 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + op: Double + span: + lo: 1 + hi: 11 + op: Negate + span: + lo: 0 + hi: 11 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Negate + span: + lo: 1 + hi: 3 + op: Double + span: + lo: 1 + hi: 13 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Double + span: + lo: 2 + hi: 12 + op: Negate + span: + lo: 0 + hi: 12 + - Unary: + receiver: + Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Double + span: + lo: 2 + hi: 12 + op: Negate + span: + lo: 1 + hi: 12 + op: Double + span: + lo: 1 + hi: 22 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + op: Double + span: + lo: 1 + hi: 11 + op: Not + span: + lo: 0 + hi: 11 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 1 + hi: 3 + op: Double + span: + lo: 1 + hi: 13 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Double + span: + lo: 2 + hi: 12 + op: Not + span: + lo: 0 + hi: 12 + - Unary: + receiver: + Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Double + span: + lo: 2 + hi: 12 + op: Not + span: + lo: 1 + hi: 12 + op: Double + span: + lo: 1 + hi: 22 diff --git a/tests/expectations/parser/parser/expression/unary/inv.out b/tests/expectations/parser/parser/expression/unary/inv.out new file mode 100644 index 0000000000..a42f31203b --- /dev/null +++ b/tests/expectations/parser/parser/expression/unary/inv.out @@ -0,0 +1,146 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + op: Inverse + span: + lo: 0 + hi: 7 + - Unary: + receiver: + Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + op: Inverse + span: + lo: 0 + hi: 7 + op: Inverse + span: + lo: 0 + hi: 13 + op: Inverse + span: + lo: 0 + hi: 19 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + op: Inverse + span: + lo: 1 + hi: 8 + op: Negate + span: + lo: 0 + hi: 8 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Negate + span: + lo: 1 + hi: 3 + op: Inverse + span: + lo: 1 + hi: 10 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Inverse + span: + lo: 2 + hi: 9 + op: Negate + span: + lo: 0 + hi: 9 + - Unary: + receiver: + Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Inverse + span: + lo: 2 + hi: 9 + op: Negate + span: + lo: 1 + hi: 9 + op: Inverse + span: + lo: 1 + hi: 16 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + op: Inverse + span: + lo: 1 + hi: 8 + op: Not + span: + lo: 0 + hi: 8 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 1 + hi: 3 + op: Inverse + span: + lo: 1 + hi: 10 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Inverse + span: + lo: 2 + hi: 9 + op: Not + span: + lo: 0 + hi: 9 + - Unary: + receiver: + Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Inverse + span: + lo: 2 + hi: 9 + op: Not + span: + lo: 1 + hi: 9 + op: Inverse + span: + lo: 1 + hi: 16 diff --git a/tests/expectations/parser/parser/expression/unary/neg.out b/tests/expectations/parser/parser/expression/unary/neg.out new file mode 100644 index 0000000000..77b8942cad --- /dev/null +++ b/tests/expectations/parser/parser/expression/unary/neg.out @@ -0,0 +1,205 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + op: Negate + span: + lo: 0 + hi: 2 + - Unary: + receiver: + Call: + function: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + arguments: [] + span: + lo: 1 + hi: 4 + op: Negate + span: + lo: 0 + hi: 4 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Negate + span: + lo: 1 + hi: 3 + op: Negate + span: + lo: 0 + hi: 3 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 1 + hi: 3 + op: Negate + span: + lo: 0 + hi: 3 + - Unary: + receiver: + Value: + Integer: + - I8 + - "5" + - span: + lo: 1 + hi: 4 + op: Negate + span: + lo: 0 + hi: 4 + - Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + op: Negate + span: + lo: 0 + hi: 7 + - Unary: + receiver: + Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + op: Negate + span: + lo: 0 + hi: 7 + op: Negate + span: + lo: 0 + hi: 13 + op: Negate + span: + lo: 0 + hi: 19 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + op: Negate + span: + lo: 1 + hi: 8 + op: Negate + span: + lo: 0 + hi: 8 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Negate + span: + lo: 1 + hi: 3 + op: Negate + span: + lo: 1 + hi: 10 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Negate + span: + lo: 2 + hi: 9 + op: Negate + span: + lo: 0 + hi: 9 + - Unary: + receiver: + Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Negate + span: + lo: 2 + hi: 9 + op: Negate + span: + lo: 1 + hi: 9 + op: Negate + span: + lo: 1 + hi: 16 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + op: Negate + span: + lo: 1 + hi: 8 + op: Not + span: + lo: 0 + hi: 8 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 1 + hi: 3 + op: Negate + span: + lo: 1 + hi: 10 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Negate + span: + lo: 2 + hi: 9 + op: Not + span: + lo: 0 + hi: 9 + - Unary: + receiver: + Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Negate + span: + lo: 2 + hi: 9 + op: Not + span: + lo: 1 + hi: 9 + op: Negate + span: + lo: 1 + hi: 16 diff --git a/tests/expectations/parser/parser/expression/unary/negate.out b/tests/expectations/parser/parser/expression/unary/negate.out deleted file mode 100644 index 6b95615862..0000000000 --- a/tests/expectations/parser/parser/expression/unary/negate.out +++ /dev/null @@ -1,63 +0,0 @@ ---- -namespace: ParseExpression -expectation: Pass -outputs: - - Unary: - receiver: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" - op: Negate - span: - lo: 0 - hi: 2 - - Unary: - receiver: - Call: - function: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" - arguments: [] - span: - lo: 1 - hi: 4 - op: Negate - span: - lo: 0 - hi: 4 - - Unary: - receiver: - Unary: - receiver: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" - op: Negate - span: - lo: 1 - hi: 3 - op: Negate - span: - lo: 0 - hi: 3 - - Unary: - receiver: - Unary: - receiver: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" - op: Not - span: - lo: 1 - hi: 3 - op: Negate - span: - lo: 0 - hi: 3 - - Unary: - receiver: - Value: - Integer: - - I8 - - "5" - - span: - lo: 1 - hi: 4 - op: Negate - span: - lo: 0 - hi: 4 diff --git a/tests/expectations/parser/parser/expression/unary/not.out b/tests/expectations/parser/parser/expression/unary/not.out index d8e4bf8976..ab180c58e4 100644 --- a/tests/expectations/parser/parser/expression/unary/not.out +++ b/tests/expectations/parser/parser/expression/unary/not.out @@ -35,6 +35,57 @@ outputs: span: lo: 0 hi: 3 + - Unary: + receiver: + Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 2 + hi: 9 + op: Negate + span: + lo: 1 + hi: 9 + op: Not + span: + lo: 0 + hi: 9 + - Unary: + receiver: + Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + op: Not + span: + lo: 0 + hi: 7 + op: Not + span: + lo: 0 + hi: 13 + op: Not + span: + lo: 0 + hi: 19 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + op: Not + span: + lo: 1 + hi: 8 + op: Negate + span: + lo: 0 + hi: 8 - Unary: receiver: Unary: @@ -45,6 +96,96 @@ outputs: lo: 1 hi: 3 op: Not + span: + lo: 1 + hi: 10 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 2 + hi: 9 + op: Negate span: lo: 0 - hi: 3 + hi: 9 + - Unary: + receiver: + Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 2 + hi: 9 + op: Negate + span: + lo: 1 + hi: 9 + op: Not + span: + lo: 1 + hi: 16 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + op: Not + span: + lo: 1 + hi: 8 + op: Not + span: + lo: 0 + hi: 8 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 1 + hi: 3 + op: Not + span: + lo: 1 + hi: 10 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 2 + hi: 9 + op: Not + span: + lo: 0 + hi: 9 + - Unary: + receiver: + Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 2 + hi: 9 + op: Not + span: + lo: 1 + hi: 9 + op: Not + span: + lo: 1 + hi: 16 diff --git a/tests/expectations/parser/parser/expression/unary/sqrt.out b/tests/expectations/parser/parser/expression/unary/sqrt.out new file mode 100644 index 0000000000..b0cdf73393 --- /dev/null +++ b/tests/expectations/parser/parser/expression/unary/sqrt.out @@ -0,0 +1,158 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Unary: + receiver: + Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: SquareRoot + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 1 + hi: 10 + op: Not + span: + lo: 0 + hi: 10 + - Unary: + receiver: + Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + op: SquareRoot + span: + lo: 0 + hi: 8 + op: SquareRoot + span: + lo: 0 + hi: 15 + op: SquareRoot + span: + lo: 0 + hi: 22 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + op: SquareRoot + span: + lo: 1 + hi: 9 + op: Negate + span: + lo: 0 + hi: 9 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Negate + span: + lo: 1 + hi: 3 + op: SquareRoot + span: + lo: 1 + hi: 11 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: SquareRoot + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 0 + hi: 10 + - Unary: + receiver: + Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: SquareRoot + span: + lo: 2 + hi: 10 + op: Negate + span: + lo: 1 + hi: 10 + op: SquareRoot + span: + lo: 1 + hi: 18 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + op: SquareRoot + span: + lo: 1 + hi: 9 + op: Not + span: + lo: 0 + hi: 9 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 1 + hi: 3 + op: SquareRoot + span: + lo: 1 + hi: 11 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: SquareRoot + span: + lo: 2 + hi: 10 + op: Not + span: + lo: 0 + hi: 10 + - Unary: + receiver: + Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: SquareRoot + span: + lo: 2 + hi: 10 + op: Not + span: + lo: 1 + hi: 10 + op: SquareRoot + span: + lo: 1 + hi: 18 diff --git a/tests/expectations/parser/parser/expression/unary/square.out b/tests/expectations/parser/parser/expression/unary/square.out new file mode 100644 index 0000000000..da10785118 --- /dev/null +++ b/tests/expectations/parser/parser/expression/unary/square.out @@ -0,0 +1,158 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Unary: + receiver: + Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Square + span: + lo: 2 + hi: 12 + op: Negate + span: + lo: 1 + hi: 12 + op: Not + span: + lo: 0 + hi: 12 + - Unary: + receiver: + Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":0,\\\"hi\\\":1}\"}" + op: Square + span: + lo: 0 + hi: 10 + op: Square + span: + lo: 0 + hi: 19 + op: Square + span: + lo: 0 + hi: 28 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + op: Square + span: + lo: 1 + hi: 11 + op: Negate + span: + lo: 0 + hi: 11 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Negate + span: + lo: 1 + hi: 3 + op: Square + span: + lo: 1 + hi: 13 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Square + span: + lo: 2 + hi: 12 + op: Negate + span: + lo: 0 + hi: 12 + - Unary: + receiver: + Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Square + span: + lo: 2 + hi: 12 + op: Negate + span: + lo: 1 + hi: 12 + op: Square + span: + lo: 1 + hi: 22 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":1,\\\"hi\\\":2}\"}" + op: Square + span: + lo: 1 + hi: 11 + op: Not + span: + lo: 0 + hi: 11 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Not + span: + lo: 1 + hi: 3 + op: Square + span: + lo: 1 + hi: 13 + - Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Square + span: + lo: 2 + hi: 12 + op: Not + span: + lo: 0 + hi: 12 + - Unary: + receiver: + Unary: + receiver: + Unary: + receiver: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"lo\\\":2,\\\"hi\\\":3}\"}" + op: Square + span: + lo: 2 + hi: 12 + op: Not + span: + lo: 1 + hi: 12 + op: Square + span: + lo: 1 + hi: 22 diff --git a/tests/expectations/parser/parser/statement/assign_fail.out b/tests/expectations/parser/parser/statement/assign_fail.out index d08ae7ee5c..353fddf784 100644 --- a/tests/expectations/parser/parser/statement/assign_fail.out +++ b/tests/expectations/parser/parser/statement/assign_fail.out @@ -2,7 +2,7 @@ namespace: ParseStatement expectation: Fail outputs: - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::y = y;\n | ^" + - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | x::y = y;\n | ^^^^" - "Error [EPAR0370028]: Could not parse the implicit value: 5.\n --> test:1:1\n |\n 1 | 5 = y;\n | ^" - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | x + x = y;\n | ^^^^^" - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | -x = y;\n | ^^" @@ -12,6 +12,6 @@ outputs: - "Error [EPAR0370009]: unexpected string: expected 'expression', got '['\n --> test:1:1\n |\n 1 | [x, x, x] = y;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '['\n --> test:1:1\n |\n 1 | [x; 3] = y;\n | ^" - "Error [EPAR0370005]: expected A valid expression. -- got 'A tuple expression.'\n --> test:1:1\n |\n 1 | (x, x, x) = y;\n | ^^^^^^^^^" - - "Error [EPAR0370005]: expected { -- got 'x'\n --> test:1:4\n |\n 1 | x {x: y, y: z} = y;\n | ^" + - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | x {x: y, y: z} = y;\n | ^^^^^^^^^^^^^^" - "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | x() = y;\n | ^^^" - "Error [EPAR0370026]: Could not lex the following content: `🦀`.\n" diff --git a/tests/expectations/parser/parser/statement/expression_fail.out b/tests/expectations/parser/parser/statement/expression_fail.out index 844cabc5b1..b384e27692 100644 --- a/tests/expectations/parser/parser/statement/expression_fail.out +++ b/tests/expectations/parser/parser/statement/expression_fail.out @@ -5,6 +5,6 @@ outputs: - "Error [EPAR0370009]: unexpected string: expected 'expression', got ']'\n --> test:1:2\n |\n 1 | (];\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '['\n --> test:1:1\n |\n 1 | [);\n | ^" - "Error [EPAR0370026]: Could not lex the following content: `\\y`.\n" - - "Error [EPAR0370005]: expected ) -- got '|'\n --> test:1:5\n |\n 1 | (x,y|;\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got ';'\n --> test:1:6\n |\n 1 | (x,y|;\n | ^" - "Error [EPAR0370005]: expected ; -- got '['\n --> test:1:2\n |\n 1 | x[};\n | ^" - "Error [EPAR0370005]: expected ) -- got ']'\n --> test:1:6\n |\n 1 | (x, y];\n | ^" diff --git a/tests/expectations/parser/parser/unreachable/define.out b/tests/expectations/parser/parser/unreachable/define.out index 597d069f53..675af70254 100644 --- a/tests/expectations/parser/parser/unreachable/define.out +++ b/tests/expectations/parser/parser/unreachable/define.out @@ -13,7 +13,7 @@ outputs: - "Error [EPAR0370005]: expected ) -- got '='\n --> test:1:5\n |\n 1 | ( x = 10u8;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ')'\n --> test:1:1\n |\n 1 | ) x = 10u8;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ':'\n --> test:1:1\n |\n 1 | : x = 10u8;\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got ':'\n --> test:1:1\n |\n 1 | :: x = 10u8;\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '::'\n --> test:1:1\n |\n 1 | :: x = 10u8;\n | ^^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '?'\n --> test:1:1\n |\n 1 | ? x = 10u8;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '_'\n --> test:1:1\n |\n 1 | _ x = 10u8;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '='\n --> test:1:1\n |\n 1 | = x = 10u8;\n | ^" diff --git a/tests/expectations/parser/parser/unreachable/eat_ident.out b/tests/expectations/parser/parser/unreachable/eat_ident.out index c45c35cbd0..cb16998106 100644 --- a/tests/expectations/parser/parser/unreachable/eat_ident.out +++ b/tests/expectations/parser/parser/unreachable/eat_ident.out @@ -2,4 +2,4 @@ namespace: Parse expectation: Fail outputs: - - "Error [EPAR0370005]: expected 'function', 'circuit', 'test' -- got 'circuit'\n --> test:3:1\n |\n 3 | circuit ;\n | ^^^^^^^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got ';'\n --> test:3:9\n |\n 3 | circuit ;\n | ^" diff --git a/tests/expectations/parser/parser/unreachable/expect_ident.out b/tests/expectations/parser/parser/unreachable/expect_ident.out index 4ce79a4fda..303b8d95ef 100644 --- a/tests/expectations/parser/parser/unreachable/expect_ident.out +++ b/tests/expectations/parser/parser/unreachable/expect_ident.out @@ -2,55 +2,55 @@ namespace: ParseStatement expectation: Fail outputs: - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::;\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::.\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::import\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::,\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::*\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::+\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::-\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::/\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::[\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::]\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::{\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::}\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::(\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::)\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x:::\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::::\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::?\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::_\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::=\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::==\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::!\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::!=\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::>\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::>=\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::<\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::<=\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::>\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::..\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::as\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::console\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::const\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::let\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::for\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::if\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::else\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::i8\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::i16\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::i32\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::i64\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::i128\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::u8\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::u16\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::u32\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::u64\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::u128\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::&\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::return\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::self\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::Self\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::true\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::false\n | ^" - - "Error [EPAR0370005]: expected ; -- got ':'\n --> test:1:2\n |\n 1 | x::0\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got ';'\n --> test:1:4\n |\n 1 | x::;\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got '.'\n --> test:1:4\n |\n 1 | x::.\n | ^" + - "Error [EPAR0370005]: expected ; -- got ''\n --> test:1:4\n |\n 1 | x::import\n | ^^^^^^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:4\n |\n 1 | x::,\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got '*'\n --> test:1:4\n |\n 1 | x::*\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got '+'\n --> test:1:4\n |\n 1 | x::+\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got '-'\n --> test:1:4\n |\n 1 | x::-\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got '/'\n --> test:1:4\n |\n 1 | x::/\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got '['\n --> test:1:4\n |\n 1 | x::[\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got ']'\n --> test:1:4\n |\n 1 | x::]\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got '{'\n --> test:1:4\n |\n 1 | x::{\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got '}'\n --> test:1:4\n |\n 1 | x::}\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got '('\n --> test:1:4\n |\n 1 | x::(\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got ')'\n --> test:1:4\n |\n 1 | x::)\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got ':'\n --> test:1:4\n |\n 1 | x:::\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got '::'\n --> test:1:4\n |\n 1 | x::::\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got '?'\n --> test:1:4\n |\n 1 | x::?\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got '_'\n --> test:1:4\n |\n 1 | x::_\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got '='\n --> test:1:4\n |\n 1 | x::=\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got '=='\n --> test:1:4\n |\n 1 | x::==\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got '!'\n --> test:1:4\n |\n 1 | x::!\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got '!='\n --> test:1:4\n |\n 1 | x::!=\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got '>'\n --> test:1:4\n |\n 1 | x::>\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got '>='\n --> test:1:4\n |\n 1 | x::>=\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got '<'\n --> test:1:4\n |\n 1 | x::<\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got '<='\n --> test:1:4\n |\n 1 | x::<=\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got '>'\n --> test:1:4\n |\n 1 | x::>\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got '..'\n --> test:1:4\n |\n 1 | x::..\n | ^^" + - "Error [EPAR0370005]: expected ; -- got ''\n --> test:1:4\n |\n 1 | x::as\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'console'\n --> test:1:4\n |\n 1 | x::console\n | ^^^^^^^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'const'\n --> test:1:4\n |\n 1 | x::const\n | ^^^^^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'let'\n --> test:1:4\n |\n 1 | x::let\n | ^^^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'for'\n --> test:1:4\n |\n 1 | x::for\n | ^^^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'if'\n --> test:1:4\n |\n 1 | x::if\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'else'\n --> test:1:4\n |\n 1 | x::else\n | ^^^^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'i8'\n --> test:1:4\n |\n 1 | x::i8\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'i16'\n --> test:1:4\n |\n 1 | x::i16\n | ^^^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'i32'\n --> test:1:4\n |\n 1 | x::i32\n | ^^^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'i64'\n --> test:1:4\n |\n 1 | x::i64\n | ^^^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'i128'\n --> test:1:4\n |\n 1 | x::i128\n | ^^^^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'u8'\n --> test:1:4\n |\n 1 | x::u8\n | ^^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'u16'\n --> test:1:4\n |\n 1 | x::u16\n | ^^^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'u32'\n --> test:1:4\n |\n 1 | x::u32\n | ^^^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'u64'\n --> test:1:4\n |\n 1 | x::u64\n | ^^^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'u128'\n --> test:1:4\n |\n 1 | x::u128\n | ^^^^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got '&'\n --> test:1:4\n |\n 1 | x::&\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'return'\n --> test:1:4\n |\n 1 | x::return\n | ^^^^^^" + - "Error [EPAR0370005]: expected ; -- got ''\n --> test:1:4\n |\n 1 | x::self\n | ^^^^" + - "Error [EPAR0370005]: expected ; -- got ''\n --> test:1:4\n |\n 1 | x::Self\n | ^^^^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'true'\n --> test:1:4\n |\n 1 | x::true\n | ^^^^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got 'false'\n --> test:1:4\n |\n 1 | x::false\n | ^^^^^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got '0'\n --> test:1:4\n |\n 1 | x::0\n | ^" diff --git a/tests/expectations/parser/parser/unreachable/math_op_fail.out b/tests/expectations/parser/parser/unreachable/math_op_fail.out index 352fa81524..81a7975b1a 100644 --- a/tests/expectations/parser/parser/unreachable/math_op_fail.out +++ b/tests/expectations/parser/parser/unreachable/math_op_fail.out @@ -45,18 +45,18 @@ outputs: - "Error [EPAR0370005]: expected ; -- got ','\n --> test:1:2\n |\n 1 | x,=b; // 43\n | ^" - "Error [EPAR0370005]: expected ; -- got '['\n --> test:1:2\n |\n 1 | x[=b;\n | ^" - "Error [EPAR0370005]: expected ; -- got ']'\n --> test:1:2\n |\n 1 | x]=b;\n | ^" - - "Error [EPAR0370005]: expected { -- got '='\n --> test:1:3\n |\n 1 | x{=b;\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'ident', got '='\n --> test:1:3\n |\n 1 | x{=b;\n | ^" - "Error [EPAR0370005]: expected ; -- got '}'\n --> test:1:2\n |\n 1 | x}=b;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ';'\n --> test:1:4\n |\n 1 | x=(;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ')'\n --> test:1:3\n |\n 1 | x=);\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ':'\n --> test:1:3\n |\n 1 | x=:;\n | ^" - - "Error [EPAR0370009]: unexpected string: expected 'expression', got ':'\n --> test:1:3\n |\n 1 | x=::;\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '::'\n --> test:1:3\n |\n 1 | x=::;\n | ^^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '='\n --> test:1:3\n |\n 1 | x?=b;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '='\n --> test:1:4\n |\n 1 | x!==b;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '='\n --> test:1:4\n |\n 1 | x>==b;\n | ^" - "Error [EPAR0370009]: unexpected string: expected 'expression', got '='\n --> test:1:4\n |\n 1 | x<==b;\n | ^" - "Error [EPAR0370005]: expected ; -- got '..'\n --> test:1:2\n |\n 1 | x..=b;\n | ^^" - - "Error [EPAR0370005]: expected ; -- got '&'\n --> test:1:2\n |\n 1 | x&=b;\n | ^" + - "Error [EPAR0370009]: unexpected string: expected 'expression', got '='\n --> test:1:3\n |\n 1 | x&=b;\n | ^" - "Error [EPAR0370041]: Expression statements are no longer supported.\n --> test:1:1\n |\n 1 | x==b;\n | ^^^^^" - "Error [EPAR0370041]: Expression statements are no longer supported.\n --> test:1:1\n |\n 1 | x!=b;\n | ^^^^^" - "Error [EPAR0370041]: Expression statements are no longer supported.\n --> test:1:1\n |\n 1 | x>=b;\n | ^^^^^" diff --git a/tests/parser/expression/binary/add.leo b/tests/parser/expression/binary/add.leo index 5b8489cb66..58762462ca 100644 --- a/tests/parser/expression/binary/add.leo +++ b/tests/parser/expression/binary/add.leo @@ -4,13 +4,20 @@ expectation: Pass */ 1u8 + 1u8 - 2u8+3u8 - 1u8 + 2u8 + 3u8 - 1u8 * 2u8 + 3u8 * 4u8 - 1u8 + 2u8 - 3u8 +1u8 * 2u8 + 3u8 * 4u8 - 5u8 * 6u8 -1u8 * 2u8 + 3u8 * 4u8 - 5u8 * 6u8 \ No newline at end of file +!-x.add(y) +x.add(y).add(y).add(y) +-x.add(y) +(-x).add(y) +-(x.add(y)) +(-x.add(y)).add(y) +!x.add(y) +(!x).add(y) +!(x.add(y)) +(!x.add(y)).add(y) +(x.add(y) + x.add(y)).add(x.add(y) + x.add(y)) \ No newline at end of file diff --git a/tests/parser/expression/binary/add_wrapped.leo b/tests/parser/expression/binary/add_wrapped.leo new file mode 100644 index 0000000000..d50c44a5f8 --- /dev/null +++ b/tests/parser/expression/binary/add_wrapped.leo @@ -0,0 +1,16 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +!-x.add_wrapped(y) +x.add_wrapped(y).add_wrapped(y).add_wrapped(y) +-x.add_wrapped(y) +(-x).add_wrapped(y) +-(x.add_wrapped(y)) +(-x.add_wrapped(y)).add_wrapped(y) +!x.add_wrapped(y) +(!x).add_wrapped(y) +!(x.add_wrapped(y)) +(!x.add_wrapped(y)).add_wrapped(y) +(x.add_wrapped(y) + x.add_wrapped(y)).add_wrapped(x.add_wrapped(y) + x.add_wrapped(y)) \ No newline at end of file diff --git a/tests/parser/expression/binary/and.leo b/tests/parser/expression/binary/and.leo index bc2fa9aaf3..7072d5bdc0 100644 --- a/tests/parser/expression/binary/and.leo +++ b/tests/parser/expression/binary/and.leo @@ -7,4 +7,16 @@ true && false false&&true -true&&false&&true \ No newline at end of file +true&&false&&true + +!-x.and(y) +x.and(y).and(y).and(y) +-x.and(y) +(-x).and(y) +-(x.and(y)) +(-x.and(y)).and(y) +!x.and(y) +(!x).and(y) +!(x.and(y)) +(!x.and(y)).and(y) +(x.and(y) + x.and(y)).and(x.and(y) + x.and(y)) \ No newline at end of file diff --git a/tests/parser/expression/binary/bit_and.leo b/tests/parser/expression/binary/bit_and.leo new file mode 100644 index 0000000000..506a561c64 --- /dev/null +++ b/tests/parser/expression/binary/bit_and.leo @@ -0,0 +1,28 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +1u8 & 1u8 + +2u8&3u8 + +1u8 & 2u8 & 3u8 + +1u8 | 2u8 & 3u8 | 4u8 + +1u8 & 2u8 & 3u8 + +1u8 | 2u8 & 3u8 | 4u8 & 5u8 | 6u8 + +!-x.and(y) +x.and(y).and(y).and(y) +-x.and(y) +(-x).and(y) +-(x.and(y)) +(-x.and(y)).and(y) +!x.and(y) +(!x).and(y) +!(x.and(y)) +(!x.and(y)).and(y) +(x.and(y) & x.and(y)).and(x.and(y) & x.and(y)) \ No newline at end of file diff --git a/tests/parser/expression/binary/bit_and.leo.off b/tests/parser/expression/binary/bit_and.leo.off deleted file mode 100644 index 5f122c5c8c..0000000000 --- a/tests/parser/expression/binary/bit_and.leo.off +++ /dev/null @@ -1,16 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - -1 & 1 - -2&3 - -1 & 2 & 3 - -1 == 2 & 3 == 4 - -1 & 2 & 3 - -1 == 2 & 3 == 4 & 5 == 6 \ No newline at end of file diff --git a/tests/parser/expression/binary/bit_or.leo b/tests/parser/expression/binary/bit_or.leo new file mode 100644 index 0000000000..7b1a2eff56 --- /dev/null +++ b/tests/parser/expression/binary/bit_or.leo @@ -0,0 +1,28 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +1u8 | 1u8 + +2u8|3u8 + +1u8 | 2u8 | 3u8 + +1u8 ^ 2u8 | 3u8 ^ 4u8 + +1u8 | 2u8 | 3u8 + +1u8 ^ 2u8 | 3u8 ^ 4u8 | 5u8 ^ 6u8 + +!-x.or(y) +x.or(y).or(y).or(y) +-x.or(y) +(-x).or(y) +-(x.or(y)) +(-x.or(y)).or(y) +!x.or(y) +(!x).or(y) +!(x.or(y)) +(!x.or(y)).or(y) +(x.or(y) | x.or(y)).or(x.or(y) | x.or(y)) \ No newline at end of file diff --git a/tests/parser/expression/binary/bit_or.leo.off b/tests/parser/expression/binary/bit_or.leo.off deleted file mode 100644 index afe99bc0f1..0000000000 --- a/tests/parser/expression/binary/bit_or.leo.off +++ /dev/null @@ -1,16 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - -1 | 1 - -2|3 - -1 | 2 | 3 - -1 ^ 2 | 3 ^ 4 - -1 | 2 | 3 - -1 ^ 2 | 3 ^ 4 | 5 ^ 6 \ No newline at end of file diff --git a/tests/parser/expression/binary/bit_xor.leo b/tests/parser/expression/binary/bit_xor.leo new file mode 100644 index 0000000000..4153640e3a --- /dev/null +++ b/tests/parser/expression/binary/bit_xor.leo @@ -0,0 +1,28 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +1u8 ^ 1u8 + +2u8^3u8 + +1u8 ^ 2u8 ^ 3u8 + +1u8 & 2u8 ^ 3u8 & 4u8 + +1u8 ^ 2u8 ^ 3u8 + +1u8 & 2u8 ^ 3u8 & 4u8 ^ 5u8 & 6u8 + +!-x.xor(y) +x.xor(y).xor(y).xor(y) +-x.xor(y) +(-x).xor(y) +-(x.xor(y)) +(-x.xor(y)).xor(y) +!x.xor(y) +(!x).xor(y) +!(x.xor(y)) +(!x.xor(y)).xor(y) +(x.xor(y) ^ x.xor(y)).xor(x.xor(y) ^ x.xor(y)) \ No newline at end of file diff --git a/tests/parser/expression/binary/bit_xor.leo.off b/tests/parser/expression/binary/bit_xor.leo.off deleted file mode 100644 index 1bfb8df786..0000000000 --- a/tests/parser/expression/binary/bit_xor.leo.off +++ /dev/null @@ -1,16 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - -1 ^ 1 - -2^3 - -1 ^ 2 ^ 3 - -1 & 2 ^ 3 & 4 - -1 ^ 2 ^ 3 - -1 & 2 ^ 3 & 4 ^ 5 & 6 \ No newline at end of file diff --git a/tests/parser/expression/binary/div.leo b/tests/parser/expression/binary/div.leo index c4d82af45a..37211031e7 100644 --- a/tests/parser/expression/binary/div.leo +++ b/tests/parser/expression/binary/div.leo @@ -9,4 +9,16 @@ expectation: Pass 1u8 / 2u8 / 3u8 -1u8 ** 2u8 / 3u8 ** 4u8 \ No newline at end of file +1u8 ** 2u8 / 3u8 ** 4u8 + +!-x.div(y) +x.div(y).div(y).div(y) +-x.div(y) +(-x).div(y) +-(x.div(y)) +(-x.div(y)).div(y) +!x.div(y) +(!x).div(y) +!(x.div(y)) +(!x.div(y)).div(y) +(x.div(y) / x.div(y)).div(x.div(y) / x.div(y)) \ No newline at end of file diff --git a/tests/parser/expression/binary/div_wrapped.leo b/tests/parser/expression/binary/div_wrapped.leo new file mode 100644 index 0000000000..f9b7d75567 --- /dev/null +++ b/tests/parser/expression/binary/div_wrapped.leo @@ -0,0 +1,16 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +!-x.div(y) +x.div(y).div(y).div(y) +-x.div(y) +(-x).div(y) +-(x.div(y)) +(-x.div(y)).div(y) +!x.div(y) +(!x).div(y) +!(x.div(y)) +(!x.div(y)).div(y) +(x.div(y) / x.div(y)).div(x.div(y) / x.div(y)) \ No newline at end of file diff --git a/tests/parser/expression/binary/eq.leo b/tests/parser/expression/binary/eq.leo index f9cc00f6a7..9a043a4bf7 100644 --- a/tests/parser/expression/binary/eq.leo +++ b/tests/parser/expression/binary/eq.leo @@ -9,4 +9,16 @@ expectation: Pass 1u8 < 2u8 == 3u8 < 4u8 -1u8 < 2u8 == 3u8 < 4u8 && 3u8 < 4u8 == 5u8 < 6u8 \ No newline at end of file +1u8 < 2u8 == 3u8 < 4u8 && 3u8 < 4u8 == 5u8 < 6u8 + +!-x.eq(y) +x.eq(y).eq(y).eq(y) +-x.eq(y) +(-x).eq(y) +-(x.eq(y)) +(-x.eq(y)).eq(y) +!x.eq(y) +(!x).eq(y) +!(x.eq(y)) +(!x.eq(y)).eq(y) +(x.eq(y) == x.eq(y)).eq(x.eq(y) == x.eq(y)) \ No newline at end of file diff --git a/tests/parser/expression/binary/exp.leo b/tests/parser/expression/binary/exp.leo deleted file mode 100644 index 3b183955e2..0000000000 --- a/tests/parser/expression/binary/exp.leo +++ /dev/null @@ -1,11 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - -1u8 ** 1u8 - -2u8**3u8 - -1u8 ** 2u8 ** 3u8 - diff --git a/tests/parser/expression/binary/ge.leo b/tests/parser/expression/binary/ge.leo new file mode 100644 index 0000000000..4160720674 --- /dev/null +++ b/tests/parser/expression/binary/ge.leo @@ -0,0 +1,22 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +1u8 >= 1u8 + +2u8 >= 3u8 + +1u8 + 2u8 >= 3u8 + 4u8 + +!-x.ge(y) +x.ge(y).ge(y).ge(y) +-x.ge(y) +(-x).ge(y) +-(x.ge(y)) +(-x.ge(y)).ge(y) +!x.ge(y) +(!x).ge(y) +!(x.ge(y)) +(!x.ge(y)).ge(y) +(x.ge(y) >= x.ge(y)).ge(x.ge(y) >= x.ge(y)) \ No newline at end of file diff --git a/tests/parser/expression/binary/gte_fail.leo b/tests/parser/expression/binary/ge_fail.leo similarity index 100% rename from tests/parser/expression/binary/gte_fail.leo rename to tests/parser/expression/binary/ge_fail.leo diff --git a/tests/parser/expression/binary/gt.leo b/tests/parser/expression/binary/gt.leo index 3776372755..cb25b256fa 100644 --- a/tests/parser/expression/binary/gt.leo +++ b/tests/parser/expression/binary/gt.leo @@ -7,4 +7,16 @@ expectation: Pass 2u8>3u8 -1u8 + 2u8 > 3u8 + 4u8 \ No newline at end of file +1u8 + 2u8 > 3u8 + 4u8 + +!-x.gt(y) +x.gt(y).gt(y).gt(y) +-x.gt(y) +(-x).gt(y) +-(x.gt(y)) +(-x.gt(y)).gt(y) +!x.gt(y) +(!x).gt(y) +!(x.gt(y)) +(!x.gt(y)).gt(y) +(x.gt(y) > x.gt(y)).gt(x.gt(y) > x.gt(y)) \ No newline at end of file diff --git a/tests/parser/expression/binary/gt.leo.off b/tests/parser/expression/binary/gt.leo.off deleted file mode 100644 index d66b9bb7f0..0000000000 --- a/tests/parser/expression/binary/gt.leo.off +++ /dev/null @@ -1,16 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - -1 > 1 - -2>3 - -1 > 2 > 3 - -1 >> 2 > 3 >> 4 - -1 > 2 > 3 - -1 >> 2 > 3 >> 4 > 5 >> 6 \ No newline at end of file diff --git a/tests/parser/expression/binary/gte.leo b/tests/parser/expression/binary/gte.leo deleted file mode 100644 index dae7325d1f..0000000000 --- a/tests/parser/expression/binary/gte.leo +++ /dev/null @@ -1,10 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - -1u8 >= 1u8 - -2u8 >= 3u8 - -1u8 + 2u8 >= 3u8 + 4u8 \ No newline at end of file diff --git a/tests/parser/expression/binary/gte.leo.off b/tests/parser/expression/binary/gte.leo.off deleted file mode 100644 index 929b13fa40..0000000000 --- a/tests/parser/expression/binary/gte.leo.off +++ /dev/null @@ -1,16 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - -1 >= 1 - -2 >= 3 - -1 >= 2 >= 3 - -1 >> 2 >= 3 >> 4 - -1 >= 2 >= 3 - -1 >> 2 >= 3 >> 4 >= 5 >> 6 \ No newline at end of file diff --git a/tests/parser/expression/binary/le.leo b/tests/parser/expression/binary/le.leo new file mode 100644 index 0000000000..e24c7580e8 --- /dev/null +++ b/tests/parser/expression/binary/le.leo @@ -0,0 +1,22 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +1u8 <= 1u8 + +2u8 <= 3u8 + +1u8 + 2u8 <= 3u8 + 4u8 + +!-x.le(y) +x.le(y).le(y).le(y) +-x.le(y) +(-x).le(y) +-(x.le(y)) +(-x.le(y)).le(y) +!x.le(y) +(!x).le(y) +!(x.le(y)) +(!x.le(y)).le(y) +(x.le(y) <= x.le(y)).le(x.le(y) <= x.le(y)) \ No newline at end of file diff --git a/tests/parser/expression/binary/lte_fail.leo b/tests/parser/expression/binary/le_fail.leo similarity index 100% rename from tests/parser/expression/binary/lte_fail.leo rename to tests/parser/expression/binary/le_fail.leo diff --git a/tests/parser/expression/binary/lt.leo b/tests/parser/expression/binary/lt.leo index eff6f96acc..63dd8b6e77 100644 --- a/tests/parser/expression/binary/lt.leo +++ b/tests/parser/expression/binary/lt.leo @@ -7,4 +7,16 @@ expectation: Pass 2u8<3u8 -1u8 + 2u8 < 3u8 + 4u8 \ No newline at end of file +1u8 + 2u8 < 3u8 + 4u8 + +!-x.lt(y) +x.lt(y).lt(y).lt(y) +-x.lt(y) +(-x).lt(y) +-(x.lt(y)) +(-x.lt(y)).lt(y) +!x.lt(y) +(!x).lt(y) +!(x.lt(y)) +(!x.lt(y)).lt(y) +(x.lt(y) < x.lt(y)).lt(x.lt(y) < x.lt(y)) \ No newline at end of file diff --git a/tests/parser/expression/binary/lt.leo.off b/tests/parser/expression/binary/lt.leo.off deleted file mode 100644 index 7f74c3f2fc..0000000000 --- a/tests/parser/expression/binary/lt.leo.off +++ /dev/null @@ -1,16 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - -1 < 1 - -2<3 - -1 < 2 < 3 - -1 << 2 < 3 << 4 - -1 < 2 < 3 - -1 << 2 < 3 << 4 < 5 << 6 \ No newline at end of file diff --git a/tests/parser/expression/binary/lte.leo b/tests/parser/expression/binary/lte.leo deleted file mode 100644 index 6f044c5829..0000000000 --- a/tests/parser/expression/binary/lte.leo +++ /dev/null @@ -1,10 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - -1u8 <= 1u8 - -2u8 <= 3u8 - -1u8 + 2u8 <= 3u8 + 4u8 \ No newline at end of file diff --git a/tests/parser/expression/binary/lte.leo.off b/tests/parser/expression/binary/lte.leo.off deleted file mode 100644 index 611fb11cf4..0000000000 --- a/tests/parser/expression/binary/lte.leo.off +++ /dev/null @@ -1,16 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - -1 <= 1 - -2 <= 3 - -1 <= 2 <= 3 - -1 << 2 <= 3 << 4 - -1 <= 2 <= 3 - -1 << 2 <= 3 << 4 <= 5 << 6 \ No newline at end of file diff --git a/tests/parser/expression/binary/mod.leo.off b/tests/parser/expression/binary/mod.leo.off deleted file mode 100644 index f20d9fd262..0000000000 --- a/tests/parser/expression/binary/mod.leo.off +++ /dev/null @@ -1,14 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - -1 % 1 - -2%3 - -1 % 2 % 3 - -1 ** 2 % 3 ** 4 - -1 ** 2 % 3 ** 4 % 5 ** 6 \ No newline at end of file diff --git a/tests/parser/expression/binary/mul.leo b/tests/parser/expression/binary/mul.leo index dc07a6ffcb..b147afa3ca 100644 --- a/tests/parser/expression/binary/mul.leo +++ b/tests/parser/expression/binary/mul.leo @@ -11,4 +11,16 @@ expectation: Pass 1u8 ** 2u8 * 3u8 ** 4u8 -1u8 ** 2u8 * 3u8 ** 4u8 / 5u8 ** 6u8 \ No newline at end of file +1u8 ** 2u8 * 3u8 ** 4u8 / 5u8 ** 6u8 + +!-x.mul(y) +x.mul(y).mul(y).mul(y) +-x.mul(y) +(-x).mul(y) +-(x.mul(y)) +(-x.mul(y)).mul(y) +!x.mul(y) +(!x).mul(y) +!(x.mul(y)) +(!x.mul(y)).mul(y) +(x.mul(y) * x.mul(y)).mul(x.mul(y) * x.mul(y)) \ No newline at end of file diff --git a/tests/parser/expression/binary/mul_wrapped.leo b/tests/parser/expression/binary/mul_wrapped.leo new file mode 100644 index 0000000000..dfaaa0ba92 --- /dev/null +++ b/tests/parser/expression/binary/mul_wrapped.leo @@ -0,0 +1,16 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +!-x.mul_wrapped(y) +x.mul_wrapped(y).mul_wrapped(y).mul_wrapped(y) +-x.mul_wrapped(y) +(-x).mul_wrapped(y) +-(x.mul_wrapped(y)) +(-x.mul_wrapped(y)).mul_wrapped(y) +!x.mul_wrapped(y) +(!x).mul_wrapped(y) +!(x.mul_wrapped(y)) +(!x.mul_wrapped(y)).mul_wrapped(y) +(x.mul_wrapped(y) * x.mul_wrapped(y)).mul_wrapped(x.mul_wrapped(y) * x.mul_wrapped(y)) \ No newline at end of file diff --git a/tests/parser/expression/binary/nand.leo b/tests/parser/expression/binary/nand.leo new file mode 100644 index 0000000000..eb5db418d0 --- /dev/null +++ b/tests/parser/expression/binary/nand.leo @@ -0,0 +1,16 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +!-x.nand(y) +x.nand(y).nand(y).nand(y) +-x.nand(y) +(-x).nand(y) +-(x.nand(y)) +(-x.nand(y)).nand(y) +!x.nand(y) +(!x).nand(y) +!(x.nand(y)) +(!x.nand(y)).nand(y) +(x.nand(y) & x.nand(y)).nand(x.nand(y) & x.nand(y)) \ No newline at end of file diff --git a/tests/parser/expression/binary/ne.leo b/tests/parser/expression/binary/ne.leo deleted file mode 100644 index 37a09c8571..0000000000 --- a/tests/parser/expression/binary/ne.leo +++ /dev/null @@ -1,12 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - -1u8 != 1u8 - -2u8!=3u8 - -1u8 < 2u8 != 3u8 < 4u8 - -1u8 < 2u8 != 3u8 < 4u8 || 3u8 < 4u8 != 5u8 < 6u8 \ No newline at end of file diff --git a/tests/parser/expression/binary/neq.leo b/tests/parser/expression/binary/neq.leo new file mode 100644 index 0000000000..56c7608173 --- /dev/null +++ b/tests/parser/expression/binary/neq.leo @@ -0,0 +1,24 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +1u8 != 1u8 + +2u8!=3u8 + +1u8 < 2u8 != 3u8 < 4u8 + +1u8 < 2u8 != 3u8 < 4u8 || 3u8 < 4u8 != 5u8 < 6u8 + +!-x.neq(y) +x.neq(y).neq(y).neq(y) +-x.neq(y) +(-x).neq(y) +-(x.neq(y)) +(-x.neq(y)).neq(y) +!x.neq(y) +(!x).neq(y) +!(x.neq(y)) +(!x.neq(y)).neq(y) +(x.neq(y) != x.neq(y)).neq(x.neq(y) != x.neq(y)) \ No newline at end of file diff --git a/tests/parser/expression/binary/ne_fail.leo b/tests/parser/expression/binary/neq_fail.leo similarity index 100% rename from tests/parser/expression/binary/ne_fail.leo rename to tests/parser/expression/binary/neq_fail.leo diff --git a/tests/parser/expression/binary/nor.leo b/tests/parser/expression/binary/nor.leo new file mode 100644 index 0000000000..f67ddb0534 --- /dev/null +++ b/tests/parser/expression/binary/nor.leo @@ -0,0 +1,16 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +!-x.nor(y) +x.nor(y).nor(y).nor(y) +-x.nor(y) +(-x).nor(y) +-(x.nor(y)) +(-x.nor(y)).nor(y) +!x.nor(y) +(!x).nor(y) +!(x.nor(y)) +(!x.nor(y)).nor(y) +(x.nor(y) != x.nor(y)).nor(x.nor(y) != x.nor(y)) \ No newline at end of file diff --git a/tests/parser/expression/binary/or.leo b/tests/parser/expression/binary/or.leo index 7a9fcda22e..16586f49c7 100644 --- a/tests/parser/expression/binary/or.leo +++ b/tests/parser/expression/binary/or.leo @@ -3,14 +3,12 @@ namespace: ParseExpression expectation: Pass */ -1u8 + 1u8 +true || true -2u8+3u16 +false||true -1u8 + 2u8 + 3u8 +true||false || false -1u8 * 2u8 + 3u8 * 4u8 +true || false || true || false -1i8 + 2i8 - 3i8 - -1u8 * 2u8 + 3u8 * 4u8 - 5u8 * 6u8 \ No newline at end of file +true || (true || false) || true \ No newline at end of file diff --git a/tests/parser/expression/binary/pow.leo b/tests/parser/expression/binary/pow.leo new file mode 100644 index 0000000000..e59e5424e9 --- /dev/null +++ b/tests/parser/expression/binary/pow.leo @@ -0,0 +1,22 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +1u8 ** 1u8 + +2u8**3u8 + +1u8 ** 2u8 ** 3u8 + +!-x.pow(y) +x.pow(y).pow(y).pow(y) +-x.pow(y) +(-x).pow(y) +-(x.pow(y)) +(-x.pow(y)).pow(y) +!x.pow(y) +(!x).pow(y) +!(x.pow(y)) +(!x.pow(y)).pow(y) +(x.pow(y) ** x.pow(y)).pow(x.pow(y) ** x.pow(y)) \ No newline at end of file diff --git a/tests/parser/expression/binary/pow_wrapped.leo b/tests/parser/expression/binary/pow_wrapped.leo new file mode 100644 index 0000000000..9a4635df57 --- /dev/null +++ b/tests/parser/expression/binary/pow_wrapped.leo @@ -0,0 +1,16 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +!-x.pow_wrapped(y) +x.pow_wrapped(y).pow_wrapped(y).pow_wrapped(y) +-x.pow_wrapped(y) +(-x).pow_wrapped(y) +-(x.pow_wrapped(y)) +(-x.pow_wrapped(y)).pow_wrapped(y) +!x.pow_wrapped(y) +(!x).pow_wrapped(y) +!(x.pow_wrapped(y)) +(!x.pow_wrapped(y)).pow_wrapped(y) +(x.pow_wrapped(y) ** x.pow_wrapped(y)).pow_wrapped(x.pow_wrapped(y) ** x.pow_wrapped(y)) \ No newline at end of file diff --git a/tests/parser/expression/binary/shl.leo b/tests/parser/expression/binary/shl.leo new file mode 100644 index 0000000000..71f28297a3 --- /dev/null +++ b/tests/parser/expression/binary/shl.leo @@ -0,0 +1,28 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +1u8 << 1u8 + +2u8<<3u8 + +1u8 << 2u8 << 3u8 + +1u8 + 2u8 << 3u8 + 4u8 + +1u8 << 2u8 << 3u8 + +1u8 + 2u8 << 3u8 + 4u8 << 5u8 + 6u8 + +!-x.shl(y) +x.shl(y).shl(y).shl(y) +-x.shl(y) +(-x).shl(y) +-(x.shl(y)) +(-x.shl(y)).shl(y) +!x.shl(y) +(!x).shl(y) +!(x.shl(y)) +(!x.shl(y)).shl(y) +(x.shl(y) << x.shl(y)).shl(x.shl(y) << x.shl(y)) \ No newline at end of file diff --git a/tests/parser/expression/binary/shl.leo.off b/tests/parser/expression/binary/shl.leo.off deleted file mode 100644 index 0064ba91d8..0000000000 --- a/tests/parser/expression/binary/shl.leo.off +++ /dev/null @@ -1,16 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - -1 << 1 - -2<<3 - -1 << 2 << 3 - -1 + 2 << 3 + 4 - -1 << 2 << 3 - -1 + 2 << 3 + 4 << 5 + 6 \ No newline at end of file diff --git a/tests/parser/expression/binary/shl_wrapped.leo b/tests/parser/expression/binary/shl_wrapped.leo new file mode 100644 index 0000000000..a010f943c3 --- /dev/null +++ b/tests/parser/expression/binary/shl_wrapped.leo @@ -0,0 +1,16 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +!-x.shl_wrapped(y) +x.shl_wrapped(y).shl_wrapped(y).shl_wrapped(y) +-x.shl_wrapped(y) +(-x).shl_wrapped(y) +-(x.shl_wrapped(y)) +(-x.shl_wrapped(y)).shl_wrapped(y) +!x.shl_wrapped(y) +(!x).shl_wrapped(y) +!(x.shl_wrapped(y)) +(!x.shl_wrapped(y)).shl_wrapped(y) +(x.shl_wrapped(y) << x.shl_wrapped(y)).shl_wrapped(x.shl_wrapped(y) << x.shl_wrapped(y)) \ No newline at end of file diff --git a/tests/parser/expression/binary/shr.leo b/tests/parser/expression/binary/shr.leo new file mode 100644 index 0000000000..51f3cdd26e --- /dev/null +++ b/tests/parser/expression/binary/shr.leo @@ -0,0 +1,28 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +1u8 >> 1u8 + +2u8>>3u8 + +1u8 >> 2u8 >> 3u8 + +1u8 + 2u8 >> 3u8 + 4u8 + +1u8 >> 2u8 >> 3u8 + +1u8 + 2u8 >> 3u8 + 4u8 >> 5u8 + 6u8 + +!-x.shr(y) +x.shr(y).shr(y).shr(y) +-x.shr(y) +(-x).shr(y) +-(x.shr(y)) +(-x.shr(y)).shr(y) +!x.shr(y) +(!x).shr(y) +!(x.shr(y)) +(!x.shr(y)).shr(y) +(x.shr(y) >> x.shr(y)).shr(x.shr(y) >> x.shr(y)) \ No newline at end of file diff --git a/tests/parser/expression/binary/shr.leo.off b/tests/parser/expression/binary/shr.leo.off deleted file mode 100644 index a02e84811b..0000000000 --- a/tests/parser/expression/binary/shr.leo.off +++ /dev/null @@ -1,16 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - -1 >> 1 - -2>>3 - -1 >> 2 >> 3 - -1 + 2 >> 3 + 4 - -1 >> 2 >> 3 - -1 + 2 >> 3 + 4 >> 5 + 6 \ No newline at end of file diff --git a/tests/parser/expression/binary/shr_signed.leo.off b/tests/parser/expression/binary/shr_signed.leo.off deleted file mode 100644 index 248e4d3bd4..0000000000 --- a/tests/parser/expression/binary/shr_signed.leo.off +++ /dev/null @@ -1,16 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - -1 >>> 1 - -2>>>3 - -1 >>> 2 >>> 3 - -1 + 2 >>> 3 + 4 - -1 >>> 2 >>> 3 - -1 + 2 >>> 3 + 4 >>> 5 + 6 \ No newline at end of file diff --git a/tests/parser/expression/binary/shr_wrapped.leo b/tests/parser/expression/binary/shr_wrapped.leo new file mode 100644 index 0000000000..bd42d7ec37 --- /dev/null +++ b/tests/parser/expression/binary/shr_wrapped.leo @@ -0,0 +1,16 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +!-x.shr_wrapped(y) +x.shr_wrapped(y).shr_wrapped(y).shr_wrapped(y) +-x.shr_wrapped(y) +(-x).shr_wrapped(y) +-(x.shr_wrapped(y)) +(-x.shr_wrapped(y)).shr_wrapped(y) +!x.shr_wrapped(y) +(!x).shr_wrapped(y) +!(x.shr_wrapped(y)) +(!x.shr_wrapped(y)).shr_wrapped(y) +(x.shr_wrapped(y) >> x.shr_wrapped(y)).shr_wrapped(x.shr_wrapped(y) >> x.shr_wrapped(y)) \ No newline at end of file diff --git a/tests/parser/expression/binary/sub.leo b/tests/parser/expression/binary/sub.leo index 7f24cad11b..9ceb155574 100644 --- a/tests/parser/expression/binary/sub.leo +++ b/tests/parser/expression/binary/sub.leo @@ -9,4 +9,16 @@ expectation: Pass 1u32 - 2u32 - 3u32 -1u8 * 2u16 - 3u32 * 4i64 \ No newline at end of file +1u8 * 2u16 - 3u32 * 4i64 + +!-x.sub(y) +x.sub(y).sub(y).sub(y) +-x.sub(y) +(-x).sub(y) +-(x.sub(y)) +(-x.sub(y)).sub(y) +!x.sub(y) +(!x).sub(y) +!(x.sub(y)) +(!x.sub(y)).sub(y) +(x.sub(y) << x.sub(y)).sub(x.sub(y) << x.sub(y)) \ No newline at end of file diff --git a/tests/parser/expression/binary/sub_wrapped.leo b/tests/parser/expression/binary/sub_wrapped.leo new file mode 100644 index 0000000000..136eff14b1 --- /dev/null +++ b/tests/parser/expression/binary/sub_wrapped.leo @@ -0,0 +1,16 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +!-x.sub_wrapped(y) +x.sub_wrapped(y).sub_wrapped(y).sub_wrapped(y) +-x.sub_wrapped(y) +(-x).sub_wrapped(y) +-(x.sub_wrapped(y)) +(-x.sub_wrapped(y)).sub_wrapped(y) +!x.sub_wrapped(y) +(!x).sub_wrapped(y) +!(x.sub_wrapped(y)) +(!x.sub_wrapped(y)).sub_wrapped(y) +(x.sub_wrapped(y) << x.sub_wrapped(y)).sub_wrapped(x.sub_wrapped(y) << x.sub_wrapped(y)) \ No newline at end of file diff --git a/tests/parser/expression/unary/abs.leo b/tests/parser/expression/unary/abs.leo new file mode 100644 index 0000000000..4480cd941b --- /dev/null +++ b/tests/parser/expression/unary/abs.leo @@ -0,0 +1,15 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +x.abs() +x.abs().abs().abs() +-x.abs() +(-x).abs() +-(x.abs()) +(-x.abs()).abs() +!x.abs() +(!x).abs() +!(x.abs()) +(!x.abs()).abs() \ No newline at end of file diff --git a/tests/parser/expression/unary/abs_wrapped.leo b/tests/parser/expression/unary/abs_wrapped.leo new file mode 100644 index 0000000000..a2f0568e5d --- /dev/null +++ b/tests/parser/expression/unary/abs_wrapped.leo @@ -0,0 +1,15 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +x.abs_wrapped() +x.abs_wrapped().abs_wrapped().abs_wrapped() +-x.abs_wrapped() +(-x).abs_wrapped() +-(x.abs_wrapped()) +(-x.abs_wrapped()).abs_wrapped() +!x.abs_wrapped() +(!x).abs_wrapped() +!(x.abs_wrapped()) +(!x.abs_wrapped()).abs_wrapped() \ No newline at end of file diff --git a/tests/parser/expression/unary/double.leo b/tests/parser/expression/unary/double.leo new file mode 100644 index 0000000000..ce939b7ada --- /dev/null +++ b/tests/parser/expression/unary/double.leo @@ -0,0 +1,15 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +x.double() +x.double().double().double() +-x.double() +(-x).double() +-(x.double()) +(-x.double()).double() +!x.double() +(!x).double() +!(x.double()) +(!x.double()).double() \ No newline at end of file diff --git a/tests/parser/expression/unary/inv.leo b/tests/parser/expression/unary/inv.leo new file mode 100644 index 0000000000..3013772fb4 --- /dev/null +++ b/tests/parser/expression/unary/inv.leo @@ -0,0 +1,15 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +x.inv() +x.inv().inv().inv() +-x.inv() +(-x).inv() +-(x.inv()) +(-x.inv()).inv() +!x.inv() +(!x).inv() +!(x.inv()) +(!x.inv()).inv() \ No newline at end of file diff --git a/tests/parser/expression/unary/neg.leo b/tests/parser/expression/unary/neg.leo new file mode 100644 index 0000000000..bad2bae1fc --- /dev/null +++ b/tests/parser/expression/unary/neg.leo @@ -0,0 +1,22 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +-x +-x() +--x +-!x + +-5i8 + +x.neg() +x.neg().neg().neg() +-x.neg() +(-x).neg() +-(x.neg()) +(-x.neg()).neg() +!x.neg() +(!x).neg() +!(x.neg()) +(!x.neg()).neg() \ No newline at end of file diff --git a/tests/parser/expression/unary/negate.leo b/tests/parser/expression/unary/negate.leo deleted file mode 100644 index 073ea866d3..0000000000 --- a/tests/parser/expression/unary/negate.leo +++ /dev/null @@ -1,11 +0,0 @@ -/* -namespace: ParseExpression -expectation: Pass -*/ - --x --x() ---x --!x - --5i8 \ No newline at end of file diff --git a/tests/parser/expression/unary/not.leo b/tests/parser/expression/unary/not.leo index db83e523bd..b54b11168f 100644 --- a/tests/parser/expression/unary/not.leo +++ b/tests/parser/expression/unary/not.leo @@ -6,4 +6,15 @@ expectation: Pass !x !x() !!x -!-x \ No newline at end of file + + +!-x.not() +x.not().not().not() +-x.not() +(-x).not() +-(x.not()) +(-x.not()).not() +!x.not() +(!x).not() +!(x.not()) +(!x.not()).not() \ No newline at end of file diff --git a/tests/parser/expression/unary/sqrt.leo b/tests/parser/expression/unary/sqrt.leo new file mode 100644 index 0000000000..50183f11f9 --- /dev/null +++ b/tests/parser/expression/unary/sqrt.leo @@ -0,0 +1,15 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +!-x.sqrt() +x.sqrt().sqrt().sqrt() +-x.sqrt() +(-x).sqrt() +-(x.sqrt()) +(-x.sqrt()).sqrt() +!x.sqrt() +(!x).sqrt() +!(x.sqrt()) +(!x.sqrt()).sqrt() \ No newline at end of file diff --git a/tests/parser/expression/unary/square.leo b/tests/parser/expression/unary/square.leo new file mode 100644 index 0000000000..8d26d5a487 --- /dev/null +++ b/tests/parser/expression/unary/square.leo @@ -0,0 +1,15 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +!-x.square() +x.square().square().square() +-x.square() +(-x).square() +-(x.square()) +(-x.square()).square() +!x.square() +(!x).square() +!(x.square()) +(!x.square()).square() \ No newline at end of file