From e5e958cac9ac3cddab6c4530aa1b476137a5d439 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 2 Jun 2022 09:42:12 +0200 Subject: [PATCH] Add tests for sequence expressions --- test/corpus/arithmetic.txt | 70 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/test/corpus/arithmetic.txt b/test/corpus/arithmetic.txt index 1f22fa7..29b73d1 100644 --- a/test/corpus/arithmetic.txt +++ b/test/corpus/arithmetic.txt @@ -139,3 +139,73 @@ Precedence left: (integer_literal) operator: (operator) right: (integer_literal)))))))) + +================================================================================ +Parenthesis precedence +================================================================================ + +-(((((1 | 2) & 3) <= 4) + 5) * 6) + +-------------------------------------------------------------------------------- + +(source_file + (unary_expression + operator: (operator) + expression: (sequence_expression + (binary_expression + left: (sequence_expression + (binary_expression + left: (sequence_expression + (binary_expression + left: (sequence_expression + (binary_expression + left: (sequence_expression + (binary_expression + left: (integer_literal) + operator: (operator) + right: (integer_literal))) + operator: (operator) + right: (integer_literal))) + operator: (operator) + right: (integer_literal))) + operator: (operator) + right: (integer_literal))) + operator: (operator) + right: (integer_literal))))) + +================================================================================ +Sequence +================================================================================ + +(12; "27"; nil) + +-------------------------------------------------------------------------------- + +(source_file + (sequence_expression + (integer_literal) + (string_literal) + (nil_literal))) + +================================================================================ +Simple parenthesized expression +================================================================================ + +(42) + +-------------------------------------------------------------------------------- + +(source_file + (sequence_expression + (integer_literal))) + +================================================================================ +Empty sequence +================================================================================ + +() + +-------------------------------------------------------------------------------- + +(source_file + (sequence_expression))