Skip to content

Commit

Permalink
Merge pull request #903 from AleoHQ/bug/abnf-circuit-grammar
Browse files Browse the repository at this point in the history
Bug/abnf-circuit-grammar
  • Loading branch information
acoglio authored May 6, 2021
2 parents 15deef6 + c063200 commit 2ddb474
Show file tree
Hide file tree
Showing 105 changed files with 508 additions and 398 deletions.
2 changes: 1 addition & 1 deletion asg/tests/fail/circuits/inline_fail.leo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit Foo {
x: u32
x: u32;
}

function main() {
Expand Down
2 changes: 1 addition & 1 deletion asg/tests/fail/circuits/member_variable_fail.leo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit Foo {
x: u32
x: u32;
}

function main() {
Expand Down
2 changes: 1 addition & 1 deletion asg/tests/fail/circuits/mut_function_fail.leo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit Foo {
a: u8,
a: u8;

function bar() {}
}
Expand Down
2 changes: 1 addition & 1 deletion asg/tests/fail/circuits/mut_self_function_fail.leo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit Foo {
a: u8,
a: u8;

function bar() {}

Expand Down
2 changes: 1 addition & 1 deletion asg/tests/fail/circuits/mut_self_static_function_fail.leo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit Foo {
a: u8,
a: u8;

function bar() {}

Expand Down
2 changes: 1 addition & 1 deletion asg/tests/fail/circuits/mut_self_variable_fail.leo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit Foo {
a: u8,
a: u8;

function set_a(self, new: u8) {
self.a = new;
Expand Down
2 changes: 1 addition & 1 deletion asg/tests/fail/circuits/mut_variable_fail.leo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit Foo {
a: u8,
a: u8;
}

function main() {
Expand Down
2 changes: 1 addition & 1 deletion asg/tests/fail/circuits/self_member_invalid.leo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit Foo {
f: u32,
f: u32;

function bar() -> u32 {
return f;
Expand Down
2 changes: 1 addition & 1 deletion asg/tests/fail/mutability/circuit.leo
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Circuits are immutable by default.
circuit Foo {
x: u32
x: u32;
}

function main() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit Foo {
a: u32,
a: u32;
}

circuit Bar {
Expand Down
2 changes: 1 addition & 1 deletion asg/tests/pass/circuits/inline.leo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit Foo {
x: u32
x: u32;
}

function main() {
Expand Down
2 changes: 1 addition & 1 deletion asg/tests/pass/circuits/member_function_nested.leo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit Foo {
x: u32,
x: u32;

function add_x(self, y: u32) -> u32 {
return self.x + y;
Expand Down
2 changes: 1 addition & 1 deletion asg/tests/pass/circuits/member_variable.leo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit Foo {
x: u32,
x: u32;
}

function main() {
Expand Down
2 changes: 1 addition & 1 deletion asg/tests/pass/circuits/member_variable_and_function.leo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit Foo {
foo: u32,
foo: u32;

function bar() -> u32 {
return 1u32;
Expand Down
2 changes: 1 addition & 1 deletion asg/tests/pass/circuits/mut_self_variable.leo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit Foo {
a: u8,
a: u8;

function set_a(mut self, new: u8) {
self.a = new;
Expand Down
2 changes: 1 addition & 1 deletion asg/tests/pass/circuits/mut_self_variable_conditional.leo
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function main() {
}

circuit Foo {
a: u32
a: u32;

function bar(mut self) {
if true {
Expand Down
2 changes: 1 addition & 1 deletion asg/tests/pass/circuits/mut_variable.leo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit Foo {
a: u8,
a: u8;
}

function main() {
Expand Down
2 changes: 1 addition & 1 deletion asg/tests/pass/circuits/pedersen_mock.leo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit PedersenHash {
parameters: [u32; 512]
parameters: [u32; 512];

function new(const parameters: [u32; 512]) -> Self {
return Self { parameters: parameters };
Expand Down
2 changes: 1 addition & 1 deletion asg/tests/pass/circuits/self_member.leo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit Foo {
f: u32,
f: u32;

function bar(self) -> u32 {
return self.f;
Expand Down
4 changes: 2 additions & 2 deletions asg/tests/pass/form_ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion asg/tests/pass/import/imports/bar/src/bat/bat.leo
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
circuit Bat {
t: u32
t: u32;
}
4 changes: 2 additions & 2 deletions asg/tests/pass/import/imports/bar/src/baz.leo
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
circuit Baz {
z: u32
z: u32;
}

circuit Bazzar {
a: u32
a: u32;
}
2 changes: 1 addition & 1 deletion asg/tests/pass/import/imports/bar/src/lib.leo
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
circuit Bar {
r: u32
r: u32;
}
2 changes: 1 addition & 1 deletion asg/tests/pass/import/imports/car/src/lib.leo
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
circuit Car {
c: u32
c: u32;
}
4 changes: 2 additions & 2 deletions asg/tests/pass/import/src/test-import.leo
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
circuit Point {
x: u32
y: u32
x: u32;
y: u32;
}

function foo() -> u32 {
Expand Down
2 changes: 1 addition & 1 deletion asg/tests/pass/mutability/circuit_mut.leo
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Adding the `mut` keyword makes a circuit variable mutable.
circuit Foo {
x: u32
x: u32;
}

function main() {
Expand Down
2 changes: 1 addition & 1 deletion asg/tests/pass/mutability/circuit_variable_mut.leo
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Adding the `mut` keyword makes a circuit variable mutable.
circuit Foo {
x: u32
x: u32;
}

function main() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit Foo {
x: u32
x: u32;

function new() -> Self {
let new: Self = Self {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit Foo {
x: u32
x: u32;

function new() -> Self {
let new: Self = Self {
Expand Down
4 changes: 2 additions & 2 deletions compiler/tests/canonicalization/compound_assignment.leo
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion compiler/tests/circuits/const_self_variable.leo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit Foo {
a: u8,
a: u8;

function use_a(const self) -> u8 {
return self.a + 1;
Expand Down
2 changes: 1 addition & 1 deletion compiler/tests/circuits/const_self_variable_fail.leo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit Foo {
a: u8,
a: u8;

function set_a(const self, new: u8) {
self.a = new;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit Foo {
a: u32,
a: u32;
}

circuit Bar {
Expand Down
2 changes: 1 addition & 1 deletion compiler/tests/circuits/duplicate_name_context.leo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit Bar {
b2: u32
b2: u32;

function add_five(z:u32) -> u32 {
return z+5u32;
Expand Down
2 changes: 1 addition & 1 deletion compiler/tests/circuits/inline.leo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit Foo {
x: u32
x: u32;
}

function main() {
Expand Down
2 changes: 1 addition & 1 deletion compiler/tests/circuits/inline_fail.leo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit Foo {
x: u32
x: u32;
}

function main() {
Expand Down
2 changes: 1 addition & 1 deletion compiler/tests/circuits/inline_member_fail.leo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit Foo {
x: u8
x: u8;
}

function main() {
Expand Down
2 changes: 1 addition & 1 deletion compiler/tests/circuits/inline_member_pass.leo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit Foo {
x: u8
x: u8;

function new(x: u8) -> Self {
return Self { x };
Expand Down
2 changes: 1 addition & 1 deletion compiler/tests/circuits/member_function.leo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit Foo {
x: u32,
x: u32;

function echo(self) -> u32 {
return self.x;
Expand Down
2 changes: 1 addition & 1 deletion compiler/tests/circuits/member_function_nested.leo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit Foo {
x: u32,
x: u32;

function add_x(self, y: u32) -> u32 {
return self.x + y;
Expand Down
2 changes: 1 addition & 1 deletion compiler/tests/circuits/member_variable.leo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit Foo {
x: u32,
x: u32;
}

function main() {
Expand Down
2 changes: 1 addition & 1 deletion compiler/tests/circuits/member_variable_and_function.leo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit Foo {
foo: u32,
foo: u32;

function bar() -> u32 {
return 1u32;
Expand Down
2 changes: 1 addition & 1 deletion compiler/tests/circuits/member_variable_fail.leo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit Foo {
x: u32
x: u32;
}

function main() {
Expand Down
2 changes: 1 addition & 1 deletion compiler/tests/circuits/mut_function_fail.leo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit Foo {
a: u8,
a: u8;

function bar() {}
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/tests/circuits/mut_self_function_fail.leo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit Foo {
a: u8,
a: u8;

function bar() {}

Expand Down
2 changes: 1 addition & 1 deletion compiler/tests/circuits/mut_self_static_function_fail.leo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit Foo {
a: u8,
a: u8;

function bar() {}

Expand Down
2 changes: 1 addition & 1 deletion compiler/tests/circuits/mut_self_variable.leo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit Foo {
a: u8,
a: u8;

function set_a(mut self, new: u8) {
self.a = new;
Expand Down
2 changes: 1 addition & 1 deletion compiler/tests/circuits/mut_self_variable_branch.leo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit Foo {
a: u8,
a: u8;

function set_a(mut self, condition: bool, new: u8) {
if condition {
Expand Down
2 changes: 1 addition & 1 deletion compiler/tests/circuits/mut_self_variable_conditional.leo
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function main() {
}

circuit Foo {
a: u32
a: u32;

function bar(mut self) {
if true {
Expand Down
2 changes: 1 addition & 1 deletion compiler/tests/circuits/mut_self_variable_fail.leo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit Foo {
a: u8,
a: u8;

function set_a(self, new: u8) {
self.a = new;
Expand Down
2 changes: 1 addition & 1 deletion compiler/tests/circuits/mut_variable.leo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit Foo {
a: u8,
a: u8;
}

function main() {
Expand Down
2 changes: 1 addition & 1 deletion compiler/tests/circuits/mut_variable_fail.leo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit Foo {
a: u8,
a: u8;
}

function main() {
Expand Down
2 changes: 1 addition & 1 deletion compiler/tests/circuits/mutable_call_immutable_context.leo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit TestMe {
x: u8,
x: u8;

function test_me(mut self) -> u8 {
self.x += 1;
Expand Down
2 changes: 1 addition & 1 deletion compiler/tests/circuits/pedersen_mock.leo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
circuit PedersenHash {
parameters: [u32; 512]
parameters: [u32; 512];

function new(const parameters: [u32; 512]) -> Self {
return Self { parameters: parameters };
Expand Down
Loading

0 comments on commit 2ddb474

Please sign in to comment.