diff --git a/asg/tests/fail/circuits/inline_fail.leo b/asg/tests/fail/circuits/inline_fail.leo index 01597005fb..302c84298a 100644 --- a/asg/tests/fail/circuits/inline_fail.leo +++ b/asg/tests/fail/circuits/inline_fail.leo @@ -1,5 +1,5 @@ circuit Foo { - x: u32 + x: u32; } function main() { diff --git a/asg/tests/fail/circuits/member_variable_fail.leo b/asg/tests/fail/circuits/member_variable_fail.leo index fdf42068d5..a0a9823486 100644 --- a/asg/tests/fail/circuits/member_variable_fail.leo +++ b/asg/tests/fail/circuits/member_variable_fail.leo @@ -1,5 +1,5 @@ circuit Foo { - x: u32 + x: u32; } function main() { diff --git a/asg/tests/fail/circuits/mut_function_fail.leo b/asg/tests/fail/circuits/mut_function_fail.leo index 1b87e2bfb1..d66edac76b 100644 --- a/asg/tests/fail/circuits/mut_function_fail.leo +++ b/asg/tests/fail/circuits/mut_function_fail.leo @@ -1,5 +1,5 @@ circuit Foo { - a: u8, + a: u8; function bar() {} } diff --git a/asg/tests/fail/circuits/mut_self_function_fail.leo b/asg/tests/fail/circuits/mut_self_function_fail.leo index 58c8088ba1..dde5133a00 100644 --- a/asg/tests/fail/circuits/mut_self_function_fail.leo +++ b/asg/tests/fail/circuits/mut_self_function_fail.leo @@ -1,5 +1,5 @@ circuit Foo { - a: u8, + a: u8; function bar() {} diff --git a/asg/tests/fail/circuits/mut_self_static_function_fail.leo b/asg/tests/fail/circuits/mut_self_static_function_fail.leo index 58c8088ba1..dde5133a00 100644 --- a/asg/tests/fail/circuits/mut_self_static_function_fail.leo +++ b/asg/tests/fail/circuits/mut_self_static_function_fail.leo @@ -1,5 +1,5 @@ circuit Foo { - a: u8, + a: u8; function bar() {} diff --git a/asg/tests/fail/circuits/mut_self_variable_fail.leo b/asg/tests/fail/circuits/mut_self_variable_fail.leo index 4db62a4d3e..50edbc11f1 100644 --- a/asg/tests/fail/circuits/mut_self_variable_fail.leo +++ b/asg/tests/fail/circuits/mut_self_variable_fail.leo @@ -1,5 +1,5 @@ circuit Foo { - a: u8, + a: u8; function set_a(self, new: u8) { self.a = new; diff --git a/asg/tests/fail/circuits/mut_variable_fail.leo b/asg/tests/fail/circuits/mut_variable_fail.leo index 7ba4193074..4b741ed07f 100644 --- a/asg/tests/fail/circuits/mut_variable_fail.leo +++ b/asg/tests/fail/circuits/mut_variable_fail.leo @@ -1,5 +1,5 @@ circuit Foo { - a: u8, + a: u8; } function main() { diff --git a/asg/tests/fail/circuits/self_member_invalid.leo b/asg/tests/fail/circuits/self_member_invalid.leo index 7283b3260a..51ba9b53df 100644 --- a/asg/tests/fail/circuits/self_member_invalid.leo +++ b/asg/tests/fail/circuits/self_member_invalid.leo @@ -1,5 +1,5 @@ circuit Foo { - f: u32, + f: u32; function bar() -> u32 { return f; diff --git a/asg/tests/fail/mutability/circuit.leo b/asg/tests/fail/mutability/circuit.leo index 508595ef16..29f2096a03 100644 --- a/asg/tests/fail/mutability/circuit.leo +++ b/asg/tests/fail/mutability/circuit.leo @@ -1,6 +1,6 @@ // Circuits are immutable by default. circuit Foo { - x: u32 + x: u32; } function main() { diff --git a/asg/tests/pass/circuits/define_circuit_inside_circuit_function.leo b/asg/tests/pass/circuits/define_circuit_inside_circuit_function.leo index cedabf2185..a15259b1d4 100644 --- a/asg/tests/pass/circuits/define_circuit_inside_circuit_function.leo +++ b/asg/tests/pass/circuits/define_circuit_inside_circuit_function.leo @@ -1,5 +1,5 @@ circuit Foo { - a: u32, + a: u32; } circuit Bar { diff --git a/asg/tests/pass/circuits/inline.leo b/asg/tests/pass/circuits/inline.leo index 9ba06f4191..19f3d5cfb2 100644 --- a/asg/tests/pass/circuits/inline.leo +++ b/asg/tests/pass/circuits/inline.leo @@ -1,5 +1,5 @@ circuit Foo { - x: u32 + x: u32; } function main() { diff --git a/asg/tests/pass/circuits/member_function_nested.leo b/asg/tests/pass/circuits/member_function_nested.leo index b8bf172947..77b0d83bb9 100644 --- a/asg/tests/pass/circuits/member_function_nested.leo +++ b/asg/tests/pass/circuits/member_function_nested.leo @@ -1,5 +1,5 @@ circuit Foo { - x: u32, + x: u32; function add_x(self, y: u32) -> u32 { return self.x + y; diff --git a/asg/tests/pass/circuits/member_variable.leo b/asg/tests/pass/circuits/member_variable.leo index a3f3fbe7e6..c1f5812dce 100644 --- a/asg/tests/pass/circuits/member_variable.leo +++ b/asg/tests/pass/circuits/member_variable.leo @@ -1,5 +1,5 @@ circuit Foo { - x: u32, + x: u32; } function main() { diff --git a/asg/tests/pass/circuits/member_variable_and_function.leo b/asg/tests/pass/circuits/member_variable_and_function.leo index f90cdca072..d579f3fbf5 100644 --- a/asg/tests/pass/circuits/member_variable_and_function.leo +++ b/asg/tests/pass/circuits/member_variable_and_function.leo @@ -1,5 +1,5 @@ circuit Foo { - foo: u32, + foo: u32; function bar() -> u32 { return 1u32; diff --git a/asg/tests/pass/circuits/mut_self_variable.leo b/asg/tests/pass/circuits/mut_self_variable.leo index 92bcca0050..cfe7e10ef5 100644 --- a/asg/tests/pass/circuits/mut_self_variable.leo +++ b/asg/tests/pass/circuits/mut_self_variable.leo @@ -1,5 +1,5 @@ circuit Foo { - a: u8, + a: u8; function set_a(mut self, new: u8) { self.a = new; diff --git a/asg/tests/pass/circuits/mut_self_variable_conditional.leo b/asg/tests/pass/circuits/mut_self_variable_conditional.leo index 61a5e354dc..fec92fef93 100644 --- a/asg/tests/pass/circuits/mut_self_variable_conditional.leo +++ b/asg/tests/pass/circuits/mut_self_variable_conditional.leo @@ -5,7 +5,7 @@ function main() { } circuit Foo { - a: u32 + a: u32; function bar(mut self) { if true { diff --git a/asg/tests/pass/circuits/mut_variable.leo b/asg/tests/pass/circuits/mut_variable.leo index 151babb1cd..a8cb60d989 100644 --- a/asg/tests/pass/circuits/mut_variable.leo +++ b/asg/tests/pass/circuits/mut_variable.leo @@ -1,5 +1,5 @@ circuit Foo { - a: u8, + a: u8; } function main() { diff --git a/asg/tests/pass/circuits/pedersen_mock.leo b/asg/tests/pass/circuits/pedersen_mock.leo index 7f2dc12180..87f528230c 100644 --- a/asg/tests/pass/circuits/pedersen_mock.leo +++ b/asg/tests/pass/circuits/pedersen_mock.leo @@ -1,5 +1,5 @@ circuit PedersenHash { - parameters: [u32; 512] + parameters: [u32; 512]; function new(const parameters: [u32; 512]) -> Self { return Self { parameters: parameters }; diff --git a/asg/tests/pass/circuits/self_member.leo b/asg/tests/pass/circuits/self_member.leo index 237baac9de..a21fbfc5cf 100644 --- a/asg/tests/pass/circuits/self_member.leo +++ b/asg/tests/pass/circuits/self_member.leo @@ -1,5 +1,5 @@ circuit Foo { - f: u32, + f: u32; function bar(self) -> u32 { return self.f; diff --git a/asg/tests/pass/form_ast.rs b/asg/tests/pass/form_ast.rs index dfb72639b9..6c4a28a645 100644 --- a/asg/tests/pass/form_ast.rs +++ b/asg/tests/pass/form_ast.rs @@ -58,8 +58,8 @@ fn test_imports() { let mut imports = crate::mocked_resolver(&context); let test_import = r#" circuit Point { - x: u32 - y: u32 + x: u32; + y: u32; } function foo() -> u32 { diff --git a/asg/tests/pass/import/imports/bar/src/bat/bat.leo b/asg/tests/pass/import/imports/bar/src/bat/bat.leo index a7d2fc83d4..f76edfe54e 100755 --- a/asg/tests/pass/import/imports/bar/src/bat/bat.leo +++ b/asg/tests/pass/import/imports/bar/src/bat/bat.leo @@ -1,3 +1,3 @@ circuit Bat { - t: u32 + t: u32; } \ No newline at end of file diff --git a/asg/tests/pass/import/imports/bar/src/baz.leo b/asg/tests/pass/import/imports/bar/src/baz.leo index 1bb268a84c..74fa3f281f 100755 --- a/asg/tests/pass/import/imports/bar/src/baz.leo +++ b/asg/tests/pass/import/imports/bar/src/baz.leo @@ -1,7 +1,7 @@ circuit Baz { - z: u32 + z: u32; } circuit Bazzar { - a: u32 + a: u32; } \ No newline at end of file diff --git a/asg/tests/pass/import/imports/bar/src/lib.leo b/asg/tests/pass/import/imports/bar/src/lib.leo index c169f5935e..845b6e5fd3 100755 --- a/asg/tests/pass/import/imports/bar/src/lib.leo +++ b/asg/tests/pass/import/imports/bar/src/lib.leo @@ -1,3 +1,3 @@ circuit Bar { - r: u32 + r: u32; } \ No newline at end of file diff --git a/asg/tests/pass/import/imports/car/src/lib.leo b/asg/tests/pass/import/imports/car/src/lib.leo index b1e037fd38..58a10e4067 100755 --- a/asg/tests/pass/import/imports/car/src/lib.leo +++ b/asg/tests/pass/import/imports/car/src/lib.leo @@ -1,3 +1,3 @@ circuit Car { - c: u32 + c: u32; } \ No newline at end of file diff --git a/asg/tests/pass/import/src/test-import.leo b/asg/tests/pass/import/src/test-import.leo index 9a57d433f4..e75fdd2fb1 100644 --- a/asg/tests/pass/import/src/test-import.leo +++ b/asg/tests/pass/import/src/test-import.leo @@ -1,6 +1,6 @@ circuit Point { - x: u32 - y: u32 + x: u32; + y: u32; } function foo() -> u32 { diff --git a/asg/tests/pass/mutability/circuit_mut.leo b/asg/tests/pass/mutability/circuit_mut.leo index f7067db11e..4ce2ea7c54 100644 --- a/asg/tests/pass/mutability/circuit_mut.leo +++ b/asg/tests/pass/mutability/circuit_mut.leo @@ -1,6 +1,6 @@ // Adding the `mut` keyword makes a circuit variable mutable. circuit Foo { - x: u32 + x: u32; } function main() { diff --git a/asg/tests/pass/mutability/circuit_variable_mut.leo b/asg/tests/pass/mutability/circuit_variable_mut.leo index f7067db11e..4ce2ea7c54 100644 --- a/asg/tests/pass/mutability/circuit_variable_mut.leo +++ b/asg/tests/pass/mutability/circuit_variable_mut.leo @@ -1,6 +1,6 @@ // Adding the `mut` keyword makes a circuit variable mutable. circuit Foo { - x: u32 + x: u32; } function main() { diff --git a/compiler/tests/canonicalization/big_self_in_circuit_replacement.leo b/compiler/tests/canonicalization/big_self_in_circuit_replacement.leo index 4081e46cbf..dfbefd0022 100644 --- a/compiler/tests/canonicalization/big_self_in_circuit_replacement.leo +++ b/compiler/tests/canonicalization/big_self_in_circuit_replacement.leo @@ -1,5 +1,5 @@ circuit Foo { - x: u32 + x: u32; function new() -> Self { let new: Self = Self { diff --git a/compiler/tests/canonicalization/big_self_outside_circuit_fail.leo b/compiler/tests/canonicalization/big_self_outside_circuit_fail.leo index 6f5100adde..e070486a4b 100644 --- a/compiler/tests/canonicalization/big_self_outside_circuit_fail.leo +++ b/compiler/tests/canonicalization/big_self_outside_circuit_fail.leo @@ -1,5 +1,5 @@ circuit Foo { - x: u32 + x: u32; function new() -> Self { let new: Self = Self { diff --git a/compiler/tests/canonicalization/compound_assignment.leo b/compiler/tests/canonicalization/compound_assignment.leo index 1a6f2171fe..cd1e7f030a 100644 --- a/compiler/tests/canonicalization/compound_assignment.leo +++ b/compiler/tests/canonicalization/compound_assignment.leo @@ -1,6 +1,6 @@ circuit Foo { - f: u8, - y: (u8, u8), + f: u8; + y: (u8, u8); function z (mut self) -> u16 { self.y.0 += 1u8; diff --git a/compiler/tests/circuits/const_self_variable.leo b/compiler/tests/circuits/const_self_variable.leo index 8ba32ba0df..f9794c72cc 100644 --- a/compiler/tests/circuits/const_self_variable.leo +++ b/compiler/tests/circuits/const_self_variable.leo @@ -1,5 +1,5 @@ circuit Foo { - a: u8, + a: u8; function use_a(const self) -> u8 { return self.a + 1; diff --git a/compiler/tests/circuits/const_self_variable_fail.leo b/compiler/tests/circuits/const_self_variable_fail.leo index fca9620946..8dda67dd1f 100644 --- a/compiler/tests/circuits/const_self_variable_fail.leo +++ b/compiler/tests/circuits/const_self_variable_fail.leo @@ -1,5 +1,5 @@ circuit Foo { - a: u8, + a: u8; function set_a(const self, new: u8) { self.a = new; diff --git a/compiler/tests/circuits/define_circuit_inside_circuit_function.leo b/compiler/tests/circuits/define_circuit_inside_circuit_function.leo index cedabf2185..a15259b1d4 100644 --- a/compiler/tests/circuits/define_circuit_inside_circuit_function.leo +++ b/compiler/tests/circuits/define_circuit_inside_circuit_function.leo @@ -1,5 +1,5 @@ circuit Foo { - a: u32, + a: u32; } circuit Bar { diff --git a/compiler/tests/circuits/duplicate_name_context.leo b/compiler/tests/circuits/duplicate_name_context.leo index 8644d27fcb..95431a18e3 100644 --- a/compiler/tests/circuits/duplicate_name_context.leo +++ b/compiler/tests/circuits/duplicate_name_context.leo @@ -1,5 +1,5 @@ circuit Bar { - b2: u32 + b2: u32; function add_five(z:u32) -> u32 { return z+5u32; diff --git a/compiler/tests/circuits/inline.leo b/compiler/tests/circuits/inline.leo index 9ba06f4191..19f3d5cfb2 100644 --- a/compiler/tests/circuits/inline.leo +++ b/compiler/tests/circuits/inline.leo @@ -1,5 +1,5 @@ circuit Foo { - x: u32 + x: u32; } function main() { diff --git a/compiler/tests/circuits/inline_fail.leo b/compiler/tests/circuits/inline_fail.leo index 01597005fb..302c84298a 100644 --- a/compiler/tests/circuits/inline_fail.leo +++ b/compiler/tests/circuits/inline_fail.leo @@ -1,5 +1,5 @@ circuit Foo { - x: u32 + x: u32; } function main() { diff --git a/compiler/tests/circuits/inline_member_fail.leo b/compiler/tests/circuits/inline_member_fail.leo index 59f6d7992b..7bc178a4e6 100644 --- a/compiler/tests/circuits/inline_member_fail.leo +++ b/compiler/tests/circuits/inline_member_fail.leo @@ -1,5 +1,5 @@ circuit Foo { - x: u8 + x: u8; } function main() { diff --git a/compiler/tests/circuits/inline_member_pass.leo b/compiler/tests/circuits/inline_member_pass.leo index 6fd7f7dff7..d9b4a930e3 100644 --- a/compiler/tests/circuits/inline_member_pass.leo +++ b/compiler/tests/circuits/inline_member_pass.leo @@ -1,5 +1,5 @@ circuit Foo { - x: u8 + x: u8; function new(x: u8) -> Self { return Self { x }; diff --git a/compiler/tests/circuits/member_function.leo b/compiler/tests/circuits/member_function.leo index eee44be448..c2e541b2cd 100644 --- a/compiler/tests/circuits/member_function.leo +++ b/compiler/tests/circuits/member_function.leo @@ -1,5 +1,5 @@ circuit Foo { - x: u32, + x: u32; function echo(self) -> u32 { return self.x; diff --git a/compiler/tests/circuits/member_function_nested.leo b/compiler/tests/circuits/member_function_nested.leo index b8bf172947..77b0d83bb9 100644 --- a/compiler/tests/circuits/member_function_nested.leo +++ b/compiler/tests/circuits/member_function_nested.leo @@ -1,5 +1,5 @@ circuit Foo { - x: u32, + x: u32; function add_x(self, y: u32) -> u32 { return self.x + y; diff --git a/compiler/tests/circuits/member_variable.leo b/compiler/tests/circuits/member_variable.leo index a3f3fbe7e6..c1f5812dce 100644 --- a/compiler/tests/circuits/member_variable.leo +++ b/compiler/tests/circuits/member_variable.leo @@ -1,5 +1,5 @@ circuit Foo { - x: u32, + x: u32; } function main() { diff --git a/compiler/tests/circuits/member_variable_and_function.leo b/compiler/tests/circuits/member_variable_and_function.leo index f90cdca072..d579f3fbf5 100644 --- a/compiler/tests/circuits/member_variable_and_function.leo +++ b/compiler/tests/circuits/member_variable_and_function.leo @@ -1,5 +1,5 @@ circuit Foo { - foo: u32, + foo: u32; function bar() -> u32 { return 1u32; diff --git a/compiler/tests/circuits/member_variable_fail.leo b/compiler/tests/circuits/member_variable_fail.leo index fdf42068d5..a0a9823486 100644 --- a/compiler/tests/circuits/member_variable_fail.leo +++ b/compiler/tests/circuits/member_variable_fail.leo @@ -1,5 +1,5 @@ circuit Foo { - x: u32 + x: u32; } function main() { diff --git a/compiler/tests/circuits/mut_function_fail.leo b/compiler/tests/circuits/mut_function_fail.leo index 44583810dd..049d7143b0 100644 --- a/compiler/tests/circuits/mut_function_fail.leo +++ b/compiler/tests/circuits/mut_function_fail.leo @@ -1,5 +1,5 @@ circuit Foo { - a: u8, + a: u8; function bar() {} } diff --git a/compiler/tests/circuits/mut_self_function_fail.leo b/compiler/tests/circuits/mut_self_function_fail.leo index b81b18e743..d29c7ad2a4 100644 --- a/compiler/tests/circuits/mut_self_function_fail.leo +++ b/compiler/tests/circuits/mut_self_function_fail.leo @@ -1,5 +1,5 @@ circuit Foo { - a: u8, + a: u8; function bar() {} diff --git a/compiler/tests/circuits/mut_self_static_function_fail.leo b/compiler/tests/circuits/mut_self_static_function_fail.leo index b81b18e743..d29c7ad2a4 100644 --- a/compiler/tests/circuits/mut_self_static_function_fail.leo +++ b/compiler/tests/circuits/mut_self_static_function_fail.leo @@ -1,5 +1,5 @@ circuit Foo { - a: u8, + a: u8; function bar() {} diff --git a/compiler/tests/circuits/mut_self_variable.leo b/compiler/tests/circuits/mut_self_variable.leo index dc2047d872..1c41bc3090 100644 --- a/compiler/tests/circuits/mut_self_variable.leo +++ b/compiler/tests/circuits/mut_self_variable.leo @@ -1,5 +1,5 @@ circuit Foo { - a: u8, + a: u8; function set_a(mut self, new: u8) { self.a = new; diff --git a/compiler/tests/circuits/mut_self_variable_branch.leo b/compiler/tests/circuits/mut_self_variable_branch.leo index 1c2f126f08..7999f600dd 100644 --- a/compiler/tests/circuits/mut_self_variable_branch.leo +++ b/compiler/tests/circuits/mut_self_variable_branch.leo @@ -1,5 +1,5 @@ circuit Foo { - a: u8, + a: u8; function set_a(mut self, condition: bool, new: u8) { if condition { diff --git a/compiler/tests/circuits/mut_self_variable_conditional.leo b/compiler/tests/circuits/mut_self_variable_conditional.leo index 61a5e354dc..fec92fef93 100644 --- a/compiler/tests/circuits/mut_self_variable_conditional.leo +++ b/compiler/tests/circuits/mut_self_variable_conditional.leo @@ -5,7 +5,7 @@ function main() { } circuit Foo { - a: u32 + a: u32; function bar(mut self) { if true { diff --git a/compiler/tests/circuits/mut_self_variable_fail.leo b/compiler/tests/circuits/mut_self_variable_fail.leo index 4db62a4d3e..50edbc11f1 100644 --- a/compiler/tests/circuits/mut_self_variable_fail.leo +++ b/compiler/tests/circuits/mut_self_variable_fail.leo @@ -1,5 +1,5 @@ circuit Foo { - a: u8, + a: u8; function set_a(self, new: u8) { self.a = new; diff --git a/compiler/tests/circuits/mut_variable.leo b/compiler/tests/circuits/mut_variable.leo index ddc7412038..9dddc0510f 100644 --- a/compiler/tests/circuits/mut_variable.leo +++ b/compiler/tests/circuits/mut_variable.leo @@ -1,5 +1,5 @@ circuit Foo { - a: u8, + a: u8; } function main() { diff --git a/compiler/tests/circuits/mut_variable_fail.leo b/compiler/tests/circuits/mut_variable_fail.leo index e116b33d5c..60bb19a5c6 100644 --- a/compiler/tests/circuits/mut_variable_fail.leo +++ b/compiler/tests/circuits/mut_variable_fail.leo @@ -1,5 +1,5 @@ circuit Foo { - a: u8, + a: u8; } function main() { diff --git a/compiler/tests/circuits/mutable_call_immutable_context.leo b/compiler/tests/circuits/mutable_call_immutable_context.leo index d235d11cb7..ab4e23ad2c 100644 --- a/compiler/tests/circuits/mutable_call_immutable_context.leo +++ b/compiler/tests/circuits/mutable_call_immutable_context.leo @@ -1,5 +1,5 @@ circuit TestMe { - x: u8, + x: u8; function test_me(mut self) -> u8 { self.x += 1; diff --git a/compiler/tests/circuits/pedersen_mock.leo b/compiler/tests/circuits/pedersen_mock.leo index 7f2dc12180..87f528230c 100644 --- a/compiler/tests/circuits/pedersen_mock.leo +++ b/compiler/tests/circuits/pedersen_mock.leo @@ -1,5 +1,5 @@ circuit PedersenHash { - parameters: [u32; 512] + parameters: [u32; 512]; function new(const parameters: [u32; 512]) -> Self { return Self { parameters: parameters }; diff --git a/compiler/tests/circuits/self_member.leo b/compiler/tests/circuits/self_member.leo index 237baac9de..a21fbfc5cf 100644 --- a/compiler/tests/circuits/self_member.leo +++ b/compiler/tests/circuits/self_member.leo @@ -1,5 +1,5 @@ circuit Foo { - f: u32, + f: u32; function bar(self) -> u32 { return self.f; diff --git a/compiler/tests/circuits/self_member_invalid.leo b/compiler/tests/circuits/self_member_invalid.leo index 7283b3260a..51ba9b53df 100644 --- a/compiler/tests/circuits/self_member_invalid.leo +++ b/compiler/tests/circuits/self_member_invalid.leo @@ -1,5 +1,5 @@ circuit Foo { - f: u32, + f: u32; function bar() -> u32 { return f; diff --git a/compiler/tests/global_consts/global_const_types.leo b/compiler/tests/global_consts/global_const_types.leo index 8819e55662..38e4493ae8 100644 --- a/compiler/tests/global_consts/global_const_types.leo +++ b/compiler/tests/global_consts/global_const_types.leo @@ -10,8 +10,8 @@ const foo = Foo { width: 10, height: 20 }; const uno = uno(); circuit Foo { - width: u32, - height: u32, + width: u32; + height: u32; } function uno() -> u32 { diff --git a/compiler/tests/import/imports/bar/src/bat/bat.leo b/compiler/tests/import/imports/bar/src/bat/bat.leo index a7d2fc83d4..f76edfe54e 100755 --- a/compiler/tests/import/imports/bar/src/bat/bat.leo +++ b/compiler/tests/import/imports/bar/src/bat/bat.leo @@ -1,3 +1,3 @@ circuit Bat { - t: u32 + t: u32; } \ No newline at end of file diff --git a/compiler/tests/import/imports/bar/src/baz.leo b/compiler/tests/import/imports/bar/src/baz.leo index 25fee7f3e5..3050653fae 100755 --- a/compiler/tests/import/imports/bar/src/baz.leo +++ b/compiler/tests/import/imports/bar/src/baz.leo @@ -1,9 +1,9 @@ circuit Baz { - z: u32 + z: u32; } circuit Bazzar { - a: u32 + a: u32; } const ONE: u8 = 1; \ No newline at end of file diff --git a/compiler/tests/import/imports/bar/src/lib.leo b/compiler/tests/import/imports/bar/src/lib.leo index c169f5935e..845b6e5fd3 100755 --- a/compiler/tests/import/imports/bar/src/lib.leo +++ b/compiler/tests/import/imports/bar/src/lib.leo @@ -1,3 +1,3 @@ circuit Bar { - r: u32 + r: u32; } \ No newline at end of file diff --git a/compiler/tests/import/imports/car/src/lib.leo b/compiler/tests/import/imports/car/src/lib.leo index b1e037fd38..58a10e4067 100755 --- a/compiler/tests/import/imports/car/src/lib.leo +++ b/compiler/tests/import/imports/car/src/lib.leo @@ -1,3 +1,3 @@ circuit Car { - c: u32 + c: u32; } \ No newline at end of file diff --git a/compiler/tests/import/src/test-import.leo b/compiler/tests/import/src/test-import.leo index 9a57d433f4..e75fdd2fb1 100644 --- a/compiler/tests/import/src/test-import.leo +++ b/compiler/tests/import/src/test-import.leo @@ -1,6 +1,6 @@ circuit Point { - x: u32 - y: u32 + x: u32; + y: u32; } function foo() -> u32 { diff --git a/compiler/tests/mutability/circuit.leo b/compiler/tests/mutability/circuit.leo index 508595ef16..29f2096a03 100644 --- a/compiler/tests/mutability/circuit.leo +++ b/compiler/tests/mutability/circuit.leo @@ -1,6 +1,6 @@ // Circuits are immutable by default. circuit Foo { - x: u32 + x: u32; } function main() { diff --git a/compiler/tests/mutability/circuit_mut.leo b/compiler/tests/mutability/circuit_mut.leo index f7067db11e..4ce2ea7c54 100644 --- a/compiler/tests/mutability/circuit_mut.leo +++ b/compiler/tests/mutability/circuit_mut.leo @@ -1,6 +1,6 @@ // Adding the `mut` keyword makes a circuit variable mutable. circuit Foo { - x: u32 + x: u32; } function main() { diff --git a/compiler/tests/mutability/circuit_variable_mut.leo b/compiler/tests/mutability/circuit_variable_mut.leo index f7067db11e..4ce2ea7c54 100644 --- a/compiler/tests/mutability/circuit_variable_mut.leo +++ b/compiler/tests/mutability/circuit_variable_mut.leo @@ -1,6 +1,6 @@ // Adding the `mut` keyword makes a circuit variable mutable. circuit Foo { - x: u32 + x: u32; } function main() { diff --git a/examples/pedersen-hash/src/main.leo b/examples/pedersen-hash/src/main.leo index 030dc0bcb8..ab6474c4e4 100644 --- a/examples/pedersen-hash/src/main.leo +++ b/examples/pedersen-hash/src/main.leo @@ -1,5 +1,5 @@ circuit PedersenHash { - parameters: [group; 256], + parameters: [group; 256]; // Instantiates a Pedersen hash circuit function new(parameters: [group; 256]) -> Self { diff --git a/examples/silly-sudoku/src/lib.leo b/examples/silly-sudoku/src/lib.leo index c1e4922461..c005af2934 100644 --- a/examples/silly-sudoku/src/lib.leo +++ b/examples/silly-sudoku/src/lib.leo @@ -16,7 +16,7 @@ circuit SillySudoku { // The starting grid values for the Sudoku puzzle. // Unset cells on the puzzle grid are set to 0. - puzzle_grid: [u8; (3, 3)], + puzzle_grid: [u8; (3, 3)]; /** * Returns true if a given Sudoku answer is correct. diff --git a/grammar/README.md b/grammar/README.md index b227bccb13..d6016eb78c 100644 --- a/grammar/README.md +++ b/grammar/README.md @@ -476,7 +476,7 @@ Line terminators form whitespace, along with spaces and horizontal tabs. whitespace = space / horizontal-tab / newline ``` -Go to: _[space](#user-content-space), [newline](#user-content-newline), [horizontal-tab](#user-content-horizontal-tab)_; +Go to: _[horizontal-tab](#user-content-horizontal-tab), [newline](#user-content-newline), [space](#user-content-space)_; There are two kinds of comments in Leo, as in other languages. @@ -511,7 +511,7 @@ rest-of-block-comment = "*" rest-of-block-comment-after-star / not-star rest-of-block-comment ``` -Go to: _[rest-of-block-comment](#user-content-rest-of-block-comment), [rest-of-block-comment-after-star](#user-content-rest-of-block-comment-after-star), [not-star](#user-content-not-star)_; +Go to: _[rest-of-block-comment-after-star](#user-content-rest-of-block-comment-after-star), [not-star](#user-content-not-star), [rest-of-block-comment](#user-content-rest-of-block-comment)_; @@ -521,7 +521,7 @@ rest-of-block-comment-after-star = "/" / not-star-or-slash rest-of-block-comment ``` -Go to: _[rest-of-block-comment](#user-content-rest-of-block-comment), [not-star-or-slash](#user-content-not-star-or-slash), [rest-of-block-comment-after-star](#user-content-rest-of-block-comment-after-star)_; +Go to: _[rest-of-block-comment-after-star](#user-content-rest-of-block-comment-after-star), [rest-of-block-comment](#user-content-rest-of-block-comment), [not-star-or-slash](#user-content-not-star-or-slash)_; @@ -642,7 +642,7 @@ format-string-element = not-double-quote-or-open-brace / format-string-container ``` -Go to: _[format-string-container](#user-content-format-string-container), [not-double-quote-or-open-brace](#user-content-not-double-quote-or-open-brace), [not-double-quote-or-close-brace](#user-content-not-double-quote-or-close-brace)_; +Go to: _[not-double-quote-or-open-brace](#user-content-not-double-quote-or-open-brace), [not-double-quote-or-close-brace](#user-content-not-double-quote-or-close-brace), [format-string-container](#user-content-format-string-container)_; @@ -767,7 +767,7 @@ atomic-literal = untyped-literal / address-literal ``` -Go to: _[product-group-literal](#user-content-product-group-literal), [signed-literal](#user-content-signed-literal), [unsigned-literal](#user-content-unsigned-literal), [field-literal](#user-content-field-literal), [boolean-literal](#user-content-boolean-literal), [untyped-literal](#user-content-untyped-literal), [address-literal](#user-content-address-literal)_; +Go to: _[unsigned-literal](#user-content-unsigned-literal), [boolean-literal](#user-content-boolean-literal), [product-group-literal](#user-content-product-group-literal), [signed-literal](#user-content-signed-literal), [address-literal](#user-content-address-literal), [field-literal](#user-content-field-literal), [untyped-literal](#user-content-untyped-literal)_; After defining the (mostly) alphanumeric tokens above, @@ -812,7 +812,7 @@ token = keyword / symbol ``` -Go to: _[package-name](#user-content-package-name), [annotation-name](#user-content-annotation-name), [format-string](#user-content-format-string), [keyword](#user-content-keyword), [atomic-literal](#user-content-atomic-literal), [identifier](#user-content-identifier), [symbol](#user-content-symbol)_; +Go to: _[package-name](#user-content-package-name), [annotation-name](#user-content-annotation-name), [symbol](#user-content-symbol), [atomic-literal](#user-content-atomic-literal), [format-string](#user-content-format-string), [identifier](#user-content-identifier), [keyword](#user-content-keyword)_; @@ -848,7 +848,7 @@ signed-type = %s"i8" / %s"i16" / %s"i32" / %s"i64" / %s"i128" integer-type = unsigned-type / signed-type ``` -Go to: _[signed-type](#user-content-signed-type), [unsigned-type](#user-content-unsigned-type)_; +Go to: _[unsigned-type](#user-content-unsigned-type), [signed-type](#user-content-signed-type)_; The integer types, along with the field and group types, @@ -890,7 +890,7 @@ address-type = %s"address" scalar-type = boolean-type / arithmetic-type / address-type ``` -Go to: _[arithmetic-type](#user-content-arithmetic-type), [address-type](#user-content-address-type), [boolean-type](#user-content-boolean-type)_; +Go to: _[address-type](#user-content-address-type), [arithmetic-type](#user-content-arithmetic-type), [boolean-type](#user-content-boolean-type)_; Circuit types are denoted by identifiers and the keyword `Self`. @@ -907,7 +907,7 @@ self-type = %s"Self" circuit-type = identifier / self-type ``` -Go to: _[identifier](#user-content-identifier), [self-type](#user-content-self-type)_; +Go to: _[self-type](#user-content-self-type), [identifier](#user-content-identifier)_; A tuple type consists of zero, two, or more component types. @@ -951,7 +951,7 @@ i.e. types whose values contain (sub-)values aggregate-type = tuple-type / array-type / circuit-type ``` -Go to: _[tuple-type](#user-content-tuple-type), [array-type](#user-content-array-type), [circuit-type](#user-content-circuit-type)_; +Go to: _[array-type](#user-content-array-type), [circuit-type](#user-content-circuit-type), [tuple-type](#user-content-tuple-type)_; Scalar and aggregate types form all the types. @@ -997,7 +997,7 @@ A literal is either an atomic one or an affine group literal. literal = atomic-literal / affine-group-literal ``` -Go to: _[affine-group-literal](#user-content-affine-group-literal), [atomic-literal](#user-content-atomic-literal)_; +Go to: _[atomic-literal](#user-content-atomic-literal), [affine-group-literal](#user-content-affine-group-literal)_; The following rule is not directly referenced in the rules for expressions @@ -1039,7 +1039,7 @@ primary-expression = identifier / circuit-expression ``` -Go to: _[tuple-expression](#user-content-tuple-expression), [identifier](#user-content-identifier), [expression](#user-content-expression), [array-expression](#user-content-array-expression), [circuit-expression](#user-content-circuit-expression), [literal](#user-content-literal)_; +Go to: _[array-expression](#user-content-array-expression), [tuple-expression](#user-content-tuple-expression), [identifier](#user-content-identifier), [literal](#user-content-literal), [expression](#user-content-expression), [circuit-expression](#user-content-circuit-expression)_; Tuple expressions construct tuples. @@ -1092,7 +1092,7 @@ Go to: _[expression](#user-content-expression)_; array-repeat-construction = "[" expression ";" array-dimensions "]" ``` -Go to: _[expression](#user-content-expression), [array-dimensions](#user-content-array-dimensions)_; +Go to: _[array-dimensions](#user-content-array-dimensions), [expression](#user-content-expression)_; @@ -1100,7 +1100,7 @@ Go to: _[expression](#user-content-expression), [array-dimensions](#user-content array-construction = array-inline-construction / array-repeat-construction ``` -Go to: _[array-repeat-construction](#user-content-array-repeat-construction), [array-inline-construction](#user-content-array-inline-construction)_; +Go to: _[array-inline-construction](#user-content-array-inline-construction), [array-repeat-construction](#user-content-array-repeat-construction)_; @@ -1128,7 +1128,7 @@ circuit-construction = circuit-type "{" "}" ``` -Go to: _[circuit-inline-element](#user-content-circuit-inline-element), [circuit-type](#user-content-circuit-type)_; +Go to: _[circuit-type](#user-content-circuit-type), [circuit-inline-element](#user-content-circuit-inline-element)_; @@ -1136,7 +1136,7 @@ Go to: _[circuit-inline-element](#user-content-circuit-inline-element), [circuit circuit-inline-element = identifier ":" expression / identifier ``` -Go to: _[expression](#user-content-expression), [identifier](#user-content-identifier)_; +Go to: _[identifier](#user-content-identifier), [expression](#user-content-expression)_; @@ -1187,7 +1187,7 @@ postfix-expression = primary-expression / postfix-expression "[" [expression] ".." [expression] "]" ``` -Go to: _[function-arguments](#user-content-function-arguments), [postfix-expression](#user-content-postfix-expression), [natural](#user-content-natural), [circuit-type](#user-content-circuit-type), [expression](#user-content-expression), [identifier](#user-content-identifier), [primary-expression](#user-content-primary-expression)_; +Go to: _[circuit-type](#user-content-circuit-type), [expression](#user-content-expression), [function-arguments](#user-content-function-arguments), [identifier](#user-content-identifier), [natural](#user-content-natural), [primary-expression](#user-content-primary-expression), [postfix-expression](#user-content-postfix-expression)_; Unary operators have the highest operator precedence. @@ -1227,7 +1227,7 @@ multiplicative-expression = exponential-expression / multiplicative-expression "/" exponential-expression ``` -Go to: _[exponential-expression](#user-content-exponential-expression), [multiplicative-expression](#user-content-multiplicative-expression)_; +Go to: _[multiplicative-expression](#user-content-multiplicative-expression), [exponential-expression](#user-content-exponential-expression)_; Then there are addition and subtraction, both left-assocative. @@ -1239,7 +1239,7 @@ additive-expression = multiplicative-expression / additive-expression "-" multiplicative-expression ``` -Go to: _[multiplicative-expression](#user-content-multiplicative-expression), [additive-expression](#user-content-additive-expression)_; +Go to: _[additive-expression](#user-content-additive-expression), [multiplicative-expression](#user-content-multiplicative-expression)_; Next in the precedence order are ordering relations. @@ -1302,7 +1302,7 @@ conditional-expression = disjunctive-expression ":" conditional-expression ``` -Go to: _[expression](#user-content-expression), [conditional-expression](#user-content-conditional-expression), [disjunctive-expression](#user-content-disjunctive-expression)_; +Go to: _[conditional-expression](#user-content-conditional-expression), [expression](#user-content-expression), [disjunctive-expression](#user-content-disjunctive-expression)_; Those above are all the expressions. @@ -1335,7 +1335,7 @@ statement = expression-statement / block ``` -Go to: _[expression-statement](#user-content-expression-statement), [return-statement](#user-content-return-statement), [assignment-statement](#user-content-assignment-statement), [block](#user-content-block), [loop-statement](#user-content-loop-statement), [constant-declaration](#user-content-constant-declaration), [conditional-statement](#user-content-conditional-statement), [console-statement](#user-content-console-statement), [variable-declaration](#user-content-variable-declaration)_; +Go to: _[console-statement](#user-content-console-statement), [expression-statement](#user-content-expression-statement), [return-statement](#user-content-return-statement), [loop-statement](#user-content-loop-statement), [assignment-statement](#user-content-assignment-statement), [variable-declaration](#user-content-variable-declaration), [constant-declaration](#user-content-constant-declaration), [block](#user-content-block), [conditional-statement](#user-content-conditional-statement)_; @@ -1378,7 +1378,7 @@ variable-declaration = %s"let" identifier-or-identifiers [ ":" type ] "=" expression ";" ``` -Go to: _[type](#user-content-type), [identifier-or-identifiers](#user-content-identifier-or-identifiers), [expression](#user-content-expression)_; +Go to: _[expression](#user-content-expression), [identifier-or-identifiers](#user-content-identifier-or-identifiers), [type](#user-content-type)_; @@ -1387,7 +1387,7 @@ constant-declaration = %s"const" identifier-or-identifiers [ ":" type ] "=" expression ";" ``` -Go to: _[expression](#user-content-expression), [type](#user-content-type), [identifier-or-identifiers](#user-content-identifier-or-identifiers)_; +Go to: _[expression](#user-content-expression), [identifier-or-identifiers](#user-content-identifier-or-identifiers), [type](#user-content-type)_; @@ -1410,7 +1410,7 @@ Note that blocks are required in all branches, not merely statements. branch = %s"if" expression block ``` -Go to: _[block](#user-content-block), [expression](#user-content-expression)_; +Go to: _[expression](#user-content-expression), [block](#user-content-block)_; @@ -1420,7 +1420,7 @@ conditional-statement = branch / branch %s"else" conditional-statement ``` -Go to: _[block](#user-content-block), [branch](#user-content-branch), [conditional-statement](#user-content-conditional-statement)_; +Go to: _[branch](#user-content-branch), [block](#user-content-block), [conditional-statement](#user-content-conditional-statement)_; A loop statement implicitly defines a loop variable @@ -1432,7 +1432,7 @@ The body is a block. loop-statement = %s"for" identifier %s"in" expression ".." expression block ``` -Go to: _[identifier](#user-content-identifier), [expression](#user-content-expression), [block](#user-content-block)_; +Go to: _[expression](#user-content-expression), [identifier](#user-content-identifier), [block](#user-content-block)_; An assignment statement is straightforward. @@ -1449,7 +1449,7 @@ assignment-operator = "=" / "+=" / "-=" / "*=" / "/=" / "**=" assignment-statement = expression assignment-operator expression ";" ``` -Go to: _[expression](#user-content-expression), [assignment-operator](#user-content-assignment-operator)_; +Go to: _[assignment-operator](#user-content-assignment-operator), [expression](#user-content-expression)_; Console statements start with the `console` keyword, @@ -1535,7 +1535,7 @@ function-declaration = *annotation %s"function" identifier block ``` -Go to: _[block](#user-content-block), [identifier](#user-content-identifier), [function-parameters](#user-content-function-parameters), [type](#user-content-type)_; +Go to: _[identifier](#user-content-identifier), [type](#user-content-type), [function-parameters](#user-content-function-parameters), [block](#user-content-block)_; @@ -1545,7 +1545,7 @@ function-parameters = self-parameter / function-inputs ``` -Go to: _[self-parameter](#user-content-self-parameter), [function-inputs](#user-content-function-inputs)_; +Go to: _[function-inputs](#user-content-function-inputs), [self-parameter](#user-content-self-parameter)_; @@ -1566,24 +1566,15 @@ Go to: _[function-input](#user-content-function-input)_; function-input = [ %s"const" ] identifier ":" type ``` -Go to: _[type](#user-content-type), [identifier](#user-content-identifier)_; +Go to: _[identifier](#user-content-identifier), [type](#user-content-type)_; A circuit member variable declaration consists of an identifier and a type. A circuit member function declaration consists of a function declaration. - -```abnf -member-declaration = member-variable-declaration - / member-function-declaration -``` - -Go to: _[member-function-declaration](#user-content-member-function-declaration), [member-variable-declaration](#user-content-member-variable-declaration)_; - - - + ```abnf -member-variable-declaration = identifier ":" type +member-variable-declarations = *(identifier ":" type ( "," / ";" )) identifier ":" type ( [ "," ] / ";" ) ``` Go to: _[identifier](#user-content-identifier), [type](#user-content-type)_; @@ -1603,10 +1594,10 @@ as consisting of member variables and functions. ```abnf circuit-declaration = *annotation %s"circuit" identifier - "{" member-declaration *( "," member-declaration ) "}" + "{" [ member-variable-declarations ] *member-function-declaration "}" ``` -Go to: _[identifier](#user-content-identifier), [member-declaration](#user-content-member-declaration)_; +Go to: _[member-variable-declarations](#user-content-member-variable-declarations), [identifier](#user-content-identifier)_; An import declaration consists of the `import` keyword @@ -1650,7 +1641,7 @@ declaration = import-declaration / constant-declaration ``` -Go to: _[constant-declaration](#user-content-constant-declaration), [import-declaration](#user-content-import-declaration), [function-declaration](#user-content-function-declaration), [circuit-declaration](#user-content-circuit-declaration)_; +Go to: _[circuit-declaration](#user-content-circuit-declaration), [constant-declaration](#user-content-constant-declaration), [function-declaration](#user-content-function-declaration), [import-declaration](#user-content-import-declaration)_; diff --git a/grammar/abnf-grammar.txt b/grammar/abnf-grammar.txt index 6887198a54..eb75939256 100644 --- a/grammar/abnf-grammar.txt +++ b/grammar/abnf-grammar.txt @@ -945,10 +945,7 @@ function-input = [ %s"const" ] identifier ":" type ; A circuit member variable declaration consists of an identifier and a type. ; A circuit member function declaration consists of a function declaration. -member-declaration = member-variable-declaration - / member-function-declaration - -member-variable-declaration = identifier ":" type +member-variable-declarations = *(identifier ":" type ( "," / ";" )) identifier ":" type ( [ "," ] / ";" ) member-function-declaration = function-declaration @@ -956,7 +953,7 @@ member-function-declaration = function-declaration ; as consisting of member variables and functions. circuit-declaration = *annotation %s"circuit" identifier - "{" member-declaration *( "," member-declaration ) "}" + "{" [ member-variable-declarations ] *member-function-declaration "}" ; An import declaration consists of the `import` keyword ; followed by a package path, which may be one of the following: diff --git a/parser/benches/big_circuit.leo b/parser/benches/big_circuit.leo index 5d2242581c..a693788f11 100644 --- a/parser/benches/big_circuit.leo +++ b/parser/benches/big_circuit.leo @@ -6,260 +6,260 @@ function main() { } circuit Foo { - x0: u8, - x1: u8, - x2: u8, - x3: u8, - x4: u8, - x5: u8, - x6: u8, - x7: u8, - x8: u8, - x9: u8, - x10: u8, - x11: u8, - x12: u8, - x13: u8, - x14: u8, - x15: u8, - x16: u8, - x17: u8, - x18: u8, - x19: u8, - x20: u8, - x21: u8, - x22: u8, - x23: u8, - x24: u8, - x25: u8, - x26: u8, - x27: u8, - x28: u8, - x29: u8, - x30: u8, - x31: u8, - x32: u8, - x33: u8, - x34: u8, - x35: u8, - x36: u8, - x37: u8, - x38: u8, - x39: u8, - x40: u8, - x41: u8, - x42: u8, - x43: u8, - x44: u8, - x45: u8, - x46: u8, - x47: u8, - x48: u8, - x49: u8, - x50: u8, - x51: u8, - x52: u8, - x53: u8, - x54: u8, - x55: u8, - x56: u8, - x57: u8, - x58: u8, - x59: u8, - x60: u8, - x61: u8, - x62: u8, - x63: u8, - x64: u8, - x65: u8, - x66: u8, - x67: u8, - x68: u8, - x69: u8, - x70: u8, - x71: u8, - x72: u8, - x73: u8, - x74: u8, - x75: u8, - x76: u8, - x77: u8, - x78: u8, - x79: u8, - x80: u8, - x81: u8, - x82: u8, - x83: u8, - x84: u8, - x85: u8, - x86: u8, - x87: u8, - x88: u8, - x89: u8, - x90: u8, - x91: u8, - x92: u8, - x93: u8, - x94: u8, - x95: u8, - x96: u8, - x97: u8, - x98: u8, - x99: u8, - x100: u8, - x101: u8, - x102: u8, - x103: u8, - x104: u8, - x105: u8, - x106: u8, - x107: u8, - x108: u8, - x109: u8, - x110: u8, - x111: u8, - x112: u8, - x113: u8, - x114: u8, - x115: u8, - x116: u8, - x117: u8, - x118: u8, - x119: u8, - x120: u8, - x121: u8, - x122: u8, - x123: u8, - x124: u8, - x125: u8, - x126: u8, - x127: u8, - x128: u8, - x129: u8, - x130: u8, - x131: u8, - x132: u8, - x133: u8, - x134: u8, - x135: u8, - x136: u8, - x137: u8, - x138: u8, - x139: u8, - x140: u8, - x141: u8, - x142: u8, - x143: u8, - x144: u8, - x145: u8, - x146: u8, - x147: u8, - x148: u8, - x149: u8, - x150: u8, - x151: u8, - x152: u8, - x153: u8, - x154: u8, - x155: u8, - x156: u8, - x157: u8, - x158: u8, - x159: u8, - x160: u8, - x161: u8, - x162: u8, - x163: u8, - x164: u8, - x165: u8, - x166: u8, - x167: u8, - x168: u8, - x169: u8, - x170: u8, - x171: u8, - x172: u8, - x173: u8, - x174: u8, - x175: u8, - x176: u8, - x177: u8, - x178: u8, - x179: u8, - x180: u8, - x181: u8, - x182: u8, - x183: u8, - x184: u8, - x185: u8, - x186: u8, - x187: u8, - x188: u8, - x189: u8, - x190: u8, - x191: u8, - x192: u8, - x193: u8, - x194: u8, - x195: u8, - x196: u8, - x197: u8, - x198: u8, - x199: u8, - x200: u8, - x201: u8, - x202: u8, - x203: u8, - x204: u8, - x205: u8, - x206: u8, - x207: u8, - x208: u8, - x209: u8, - x210: u8, - x211: u8, - x212: u8, - x213: u8, - x214: u8, - x215: u8, - x216: u8, - x217: u8, - x218: u8, - x219: u8, - x220: u8, - x221: u8, - x222: u8, - x223: u8, - x224: u8, - x225: u8, - x226: u8, - x227: u8, - x228: u8, - x229: u8, - x230: u8, - x231: u8, - x232: u8, - x233: u8, - x234: u8, - x235: u8, - x236: u8, - x237: u8, - x238: u8, - x239: u8, - x240: u8, - x241: u8, - x242: u8, - x243: u8, - x244: u8, - x245: u8, - x246: u8, - x247: u8, - x248: u8, - x249: u8, - x250: u8, - x251: u8, - x252: u8, - x253: u8, - x254: u8, - x255: u8 + x0: u8; + x1: u8; + x2: u8; + x3: u8; + x4: u8; + x5: u8; + x6: u8; + x7: u8; + x8: u8; + x9: u8; + x10: u8; + x11: u8; + x12: u8; + x13: u8; + x14: u8; + x15: u8; + x16: u8; + x17: u8; + x18: u8; + x19: u8; + x20: u8; + x21: u8; + x22: u8; + x23: u8; + x24: u8; + x25: u8; + x26: u8; + x27: u8; + x28: u8; + x29: u8; + x30: u8; + x31: u8; + x32: u8; + x33: u8; + x34: u8; + x35: u8; + x36: u8; + x37: u8; + x38: u8; + x39: u8; + x40: u8; + x41: u8; + x42: u8; + x43: u8; + x44: u8; + x45: u8; + x46: u8; + x47: u8; + x48: u8; + x49: u8; + x50: u8; + x51: u8; + x52: u8; + x53: u8; + x54: u8; + x55: u8; + x56: u8; + x57: u8; + x58: u8; + x59: u8; + x60: u8; + x61: u8; + x62: u8; + x63: u8; + x64: u8; + x65: u8; + x66: u8; + x67: u8; + x68: u8; + x69: u8; + x70: u8; + x71: u8; + x72: u8; + x73: u8; + x74: u8; + x75: u8; + x76: u8; + x77: u8; + x78: u8; + x79: u8; + x80: u8; + x81: u8; + x82: u8; + x83: u8; + x84: u8; + x85: u8; + x86: u8; + x87: u8; + x88: u8; + x89: u8; + x90: u8; + x91: u8; + x92: u8; + x93: u8; + x94: u8; + x95: u8; + x96: u8; + x97: u8; + x98: u8; + x99: u8; + x100: u8; + x101: u8; + x102: u8; + x103: u8; + x104: u8; + x105: u8; + x106: u8; + x107: u8; + x108: u8; + x109: u8; + x110: u8; + x111: u8; + x112: u8; + x113: u8; + x114: u8; + x115: u8; + x116: u8; + x117: u8; + x118: u8; + x119: u8; + x120: u8; + x121: u8; + x122: u8; + x123: u8; + x124: u8; + x125: u8; + x126: u8; + x127: u8; + x128: u8; + x129: u8; + x130: u8; + x131: u8; + x132: u8; + x133: u8; + x134: u8; + x135: u8; + x136: u8; + x137: u8; + x138: u8; + x139: u8; + x140: u8; + x141: u8; + x142: u8; + x143: u8; + x144: u8; + x145: u8; + x146: u8; + x147: u8; + x148: u8; + x149: u8; + x150: u8; + x151: u8; + x152: u8; + x153: u8; + x154: u8; + x155: u8; + x156: u8; + x157: u8; + x158: u8; + x159: u8; + x160: u8; + x161: u8; + x162: u8; + x163: u8; + x164: u8; + x165: u8; + x166: u8; + x167: u8; + x168: u8; + x169: u8; + x170: u8; + x171: u8; + x172: u8; + x173: u8; + x174: u8; + x175: u8; + x176: u8; + x177: u8; + x178: u8; + x179: u8; + x180: u8; + x181: u8; + x182: u8; + x183: u8; + x184: u8; + x185: u8; + x186: u8; + x187: u8; + x188: u8; + x189: u8; + x190: u8; + x191: u8; + x192: u8; + x193: u8; + x194: u8; + x195: u8; + x196: u8; + x197: u8; + x198: u8; + x199: u8; + x200: u8; + x201: u8; + x202: u8; + x203: u8; + x204: u8; + x205: u8; + x206: u8; + x207: u8; + x208: u8; + x209: u8; + x210: u8; + x211: u8; + x212: u8; + x213: u8; + x214: u8; + x215: u8; + x216: u8; + x217: u8; + x218: u8; + x219: u8; + x220: u8; + x221: u8; + x222: u8; + x223: u8; + x224: u8; + x225: u8; + x226: u8; + x227: u8; + x228: u8; + x229: u8; + x230: u8; + x231: u8; + x232: u8; + x233: u8; + x234: u8; + x235: u8; + x236: u8; + x237: u8; + x238: u8; + x239: u8; + x240: u8; + x241: u8; + x242: u8; + x243: u8; + x244: u8; + x245: u8; + x246: u8; + x247: u8; + x248: u8; + x249: u8; + x250: u8; + x251: u8; + x252: u8; + x253: u8; + x254: u8; + x255: u8; } \ No newline at end of file diff --git a/parser/src/errors/syntax.rs b/parser/src/errors/syntax.rs index a5850ee9b5..24071708a4 100644 --- a/parser/src/errors/syntax.rs +++ b/parser/src/errors/syntax.rs @@ -74,6 +74,13 @@ impl SyntaxError { ) } + pub fn mixed_commas_and_semicolons(span: &Span) -> Self { + Self::new_from_span( + "Cannot mix use of commas and semi-colons for circuit member variable declarations.".to_string(), + span, + ) + } + pub fn unexpected_ident(got: &str, expected: &[&str], span: &Span) -> Self { Self::new_from_span( format!( diff --git a/parser/src/parser/context.rs b/parser/src/parser/context.rs index 1f4a15c490..c83cf2a4dd 100644 --- a/parser/src/parser/context.rs +++ b/parser/src/parser/context.rs @@ -66,6 +66,13 @@ impl ParserContext { SyntaxError::unexpected_eof(&self.end_span) } + /// + /// Returns a reference to the next next token or error if it does not exist. + /// + pub fn peek_next(&self) -> SyntaxResult<&SpannedToken> { + self.tokens.get(self.tokens.len() - 2).ok_or_else(|| self.eof()) + } + /// /// Returns a reference to the next token or error if it does not exist. /// diff --git a/parser/src/parser/file.rs b/parser/src/parser/file.rs index 8dfdfc132a..a9c460d9bb 100644 --- a/parser/src/parser/file.rs +++ b/parser/src/parser/file.rs @@ -280,18 +280,82 @@ impl ParserContext { /// Returns a [`CircuitMember`] AST node if the next tokens represent a circuit member variable /// or circuit member function. /// - pub fn parse_circuit_member(&mut self) -> SyntaxResult { + pub fn parse_circuit_declaration(&mut self) -> SyntaxResult> { + let mut members = Vec::new(); let peeked = &self.peek()?.token; - if peeked == &Token::Function || peeked == &Token::At { + let mut last_variable = peeked == &Token::Function || peeked == &Token::At; + let (mut semi_colons, mut commas) = (false, false); + while self.eat(Token::RightCurly).is_none() { + if !last_variable { + let (variable, last) = self.parse_member_variable_declaration()?; + + members.push(variable); + + let peeked = &self.peek()?; + if peeked.token == Token::Semicolon { + if commas { + return Err(SyntaxError::mixed_commas_and_semicolons(&peeked.span)); + } + + semi_colons = true; + self.expect(Token::Semicolon)?; + } else { + if semi_colons { + return Err(SyntaxError::mixed_commas_and_semicolons(&peeked.span)); + } + + commas = true; + self.eat(Token::Comma); + } + + if last { + last_variable = last; + } + } else { + let function = self.parse_member_function_declaration()?; + members.push(function); + } + } + + Ok(members) + } + + /// + /// Returns a [`CircuitMember`] AST node if the next tokens represent a circuit member variable. + /// + pub fn parse_member_variable_declaration(&mut self) -> SyntaxResult<(CircuitMember, bool)> { + let name = self.expect_ident()?; + self.expect(Token::Colon)?; + let type_ = self.parse_type()?.0; + + let peeked = &self.peek()?.token; + if peeked == &Token::Function || peeked == &Token::At || peeked == &Token::RightCurly { + return Ok((CircuitMember::CircuitVariable(name, type_), true)); + } else if peeked == &Token::Comma || peeked == &Token::Semicolon { + let peeked = &self.peek_next()?.token; + if peeked == &Token::Function || peeked == &Token::At || peeked == &Token::RightCurly { + return Ok((CircuitMember::CircuitVariable(name, type_), true)); + } + } + + Ok((CircuitMember::CircuitVariable(name, type_), false)) + } + + /// + /// Returns a [`CircuitMember`] AST node if the next tokens represent a circuit member function. + /// + pub fn parse_member_function_declaration(&mut self) -> SyntaxResult { + let peeked = &self.peek()?; + let peeked_token = &peeked.token; + if peeked_token == &Token::Function || peeked_token == &Token::At { let function = self.parse_function_declaration()?; Ok(CircuitMember::CircuitFunction(function.1)) } else { - // circuit variable - let name = self.expect_ident()?; - self.expect(Token::Colon)?; - let type_ = self.parse_type()?.0; - self.eat(Token::Comma); - Ok(CircuitMember::CircuitVariable(name, type_)) + Err(SyntaxError::unexpected( + peeked_token, + &[Token::Function, Token::At], + &peeked.span, + )) } } @@ -303,11 +367,8 @@ impl ParserContext { self.expect(Token::Circuit)?; let name = self.expect_ident()?; self.expect(Token::LeftCurly)?; - let mut members = Vec::new(); - while self.eat(Token::RightCurly).is_none() { - let member = self.parse_circuit_member()?; - members.push(member); - } + let members = self.parse_circuit_declaration()?; + Ok((name.clone(), Circuit { circuit_name: name, members, diff --git a/tests/expectations/parser/parser/circuits/big_self.leo.out b/tests/expectations/parser/parser/circuits/big_self.leo.out index ee647ea625..abdced08ca 100644 --- a/tests/expectations/parser/parser/circuits/big_self.leo.out +++ b/tests/expectations/parser/parser/circuits/big_self.leo.out @@ -49,4 +49,5 @@ outputs: col_stop: 6 path: test content: " function x() -> Self {\n...\n }" + global_consts: {} functions: {} diff --git a/tests/expectations/parser/parser/circuits/empty.leo.out b/tests/expectations/parser/parser/circuits/empty.leo.out index 0fa7fe2114..e826c4097d 100644 --- a/tests/expectations/parser/parser/circuits/empty.leo.out +++ b/tests/expectations/parser/parser/circuits/empty.leo.out @@ -9,4 +9,5 @@ outputs: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}": circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}" members: [] + global_consts: {} functions: {} diff --git a/tests/expectations/parser/parser/circuits/field_and_functions.leo.out b/tests/expectations/parser/parser/circuits/field_and_functions.leo.out index 02b64f582e..a13e5be7fb 100644 --- a/tests/expectations/parser/parser/circuits/field_and_functions.leo.out +++ b/tests/expectations/parser/parser/circuits/field_and_functions.leo.out @@ -13,7 +13,7 @@ outputs: - "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" x: u32,\\\"}\"}" - IntegerType: U32 - CircuitVariable: - - "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" y: u32,\\\"}\"}" + - "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" y: u32\\\"}\"}" - IntegerType: U32 - CircuitFunction: annotations: [] @@ -93,4 +93,5 @@ outputs: col_stop: 6 path: test content: " function y() {\n...\n }" + global_consts: {} functions: {} diff --git a/tests/expectations/parser/parser/circuits/fields.leo.out b/tests/expectations/parser/parser/circuits/fields.leo.out index 354a6892bc..041cc13554 100644 --- a/tests/expectations/parser/parser/circuits/fields.leo.out +++ b/tests/expectations/parser/parser/circuits/fields.leo.out @@ -10,9 +10,10 @@ outputs: circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}" members: - CircuitVariable: - - "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" x: u32,\\\"}\"}" + - "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" x: u32;\\\"}\"}" - IntegerType: U32 - CircuitVariable: - - "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" y: u32,\\\"}\"}" + - "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\" y: u32;\\\"}\"}" - IntegerType: U32 + global_consts: {} functions: {} diff --git a/tests/expectations/parser/parser/circuits/fields_fail.leo.out b/tests/expectations/parser/parser/circuits/fields_fail.leo.out new file mode 100644 index 0000000000..006159e9d5 --- /dev/null +++ b/tests/expectations/parser/parser/circuits/fields_fail.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Parse +expectation: Fail +outputs: + - " --> test:10:11\n |\n 10 | y: u32;\n | ^\n |\n = Cannot mix use of commas and semi-colons for circuit member variable declarations." diff --git a/tests/expectations/parser/parser/circuits/functions.leo.out b/tests/expectations/parser/parser/circuits/functions.leo.out index 71b4a7a2bb..aebda6c4e5 100644 --- a/tests/expectations/parser/parser/circuits/functions.leo.out +++ b/tests/expectations/parser/parser/circuits/functions.leo.out @@ -87,4 +87,5 @@ outputs: col_stop: 6 path: test content: " function y() {\n...\n }" + global_consts: {} functions: {} diff --git a/tests/expectations/parser/parser/circuits/mut_self.leo.out b/tests/expectations/parser/parser/circuits/mut_self.leo.out index 54800e5ed7..03997801dc 100644 --- a/tests/expectations/parser/parser/circuits/mut_self.leo.out +++ b/tests/expectations/parser/parser/circuits/mut_self.leo.out @@ -49,4 +49,5 @@ outputs: col_stop: 6 path: test content: " function x(mut self) {\n...\n }" + global_consts: {} functions: {} diff --git a/tests/expectations/parser/parser/circuits/self.leo.out b/tests/expectations/parser/parser/circuits/self.leo.out index 6f1445d071..65785a36b6 100644 --- a/tests/expectations/parser/parser/circuits/self.leo.out +++ b/tests/expectations/parser/parser/circuits/self.leo.out @@ -49,4 +49,5 @@ outputs: col_stop: 6 path: test content: " function x(self) {\n...\n }" + global_consts: {} functions: {} diff --git a/tests/expectations/parser/parser/functions/annotated.leo.out b/tests/expectations/parser/parser/functions/annotated.leo.out index c0e6dab6fb..29612e265a 100644 --- a/tests/expectations/parser/parser/functions/annotated.leo.out +++ b/tests/expectations/parser/parser/functions/annotated.leo.out @@ -6,6 +6,7 @@ outputs: expected_input: [] imports: [] circuits: {} + global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x() {\\\"}\"}": annotations: diff --git a/tests/expectations/parser/parser/functions/annotated_param.leo.out b/tests/expectations/parser/parser/functions/annotated_param.leo.out index 99ca4119f9..72ca72549e 100644 --- a/tests/expectations/parser/parser/functions/annotated_param.leo.out +++ b/tests/expectations/parser/parser/functions/annotated_param.leo.out @@ -6,6 +6,7 @@ outputs: expected_input: [] imports: [] circuits: {} + global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x() {\\\"}\"}": annotations: diff --git a/tests/expectations/parser/parser/functions/annotated_twice.leo.out b/tests/expectations/parser/parser/functions/annotated_twice.leo.out index 2a4220983e..a83199ec50 100644 --- a/tests/expectations/parser/parser/functions/annotated_twice.leo.out +++ b/tests/expectations/parser/parser/functions/annotated_twice.leo.out @@ -6,6 +6,7 @@ outputs: expected_input: [] imports: [] circuits: {} + global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x() {\\\"}\"}": annotations: diff --git a/tests/expectations/parser/parser/functions/const_param.leo.out b/tests/expectations/parser/parser/functions/const_param.leo.out index 28916f76c8..609a83247f 100644 --- a/tests/expectations/parser/parser/functions/const_param.leo.out +++ b/tests/expectations/parser/parser/functions/const_param.leo.out @@ -6,6 +6,7 @@ outputs: expected_input: [] imports: [] circuits: {} + global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x(x: u32, const y: i32) {\\\"}\"}": annotations: [] diff --git a/tests/expectations/parser/parser/functions/const_self_bad.leo.out b/tests/expectations/parser/parser/functions/const_self_bad.leo.out index 68248c8693..3b6e210cef 100644 --- a/tests/expectations/parser/parser/functions/const_self_bad.leo.out +++ b/tests/expectations/parser/parser/functions/const_self_bad.leo.out @@ -6,6 +6,7 @@ outputs: expected_input: [] imports: [] circuits: {} + global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x(const self) {\\\"}\"}": annotations: [] diff --git a/tests/expectations/parser/parser/functions/empty.leo.out b/tests/expectations/parser/parser/functions/empty.leo.out index 03ff79d359..5ead848ab3 100644 --- a/tests/expectations/parser/parser/functions/empty.leo.out +++ b/tests/expectations/parser/parser/functions/empty.leo.out @@ -6,6 +6,7 @@ outputs: expected_input: [] imports: [] circuits: {} + global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x() {\\\"}\"}": annotations: [] diff --git a/tests/expectations/parser/parser/functions/empty2.leo.out b/tests/expectations/parser/parser/functions/empty2.leo.out index ba7212db42..16574b1dc3 100644 --- a/tests/expectations/parser/parser/functions/empty2.leo.out +++ b/tests/expectations/parser/parser/functions/empty2.leo.out @@ -6,6 +6,7 @@ outputs: expected_input: [] imports: [] circuits: {} + global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x() {}\\\"}\"}": annotations: [] diff --git a/tests/expectations/parser/parser/functions/param_array.leo.out b/tests/expectations/parser/parser/functions/param_array.leo.out index 6854e088a5..c9b3cc79cd 100644 --- a/tests/expectations/parser/parser/functions/param_array.leo.out +++ b/tests/expectations/parser/parser/functions/param_array.leo.out @@ -6,6 +6,7 @@ outputs: expected_input: [] imports: [] circuits: {} + global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x(x: [u8; 12]) {\\\"}\"}": annotations: [] diff --git a/tests/expectations/parser/parser/functions/param_circuit.leo.out b/tests/expectations/parser/parser/functions/param_circuit.leo.out index a43143a6cb..e998fe7f92 100644 --- a/tests/expectations/parser/parser/functions/param_circuit.leo.out +++ b/tests/expectations/parser/parser/functions/param_circuit.leo.out @@ -6,6 +6,7 @@ outputs: expected_input: [] imports: [] circuits: {} + global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x(x: MyCircuit) {\\\"}\"}": annotations: [] diff --git a/tests/expectations/parser/parser/functions/param_tuple.leo.out b/tests/expectations/parser/parser/functions/param_tuple.leo.out index 520d664450..9597b18cb3 100644 --- a/tests/expectations/parser/parser/functions/param_tuple.leo.out +++ b/tests/expectations/parser/parser/functions/param_tuple.leo.out @@ -6,6 +6,7 @@ outputs: expected_input: [] imports: [] circuits: {} + global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x(x: (u32, i32)) {\\\"}\"}": annotations: [] diff --git a/tests/expectations/parser/parser/functions/params.leo.out b/tests/expectations/parser/parser/functions/params.leo.out index 6549ea1ca2..9c74dafafd 100644 --- a/tests/expectations/parser/parser/functions/params.leo.out +++ b/tests/expectations/parser/parser/functions/params.leo.out @@ -6,6 +6,7 @@ outputs: expected_input: [] imports: [] circuits: {} + global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) {\\\"}\"}": annotations: [] diff --git a/tests/expectations/parser/parser/functions/params_return.leo.out b/tests/expectations/parser/parser/functions/params_return.leo.out index 1ec8867568..6b1980e238 100644 --- a/tests/expectations/parser/parser/functions/params_return.leo.out +++ b/tests/expectations/parser/parser/functions/params_return.leo.out @@ -6,6 +6,7 @@ outputs: expected_input: [] imports: [] circuits: {} + global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) -> u32 {\\\"}\"}": annotations: [] diff --git a/tests/expectations/parser/parser/functions/return.leo.out b/tests/expectations/parser/parser/functions/return.leo.out index 0f87e02968..3baa2a2e79 100644 --- a/tests/expectations/parser/parser/functions/return.leo.out +++ b/tests/expectations/parser/parser/functions/return.leo.out @@ -6,6 +6,7 @@ outputs: expected_input: [] imports: [] circuits: {} + global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x() -> u32 {\\\"}\"}": annotations: [] diff --git a/tests/expectations/parser/parser/functions/return_tuple.leo.out b/tests/expectations/parser/parser/functions/return_tuple.leo.out index 16b4bd1c45..aa853f04df 100644 --- a/tests/expectations/parser/parser/functions/return_tuple.leo.out +++ b/tests/expectations/parser/parser/functions/return_tuple.leo.out @@ -6,6 +6,7 @@ outputs: expected_input: [] imports: [] circuits: {} + global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"test\\\",\\\"content\\\":\\\"function x() -> (u32, u32) {\\\"}\"}": annotations: [] diff --git a/tests/expectations/parser/parser/import/alias.leo.out b/tests/expectations/parser/parser/import/alias.leo.out index 654fbcefc6..e0c181f3d7 100644 --- a/tests/expectations/parser/parser/import/alias.leo.out +++ b/tests/expectations/parser/parser/import/alias.leo.out @@ -34,4 +34,5 @@ outputs: path: test content: import a.b as bar; circuits: {} + global_consts: {} functions: {} diff --git a/tests/expectations/parser/parser/import/basic.leo.out b/tests/expectations/parser/parser/import/basic.leo.out index 6467c45999..7293ccb78e 100644 --- a/tests/expectations/parser/parser/import/basic.leo.out +++ b/tests/expectations/parser/parser/import/basic.leo.out @@ -34,4 +34,5 @@ outputs: path: test content: import a.b; circuits: {} + global_consts: {} functions: {} diff --git a/tests/expectations/parser/parser/import/many_import.leo.out b/tests/expectations/parser/parser/import/many_import.leo.out index 27e4abedd1..c8bf9349c8 100644 --- a/tests/expectations/parser/parser/import/many_import.leo.out +++ b/tests/expectations/parser/parser/import/many_import.leo.out @@ -132,4 +132,5 @@ outputs: path: test content: "import bar.( // imports directory import\n...\n bat.bat.Bat," circuits: {} + global_consts: {} functions: {} diff --git a/tests/expectations/parser/parser/import/many_import_star.leo.out b/tests/expectations/parser/parser/import/many_import_star.leo.out index d72655988c..9a04d35a1c 100644 --- a/tests/expectations/parser/parser/import/many_import_star.leo.out +++ b/tests/expectations/parser/parser/import/many_import_star.leo.out @@ -161,4 +161,5 @@ outputs: path: test content: import car.*; // imports directory import circuits: {} + global_consts: {} functions: {} diff --git a/tests/expectations/parser/parser/import/names.leo.out b/tests/expectations/parser/parser/import/names.leo.out index 0ea33ddad3..9bc9319577 100644 --- a/tests/expectations/parser/parser/import/names.leo.out +++ b/tests/expectations/parser/parser/import/names.leo.out @@ -90,4 +90,5 @@ outputs: path: test content: import hello-world.hello; circuits: {} + global_consts: {} functions: {} diff --git a/tests/expectations/parser/parser/import/names_underscore.leo.out b/tests/expectations/parser/parser/import/names_underscore.leo.out index 1dcd68015c..952c5c0ac7 100644 --- a/tests/expectations/parser/parser/import/names_underscore.leo.out +++ b/tests/expectations/parser/parser/import/names_underscore.leo.out @@ -34,4 +34,5 @@ outputs: path: test content: import hello_world.foo; circuits: {} + global_consts: {} functions: {} diff --git a/tests/expectations/parser/parser/import/star.leo.out b/tests/expectations/parser/parser/import/star.leo.out index 59d6e5c5b9..5bdc771258 100644 --- a/tests/expectations/parser/parser/import/star.leo.out +++ b/tests/expectations/parser/parser/import/star.leo.out @@ -31,4 +31,5 @@ outputs: path: test content: import test-import.*; circuits: {} + global_consts: {} functions: {} diff --git a/tests/parser/circuits/field_and_functions.leo b/tests/parser/circuits/field_and_functions.leo index 01f4d3e636..51d09324ec 100644 --- a/tests/parser/circuits/field_and_functions.leo +++ b/tests/parser/circuits/field_and_functions.leo @@ -5,7 +5,7 @@ expectation: Pass circuit X { x: u32, - y: u32, + y: u32 function x() { return (); } diff --git a/tests/parser/circuits/fields.leo b/tests/parser/circuits/fields.leo index 34c7f5cf8f..1369166472 100644 --- a/tests/parser/circuits/fields.leo +++ b/tests/parser/circuits/fields.leo @@ -4,6 +4,6 @@ expectation: Pass */ circuit X { - x: u32, - y: u32, + x: u32; + y: u32; } \ No newline at end of file diff --git a/tests/parser/circuits/fields_fail.leo b/tests/parser/circuits/fields_fail.leo new file mode 100644 index 0000000000..a56bdb1a6e --- /dev/null +++ b/tests/parser/circuits/fields_fail.leo @@ -0,0 +1,14 @@ +/* +namespace: Parse +expectation: Fail +*/ + +circuit X { + x: u32 + y: u32 +} + +circuit X { + x: u32, + y: u32; +} \ No newline at end of file