require spacing after keywords

This commit is contained in:
collin 2020-06-29 12:08:18 -07:00
parent b63260380c
commit b8292e3fd9

View File

@ -18,7 +18,7 @@ protected_name = {
LINE_END = { ";" ~ NEWLINE* } LINE_END = { ";" ~ NEWLINE* }
// Declared in common/mutable.rs // Declared in common/mutable.rs
mutable = { "mut" } mutable = { "mut " }
// Declared in common/range.rs // Declared in common/range.rs
range = { from_expression? ~ ".." ~ to_expression? } range = { from_expression? ~ ".." ~ to_expression? }
@ -35,15 +35,15 @@ spread = { "..." ~ expression }
spread_or_expression = { spread | expression } spread_or_expression = { spread | expression }
// Declared in common/static_.rs // Declared in common/static_.rs
static_ = { "static" } static_ = { "static " }
// Declared in common/variable.rs // Declared in common/variable.rs
variable = { mutable? ~ identifier ~ (":" ~ type_)? } variable = { mutable? ~ identifier ~ (":" ~ type_)? }
// Declared in common/declare.rs // Declared in common/declare.rs
declare = { let_ | const_ } declare = { let_ | const_ }
const_ = { "const" } const_ = { "const " }
let_ = { "let" } let_ = { "let " }
/// Operations /// Operations
@ -177,7 +177,7 @@ access_static_member = { "::" ~ identifier }
/// Circuits /// Circuits
// Declared in circuits/circuit_definition.rs // 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 // Declared in circuits/circuit_field.rs
circuit_field = { identifier ~ ":" ~ expression } circuit_field = { identifier ~ ":" ~ expression }
@ -193,7 +193,7 @@ circuit_member = { circuit_function | circuit_field_definition }
/// Conditionals /// Conditionals
expression_conditional = { "if" ~ expression ~ "?" ~ expression ~ ":" ~ expression} expression_conditional = { "if " ~ expression ~ "? " ~ expression ~ ": " ~ expression}
/// Expressions /// Expressions
@ -254,7 +254,7 @@ assert_eq = {"assert_eq!" ~ "(" ~ NEWLINE* ~ expression ~ "," ~ NEWLINE* ~ expre
statement_assign = { assignee ~ operation_assign ~ expression ~ LINE_END } statement_assign = { assignee ~ operation_assign ~ expression ~ LINE_END }
// Declared in statements/conditional_statement.rs // 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+ ~ "}"} conditional_nested_or_end_statement = { statement_conditional | "{" ~ NEWLINE* ~ statement+ ~ "}"}
// Declared in statements/definition_statement.rs // Declared in statements/definition_statement.rs
@ -264,26 +264,26 @@ statement_definition = { declare ~ variable ~ "=" ~ expression ~ LINE_END}
statement_expression = { expression ~ LINE_END } statement_expression = { expression ~ LINE_END }
// Declared in statements/for_statement.rs // 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 // Declared in statements/multiple_assignment_statement.rs
statement_multiple_assignment = { declare ~ "(" ~ variable_tuple ~ ")" ~ "=" ~ identifier ~ "(" ~ expression_tuple ~ ")" ~ LINE_END} statement_multiple_assignment = { declare ~ "(" ~ variable_tuple ~ ")" ~ "=" ~ identifier ~ "(" ~ expression_tuple ~ ")" ~ LINE_END}
variable_tuple = _{ variable ~ ("," ~ variable)* } variable_tuple = _{ variable ~ ("," ~ variable)* }
// Declared in statements/return_statement.rs // Declared in statements/return_statement.rs
statement_return = { "return" ~ expression_tuple } statement_return = { "return " ~ expression_tuple }
/// Functions /// Functions
// Declared in functions/function.rs // 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 // Declared in functions/function_input.rs
function_input = { mutable? ~ identifier ~ ":" ~ type_ } function_input = { mutable? ~ identifier ~ ":" ~ type_ }
input_model_list = _{ (function_input ~ ("," ~ function_input)*)? } input_model_list = _{ (function_input ~ ("," ~ function_input)*)? }
// Declared in functions/test_function.rs // Declared in functions/test_function.rs
test_function = { "test" ~ function_definition } test_function = { "test " ~ function_definition }
/// Imports /// Imports
@ -300,4 +300,4 @@ import_symbol_tuple = _{ import_symbol ~ ("," ~ NEWLINE* ~ import_symbol)* }
/// Utilities /// Utilities
COMMENT = _{ ("/*" ~ (!"*/" ~ ANY)* ~ "*/") | ("//" ~ (!NEWLINE ~ ANY)*) } COMMENT = _{ ("/*" ~ (!"*/" ~ ANY)* ~ "*/") | ("//" ~ (!NEWLINE ~ ANY)*) }
WHITESPACE = _{ " " | "\t" ~ (NEWLINE)* } WHITESPACE = _{ " " | "\t" ~ (NEWLINE)* } // pest implicit whitespace keyword