summaryrefslogtreecommitdiff
path: root/grammar
diff options
context:
space:
mode:
Diffstat (limited to 'grammar')
-rw-r--r--grammar/rust.lm100
1 files changed, 50 insertions, 50 deletions
diff --git a/grammar/rust.lm b/grammar/rust.lm
index 446488d6..45e01d73 100644
--- a/grammar/rust.lm
+++ b/grammar/rust.lm
@@ -149,7 +149,7 @@ def macro_rules_tail
| []
def macro_rules
- [macro_rule macro_rules_tail `; ?]
+ [macro_rule macro_rules_tail `;`?]
def macro_rules_def
[`( macro_rules `) `;]
@@ -194,7 +194,7 @@ def use_as_opt
def use_tree
[use_path_opt `*]
-| [use_path_opt `{ use_tree use_list_tail `, ? `}]
+| [use_path_opt `{ use_tree use_list_tail `,`? `}]
| [simple_path use_as_opt]
def use_declaration
@@ -210,12 +210,12 @@ def literal_pattern
| [char]
| [string]
| [raw_string]
-| [`- ? number]
-| [`- ? float]
+| [`-`? number]
+| [`-`? float]
def identifier_pattern
- [`ref ? `mut ? id]
-| [`ref ? `mut ? id `@ pattern]
+ [`ref`? `mut`? id]
+| [`ref`? `mut`? id `@ pattern]
def wildcard_pattern
[`_]
@@ -228,8 +228,8 @@ def range_pattern
| [range_pattern_bound `... range_pattern_bound]
def reference_pattern
- [`& `mut ? pattern]
-| [`&& `mut ? pattern]
+ [`& `mut`? pattern]
+| [`&& `mut`? pattern]
#
# struct pattern
@@ -237,7 +237,7 @@ def reference_pattern
def struct_pattern_field
[number `: pattern]
| [id `: pattern]
-| [`ref ? `mut ? id]
+| [`ref`? `mut`? id]
def struct_pattern_fields
[struct_pattern_fields `, struct_pattern_field]
@@ -268,7 +268,7 @@ def tuple_struct_items
| [tuple_struct_item]
def tuple_struct_pattern
- [path_in_expression `( tuple_struct_items `, ? `)]
+ [path_in_expression `( tuple_struct_items `,`? `)]
def tuple_pattern_item
[pattern]
@@ -281,7 +281,7 @@ def tuple_pattern_items
def tuple_pattern
[`( `)]
| [`( tuple_pattern_item `, `)]
-| [`( tuple_pattern_item `, tuple_pattern_items `, ? `)]
+| [`( tuple_pattern_item `, tuple_pattern_items `,`? `)]
def grouped_pattern
[`( pattern `)]
@@ -295,7 +295,7 @@ def pattern_list
# allowing it.
#
def slice_pattern
- [`[ pattern `, pattern_list `, ? `]]
+ [`[ pattern `, pattern_list `,`? `]]
| [`[ pattern `, `]]
| [`[ pattern `]]
| [`[ `]]
@@ -328,11 +328,11 @@ def match_expression
[`match expression `{ match_arms? `}]
def match_arms_last
- [match_arm `=> block_expression `, ?]
-| [match_arm `=> expression `, ?]
+ [match_arm `=> block_expression `,`?]
+| [match_arm `=> expression `,`?]
def match_arms_first_case
- [match_arm `=> block_expression `, ?]
+ [match_arm `=> block_expression `,`?]
| [match_arm `=> expression `,]
def match_arms_first_list
@@ -350,7 +350,7 @@ def match_arms_pattern_tail
| []
def match_arm_patterns
- [`| ? pattern match_arms_pattern_tail]
+ [`|`? pattern match_arms_pattern_tail]
def opt_match_arm_guard
[`if expression]
@@ -391,9 +391,9 @@ def lifetime_list
[lifetime lifetime_tail]
def opt_type_params
- [`< lifetime_list `, ? `>]
-| [`< type_list `, ? `>]
-| [`< lifetime_list `, type_list `, ? `>]
+ [`< lifetime_list `,`? `>]
+| [`< type_list `,`? `>]
+| [`< lifetime_list `, type_list `,`? `>]
| []
@@ -419,7 +419,7 @@ def func_param_tail
| []
def function_parameters
- [function_param func_param_tail `, ?]
+ [function_param func_param_tail `,`?]
def function
[
@@ -432,10 +432,10 @@ def function
#
def self_param
- [`mut ? `self]
-| [`& `mut ? `self]
-| [`& lifetime `mut ? `self]
-| [`mut ? `self `: type]
+ [`mut`? `self]
+| [`& `mut`? `self]
+| [`& lifetime `mut`? `self]
+| [`mut`? `self `: type]
def opt_method_params
[`, function_parameters]
@@ -475,7 +475,7 @@ def opt_arrow_type
| []
def type_path_fn_inputs
- [type_list `, ?]
+ [type_list `,`?]
def type_path_tail
[type_path_tail `:: type_path_segment]
@@ -505,7 +505,7 @@ def raw_pointer_type
def tuple_type
[`( `)]
| [`( type `, `)]
-| [`( type `, type_list `, ? `)]
+| [`( type `, type_list `,`? `)]
def trait_object_type
[`dyn ? type_param_bounds]
@@ -542,7 +542,7 @@ def maybe_named_param_tail
| []
def maybe_named_function_parameters
- [maybe_named_param maybe_named_param_tail `, ?]
+ [maybe_named_param maybe_named_param_tail `,`?]
def maybe_named_param
[id `: type]
@@ -611,7 +611,7 @@ def cons_plus
| [_construct]
def cons_list
- [cons_plus `, ?]
+ [cons_plus `,`?]
| []
@@ -631,13 +631,13 @@ def path_expr_segment
def generic_args
[`< `>]
-| [`< generic_args_lifetimes `, ? `>]
-| [`< generic_args_types `, ? `>]
-| [`< generic_args_bindings `, ? `>]
-| [`< generic_args_types `, generic_args_bindings `, ? `>]
-| [`< generic_args_lifetimes `, generic_args_types `, ? `>]
-| [`< generic_args_lifetimes `, generic_args_bindings `, ? `>]
-| [`< generic_args_lifetimes `, generic_args_types `, generic_args_bindings `, ? `>]
+| [`< generic_args_lifetimes `,`? `>]
+| [`< generic_args_types `,`? `>]
+| [`< generic_args_bindings `,`? `>]
+| [`< generic_args_types `, generic_args_bindings `,`? `>]
+| [`< generic_args_lifetimes `, generic_args_types `,`? `>]
+| [`< generic_args_lifetimes `, generic_args_bindings `,`? `>]
+| [`< generic_args_lifetimes `, generic_args_types `, generic_args_bindings `,`? `>]
def generic_args_lifetimes
[lifetime_list]
@@ -672,10 +672,10 @@ def path_expression
def tuple_expression
[`( expression `, `)]
-| [`( expression `, expr_list `, ? `)]
+| [`( expression `, expr_list `,`? `)]
def array_expression
- [`[ expr_list `, ? `]]
+ [`[ expr_list `,`? `]]
| [`[ expression `; expression `]]
def closure_parameters
@@ -687,7 +687,7 @@ def closure_param
| [pattern `: type]
def closure_expression_param_forms
- [`| closure_parameters `, ? `|]
+ [`| closure_parameters `,`? `|]
| [`||]
def closure_expression
@@ -721,8 +721,8 @@ def paths
def func_index
[func_index `. path_expr_segment]
| [func_index `. number]
-| [func_index `( expr_list `, ? `)]
-| [func_index `[ expr_list `, ? `]]
+| [func_index `( expr_list `,`? `)]
+| [func_index `[ expr_list `,`? `]]
| [func_index `?]
| [paths]
@@ -931,7 +931,7 @@ def tpb_tail
[`+ type_param_bound]
def type_param_bounds
- [type_param_bound tpb_tail* `+ ?]
+ [type_param_bound tpb_tail* `+`?]
#
# Type Params
@@ -974,7 +974,7 @@ def opt_generics
#
def lifetime_params
- [lifetime_param_list? `, ?]
+ [lifetime_param_list? `,`?]
def for_lifetimes
[`for `< lifetime_params `>]
@@ -984,7 +984,7 @@ def lifetime_bounds_list
| [lifetime]
def lifetime_bounds
- [lifetime_bounds_list? `+ ?]
+ [lifetime_bounds_list? `+`?]
def lifetime_where_clause_item
[lifetime `: lifetime_bounds]
@@ -1001,7 +1001,7 @@ def where_clause_item_list
| [where_clause_item]
def opt_where_clause
- [`where where_clause_item_list `, ? ]
+ [`where where_clause_item_list `,`? ]
| []
@@ -1017,7 +1017,7 @@ def tuple_field_list
| [tuple_field]
def tuple_fields
- [tuple_field_list `, ?]
+ [tuple_field_list `,`?]
#
# Structure
@@ -1031,7 +1031,7 @@ def struct_field_list
| [struct_field]
def struct_fields
- [struct_field_list `, ?]
+ [struct_field_list `,`?]
def struct_struct
[`struct id opt_generics opt_where_clause `{ struct_fields? `}]
@@ -1169,7 +1169,7 @@ def extern_crate
[`extern `crate crate_ref as_clause? `;]
def enum
- [`enum id opt_generics opt_where_clause `{ enum_items? `, ? `}]
+ [`enum id opt_generics opt_where_clause `{ enum_items? `,`? `}]
def enum_items
[enum_items `, enum_item]
@@ -1185,20 +1185,20 @@ def enum_item_tuple
[`( tuple_fields? `)]
def enum_item_struct
- [`{ field_list `, ? `}]
+ [`{ field_list `,`? `}]
def enum_item_discriminant
[`= expression]
def static_item
- [`static `mut ? id `: type `= expression `;]
+ [`static `mut`? id `: type `= expression `;]
def abi
[string]
| [raw_string]
def external_static_item
- [`static `mut ? id `: type `;]
+ [`static `mut`? id `: type `;]
def function_return_type
[`-> type]