mirror of
https://github.com/AleoHQ/leo.git
synced 2024-12-02 03:19:41 +03:00
clean up comments
This commit is contained in:
parent
474c81a3ab
commit
0e00cbc422
@ -69,16 +69,10 @@ static_ = { "static " }
|
||||
// Declared in common/variable_name.rs
|
||||
|
||||
variable_name = {mutable? ~ identifier}
|
||||
variable_name_list = _{"(" ~ variable_name ~ ("," ~ variable_name)+ ~ ")"}
|
||||
|
||||
// Declared in
|
||||
|
||||
// Declared in common/variable.rs
|
||||
// variable = { mutable? ~ identifier ~ (":" ~ type_)? }
|
||||
// variable_list = _{ variable ~ ("," ~ variable)* }
|
||||
variable_name_tuple = _{"(" ~ variable_name ~ ("," ~ variable_name)+ ~ ")"}
|
||||
|
||||
// Declared in common/variables.rs
|
||||
variables = { ( variable_name_list | variable_name ) ~ (":" ~ ( type_list | type_ ))? }
|
||||
variables = { ( variable_name_tuple | variable_name ) ~ (":" ~ ( type_tuple | type_ ))? }
|
||||
|
||||
// Declared in common/declare.rs
|
||||
declare = { let_ | const_ }
|
||||
@ -203,7 +197,7 @@ type_circuit = { identifier }
|
||||
// Declared in types/array_type.rs
|
||||
type_array = { type_data ~ ("[" ~ number_positive ~ "]")+ }
|
||||
|
||||
type_list = _{ "(" ~ type_ ~ ("," ~ type_)+ ~ ")" }
|
||||
type_tuple = _{ "(" ~ type_ ~ ("," ~ type_)+ ~ ")" }
|
||||
|
||||
/// Values
|
||||
|
||||
@ -264,7 +258,7 @@ access_array = !{ "[" ~ range_or_expression ~ "]" }
|
||||
access_assignee = { access_array | access_member }
|
||||
|
||||
// Declared in access/call_access.rs
|
||||
access_call = !{ expression_list }
|
||||
access_call = !{ expression_tuple }
|
||||
|
||||
// Declared in access/member_access.rs
|
||||
access_member = ${ "." ~ identifier }
|
||||
@ -310,7 +304,7 @@ expression_term = {
|
||||
|
||||
// Declared in expressions/expression.rs
|
||||
expression = { expression_term ~ (operation_binary ~ expression_term)* }
|
||||
expression_list = _{ "(" ~ (expression ~ ("," ~ expression)*)? ~ ")" }
|
||||
expression_tuple = _{ "(" ~ (expression ~ ("," ~ expression)*)? ~ ")" }
|
||||
|
||||
// Declared in expressions/array_initializer_expression.rs
|
||||
expression_array_initializer = { "[" ~ spread_or_expression ~ ";" ~ number_positive ~ "]" }
|
||||
@ -336,7 +330,6 @@ statement = {
|
||||
(statement_return
|
||||
| statement_conditional
|
||||
| statement_for
|
||||
// | statement_multiple_assignment
|
||||
| statement_macro
|
||||
| statement_definition
|
||||
| statement_assign
|
||||
@ -358,7 +351,7 @@ statement_conditional = {"if " ~ (expression | "(" ~ expression ~ ")") ~ "{" ~ N
|
||||
conditional_nested_or_end_statement = { statement_conditional | "{" ~ NEWLINE* ~ statement+ ~ "}"}
|
||||
|
||||
// Declared in statements/definition_statement.rs
|
||||
statement_definition = { declare ~ variables ~ "=" ~ (expression_list | expression) ~ LINE_END}
|
||||
statement_definition = { declare ~ variables ~ "=" ~ (expression_tuple | expression) ~ LINE_END}
|
||||
|
||||
// Declared in statements/expression_statement.rs
|
||||
statement_expression = { expression ~ LINE_END }
|
||||
@ -375,7 +368,7 @@ statement_return = { "return " ~ return_}
|
||||
test_function = { "test " ~ function }
|
||||
|
||||
// Declared in functions/function.rs
|
||||
function = { "function " ~ identifier ~ input_list ~ ("->" ~ (type_list| type_))? ~ "{" ~ NEWLINE* ~ statement* ~ NEWLINE* ~ "}" ~ NEWLINE* }
|
||||
function = { "function " ~ identifier ~ input_tuple ~ ("->" ~ (type_tuple| type_))? ~ "{" ~ NEWLINE* ~ statement* ~ NEWLINE* ~ "}" ~ NEWLINE* }
|
||||
|
||||
// Declared in functions/input/function_input.rs
|
||||
function_input = { mutable? ~ identifier ~ ":" ~ type_ }
|
||||
@ -388,7 +381,7 @@ input = {
|
||||
function_input
|
||||
| input_keyword
|
||||
}
|
||||
input_list = _{ "(" ~(input ~ ("," ~ NEWLINE* ~ input)*)? ~ ")"}
|
||||
input_tuple = _{ "(" ~(input ~ ("," ~ NEWLINE* ~ input)*)? ~ ")"}
|
||||
|
||||
|
||||
/// Imports
|
||||
|
@ -19,9 +19,6 @@ pub use expression_statement::*;
|
||||
pub mod for_statement;
|
||||
pub use for_statement::*;
|
||||
|
||||
// pub mod multiple_assignment_statement;
|
||||
// pub use multiple_assignment_statement::*;
|
||||
|
||||
pub mod return_statement;
|
||||
pub use return_statement::*;
|
||||
|
||||
|
@ -1,36 +0,0 @@
|
||||
use crate::{
|
||||
ast::Rule,
|
||||
common::{Declare, Identifier, LineEnd, Variable},
|
||||
expressions::Expression,
|
||||
SpanDef,
|
||||
};
|
||||
|
||||
use pest::Span;
|
||||
use pest_ast::FromPest;
|
||||
use serde::Serialize;
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Clone, Debug, FromPest, PartialEq, Serialize)]
|
||||
#[pest_ast(rule(Rule::statement_multiple_assignment))]
|
||||
pub struct MultipleAssignmentStatement<'ast> {
|
||||
pub declare: Declare,
|
||||
pub variables: Vec<Variable<'ast>>,
|
||||
pub function_name: Identifier<'ast>,
|
||||
pub arguments: Vec<Expression<'ast>>,
|
||||
pub line_end: LineEnd,
|
||||
#[pest_ast(outer())]
|
||||
#[serde(with = "SpanDef")]
|
||||
pub span: Span<'ast>,
|
||||
}
|
||||
|
||||
impl<'ast> fmt::Display for MultipleAssignmentStatement<'ast> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
for (i, id) in self.variables.iter().enumerate() {
|
||||
write!(f, "{}", id)?;
|
||||
if i < self.variables.len() - 1 {
|
||||
write!(f, ", ")?;
|
||||
}
|
||||
}
|
||||
write!(f, " = {}", self.function_name)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user