From f34f63cea490ba4cba1ff4c7d7136ea9b75bb835 Mon Sep 17 00:00:00 2001 From: gluax <16431709+gluax@users.noreply.github.com> Date: Wed, 1 Jun 2022 08:48:36 -0700 Subject: [PATCH] update abnf --- docs/grammar/abnf-grammar.txt | 4 ++-- .../definition/use_decl_variable_as_assign_fail.leo.out | 5 +++++ .../compiler/compiler/statements/no_return_fail.leo.out | 5 +++++ .../compiler/statements/non_existant_var_exp_fail.leo.out | 5 +++++ .../compiler/statements/non_existant_vars_mul_fail.leo.out | 5 +++++ 5 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 tests/expectations/compiler/compiler/definition/use_decl_variable_as_assign_fail.leo.out create mode 100644 tests/expectations/compiler/compiler/statements/no_return_fail.leo.out create mode 100644 tests/expectations/compiler/compiler/statements/non_existant_var_exp_fail.leo.out create mode 100644 tests/expectations/compiler/compiler/statements/non_existant_vars_mul_fail.leo.out diff --git a/docs/grammar/abnf-grammar.txt b/docs/grammar/abnf-grammar.txt index 2d31190987..6578fb8282 100644 --- a/docs/grammar/abnf-grammar.txt +++ b/docs/grammar/abnf-grammar.txt @@ -216,7 +216,7 @@ address-type = %s"address" primitive-type = boolean-type / arithmetic-type / address-type -type = primitive-type +type = primitive-type / identifier group-coordinate = ( [ "-" ] numeral ) / "+" / "-" / "_" @@ -355,7 +355,7 @@ format-string = *format-string-element ; Input Grammar ; ------------- -input-type = type +input-type = primitive-type input-expression = literal diff --git a/tests/expectations/compiler/compiler/definition/use_decl_variable_as_assign_fail.leo.out b/tests/expectations/compiler/compiler/definition/use_decl_variable_as_assign_fail.leo.out new file mode 100644 index 0000000000..9442d7d720 --- /dev/null +++ b/tests/expectations/compiler/compiler/definition/use_decl_variable_as_assign_fail.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Compile +expectation: Fail +outputs: + - "Error [ETYC0372003]: Unknown variable `b`\n --> compiler-test:4:14\n |\n 4 | \tlet b: u8 = b;\n | ^\n" diff --git a/tests/expectations/compiler/compiler/statements/no_return_fail.leo.out b/tests/expectations/compiler/compiler/statements/no_return_fail.leo.out new file mode 100644 index 0000000000..e584776b23 --- /dev/null +++ b/tests/expectations/compiler/compiler/statements/no_return_fail.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Compile +expectation: Fail +outputs: + - "Error [ETYC0372012]: 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/statements/non_existant_var_exp_fail.leo.out b/tests/expectations/compiler/compiler/statements/non_existant_var_exp_fail.leo.out new file mode 100644 index 0000000000..7cf5b586ac --- /dev/null +++ b/tests/expectations/compiler/compiler/statements/non_existant_var_exp_fail.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Compile +expectation: Fail +outputs: + - "Error [ETYC0372003]: Unknown variable `z`\n --> compiler-test:4:19\n |\n 4 | \tlet b: u8 = 1u8**z;\n | ^\n" diff --git a/tests/expectations/compiler/compiler/statements/non_existant_vars_mul_fail.leo.out b/tests/expectations/compiler/compiler/statements/non_existant_vars_mul_fail.leo.out new file mode 100644 index 0000000000..012ae3bd2c --- /dev/null +++ b/tests/expectations/compiler/compiler/statements/non_existant_vars_mul_fail.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Compile +expectation: Fail +outputs: + - "Error [ETYC0372003]: Unknown variable `x`\n --> compiler-test:4:14\n |\n 4 | \tlet b: u8 = x*z;\n | ^\nError [ETYC0372003]: Unknown variable `z`\n --> compiler-test:4:16\n |\n 4 | \tlet b: u8 = x*z;\n | ^\n"