From b8292e3fd999fe07555f4dc842a79776c88c4671 Mon Sep 17 00:00:00 2001 From: collin Date: Mon, 29 Jun 2020 12:08:18 -0700 Subject: [PATCH] require spacing after keywords --- ast/src/leo.pest | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/ast/src/leo.pest b/ast/src/leo.pest index 40886ba32a..ca41f1a5b5 100644 --- a/ast/src/leo.pest +++ b/ast/src/leo.pest @@ -18,7 +18,7 @@ protected_name = { LINE_END = { ";" ~ NEWLINE* } // Declared in common/mutable.rs -mutable = { "mut" } +mutable = { "mut " } // Declared in common/range.rs range = { from_expression? ~ ".." ~ to_expression? } @@ -35,15 +35,15 @@ spread = { "..." ~ expression } spread_or_expression = { spread | expression } // Declared in common/static_.rs -static_ = { "static" } +static_ = { "static " } // Declared in common/variable.rs variable = { mutable? ~ identifier ~ (":" ~ type_)? } // Declared in common/declare.rs declare = { let_ | const_ } -const_ = { "const" } -let_ = { "let" } +const_ = { "const " } +let_ = { "let " } /// Operations @@ -177,7 +177,7 @@ access_static_member = { "::" ~ identifier } /// Circuits // Declared in circuits/circuit_definition.rs -circuit = { "circuit" ~ identifier ~ "{" ~ NEWLINE* ~ circuit_member* ~ NEWLINE* ~ "}" ~ NEWLINE* } +circuit = { "circuit " ~ identifier ~ "{" ~ NEWLINE* ~ circuit_member* ~ NEWLINE* ~ "}" ~ NEWLINE* } // Declared in circuits/circuit_field.rs circuit_field = { identifier ~ ":" ~ expression } @@ -193,7 +193,7 @@ circuit_member = { circuit_function | circuit_field_definition } /// Conditionals -expression_conditional = { "if" ~ expression ~ "?" ~ expression ~ ":" ~ expression} +expression_conditional = { "if " ~ expression ~ "? " ~ expression ~ ": " ~ expression} /// Expressions @@ -254,7 +254,7 @@ assert_eq = {"assert_eq!" ~ "(" ~ NEWLINE* ~ expression ~ "," ~ NEWLINE* ~ expre statement_assign = { assignee ~ operation_assign ~ expression ~ LINE_END } // Declared in statements/conditional_statement.rs -statement_conditional = {"if" ~ (expression | "(" ~ expression ~ ")") ~ "{" ~ NEWLINE* ~ statement+ ~ "}" ~ ("else" ~ conditional_nested_or_end_statement)?} +statement_conditional = {"if " ~ (expression | "(" ~ expression ~ ")") ~ "{" ~ NEWLINE* ~ statement+ ~ "}" ~ ("else" ~ conditional_nested_or_end_statement)?} conditional_nested_or_end_statement = { statement_conditional | "{" ~ NEWLINE* ~ statement+ ~ "}"} // Declared in statements/definition_statement.rs @@ -264,26 +264,26 @@ statement_definition = { declare ~ variable ~ "=" ~ expression ~ LINE_END} statement_expression = { expression ~ LINE_END } // Declared in statements/for_statement.rs -statement_for = { "for" ~ identifier ~ "in" ~ expression ~ ".." ~ expression ~ "{" ~ NEWLINE* ~ statement+ ~ "}"} +statement_for = { "for " ~ identifier ~ "in " ~ expression ~ ".." ~ expression ~ "{" ~ NEWLINE* ~ statement+ ~ "}"} // Declared in statements/multiple_assignment_statement.rs statement_multiple_assignment = { declare ~ "(" ~ variable_tuple ~ ")" ~ "=" ~ identifier ~ "(" ~ expression_tuple ~ ")" ~ LINE_END} variable_tuple = _{ variable ~ ("," ~ variable)* } // Declared in statements/return_statement.rs -statement_return = { "return" ~ expression_tuple } +statement_return = { "return " ~ expression_tuple } /// Functions // Declared in functions/function.rs -function_definition = { "function" ~ identifier ~ "(" ~ input_model_list ~ ")" ~ ("->" ~ (type_ | "(" ~ type_list ~ ")"))? ~ "{" ~ NEWLINE* ~ statement* ~ NEWLINE* ~ "}" ~ NEWLINE* } +function_definition = { "function " ~ identifier ~ "(" ~ input_model_list ~ ")" ~ ("->" ~ (type_ | "(" ~ type_list ~ ")"))? ~ "{" ~ NEWLINE* ~ statement* ~ NEWLINE* ~ "}" ~ NEWLINE* } // Declared in functions/function_input.rs function_input = { mutable? ~ identifier ~ ":" ~ type_ } input_model_list = _{ (function_input ~ ("," ~ function_input)*)? } // Declared in functions/test_function.rs -test_function = { "test" ~ function_definition } +test_function = { "test " ~ function_definition } /// Imports @@ -300,4 +300,4 @@ import_symbol_tuple = _{ import_symbol ~ ("," ~ NEWLINE* ~ import_symbol)* } /// Utilities COMMENT = _{ ("/*" ~ (!"*/" ~ ANY)* ~ "*/") | ("//" ~ (!NEWLINE ~ ANY)*) } -WHITESPACE = _{ " " | "\t" ~ (NEWLINE)* } +WHITESPACE = _{ " " | "\t" ~ (NEWLINE)* } // pest implicit whitespace keyword