diff options
author | Adrian Thurston <thurston@colm.net> | 2019-10-17 13:15:07 -0300 |
---|---|---|
committer | Adrian Thurston <thurston@colm.net> | 2019-10-17 13:15:07 -0300 |
commit | 8f881602bd88d5cc6cac14d4de583e9625241c24 (patch) | |
tree | f15f0b82d292e217bff2da5d3d4cdf9f9c0f4f87 /grammar | |
parent | d2c114285a7b75c84ce7b198c0805df48cacdd0c (diff) | |
download | colm-8f881602bd88d5cc6cac14d4de583e9625241c24.tar.gz |
rust grammar: expanded use_declarataion to include {} and *
Diffstat (limited to 'grammar')
-rw-r--r-- | grammar/rust.lm | 54 |
1 files changed, 49 insertions, 5 deletions
diff --git a/grammar/rust.lm b/grammar/rust.lm index f7474a2d..fbe7b578 100644 --- a/grammar/rust.lm +++ b/grammar/rust.lm @@ -1,7 +1,7 @@ lex literal `fn `use `let `mut `if `else `struct `for `in literal `true `false - literal `ref `match + literal `ref `match `as `impl literal `; `:: `( `) `{ `} `. `, literal `[ `] `: @@ -37,8 +37,34 @@ end # Use statments # +def sp_tail + [sp_tail `:: id] +| [] + +def simple_path + [id sp_tail] + +def use_list_tail + [use_list_tail `, use_tree] +| [] + +def use_path_opt + [simple_path `::] +| [`::] +| [] + +def use_as_opt + [`as id] +| [`as `_] +| [] + +def use_tree + [use_path_opt `*] +| [use_path_opt `{ use_tree use_list_tail `}] +| [simple_path use_as_opt] + def use_declaration - [`use qual_id `;] + [`use use_tree `;] # # Patterns @@ -468,13 +494,31 @@ def structure | [`struct id opt_generics `( tuple_field_list `) `; ] # +# Implementation +# + +def inherent_impl_item + [function] + +def inherent_impl + [`impl opt_generics type `{ inherent_impl_item* `}] + +def trait_impl + [] + +def implementation + [inherent_impl] +#| [trait_impl] + +# # All Items. # def item - [function] -| [structure] -| [use_declaration] + [function] commit +| [structure] commit +| [implementation] commit +| [use_declaration] commit def program [item*] |