mirror of
https://github.com/AleoHQ/leo.git
synced 2024-12-20 08:01:42 +03:00
merge upstream testnet3
This commit is contained in:
parent
88c1bfd8a3
commit
398e6f5469
38
Cargo.lock
generated
38
Cargo.lock
generated
@ -1150,7 +1150,7 @@ dependencies = [
|
|||||||
"toml",
|
"toml",
|
||||||
"tracing",
|
"tracing",
|
||||||
"tracing-subscriber",
|
"tracing-subscriber",
|
||||||
"zip 0.6.0",
|
"zip",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -1164,7 +1164,7 @@ dependencies = [
|
|||||||
"toml",
|
"toml",
|
||||||
"tracing",
|
"tracing",
|
||||||
"walkdir",
|
"walkdir",
|
||||||
"zip 0.6.0",
|
"zip",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -1719,9 +1719,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quick-xml"
|
name = "quick-xml"
|
||||||
version = "0.20.0"
|
version = "0.22.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "26aab6b48e2590e4a64d1ed808749ba06257882b461d01ca71baeb747074a6dd"
|
checksum = "8533f14c8382aaad0d592c812ac3b826162128b65662331e1127b45c3d18536b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
@ -2018,9 +2018,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "self_update"
|
name = "self_update"
|
||||||
version = "0.28.0"
|
version = "0.29.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5bc3e89793fe56c82104ddc103c998e4e94713cb975202207829e61031eb4be6"
|
checksum = "710b9f39843957861314222c3bad16b9138f664665125ba277a48930253c4ed5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hyper",
|
"hyper",
|
||||||
"indicatif",
|
"indicatif",
|
||||||
@ -2031,7 +2031,7 @@ dependencies = [
|
|||||||
"semver 0.11.0",
|
"semver 0.11.0",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"zip 0.5.13",
|
"zip",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -2363,16 +2363,6 @@ dependencies = [
|
|||||||
"once_cell",
|
"once_cell",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "time"
|
|
||||||
version = "0.1.43"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438"
|
|
||||||
dependencies = [
|
|
||||||
"libc",
|
|
||||||
"winapi 0.3.9",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "time"
|
name = "time"
|
||||||
version = "0.3.7"
|
version = "0.3.7"
|
||||||
@ -2819,18 +2809,6 @@ dependencies = [
|
|||||||
"linked-hash-map",
|
"linked-hash-map",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "zip"
|
|
||||||
version = "0.5.13"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "93ab48844d61251bb3835145c521d88aa4031d7139e8485990f60ca911fa0815"
|
|
||||||
dependencies = [
|
|
||||||
"byteorder",
|
|
||||||
"crc32fast",
|
|
||||||
"thiserror",
|
|
||||||
"time 0.1.43",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zip"
|
name = "zip"
|
||||||
version = "0.6.0"
|
version = "0.6.0"
|
||||||
@ -2846,7 +2824,7 @@ dependencies = [
|
|||||||
"hmac",
|
"hmac",
|
||||||
"pbkdf2",
|
"pbkdf2",
|
||||||
"sha1",
|
"sha1",
|
||||||
"time 0.3.7",
|
"time",
|
||||||
"zstd",
|
"zstd",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ version = "0.11.10"
|
|||||||
features = [ "blocking", "json", "multipart" ]
|
features = [ "blocking", "json", "multipart" ]
|
||||||
|
|
||||||
[dependencies.self_update]
|
[dependencies.self_update]
|
||||||
version = "0.28.0"
|
version = "0.29.0"
|
||||||
features = [ "archive-zip" ]
|
features = [ "archive-zip" ]
|
||||||
|
|
||||||
[dependencies.serde]
|
[dependencies.serde]
|
||||||
|
@ -53,6 +53,18 @@ impl fmt::Display for Char {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct Chars(pub Vec<Char>);
|
||||||
|
|
||||||
|
impl fmt::Display for Chars {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
for character in self.0.iter() {
|
||||||
|
write!(f, "{}", character)?;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
pub struct CharValue {
|
pub struct CharValue {
|
||||||
pub character: Char,
|
pub character: Char,
|
||||||
|
@ -30,8 +30,8 @@ pub struct ParserContext<'a> {
|
|||||||
pub(crate) handler: &'a Handler,
|
pub(crate) handler: &'a Handler,
|
||||||
tokens: Vec<SpannedToken>,
|
tokens: Vec<SpannedToken>,
|
||||||
end_span: Span,
|
end_span: Span,
|
||||||
// true if parsing an expression for an if statement -- means circuit inits are not legal
|
// true if parsing an expression for if and loop statements -- means circuit inits are not legal
|
||||||
pub(crate) fuzzy_struct_state: bool,
|
pub(crate) disallow_circuit_construction: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Iterator for ParserContext<'_> {
|
impl Iterator for ParserContext<'_> {
|
||||||
@ -61,7 +61,7 @@ impl<'a> ParserContext<'a> {
|
|||||||
.map(|x| x.span.clone())
|
.map(|x| x.span.clone())
|
||||||
.unwrap_or_default(),
|
.unwrap_or_default(),
|
||||||
tokens,
|
tokens,
|
||||||
fuzzy_struct_state: false,
|
disallow_circuit_construction: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,16 +41,16 @@ impl ParserContext<'_> {
|
|||||||
///
|
///
|
||||||
pub fn parse_expression(&mut self) -> Result<Expression> {
|
pub fn parse_expression(&mut self) -> Result<Expression> {
|
||||||
// Store current parser state.
|
// Store current parser state.
|
||||||
let prior_fuzzy_state = self.fuzzy_struct_state;
|
let prior_fuzzy_state = self.disallow_circuit_construction;
|
||||||
|
|
||||||
// Allow circuit init expressions.
|
// Allow circuit init expressions.
|
||||||
self.fuzzy_struct_state = false;
|
self.disallow_circuit_construction = false;
|
||||||
|
|
||||||
// Parse expression.
|
// Parse expression.
|
||||||
let result = self.parse_conditional_expression();
|
let result = self.parse_conditional_expression();
|
||||||
|
|
||||||
// Restore prior parser state.
|
// Restore prior parser state.
|
||||||
self.fuzzy_struct_state = prior_fuzzy_state;
|
self.disallow_circuit_construction = prior_fuzzy_state;
|
||||||
|
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
@ -248,16 +248,6 @@ impl ParserContext<'_> {
|
|||||||
Token::Minus => UnaryOperation::Negate,
|
Token::Minus => UnaryOperation::Negate,
|
||||||
_ => unreachable!("parse_unary_expression_ shouldn't produce this"),
|
_ => unreachable!("parse_unary_expression_ shouldn't produce this"),
|
||||||
};
|
};
|
||||||
// hack for const signed integer overflow issues
|
|
||||||
if matches!(operation, UnaryOperation::Negate) {
|
|
||||||
if let Expression::Value(ValueExpression::Integer(type_, value, span)) = inner {
|
|
||||||
inner = Expression::Value(ValueExpression::Integer(type_, format!("-{}", value), &op.span + &span));
|
|
||||||
continue;
|
|
||||||
} else if let Expression::Value(ValueExpression::Implicit(value, span)) = inner {
|
|
||||||
inner = Expression::Value(ValueExpression::Implicit(format!("-{}", value), &op.span + &span));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
inner = Expression::Unary(UnaryExpression {
|
inner = Expression::Unary(UnaryExpression {
|
||||||
span: &op.span + inner.span(),
|
span: &op.span + inner.span(),
|
||||||
op: operation,
|
op: operation,
|
||||||
@ -557,7 +547,7 @@ impl ParserContext<'_> {
|
|||||||
Token::LeftSquare => self.parse_array_expression(&span)?,
|
Token::LeftSquare => self.parse_array_expression(&span)?,
|
||||||
Token::Ident(name) => {
|
Token::Ident(name) => {
|
||||||
let ident = Identifier { name, span };
|
let ident = Identifier { name, span };
|
||||||
if !self.fuzzy_struct_state && self.peek_token().as_ref() == &Token::LeftCurly {
|
if !self.disallow_circuit_construction && self.peek_token().as_ref() == &Token::LeftCurly {
|
||||||
self.parse_circuit_expression(ident)?
|
self.parse_circuit_expression(ident)?
|
||||||
} else {
|
} else {
|
||||||
Expression::Identifier(ident)
|
Expression::Identifier(ident)
|
||||||
@ -568,7 +558,7 @@ impl ParserContext<'_> {
|
|||||||
name: sym::SelfUpper,
|
name: sym::SelfUpper,
|
||||||
span,
|
span,
|
||||||
};
|
};
|
||||||
if !self.fuzzy_struct_state && self.peek_token().as_ref() == &Token::LeftCurly {
|
if !self.disallow_circuit_construction && self.peek_token().as_ref() == &Token::LeftCurly {
|
||||||
self.parse_circuit_expression(ident)?
|
self.parse_circuit_expression(ident)?
|
||||||
} else {
|
} else {
|
||||||
Expression::Identifier(ident)
|
Expression::Identifier(ident)
|
||||||
|
@ -293,11 +293,11 @@ impl ParserContext<'_> {
|
|||||||
// `IDENT: TYPE = EXPR`:
|
// `IDENT: TYPE = EXPR`:
|
||||||
let (name, type_) = self.parse_typed_field_name()?;
|
let (name, type_) = self.parse_typed_field_name()?;
|
||||||
self.expect(Token::Assign)?;
|
self.expect(Token::Assign)?;
|
||||||
let literal = self.parse_primary_expression()?;
|
let expr = self.parse_expression()?;
|
||||||
|
|
||||||
self.expect(Token::Semicolon)?;
|
self.expect(Token::Semicolon)?;
|
||||||
|
|
||||||
Ok(CircuitMember::CircuitConst(name, type_, literal))
|
Ok(CircuitMember::CircuitConst(name, type_, expr))
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -336,11 +336,6 @@ impl ParserContext<'_> {
|
|||||||
pub fn parse_circuit(&mut self) -> Result<(Identifier, Circuit)> {
|
pub fn parse_circuit(&mut self) -> Result<(Identifier, Circuit)> {
|
||||||
let name = if let Some(ident) = self.eat_identifier() {
|
let name = if let Some(ident) = self.eat_identifier() {
|
||||||
ident
|
ident
|
||||||
} else if let Some(scalar_type) = self.eat_any(crate::type_::TYPE_TOKENS) {
|
|
||||||
Identifier {
|
|
||||||
name: scalar_type.token.keyword_to_symbol().unwrap(),
|
|
||||||
span: scalar_type.span,
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
let next = self.peek()?;
|
let next = self.peek()?;
|
||||||
return Err(ParserError::unexpected_str(&next.token, "ident", &next.span).into());
|
return Err(ParserError::unexpected_str(&next.token, "ident", &next.span).into());
|
||||||
|
@ -167,9 +167,9 @@ impl ParserContext<'_> {
|
|||||||
/// Returns a [`ConditionalStatement`] AST node if the next tokens represent a conditional statement.
|
/// Returns a [`ConditionalStatement`] AST node if the next tokens represent a conditional statement.
|
||||||
pub fn parse_conditional_statement(&mut self) -> Result<ConditionalStatement> {
|
pub fn parse_conditional_statement(&mut self) -> Result<ConditionalStatement> {
|
||||||
let start = self.expect(Token::If)?;
|
let start = self.expect(Token::If)?;
|
||||||
self.fuzzy_struct_state = true;
|
self.disallow_circuit_construction = true;
|
||||||
let expr = self.parse_conditional_expression()?;
|
let expr = self.parse_conditional_expression()?;
|
||||||
self.fuzzy_struct_state = false;
|
self.disallow_circuit_construction = false;
|
||||||
let body = self.parse_block()?;
|
let body = self.parse_block()?;
|
||||||
let next = if self.eat(Token::Else).is_some() {
|
let next = if self.eat(Token::Else).is_some() {
|
||||||
let s = self.parse_statement()?;
|
let s = self.parse_statement()?;
|
||||||
@ -199,9 +199,9 @@ impl ParserContext<'_> {
|
|||||||
let start = self.parse_expression()?;
|
let start = self.parse_expression()?;
|
||||||
self.expect(Token::DotDot)?;
|
self.expect(Token::DotDot)?;
|
||||||
let inclusive = self.eat(Token::Assign).is_some();
|
let inclusive = self.eat(Token::Assign).is_some();
|
||||||
self.fuzzy_struct_state = true;
|
self.disallow_circuit_construction = true;
|
||||||
let stop = self.parse_conditional_expression()?;
|
let stop = self.parse_conditional_expression()?;
|
||||||
self.fuzzy_struct_state = false;
|
self.disallow_circuit_construction = false;
|
||||||
|
|
||||||
let block = self.parse_block()?;
|
let block = self.parse_block()?;
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ impl Token {
|
|||||||
return Ok((len + 2, Token::StringLit(string)));
|
return Ok((len + 2, Token::StringLit(string)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return Err(ParserError::lexer_string_not_closed(string).into());
|
return Err(ParserError::lexer_string_not_closed(leo_ast::Chars(string)).into());
|
||||||
}
|
}
|
||||||
Some('\'') => {
|
Some('\'') => {
|
||||||
input.next();
|
input.next();
|
||||||
|
Binary file not shown.
@ -35,15 +35,16 @@ single-quote = %x27 ; '
|
|||||||
|
|
||||||
not-star = %x0-29 / %x2B-10FFFF ; anything but *
|
not-star = %x0-29 / %x2B-10FFFF ; anything but *
|
||||||
|
|
||||||
not-star-or-slash = %x0-29 / %x2B-2E / %x30-10FFFF ; anything but * or /
|
not-star-or-slash = %x0-29 / %x2B-2E / %x30-D7FF / %xE000-10FFFF
|
||||||
|
; anything but * or /
|
||||||
|
|
||||||
not-line-feed-or-carriage-return = %x0-9 / %xB-C / %xE-10FFFF
|
not-line-feed-or-carriage-return = %x0-9 / %xB-C / %xE-D7FF / %xE000-10FFFF
|
||||||
; anything but <LF> or <CR>
|
; anything but <LF> or <CR>
|
||||||
|
|
||||||
not-double-quote-or-backslash = %x0-21 / %x23-5B / %x5D-10FFFF
|
not-double-quote-or-backslash = %x0-21 / %x23-5B / %x5D-D7FF / %xE000-10FFFF
|
||||||
; anything but " or \
|
; anything but " or \
|
||||||
|
|
||||||
not-single-quote-or-backslash = %x0-26 / %x28-5B / %x5D-10FFFF
|
not-single-quote-or-backslash = %x0-26 / %x28-5B / %x5D-D7FF / %xE000-10FFFF
|
||||||
; anything but ' or \
|
; anything but ' or \
|
||||||
|
|
||||||
line-terminator = line-feed / carriage-return / carriage-return line-feed
|
line-terminator = line-feed / carriage-return / carriage-return line-feed
|
||||||
|
@ -235,8 +235,8 @@ create_errors!(
|
|||||||
/// When a string is not properly closed.
|
/// When a string is not properly closed.
|
||||||
@backtraced
|
@backtraced
|
||||||
lexer_string_not_closed {
|
lexer_string_not_closed {
|
||||||
args: (input: impl Debug),
|
args: (input: impl Display),
|
||||||
msg: format!("Expected a closed string but found `{:?}`.", input),
|
msg: format!("Expected a closed string but found `{}`.", input),
|
||||||
help: None,
|
help: None,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,5 +37,129 @@ outputs:
|
|||||||
col_stop: 28
|
col_stop: 28
|
||||||
path: ""
|
path: ""
|
||||||
content: " static const y: u32 = 5;"
|
content: " static const y: u32 = 5;"
|
||||||
|
- CircuitConst:
|
||||||
|
- "{\"name\":\"G\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const G: u8 = G;\\\"}\"}"
|
||||||
|
- IntegerType: U8
|
||||||
|
- Identifier: "{\"name\":\"G\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":26,\\\"col_stop\\\":27,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const G: u8 = G;\\\"}\"}"
|
||||||
|
- CircuitConst:
|
||||||
|
- "{\"name\":\"FOO\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":18,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const FOO: Foo = Foo {};\\\"}\"}"
|
||||||
|
- Identifier: "{\"name\":\"Foo\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":23,\\\"col_stop\\\":26,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const FOO: Foo = Foo {};\\\"}\"}"
|
||||||
|
- CircuitInit:
|
||||||
|
name: "{\"name\":\"Foo\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":29,\\\"col_stop\\\":32,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const FOO: Foo = Foo {};\\\"}\"}"
|
||||||
|
members: []
|
||||||
|
span:
|
||||||
|
line_start: 7
|
||||||
|
line_stop: 7
|
||||||
|
col_start: 29
|
||||||
|
col_stop: 35
|
||||||
|
path: ""
|
||||||
|
content: " static const FOO: Foo = Foo {};"
|
||||||
|
- CircuitConst:
|
||||||
|
- "{\"name\":\"INDEXED\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":18,\\\"col_stop\\\":25,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const INDEXED: Foo = A[0];\\\"}\"}"
|
||||||
|
- Identifier: "{\"name\":\"Foo\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":27,\\\"col_stop\\\":30,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const INDEXED: Foo = A[0];\\\"}\"}"
|
||||||
|
- Access:
|
||||||
|
Array:
|
||||||
|
array:
|
||||||
|
Identifier: "{\"name\":\"A\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":33,\\\"col_stop\\\":34,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const INDEXED: Foo = A[0];\\\"}\"}"
|
||||||
|
index:
|
||||||
|
Value:
|
||||||
|
Implicit:
|
||||||
|
- "0"
|
||||||
|
- span:
|
||||||
|
line_start: 8
|
||||||
|
line_stop: 8
|
||||||
|
col_start: 35
|
||||||
|
col_stop: 36
|
||||||
|
path: ""
|
||||||
|
content: " static const INDEXED: Foo = A[0];"
|
||||||
|
span:
|
||||||
|
line_start: 8
|
||||||
|
line_stop: 8
|
||||||
|
col_start: 33
|
||||||
|
col_stop: 37
|
||||||
|
path: ""
|
||||||
|
content: " static const INDEXED: Foo = A[0];"
|
||||||
|
- CircuitConst:
|
||||||
|
- "{\"name\":\"TINDEXED\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":18,\\\"col_stop\\\":26,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const TINDEXED: Foo = T.0;\\\"}\"}"
|
||||||
|
- Identifier: "{\"name\":\"Foo\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":28,\\\"col_stop\\\":31,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const TINDEXED: Foo = T.0;\\\"}\"}"
|
||||||
|
- Access:
|
||||||
|
Tuple:
|
||||||
|
tuple:
|
||||||
|
Identifier: "{\"name\":\"T\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":34,\\\"col_stop\\\":35,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const TINDEXED: Foo = T.0;\\\"}\"}"
|
||||||
|
index:
|
||||||
|
value: "0"
|
||||||
|
span:
|
||||||
|
line_start: 9
|
||||||
|
line_stop: 9
|
||||||
|
col_start: 34
|
||||||
|
col_stop: 37
|
||||||
|
path: ""
|
||||||
|
content: " static const TINDEXED: Foo = T.0;"
|
||||||
|
- CircuitConst:
|
||||||
|
- "{\"name\":\"TWO\",\"span\":\"{\\\"line_start\\\":10,\\\"line_stop\\\":10,\\\"col_start\\\":18,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const TWO: i8 = 1i8 + 1i8;\\\"}\"}"
|
||||||
|
- IntegerType: I8
|
||||||
|
- Binary:
|
||||||
|
left:
|
||||||
|
Value:
|
||||||
|
Integer:
|
||||||
|
- I8
|
||||||
|
- "1"
|
||||||
|
- span:
|
||||||
|
line_start: 10
|
||||||
|
line_stop: 10
|
||||||
|
col_start: 28
|
||||||
|
col_stop: 31
|
||||||
|
path: ""
|
||||||
|
content: " static const TWO: i8 = 1i8 + 1i8;"
|
||||||
|
right:
|
||||||
|
Value:
|
||||||
|
Integer:
|
||||||
|
- I8
|
||||||
|
- "1"
|
||||||
|
- span:
|
||||||
|
line_start: 10
|
||||||
|
line_stop: 10
|
||||||
|
col_start: 34
|
||||||
|
col_stop: 37
|
||||||
|
path: ""
|
||||||
|
content: " static const TWO: i8 = 1i8 + 1i8;"
|
||||||
|
op: Add
|
||||||
|
span:
|
||||||
|
line_start: 10
|
||||||
|
line_stop: 10
|
||||||
|
col_start: 28
|
||||||
|
col_stop: 37
|
||||||
|
path: ""
|
||||||
|
content: " static const TWO: i8 = 1i8 + 1i8;"
|
||||||
|
- CircuitConst:
|
||||||
|
- "{\"name\":\"mult\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":18,\\\"col_stop\\\":22,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const mult: i8 = x * y;\\\"}\"}"
|
||||||
|
- IntegerType: I8
|
||||||
|
- Binary:
|
||||||
|
left:
|
||||||
|
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":29,\\\"col_stop\\\":30,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const mult: i8 = x * y;\\\"}\"}"
|
||||||
|
right:
|
||||||
|
Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":33,\\\"col_stop\\\":34,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const mult: i8 = x * y;\\\"}\"}"
|
||||||
|
op: Mul
|
||||||
|
span:
|
||||||
|
line_start: 11
|
||||||
|
line_stop: 11
|
||||||
|
col_start: 29
|
||||||
|
col_stop: 34
|
||||||
|
path: ""
|
||||||
|
content: " static const mult: i8 = x * y;"
|
||||||
|
- CircuitConst:
|
||||||
|
- "{\"name\":\"mult\",\"span\":\"{\\\"line_start\\\":12,\\\"line_stop\\\":12,\\\"col_start\\\":18,\\\"col_stop\\\":22,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const mult: i8 = one();\\\"}\"}"
|
||||||
|
- IntegerType: I8
|
||||||
|
- Call:
|
||||||
|
function:
|
||||||
|
Identifier: "{\"name\":\"one\",\"span\":\"{\\\"line_start\\\":12,\\\"line_stop\\\":12,\\\"col_start\\\":29,\\\"col_stop\\\":32,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const mult: i8 = one();\\\"}\"}"
|
||||||
|
arguments: []
|
||||||
|
span:
|
||||||
|
line_start: 12
|
||||||
|
line_stop: 12
|
||||||
|
col_start: 29
|
||||||
|
col_stop: 34
|
||||||
|
path: ""
|
||||||
|
content: " static const mult: i8 = one();"
|
||||||
global_consts: {}
|
global_consts: {}
|
||||||
functions: {}
|
functions: {}
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
namespace: Parse
|
||||||
|
expectation: Fail
|
||||||
|
outputs:
|
||||||
|
- "Error [EPAR0370000]: Function calls not allowed in circuit members.\n --> test:4:27\n |\n 4 | static const x: u32 = foo();\n | ^^^^^"
|
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
namespace: Parse
|
||||||
|
expectation: Pass
|
||||||
|
outputs:
|
||||||
|
- name: ""
|
||||||
|
expected_input: []
|
||||||
|
import_statements: []
|
||||||
|
imports: {}
|
||||||
|
aliases: {}
|
||||||
|
circuits:
|
||||||
|
"{\"name\":\"u32\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit u32 {}\\\"}\"}":
|
||||||
|
circuit_name: "{\"name\":\"u32\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit u32 {}\\\"}\"}"
|
||||||
|
members: []
|
||||||
|
global_consts: {}
|
||||||
|
functions: {}
|
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
namespace: Parse
|
||||||
|
expectation: Fail
|
||||||
|
outputs:
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'ident', got 'address'\n --> test:3:9\n |\n 3 | circuit address {}\n | ^^^^^^^"
|
@ -8,6 +8,7 @@ outputs:
|
|||||||
- "Error [EPAR0370030]: Could not lex the following content: `\\n`."
|
- "Error [EPAR0370030]: Could not lex the following content: `\\n`."
|
||||||
- "Error [EPAR0370023]: Expected more characters to lex but found none."
|
- "Error [EPAR0370023]: Expected more characters to lex but found none."
|
||||||
- "Error [EPAR0370023]: Expected more characters to lex but found none."
|
- "Error [EPAR0370023]: Expected more characters to lex but found none."
|
||||||
|
- "Error [EPAR0370023]: Expected more characters to lex but found none."
|
||||||
- "Error [EPAR0370031]: Expected a valid hex character but found `'`."
|
- "Error [EPAR0370031]: Expected a valid hex character but found `'`."
|
||||||
- "Error [EPAR0370031]: Expected a valid hex character but found `'`."
|
- "Error [EPAR0370031]: Expected a valid hex character but found `'`."
|
||||||
- "Error [EPAR0370031]: Expected a valid hex character but found `9A`."
|
- "Error [EPAR0370031]: Expected a valid hex character but found `9A`."
|
||||||
@ -44,5 +45,6 @@ outputs:
|
|||||||
- "Error [EPAR0370037]: There was no opening `{` after starting an escaped unicode `0`."
|
- "Error [EPAR0370037]: There was no opening `{` after starting an escaped unicode `0`."
|
||||||
- "Error [EPAR0370037]: There was no opening `{` after starting an escaped unicode `0`."
|
- "Error [EPAR0370037]: There was no opening `{` after starting an escaped unicode `0`."
|
||||||
- "Error [EPAR0370034]: The escaped unicode char `110000` is greater than 0x10FFFF."
|
- "Error [EPAR0370034]: The escaped unicode char `110000` is greater than 0x10FFFF."
|
||||||
|
- "Error [EPAR0370033]: The escaped unicode char `1234567890` is not within valid length of [1, 6]."
|
||||||
- "Error [EPAR0370026]: Expected a closed char but found ``."
|
- "Error [EPAR0370026]: Expected a closed char but found ``."
|
||||||
- "Error [EPAR0370026]: Expected a closed char but found `😭`."
|
- "Error [EPAR0370026]: Expected a closed char but found `😭`."
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
---
|
||||||
|
namespace: ParseExpression
|
||||||
|
expectation: Fail
|
||||||
|
outputs:
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got 'address'\n --> test:1:1\n |\n 1 | address::call()\n | ^^^^^^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got 'bool'\n --> test:1:1\n |\n 1 | bool::call()\n | ^^^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got 'char'\n --> test:1:1\n |\n 1 | char::call()\n | ^^^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got 'field'\n --> test:1:1\n |\n 1 | field::call()\n | ^^^^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got 'group'\n --> test:1:1\n |\n 1 | group::call()\n | ^^^^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got 'i8'\n --> test:1:1\n |\n 1 | i8::call()\n | ^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got 'i16'\n --> test:1:1\n |\n 1 | i16::call()\n | ^^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got 'i32'\n --> test:1:1\n |\n 1 | i32::call()\n | ^^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got 'i64'\n --> test:1:1\n |\n 1 | i64::call()\n | ^^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got 'i128'\n --> test:1:1\n |\n 1 | i128::call()\n | ^^^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got 'u8'\n --> test:1:1\n |\n 1 | u8::call()\n | ^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got 'u16'\n --> test:1:1\n |\n 1 | u16::call()\n | ^^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got 'u32'\n --> test:1:1\n |\n 1 | u32::call()\n | ^^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got 'u64'\n --> test:1:1\n |\n 1 | u64::call()\n | ^^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got 'u128'\n --> test:1:1\n |\n 1 | u128::call()\n | ^^^^"
|
@ -2,8 +2,8 @@
|
|||||||
namespace: Token
|
namespace: Token
|
||||||
expectation: Fail
|
expectation: Fail
|
||||||
outputs:
|
outputs:
|
||||||
- "Error [EPAR0370025]: Expected a closed string but found `[Scalar('H'), Scalar('e'), Scalar('l'), Scalar('l'), Scalar('o'), Scalar(' '), Scalar('w'), Scalar('o'), Scalar('r'), Scalar('l'), Scalar('d'), Scalar('!')]`."
|
- "Error [EPAR0370025]: Expected a closed string but found `Hello world!`."
|
||||||
- "Error [EPAR0370025]: Expected a closed string but found `[Scalar('\"')]`."
|
- "Error [EPAR0370025]: Expected a closed string but found `\"`."
|
||||||
- "Error [EPAR0370023]: Expected more characters to lex but found none."
|
- "Error [EPAR0370023]: Expected more characters to lex but found none."
|
||||||
- "Error [EPAR0370024]: Expected a valid escape character but found `l`."
|
- "Error [EPAR0370024]: Expected a valid escape character but found `l`."
|
||||||
- "Error [EPAR0370037]: There was no opening `{` after starting an escaped unicode `a`."
|
- "Error [EPAR0370037]: There was no opening `{` after starting an escaped unicode `a`."
|
||||||
@ -13,5 +13,5 @@ outputs:
|
|||||||
- "Error [EPAR0370037]: There was no opening `{` after starting an escaped unicode `}`."
|
- "Error [EPAR0370037]: There was no opening `{` after starting an escaped unicode `}`."
|
||||||
- "Error [EPAR0370037]: There was no opening `{` after starting an escaped unicode `6`."
|
- "Error [EPAR0370037]: There was no opening `{` after starting an escaped unicode `6`."
|
||||||
- "Error [EPAR0370032]: There was no closing `}` after a escaped unicode `af🦀\"`."
|
- "Error [EPAR0370032]: There was no closing `}` after a escaped unicode `af🦀\"`."
|
||||||
- "Error [EPAR0370025]: Expected a closed string but found `[Scalar('\"')]`."
|
- "Error [EPAR0370025]: Expected a closed string but found `\"`."
|
||||||
- "Error [EPAR0370025]: Expected a closed string but found `[Scalar('⭇'), Scalar('😍'), Scalar(';')]`."
|
- "Error [EPAR0370025]: Expected a closed string but found `⭇😍;`."
|
||||||
|
@ -0,0 +1,82 @@
|
|||||||
|
---
|
||||||
|
namespace: ParseExpression
|
||||||
|
expectation: Fail
|
||||||
|
outputs:
|
||||||
|
- "Error [EPAR0370030]: Could not lex the following content: `~`."
|
||||||
|
- "Error [EPAR0370030]: Could not lex the following content: `~`."
|
||||||
|
- "Error [EPAR0370030]: Could not lex the following content: `~`."
|
||||||
|
- "Error [EPAR0370030]: Could not lex the following content: `~`."
|
||||||
|
- "Error [EPAR0370030]: Could not lex the following content: `~`."
|
||||||
|
- "Error [EPAR0370030]: Could not lex the following content: `~`."
|
||||||
|
- "Error [EPAR0370030]: Could not lex the following content: `~`."
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got '@'\n --> test:1:1\n |\n 1 | @test\n | ^"
|
||||||
|
- "Error [EPAR0370030]: Could not lex the following content: `~`."
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got '&&'\n --> test:1:1\n |\n 1 | &&\n | ^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got '||'\n --> test:1:1\n |\n 1 | ||\n | ^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got '=='\n --> test:1:1\n |\n 1 | ==\n | ^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got '!='\n --> test:1:1\n |\n 1 | !=\n | ^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got '<'\n --> test:1:1\n |\n 1 | <\n | ^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got '<='\n --> test:1:1\n |\n 1 | <=\n | ^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got '>'\n --> test:1:1\n |\n 1 | >\n | ^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got '>='\n --> test:1:1\n |\n 1 | >=\n | ^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got '+'\n --> test:1:1\n |\n 1 | +\n | ^"
|
||||||
|
- "Error [EPAR0370003]: unexpected EOF\n --> test:1:1\n |\n 1 | -\n | ^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got '*'\n --> test:1:1\n |\n 1 | *\n | ^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got '**'\n --> test:1:1\n |\n 1 | **\n | ^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got '/'\n --> test:1:1\n |\n 1 | /\n | ^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got '='\n --> test:1:1\n |\n 1 | =\n | ^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got '+='\n --> test:1:1\n |\n 1 | +=\n | ^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got '-='\n --> test:1:1\n |\n 1 | -=\n | ^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got '*='\n --> test:1:1\n |\n 1 | *=\n | ^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got '/='\n --> test:1:1\n |\n 1 | /=\n | ^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got '**='\n --> test:1:1\n |\n 1 | **=\n | ^^^"
|
||||||
|
- "Error [EPAR0370003]: unexpected EOF\n --> test:1:1\n |\n 1 | (\n | ^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got ')'\n --> test:1:1\n |\n 1 | )\n | ^"
|
||||||
|
- "Error [EPAR0370003]: unexpected EOF\n --> test:1:1\n |\n 1 | [\n | ^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got ']'\n --> test:1:1\n |\n 1 | ]\n | ^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got '{'\n --> test:1:1\n |\n 1 | {\n | ^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got '}'\n --> test:1:1\n |\n 1 | }\n | ^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got ','\n --> test:1:1\n |\n 1 | ,\n | ^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got '.'\n --> test:1:1\n |\n 1 | .\n | ^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got '..'\n --> test:1:1\n |\n 1 | ..\n | ^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got '...'\n --> test:1:1\n |\n 1 | ...\n | ^^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got ';'\n --> test:1:1\n |\n 1 | ;\n | ^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got ':'\n --> test:1:1\n |\n 1 | :\n | ^"
|
||||||
|
- "Error [EPAR0370003]: unexpected EOF\n --> test:1:2\n |\n 1 | h::\n | ^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got '?'\n --> test:1:1\n |\n 1 | ?\n | ^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got '->'\n --> test:1:1\n |\n 1 | ->\n | ^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got '_'\n --> test:1:1\n |\n 1 | _\n | ^"
|
||||||
|
- "Error [EPAR0370030]: Could not lex the following content: `~`."
|
||||||
|
- "Error [EPAR0370030]: Could not lex the following content: `~`."
|
||||||
|
- "Error [EPAR0370030]: Could not lex the following content: `~`."
|
||||||
|
- "Error [EPAR0370030]: Could not lex the following content: `~`."
|
||||||
|
- "Error [EPAR0370030]: Could not lex the following content: `~`."
|
||||||
|
- "Error [EPAR0370030]: Could not lex the following content: `~`."
|
||||||
|
- "Error [EPAR0370030]: Could not lex the following content: `~`."
|
||||||
|
- "Error [EPAR0370030]: Could not lex the following content: `~`."
|
||||||
|
- "Error [EPAR0370030]: Could not lex the following content: `~`."
|
||||||
|
- "Error [EPAR0370030]: Could not lex the following content: `~`."
|
||||||
|
- "Error [EPAR0370030]: Could not lex the following content: `~`."
|
||||||
|
- "Error [EPAR0370030]: Could not lex the following content: `~`."
|
||||||
|
- "Error [EPAR0370030]: Could not lex the following content: `~`."
|
||||||
|
- "Error [EPAR0370030]: Could not lex the following content: `~`."
|
||||||
|
- "Error [EPAR0370030]: Could not lex the following content: `~`."
|
||||||
|
- "Error [EPAR0370030]: Could not lex the following content: `~`."
|
||||||
|
- "Error [EPAR0370030]: Could not lex the following content: `~`."
|
||||||
|
- "Error [EPAR0370030]: Could not lex the following content: `~`."
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got 'import'\n --> test:1:1\n |\n 1 | import\n | ^^^^^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got 'as'\n --> test:1:1\n |\n 1 | as\n | ^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got 'circuit'\n --> test:1:1\n |\n 1 | circuit\n | ^^^^^^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got 'console'\n --> test:1:1\n |\n 1 | console\n | ^^^^^^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got 'const'\n --> test:1:1\n |\n 1 | const\n | ^^^^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got 'else'\n --> test:1:1\n |\n 1 | else\n | ^^^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got 'for'\n --> test:1:1\n |\n 1 | for\n | ^^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got 'function'\n --> test:1:1\n |\n 1 | function\n | ^^^^^^^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got 'if'\n --> test:1:1\n |\n 1 | if\n | ^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got 'in'\n --> test:1:1\n |\n 1 | in\n | ^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got 'let'\n --> test:1:1\n |\n 1 | let\n | ^^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got 'mut'\n --> test:1:1\n |\n 1 | mut\n | ^^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got '&'\n --> test:1:1\n |\n 1 | &\n | ^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got 'return'\n --> test:1:1\n |\n 1 | return\n | ^^^^^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got 'static'\n --> test:1:1\n |\n 1 | static\n | ^^^^^^"
|
||||||
|
- "Error [EPAR0370009]: unexpected string: expected 'expression', got 'type'\n --> test:1:1\n |\n 1 | type\n | ^^^^"
|
@ -122,21 +122,41 @@ outputs:
|
|||||||
col_stop: 4
|
col_stop: 4
|
||||||
path: ""
|
path: ""
|
||||||
content: "-!x"
|
content: "-!x"
|
||||||
- Value:
|
- Unary:
|
||||||
|
inner:
|
||||||
|
Value:
|
||||||
Implicit:
|
Implicit:
|
||||||
- "-5"
|
- "5"
|
||||||
- span:
|
- span:
|
||||||
|
line_start: 1
|
||||||
|
line_stop: 1
|
||||||
|
col_start: 2
|
||||||
|
col_stop: 3
|
||||||
|
path: ""
|
||||||
|
content: "-5"
|
||||||
|
op: Negate
|
||||||
|
span:
|
||||||
line_start: 1
|
line_start: 1
|
||||||
line_stop: 1
|
line_stop: 1
|
||||||
col_start: 1
|
col_start: 1
|
||||||
col_stop: 3
|
col_stop: 3
|
||||||
path: ""
|
path: ""
|
||||||
content: "-5"
|
content: "-5"
|
||||||
- Value:
|
- Unary:
|
||||||
|
inner:
|
||||||
|
Value:
|
||||||
Integer:
|
Integer:
|
||||||
- I8
|
- I8
|
||||||
- "-5"
|
- "5"
|
||||||
- span:
|
- span:
|
||||||
|
line_start: 1
|
||||||
|
line_stop: 1
|
||||||
|
col_start: 2
|
||||||
|
col_stop: 5
|
||||||
|
path: ""
|
||||||
|
content: "-5i8"
|
||||||
|
op: Negate
|
||||||
|
span:
|
||||||
line_start: 1
|
line_start: 1
|
||||||
line_stop: 1
|
line_stop: 1
|
||||||
col_start: 1
|
col_start: 1
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
namespace: Parse
|
||||||
|
expectation: Fail
|
||||||
|
outputs:
|
||||||
|
- "Error [EPAR0370005]: expected 'import', 'circuit', 'function', 'test', '@' -- got '1'\n --> test:3:1\n |\n 3 | 1 main() {}\n | ^"
|
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
namespace: Parse
|
||||||
|
expectation: Fail
|
||||||
|
outputs:
|
||||||
|
- "Error [EPAR0370013]: function func(mut a: u32) { ... } is deprecated. Passed variables are mutable by default.\n --> test:3:12\n |\n 3 | function f(mut a: u8) {}\n | ^^^^^"
|
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
namespace: Parse
|
||||||
|
expectation: Fail
|
||||||
|
outputs:
|
||||||
|
- "Error [EPAR0370013]: function func(mut a: u32) { ... } is deprecated. Passed variables are mutable by default.\n --> test:3:12\n |\n 3 | function f(mut a: u8) {}\n | ^^^^^"
|
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
namespace: Parse
|
||||||
|
expectation: Fail
|
||||||
|
outputs:
|
||||||
|
- "Error [EPAR0370015]: \"test function...\" is deprecated. Did you mean @test annotation?\n --> test:3:1\n |\n 3 | test main() {}\n | ^^^^"
|
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
namespace: Input
|
||||||
|
expectation: Fail
|
||||||
|
outputs:
|
||||||
|
- "Error [EPAR0370000]: main\n --> test:3:1\n |\n 3 | main\n | ^^^^"
|
@ -2,4 +2,4 @@
|
|||||||
namespace: Parse
|
namespace: Parse
|
||||||
expectation: Fail
|
expectation: Fail
|
||||||
outputs:
|
outputs:
|
||||||
- "Error [EPAR0370025]: Expected a closed string but found `[]`."
|
- "Error [EPAR0370025]: Expected a closed string but found ``."
|
||||||
|
58
tests/expectations/parser/parser/statement/alias.leo.out
Normal file
58
tests/expectations/parser/parser/statement/alias.leo.out
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
---
|
||||||
|
namespace: Parse
|
||||||
|
expectation: Pass
|
||||||
|
outputs:
|
||||||
|
- name: ""
|
||||||
|
expected_input: []
|
||||||
|
import_statements: []
|
||||||
|
imports: {}
|
||||||
|
aliases:
|
||||||
|
"{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"type a = u32;\\\"}\"}":
|
||||||
|
name: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"type a = u32;\\\"}\"}"
|
||||||
|
span:
|
||||||
|
line_start: 3
|
||||||
|
line_stop: 3
|
||||||
|
col_start: 1
|
||||||
|
col_stop: 14
|
||||||
|
path: ""
|
||||||
|
content: type a = u32;
|
||||||
|
represents:
|
||||||
|
IntegerType: U32
|
||||||
|
"{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"type b = string;\\\"}\"}":
|
||||||
|
name: "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"type b = string;\\\"}\"}"
|
||||||
|
span:
|
||||||
|
line_start: 5
|
||||||
|
line_stop: 5
|
||||||
|
col_start: 1
|
||||||
|
col_stop: 17
|
||||||
|
path: ""
|
||||||
|
content: type b = string;
|
||||||
|
represents:
|
||||||
|
Identifier: "{\"name\":\"string\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":10,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"type b = string;\\\"}\"}"
|
||||||
|
"{\"name\":\"c\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"type c = a;\\\"}\"}":
|
||||||
|
name: "{\"name\":\"c\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"type c = a;\\\"}\"}"
|
||||||
|
span:
|
||||||
|
line_start: 7
|
||||||
|
line_stop: 7
|
||||||
|
col_start: 1
|
||||||
|
col_stop: 12
|
||||||
|
path: ""
|
||||||
|
content: type c = a;
|
||||||
|
represents:
|
||||||
|
Identifier: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"type c = a;\\\"}\"}"
|
||||||
|
"{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"type b = [u8; 5];\\\"}\"}":
|
||||||
|
name: "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"type b = [u8; 5];\\\"}\"}"
|
||||||
|
span:
|
||||||
|
line_start: 9
|
||||||
|
line_stop: 9
|
||||||
|
col_start: 1
|
||||||
|
col_stop: 18
|
||||||
|
path: ""
|
||||||
|
content: "type b = [u8; 5];"
|
||||||
|
represents:
|
||||||
|
Array:
|
||||||
|
- IntegerType: U8
|
||||||
|
- - value: "5"
|
||||||
|
circuits: {}
|
||||||
|
global_consts: {}
|
||||||
|
functions: {}
|
109
tests/expectations/parser/parser/statement/global_const.leo.out
Normal file
109
tests/expectations/parser/parser/statement/global_const.leo.out
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
---
|
||||||
|
namespace: Parse
|
||||||
|
expectation: Pass
|
||||||
|
outputs:
|
||||||
|
- name: ""
|
||||||
|
expected_input: []
|
||||||
|
import_statements: []
|
||||||
|
imports: {}
|
||||||
|
aliases: {}
|
||||||
|
circuits: {}
|
||||||
|
global_consts:
|
||||||
|
x:
|
||||||
|
declaration_type: Const
|
||||||
|
variable_names:
|
||||||
|
- mutable: false
|
||||||
|
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const x: char = 'b';\\\"}\"}"
|
||||||
|
span:
|
||||||
|
line_start: 11
|
||||||
|
line_stop: 11
|
||||||
|
col_start: 7
|
||||||
|
col_stop: 8
|
||||||
|
path: ""
|
||||||
|
content: "const x: char = 'b';"
|
||||||
|
type_: Char
|
||||||
|
value:
|
||||||
|
Value:
|
||||||
|
Char:
|
||||||
|
character:
|
||||||
|
Scalar: 98
|
||||||
|
span:
|
||||||
|
line_start: 11
|
||||||
|
line_stop: 11
|
||||||
|
col_start: 17
|
||||||
|
col_stop: 20
|
||||||
|
path: ""
|
||||||
|
content: "const x: char = 'b';"
|
||||||
|
span:
|
||||||
|
line_start: 11
|
||||||
|
line_stop: 11
|
||||||
|
col_start: 1
|
||||||
|
col_stop: 20
|
||||||
|
path: ""
|
||||||
|
content: "const x: char = 'b';"
|
||||||
|
f:
|
||||||
|
declaration_type: Const
|
||||||
|
variable_names:
|
||||||
|
- mutable: false
|
||||||
|
identifier: "{\"name\":\"f\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const f: u32 = x;\\\"}\"}"
|
||||||
|
span:
|
||||||
|
line_start: 5
|
||||||
|
line_stop: 5
|
||||||
|
col_start: 7
|
||||||
|
col_stop: 8
|
||||||
|
path: ""
|
||||||
|
content: "const f: u32 = x;"
|
||||||
|
type_:
|
||||||
|
IntegerType: U32
|
||||||
|
value:
|
||||||
|
Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":16,\\\"col_stop\\\":17,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const f: u32 = x;\\\"}\"}"
|
||||||
|
span:
|
||||||
|
line_start: 5
|
||||||
|
line_stop: 5
|
||||||
|
col_start: 1
|
||||||
|
col_stop: 17
|
||||||
|
path: ""
|
||||||
|
content: "const f: u32 = x;"
|
||||||
|
y:
|
||||||
|
declaration_type: Const
|
||||||
|
variable_names:
|
||||||
|
- mutable: false
|
||||||
|
identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const y: string = \\\\\\\"hello world\\\\\\\";\\\"}\"}"
|
||||||
|
span:
|
||||||
|
line_start: 9
|
||||||
|
line_stop: 9
|
||||||
|
col_start: 7
|
||||||
|
col_stop: 8
|
||||||
|
path: ""
|
||||||
|
content: "const y: string = \"hello world\";"
|
||||||
|
type_:
|
||||||
|
Identifier: "{\"name\":\"string\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":10,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const y: string = \\\\\\\"hello world\\\\\\\";\\\"}\"}"
|
||||||
|
value:
|
||||||
|
Value:
|
||||||
|
String:
|
||||||
|
- - Scalar: 104
|
||||||
|
- Scalar: 101
|
||||||
|
- Scalar: 108
|
||||||
|
- Scalar: 108
|
||||||
|
- Scalar: 111
|
||||||
|
- Scalar: 32
|
||||||
|
- Scalar: 119
|
||||||
|
- Scalar: 111
|
||||||
|
- Scalar: 114
|
||||||
|
- Scalar: 108
|
||||||
|
- Scalar: 100
|
||||||
|
- span:
|
||||||
|
line_start: 9
|
||||||
|
line_stop: 9
|
||||||
|
col_start: 19
|
||||||
|
col_stop: 32
|
||||||
|
path: ""
|
||||||
|
content: "const y: string = \"hello world\";"
|
||||||
|
span:
|
||||||
|
line_start: 9
|
||||||
|
line_stop: 9
|
||||||
|
col_start: 1
|
||||||
|
col_stop: 32
|
||||||
|
path: ""
|
||||||
|
content: "const y: string = \"hello world\";"
|
||||||
|
functions: {}
|
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
namespace: Parse
|
||||||
|
expectation: Fail
|
||||||
|
outputs:
|
||||||
|
- "Error [EPAR0370015]: \"test function...\" is deprecated. Did you mean @test annotation?\n --> test:3:1\n |\n 3 | test main() {}\n | ^^^^"
|
@ -6,4 +6,11 @@ expectation: Pass
|
|||||||
circuit X {
|
circuit X {
|
||||||
static const x: u32 = 2;
|
static const x: u32 = 2;
|
||||||
static const y: u32 = 5;
|
static const y: u32 = 5;
|
||||||
|
static const G: u8 = G;
|
||||||
|
static const FOO: Foo = Foo {};
|
||||||
|
static const INDEXED: Foo = A[0];
|
||||||
|
static const TINDEXED: Foo = T.0;
|
||||||
|
static const TWO: i8 = 1i8 + 1i8;
|
||||||
|
static const mult: i8 = x * y;
|
||||||
|
static const mult: i8 = one();
|
||||||
}
|
}
|
6
tests/parser/circuits/token_circuit_name.leo
Normal file
6
tests/parser/circuits/token_circuit_name.leo
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
/*
|
||||||
|
namespace: Parse
|
||||||
|
expectation: Pass
|
||||||
|
*/
|
||||||
|
|
||||||
|
circuit u32 {}
|
17
tests/parser/circuits/types_fail.leo
Normal file
17
tests/parser/circuits/types_fail.leo
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
namespace: Parse
|
||||||
|
expectation: Fail
|
||||||
|
*/
|
||||||
|
|
||||||
|
circuit address {}
|
||||||
|
circuit bool {}
|
||||||
|
circuit char {}
|
||||||
|
circuit group {}
|
||||||
|
circuit i8 {}
|
||||||
|
circuit i16 {}
|
||||||
|
circuit i32 {}
|
||||||
|
circuit i64 {}
|
||||||
|
circuit u8 {}
|
||||||
|
circuit u16 {}
|
||||||
|
circuit u32 {}
|
||||||
|
circuit u64 {}
|
@ -12,6 +12,7 @@ expectation: Fail
|
|||||||
|
|
||||||
''
|
''
|
||||||
|
|
||||||
|
'\x
|
||||||
'\x7'
|
'\x7'
|
||||||
'\xz'
|
'\xz'
|
||||||
'\x9A'
|
'\x9A'
|
||||||
@ -51,6 +52,7 @@ expectation: Fail
|
|||||||
'\u00000000'
|
'\u00000000'
|
||||||
'\u01000000'
|
'\u01000000'
|
||||||
'\u{110000}'
|
'\u{110000}'
|
||||||
|
'\u{1234567890}'
|
||||||
'\u{bbbbb}\u{aaaa}'
|
'\u{bbbbb}\u{aaaa}'
|
||||||
|
|
||||||
'😭😂😘'
|
'😭😂😘'
|
||||||
|
160
tests/parser/expression/token_format.leo
Normal file
160
tests/parser/expression/token_format.leo
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
/*
|
||||||
|
namespace: ParseExpression
|
||||||
|
expectation: Fail
|
||||||
|
*/
|
||||||
|
|
||||||
|
"test" ~
|
||||||
|
|
||||||
|
u32 ~
|
||||||
|
|
||||||
|
1 ~
|
||||||
|
|
||||||
|
true ~
|
||||||
|
|
||||||
|
false ~
|
||||||
|
|
||||||
|
aleo13jgjyzhzhvrqecjct7scsjrfsfn09j9vryung8mfykt5502p75rsx7l9lr ~
|
||||||
|
|
||||||
|
'h' ~
|
||||||
|
|
||||||
|
@test
|
||||||
|
|
||||||
|
!1 ~
|
||||||
|
|
||||||
|
&&
|
||||||
|
|
||||||
|
||
|
||||||
|
|
||||||
|
==
|
||||||
|
|
||||||
|
!=
|
||||||
|
|
||||||
|
<
|
||||||
|
|
||||||
|
<=
|
||||||
|
|
||||||
|
>
|
||||||
|
|
||||||
|
>=
|
||||||
|
|
||||||
|
+
|
||||||
|
|
||||||
|
-
|
||||||
|
|
||||||
|
*
|
||||||
|
|
||||||
|
**
|
||||||
|
|
||||||
|
/
|
||||||
|
|
||||||
|
=
|
||||||
|
|
||||||
|
+=
|
||||||
|
|
||||||
|
-=
|
||||||
|
|
||||||
|
*=
|
||||||
|
|
||||||
|
/=
|
||||||
|
|
||||||
|
**=
|
||||||
|
|
||||||
|
(
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
[
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
,
|
||||||
|
|
||||||
|
.
|
||||||
|
|
||||||
|
..
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
:
|
||||||
|
|
||||||
|
h::
|
||||||
|
|
||||||
|
?
|
||||||
|
|
||||||
|
->
|
||||||
|
|
||||||
|
_
|
||||||
|
|
||||||
|
u8 ~
|
||||||
|
|
||||||
|
u16 ~
|
||||||
|
|
||||||
|
u32 ~
|
||||||
|
|
||||||
|
u64 ~
|
||||||
|
|
||||||
|
u128 ~
|
||||||
|
|
||||||
|
i8 ~
|
||||||
|
|
||||||
|
i16 ~
|
||||||
|
|
||||||
|
i32 ~
|
||||||
|
|
||||||
|
i64 ~
|
||||||
|
|
||||||
|
i128 ~
|
||||||
|
|
||||||
|
field ~
|
||||||
|
|
||||||
|
group ~
|
||||||
|
|
||||||
|
bool ~
|
||||||
|
|
||||||
|
address ~
|
||||||
|
|
||||||
|
char ~
|
||||||
|
|
||||||
|
Self ~
|
||||||
|
|
||||||
|
input ~
|
||||||
|
|
||||||
|
self ~
|
||||||
|
|
||||||
|
import
|
||||||
|
|
||||||
|
as
|
||||||
|
|
||||||
|
circuit
|
||||||
|
|
||||||
|
console
|
||||||
|
|
||||||
|
const
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
for
|
||||||
|
|
||||||
|
function
|
||||||
|
|
||||||
|
if
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
mut
|
||||||
|
|
||||||
|
&
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
static
|
||||||
|
|
||||||
|
type
|
6
tests/parser/functions/ident_token_fail.leo
Normal file
6
tests/parser/functions/ident_token_fail.leo
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
/*
|
||||||
|
namespace: Parse
|
||||||
|
expectation: Fail
|
||||||
|
*/
|
||||||
|
|
||||||
|
1 main() {}
|
6
tests/parser/functions/mut_input_fail.leo
Normal file
6
tests/parser/functions/mut_input_fail.leo
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
/*
|
||||||
|
namespace: Parse
|
||||||
|
expectation: Fail
|
||||||
|
*/
|
||||||
|
|
||||||
|
function f(mut a: u8) {}
|
6
tests/parser/functions/test_keyword_fail.leo
Normal file
6
tests/parser/functions/test_keyword_fail.leo
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
/*
|
||||||
|
namespace: Parse
|
||||||
|
expectation: Fail
|
||||||
|
*/
|
||||||
|
|
||||||
|
test main() {}
|
6
tests/parser/inputs/input_fail.leo
Normal file
6
tests/parser/inputs/input_fail.leo
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
/*
|
||||||
|
namespace: Input
|
||||||
|
expectation: Fail
|
||||||
|
*/
|
||||||
|
|
||||||
|
main
|
12
tests/parser/statement/alias.leo
Normal file
12
tests/parser/statement/alias.leo
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
/*
|
||||||
|
namespace: Parse
|
||||||
|
expectation: Pass
|
||||||
|
*/
|
||||||
|
|
||||||
|
type a = u32;
|
||||||
|
|
||||||
|
type b = string;
|
||||||
|
|
||||||
|
type c = a;
|
||||||
|
|
||||||
|
type b = [u8; 5];
|
14
tests/parser/statement/global_const.leo
Normal file
14
tests/parser/statement/global_const.leo
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/*
|
||||||
|
namespace: Parse
|
||||||
|
expectation: Pass
|
||||||
|
*/
|
||||||
|
|
||||||
|
const x: u32 = 1u32;
|
||||||
|
|
||||||
|
const f: u32 = x;
|
||||||
|
|
||||||
|
const x: i32 = 1i32;
|
||||||
|
|
||||||
|
const y: string = "hello world";
|
||||||
|
|
||||||
|
const x: char = 'b';
|
Loading…
Reference in New Issue
Block a user