mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-12-23 02:01:54 +03:00
hacky, but optional comma only allowed on last member variable
This commit is contained in:
parent
282cbb8840
commit
e0cf988261
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
x: u32
|
||||
x: u32;
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
x: u32
|
||||
x: u32;
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
a: u8,
|
||||
a: u8;
|
||||
|
||||
function bar() {}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
a: u8,
|
||||
a: u8;
|
||||
|
||||
function bar() {}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
a: u8,
|
||||
a: u8;
|
||||
|
||||
function bar() {}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
a: u8,
|
||||
a: u8;
|
||||
|
||||
function set_a(self, new: u8) {
|
||||
self.a = new;
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
a: u8,
|
||||
a: u8;
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
f: u32,
|
||||
f: u32;
|
||||
|
||||
function bar() -> u32 {
|
||||
return f;
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Circuits are immutable by default.
|
||||
circuit Foo {
|
||||
x: u32
|
||||
x: u32;
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
a: u32,
|
||||
a: u32;
|
||||
}
|
||||
|
||||
circuit Bar {
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
x: u32
|
||||
x: u32;
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
x: u32,
|
||||
x: u32;
|
||||
|
||||
function add_x(self, y: u32) -> u32 {
|
||||
return self.x + y;
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
x: u32,
|
||||
x: u32;
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
foo: u32,
|
||||
foo: u32;
|
||||
|
||||
function bar() -> u32 {
|
||||
return 1u32;
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
a: u8,
|
||||
a: u8;
|
||||
|
||||
function set_a(mut self, new: u8) {
|
||||
self.a = new;
|
||||
|
@ -5,7 +5,7 @@ function main() {
|
||||
}
|
||||
|
||||
circuit Foo {
|
||||
a: u32
|
||||
a: u32;
|
||||
|
||||
function bar(mut self) {
|
||||
if true {
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
a: u8,
|
||||
a: u8;
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit PedersenHash {
|
||||
parameters: [u32; 512]
|
||||
parameters: [u32; 512];
|
||||
|
||||
function new(parameters: [u32; 512]) -> Self {
|
||||
return Self { parameters: parameters };
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
f: u32,
|
||||
f: u32;
|
||||
|
||||
function bar(self) -> u32 {
|
||||
return self.f;
|
||||
|
@ -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 {
|
||||
|
@ -1,3 +1,3 @@
|
||||
circuit Bat {
|
||||
t: u32
|
||||
t: u32;
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
circuit Baz {
|
||||
z: u32
|
||||
z: u32;
|
||||
}
|
||||
|
||||
circuit Bazzar {
|
||||
a: u32
|
||||
a: u32;
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
circuit Bar {
|
||||
r: u32
|
||||
r: u32;
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
circuit Car {
|
||||
c: u32
|
||||
c: u32;
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
circuit Point {
|
||||
x: u32
|
||||
y: u32
|
||||
x: u32;
|
||||
y: u32;
|
||||
}
|
||||
|
||||
function foo() -> u32 {
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Adding the `mut` keyword makes a circuit variable mutable.
|
||||
circuit Foo {
|
||||
x: u32
|
||||
x: u32;
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Adding the `mut` keyword makes a circuit variable mutable.
|
||||
circuit Foo {
|
||||
x: u32
|
||||
x: u32;
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
x: u32
|
||||
x: u32;
|
||||
|
||||
function new() -> Self {
|
||||
let new: Self = Self {
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
x: u32
|
||||
x: u32;
|
||||
|
||||
function new() -> Self {
|
||||
let new: Self = Self {
|
||||
|
@ -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;
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
a: u8,
|
||||
a: u8;
|
||||
|
||||
function use_a(const self) -> u8 {
|
||||
return self.a + 1;
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
a: u8,
|
||||
a: u8;
|
||||
|
||||
function set_a(const self, new: u8) {
|
||||
self.a = new;
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
a: u32,
|
||||
a: u32;
|
||||
}
|
||||
|
||||
circuit Bar {
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Bar {
|
||||
b2: u32
|
||||
b2: u32;
|
||||
|
||||
function add_five(z:u32) -> u32 {
|
||||
return z+5u32;
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
x: u32
|
||||
x: u32;
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
x: u32
|
||||
x: u32;
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
x: u8
|
||||
x: u8;
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
x: u8
|
||||
x: u8;
|
||||
|
||||
function new(x: u8) -> Self {
|
||||
return Self { x };
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
x: u32,
|
||||
x: u32;
|
||||
|
||||
function echo(self) -> u32 {
|
||||
return self.x;
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
x: u32,
|
||||
x: u32;
|
||||
|
||||
function add_x(self, y: u32) -> u32 {
|
||||
return self.x + y;
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
x: u32,
|
||||
x: u32;
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
foo: u32,
|
||||
foo: u32;
|
||||
|
||||
function bar() -> u32 {
|
||||
return 1u32;
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
x: u32
|
||||
x: u32;
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
a: u8,
|
||||
a: u8;
|
||||
|
||||
function bar() {}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
a: u8,
|
||||
a: u8;
|
||||
|
||||
function bar() {}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
a: u8,
|
||||
a: u8;
|
||||
|
||||
function bar() {}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
a: u8,
|
||||
a: u8;
|
||||
|
||||
function set_a(mut self, new: u8) {
|
||||
self.a = new;
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
a: u8,
|
||||
a: u8;
|
||||
|
||||
function set_a(mut self, condition: bool, new: u8) {
|
||||
if condition {
|
||||
|
@ -5,7 +5,7 @@ function main() {
|
||||
}
|
||||
|
||||
circuit Foo {
|
||||
a: u32
|
||||
a: u32;
|
||||
|
||||
function bar(mut self) {
|
||||
if true {
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
a: u8,
|
||||
a: u8;
|
||||
|
||||
function set_a(self, new: u8) {
|
||||
self.a = new;
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
a: u8,
|
||||
a: u8;
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
a: u8,
|
||||
a: u8;
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit TestMe {
|
||||
x: u8,
|
||||
x: u8;
|
||||
|
||||
function test_me(mut self) -> u8 {
|
||||
self.x += 1;
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit PedersenHash {
|
||||
parameters: [u32; 512]
|
||||
parameters: [u32; 512];
|
||||
|
||||
function new(parameters: [u32; 512]) -> Self {
|
||||
return Self { parameters: parameters };
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
f: u32,
|
||||
f: u32;
|
||||
|
||||
function bar(self) -> u32 {
|
||||
return self.f;
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit Foo {
|
||||
f: u32,
|
||||
f: u32;
|
||||
|
||||
function bar() -> u32 {
|
||||
return f;
|
||||
|
@ -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 {
|
||||
|
@ -1,3 +1,3 @@
|
||||
circuit Bat {
|
||||
t: u32
|
||||
t: u32;
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
circuit Baz {
|
||||
z: u32
|
||||
z: u32;
|
||||
}
|
||||
|
||||
circuit Bazzar {
|
||||
a: u32
|
||||
a: u32;
|
||||
}
|
||||
|
||||
const ONE: u8 = 1;
|
@ -1,3 +1,3 @@
|
||||
circuit Bar {
|
||||
r: u32
|
||||
r: u32;
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
circuit Car {
|
||||
c: u32
|
||||
c: u32;
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
circuit Point {
|
||||
x: u32
|
||||
y: u32
|
||||
x: u32;
|
||||
y: u32;
|
||||
}
|
||||
|
||||
function foo() -> u32 {
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Circuits are immutable by default.
|
||||
circuit Foo {
|
||||
x: u32
|
||||
x: u32;
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Adding the `mut` keyword makes a circuit variable mutable.
|
||||
circuit Foo {
|
||||
x: u32
|
||||
x: u32;
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Adding the `mut` keyword makes a circuit variable mutable.
|
||||
circuit Foo {
|
||||
x: u32
|
||||
x: u32;
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
circuit PedersenHash {
|
||||
parameters: [group; 256],
|
||||
parameters: [group; 256];
|
||||
|
||||
// Instantiates a Pedersen hash circuit
|
||||
function new(parameters: [group; 256]) -> Self {
|
||||
|
@ -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.
|
||||
|
@ -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), [horizontal-tab](#user-content-horizontal-tab), [newline](#user-content-newline)_;
|
||||
Go to: _[newline](#user-content-newline), [horizontal-tab](#user-content-horizontal-tab), [space](#user-content-space)_;
|
||||
|
||||
|
||||
There are two kinds of comments in Leo, as in other languages.
|
||||
@ -494,7 +494,7 @@ the ones used in the Java language reference.
|
||||
comment = block-comment / end-of-line-comment
|
||||
```
|
||||
|
||||
Go to: _[end-of-line-comment](#user-content-end-of-line-comment), [block-comment](#user-content-block-comment)_;
|
||||
Go to: _[block-comment](#user-content-block-comment), [end-of-line-comment](#user-content-end-of-line-comment)_;
|
||||
|
||||
|
||||
<a name="block-comment"></a>
|
||||
@ -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-after-star](#user-content-rest-of-block-comment-after-star), [rest-of-block-comment](#user-content-rest-of-block-comment), [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)_;
|
||||
|
||||
|
||||
<a name="rest-of-block-comment-after-star"></a>
|
||||
@ -521,7 +521,7 @@ rest-of-block-comment-after-star = "/"
|
||||
/ not-star-or-slash rest-of-block-comment
|
||||
```
|
||||
|
||||
Go to: _[not-star-or-slash](#user-content-not-star-or-slash), [rest-of-block-comment-after-star](#user-content-rest-of-block-comment-after-star), [rest-of-block-comment](#user-content-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-or-slash](#user-content-not-star-or-slash)_;
|
||||
|
||||
|
||||
<a name="end-of-line-comment"></a>
|
||||
@ -596,7 +596,7 @@ lowercase-letter = %x61-7A ; a-z
|
||||
letter = uppercase-letter / lowercase-letter
|
||||
```
|
||||
|
||||
Go to: _[uppercase-letter](#user-content-uppercase-letter), [lowercase-letter](#user-content-lowercase-letter)_;
|
||||
Go to: _[lowercase-letter](#user-content-lowercase-letter), [uppercase-letter](#user-content-uppercase-letter)_;
|
||||
|
||||
|
||||
An identifier is a non-empty sequence of letters, digits, and underscores,
|
||||
@ -639,7 +639,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-close-brace](#user-content-not-double-quote-or-close-brace), [not-double-quote-or-open-brace](#user-content-not-double-quote-or-open-brace), [format-string-container](#user-content-format-string-container)_;
|
||||
|
||||
|
||||
<a name="format-string"></a>
|
||||
@ -764,7 +764,7 @@ atomic-literal = untyped-literal
|
||||
/ address-literal
|
||||
```
|
||||
|
||||
Go to: _[signed-literal](#user-content-signed-literal), [untyped-literal](#user-content-untyped-literal), [boolean-literal](#user-content-boolean-literal), [field-literal](#user-content-field-literal), [unsigned-literal](#user-content-unsigned-literal), [product-group-literal](#user-content-product-group-literal), [address-literal](#user-content-address-literal)_;
|
||||
Go to: _[product-group-literal](#user-content-product-group-literal), [signed-literal](#user-content-signed-literal), [field-literal](#user-content-field-literal), [address-literal](#user-content-address-literal), [boolean-literal](#user-content-boolean-literal), [untyped-literal](#user-content-untyped-literal), [unsigned-literal](#user-content-unsigned-literal)_;
|
||||
|
||||
|
||||
After defining the (mostly) alphanumeric tokens above,
|
||||
@ -809,7 +809,7 @@ token = keyword
|
||||
/ symbol
|
||||
```
|
||||
|
||||
Go to: _[keyword](#user-content-keyword), [format-string](#user-content-format-string), [annotation-name](#user-content-annotation-name), [atomic-literal](#user-content-atomic-literal), [identifier](#user-content-identifier), [package-name](#user-content-package-name), [symbol](#user-content-symbol)_;
|
||||
Go to: _[symbol](#user-content-symbol), [package-name](#user-content-package-name), [format-string](#user-content-format-string), [annotation-name](#user-content-annotation-name), [identifier](#user-content-identifier), [keyword](#user-content-keyword), [atomic-literal](#user-content-atomic-literal)_;
|
||||
|
||||
|
||||
|
||||
@ -845,7 +845,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,
|
||||
@ -866,7 +866,7 @@ group-type = %s"group"
|
||||
arithmetic-type = integer-type / field-type / group-type
|
||||
```
|
||||
|
||||
Go to: _[field-type](#user-content-field-type), [integer-type](#user-content-integer-type), [group-type](#user-content-group-type)_;
|
||||
Go to: _[group-type](#user-content-group-type), [integer-type](#user-content-integer-type), [field-type](#user-content-field-type)_;
|
||||
|
||||
|
||||
The arithmetic types, along with the boolean and address types,
|
||||
@ -887,7 +887,7 @@ address-type = %s"address"
|
||||
scalar-type = boolean-type / arithmetic-type / address-type
|
||||
```
|
||||
|
||||
Go to: _[boolean-type](#user-content-boolean-type), [address-type](#user-content-address-type), [arithmetic-type](#user-content-arithmetic-type)_;
|
||||
Go to: _[boolean-type](#user-content-boolean-type), [arithmetic-type](#user-content-arithmetic-type), [address-type](#user-content-address-type)_;
|
||||
|
||||
|
||||
Circuit types are denoted by identifiers and the keyword `Self`.
|
||||
@ -927,7 +927,7 @@ or a tuple of one or more dimensions.
|
||||
array-type = "[" type ";" array-dimensions "]"
|
||||
```
|
||||
|
||||
Go to: _[array-dimensions](#user-content-array-dimensions), [type](#user-content-type)_;
|
||||
Go to: _[type](#user-content-type), [array-dimensions](#user-content-array-dimensions)_;
|
||||
|
||||
|
||||
<a name="array-dimensions"></a>
|
||||
@ -948,7 +948,7 @@ i.e. types whose values contain (sub-)values
|
||||
aggregate-type = tuple-type / array-type / circuit-type
|
||||
```
|
||||
|
||||
Go to: _[circuit-type](#user-content-circuit-type), [tuple-type](#user-content-tuple-type), [array-type](#user-content-array-type)_;
|
||||
Go to: _[array-type](#user-content-array-type), [tuple-type](#user-content-tuple-type), [circuit-type](#user-content-circuit-type)_;
|
||||
|
||||
|
||||
Scalar and aggregate types form all the types.
|
||||
@ -994,7 +994,7 @@ A literal is either an atomic one or an affine group literal.
|
||||
literal = atomic-literal / affine-group-literal
|
||||
```
|
||||
|
||||
Go to: _[atomic-literal](#user-content-atomic-literal), [affine-group-literal](#user-content-affine-group-literal)_;
|
||||
Go to: _[affine-group-literal](#user-content-affine-group-literal), [atomic-literal](#user-content-atomic-literal)_;
|
||||
|
||||
|
||||
The following rule is not directly referenced in the rules for expressions
|
||||
@ -1036,7 +1036,7 @@ primary-expression = identifier
|
||||
/ circuit-expression
|
||||
```
|
||||
|
||||
Go to: _[identifier](#user-content-identifier), [expression](#user-content-expression), [tuple-expression](#user-content-tuple-expression), [literal](#user-content-literal), [array-expression](#user-content-array-expression), [circuit-expression](#user-content-circuit-expression)_;
|
||||
Go to: _[literal](#user-content-literal), [expression](#user-content-expression), [tuple-expression](#user-content-tuple-expression), [identifier](#user-content-identifier), [array-expression](#user-content-array-expression), [circuit-expression](#user-content-circuit-expression)_;
|
||||
|
||||
|
||||
Tuple expressions construct tuples.
|
||||
@ -1089,7 +1089,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)_;
|
||||
|
||||
|
||||
<a name="array-construction"></a>
|
||||
@ -1097,7 +1097,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)_;
|
||||
|
||||
|
||||
<a name="array-expression"></a>
|
||||
@ -1184,7 +1184,7 @@ postfix-expression = primary-expression
|
||||
/ postfix-expression "[" [expression] ".." [expression] "]"
|
||||
```
|
||||
|
||||
Go to: _[function-arguments](#user-content-function-arguments), [circuit-type](#user-content-circuit-type), [postfix-expression](#user-content-postfix-expression), [primary-expression](#user-content-primary-expression), [identifier](#user-content-identifier), [natural](#user-content-natural), [expression](#user-content-expression)_;
|
||||
Go to: _[identifier](#user-content-identifier), [expression](#user-content-expression), [primary-expression](#user-content-primary-expression), [function-arguments](#user-content-function-arguments), [natural](#user-content-natural), [postfix-expression](#user-content-postfix-expression), [circuit-type](#user-content-circuit-type)_;
|
||||
|
||||
|
||||
Unary operators have the highest operator precedence.
|
||||
@ -1224,7 +1224,7 @@ multiplicative-expression = exponential-expression
|
||||
/ multiplicative-expression "/" exponential-expression
|
||||
```
|
||||
|
||||
Go to: _[multiplicative-expression](#user-content-multiplicative-expression), [exponential-expression](#user-content-exponential-expression)_;
|
||||
Go to: _[exponential-expression](#user-content-exponential-expression), [multiplicative-expression](#user-content-multiplicative-expression)_;
|
||||
|
||||
|
||||
Then there are addition and subtraction, both left-assocative.
|
||||
@ -1236,7 +1236,7 @@ additive-expression = multiplicative-expression
|
||||
/ additive-expression "-" multiplicative-expression
|
||||
```
|
||||
|
||||
Go to: _[additive-expression](#user-content-additive-expression), [multiplicative-expression](#user-content-multiplicative-expression)_;
|
||||
Go to: _[multiplicative-expression](#user-content-multiplicative-expression), [additive-expression](#user-content-additive-expression)_;
|
||||
|
||||
|
||||
Next in the precedence order are ordering relations.
|
||||
@ -1275,7 +1275,7 @@ conjunctive-expression = equality-expression
|
||||
/ conjunctive-expression "&&" equality-expression
|
||||
```
|
||||
|
||||
Go to: _[conjunctive-expression](#user-content-conjunctive-expression), [equality-expression](#user-content-equality-expression)_;
|
||||
Go to: _[equality-expression](#user-content-equality-expression), [conjunctive-expression](#user-content-conjunctive-expression)_;
|
||||
|
||||
|
||||
Next come disjunctive expressions, left-associative.
|
||||
@ -1286,7 +1286,7 @@ disjunctive-expression = conjunctive-expression
|
||||
/ disjunctive-expression "||" conjunctive-expression
|
||||
```
|
||||
|
||||
Go to: _[conjunctive-expression](#user-content-conjunctive-expression), [disjunctive-expression](#user-content-disjunctive-expression)_;
|
||||
Go to: _[disjunctive-expression](#user-content-disjunctive-expression), [conjunctive-expression](#user-content-conjunctive-expression)_;
|
||||
|
||||
|
||||
Finally we have conditional expressions.
|
||||
@ -1299,7 +1299,7 @@ conditional-expression = disjunctive-expression
|
||||
":" conditional-expression
|
||||
```
|
||||
|
||||
Go to: _[expression](#user-content-expression), [disjunctive-expression](#user-content-disjunctive-expression), [conditional-expression](#user-content-conditional-expression)_;
|
||||
Go to: _[disjunctive-expression](#user-content-disjunctive-expression), [conditional-expression](#user-content-conditional-expression), [expression](#user-content-expression)_;
|
||||
|
||||
|
||||
Those above are all the expressions.
|
||||
@ -1332,7 +1332,7 @@ statement = expression-statement
|
||||
/ block
|
||||
```
|
||||
|
||||
Go to: _[return-statement](#user-content-return-statement), [variable-declaration](#user-content-variable-declaration), [constant-declaration](#user-content-constant-declaration), [expression-statement](#user-content-expression-statement), [conditional-statement](#user-content-conditional-statement), [console-statement](#user-content-console-statement), [block](#user-content-block), [assignment-statement](#user-content-assignment-statement), [loop-statement](#user-content-loop-statement)_;
|
||||
Go to: _[expression-statement](#user-content-expression-statement), [console-statement](#user-content-console-statement), [return-statement](#user-content-return-statement), [variable-declaration](#user-content-variable-declaration), [loop-statement](#user-content-loop-statement), [constant-declaration](#user-content-constant-declaration), [assignment-statement](#user-content-assignment-statement), [conditional-statement](#user-content-conditional-statement), [block](#user-content-block)_;
|
||||
|
||||
|
||||
<a name="block"></a>
|
||||
@ -1373,7 +1373,7 @@ variable-declaration = %s"let" identifier-or-identifiers [ ":" type ] "=" expres
|
||||
constant-declaration = %s"const" identifier-or-identifiers [ ":" type ] "=" expression ";"
|
||||
```
|
||||
|
||||
Go to: _[identifier-or-identifiers](#user-content-identifier-or-identifiers), [type](#user-content-type), [expression](#user-content-expression)_;
|
||||
Go to: _[expression](#user-content-expression), [identifier-or-identifiers](#user-content-identifier-or-identifiers), [type](#user-content-type)_;
|
||||
|
||||
|
||||
|
||||
@ -1397,7 +1397,7 @@ Note that blocks are required in all branches, not merely statements.
|
||||
branch = %s"if" expression block
|
||||
```
|
||||
|
||||
Go to: _[expression](#user-content-expression), [block](#user-content-block)_;
|
||||
Go to: _[block](#user-content-block), [expression](#user-content-expression)_;
|
||||
|
||||
|
||||
<a name="conditional-statement"></a>
|
||||
@ -1407,7 +1407,7 @@ conditional-statement = branch
|
||||
/ branch %s"else" conditional-statement
|
||||
```
|
||||
|
||||
Go to: _[branch](#user-content-branch), [conditional-statement](#user-content-conditional-statement), [block](#user-content-block)_;
|
||||
Go to: _[branch](#user-content-branch), [block](#user-content-block), [conditional-statement](#user-content-conditional-statement)_;
|
||||
|
||||
|
||||
A loop statement implicitly defines a loop variable
|
||||
@ -1419,7 +1419,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: _[block](#user-content-block), [identifier](#user-content-identifier), [expression](#user-content-expression)_;
|
||||
|
||||
|
||||
An assignment statement is straightforward.
|
||||
@ -1436,7 +1436,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,
|
||||
@ -1492,7 +1492,7 @@ Go to: _[format-string](#user-content-format-string)_;
|
||||
print-call = print-function print-arguments
|
||||
```
|
||||
|
||||
Go to: _[print-arguments](#user-content-print-arguments), [print-function](#user-content-print-function)_;
|
||||
Go to: _[print-function](#user-content-print-function), [print-arguments](#user-content-print-arguments)_;
|
||||
|
||||
|
||||
An annotation consists of an annotation name (which starts with `@`)
|
||||
@ -1505,7 +1505,7 @@ annotation = annotation-name
|
||||
[ "(" identifier *( "," identifier ) ")" ]
|
||||
```
|
||||
|
||||
Go to: _[annotation-name](#user-content-annotation-name), [identifier](#user-content-identifier)_;
|
||||
Go to: _[identifier](#user-content-identifier), [annotation-name](#user-content-annotation-name)_;
|
||||
|
||||
|
||||
A function declaration defines a function.
|
||||
@ -1522,7 +1522,7 @@ function-declaration = *annotation %s"function" identifier
|
||||
block
|
||||
```
|
||||
|
||||
Go to: _[identifier](#user-content-identifier), [block](#user-content-block), [type](#user-content-type), [function-parameters](#user-content-function-parameters)_;
|
||||
Go to: _[function-parameters](#user-content-function-parameters), [type](#user-content-type), [block](#user-content-block), [identifier](#user-content-identifier)_;
|
||||
|
||||
|
||||
<a name="function-parameters"></a>
|
||||
@ -1532,7 +1532,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)_;
|
||||
|
||||
|
||||
<a name="self-parameter"></a>
|
||||
@ -1581,10 +1581,10 @@ as consisting of member variables and functions.
|
||||
<a name="circuit-declaration"></a>
|
||||
```abnf
|
||||
circuit-declaration = *annotation %s"circuit" identifier
|
||||
"{" *member-variable-declaration *member-function-declaration "}"
|
||||
"{" [ member-variable-declaration ] *member-function-declaration "}"
|
||||
```
|
||||
|
||||
Go to: _[identifier](#user-content-identifier)_;
|
||||
Go to: _[identifier](#user-content-identifier), [member-variable-declaration](#user-content-member-variable-declaration)_;
|
||||
|
||||
|
||||
An import declaration consists of the `import` keyword
|
||||
@ -1613,7 +1613,7 @@ package-path = "*"
|
||||
/ "(" package-path *( "," package-path ) [","] ")"
|
||||
```
|
||||
|
||||
Go to: _[identifier](#user-content-identifier), [package-path](#user-content-package-path), [package-name](#user-content-package-name)_;
|
||||
Go to: _[identifier](#user-content-identifier), [package-name](#user-content-package-name), [package-path](#user-content-package-path)_;
|
||||
|
||||
|
||||
Finally, we define a file as a sequence of zero or more declarations.
|
||||
@ -1626,7 +1626,7 @@ declaration = import-declaration
|
||||
/ constant-declaration
|
||||
```
|
||||
|
||||
Go to: _[import-declaration](#user-content-import-declaration), [constant-declaration](#user-content-constant-declaration), [function-declaration](#user-content-function-declaration), [circuit-declaration](#user-content-circuit-declaration)_;
|
||||
Go to: _[import-declaration](#user-content-import-declaration), [function-declaration](#user-content-function-declaration), [constant-declaration](#user-content-constant-declaration), [circuit-declaration](#user-content-circuit-declaration)_;
|
||||
|
||||
|
||||
<a name="file"></a>
|
||||
|
@ -946,7 +946,7 @@ member-function-declaration = function-declaration
|
||||
; as consisting of member variables and functions.
|
||||
|
||||
circuit-declaration = *annotation %s"circuit" identifier
|
||||
"{" *member-variable-declaration *member-function-declaration "}"
|
||||
"{" [ member-variable-declaration ] *member-function-declaration "}"
|
||||
|
||||
; An import declaration consists of the `import` keyword
|
||||
; followed by a package path, which may be one of the following:
|
||||
|
@ -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;
|
||||
}
|
@ -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.
|
||||
///
|
||||
|
@ -310,27 +310,28 @@ impl ParserContext {
|
||||
}
|
||||
|
||||
///
|
||||
/// Returns a [`CircuitMember`] AST node if the next tokens represent a circuit member variable
|
||||
/// or circuit member function.
|
||||
/// 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()?;
|
||||
let peeked_token = &peeked.token;
|
||||
|
||||
if peeked_token == &Token::Function || peeked_token == &Token::At || peeked_token == &Token::RightCurly {
|
||||
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 variable
|
||||
/// or circuit member function.
|
||||
/// Returns a [`CircuitMember`] AST node if the next tokens represent a circuit member function.
|
||||
///
|
||||
pub fn parse_member_function_declaration(&mut self) -> SyntaxResult<CircuitMember> {
|
||||
let peeked = &self.peek()?;
|
||||
|
@ -49,4 +49,5 @@ outputs:
|
||||
col_stop: 6
|
||||
path: test
|
||||
content: " function x() -> Self {\n...\n }"
|
||||
global_consts: {}
|
||||
functions: {}
|
||||
|
@ -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: {}
|
||||
|
@ -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: {}
|
||||
|
@ -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: {}
|
||||
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
namespace: Parse
|
||||
expectation: Fail
|
||||
outputs:
|
||||
- " --> test:5:5\n |\n 5 | y: u32\n | ^\n |\n = expected ',', ';' -- got 'y'"
|
@ -87,4 +87,5 @@ outputs:
|
||||
col_stop: 6
|
||||
path: test
|
||||
content: " function y() {\n...\n }"
|
||||
global_consts: {}
|
||||
functions: {}
|
||||
|
@ -49,4 +49,5 @@ outputs:
|
||||
col_stop: 6
|
||||
path: test
|
||||
content: " function x(mut self) {\n...\n }"
|
||||
global_consts: {}
|
||||
functions: {}
|
||||
|
@ -49,4 +49,5 @@ outputs:
|
||||
col_stop: 6
|
||||
path: test
|
||||
content: " function x(self) {\n...\n }"
|
||||
global_consts: {}
|
||||
functions: {}
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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: []
|
||||
|
@ -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: []
|
||||
|
@ -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: []
|
||||
|
@ -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: []
|
||||
|
@ -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: []
|
||||
|
@ -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: []
|
||||
|
@ -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: []
|
||||
|
@ -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: []
|
||||
|
@ -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: []
|
||||
|
@ -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: []
|
||||
|
@ -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: []
|
||||
|
@ -34,4 +34,5 @@ outputs:
|
||||
path: test
|
||||
content: import a.b as bar;
|
||||
circuits: {}
|
||||
global_consts: {}
|
||||
functions: {}
|
||||
|
@ -34,4 +34,5 @@ outputs:
|
||||
path: test
|
||||
content: import a.b;
|
||||
circuits: {}
|
||||
global_consts: {}
|
||||
functions: {}
|
||||
|
@ -132,4 +132,5 @@ outputs:
|
||||
path: test
|
||||
content: "import bar.( // imports directory import\n...\n bat.bat.Bat,"
|
||||
circuits: {}
|
||||
global_consts: {}
|
||||
functions: {}
|
||||
|
@ -161,4 +161,5 @@ outputs:
|
||||
path: test
|
||||
content: import car.*; // imports directory import
|
||||
circuits: {}
|
||||
global_consts: {}
|
||||
functions: {}
|
||||
|
@ -90,4 +90,5 @@ outputs:
|
||||
path: test
|
||||
content: import hello-world.hello;
|
||||
circuits: {}
|
||||
global_consts: {}
|
||||
functions: {}
|
||||
|
@ -34,4 +34,5 @@ outputs:
|
||||
path: test
|
||||
content: import hello_world.foo;
|
||||
circuits: {}
|
||||
global_consts: {}
|
||||
functions: {}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user