diff options
Diffstat (limited to 'src/parser.rs')
| -rw-r--r-- | src/parser.rs | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/parser.rs b/src/parser.rs index ecf6ab3..285bb84 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -227,9 +227,21 @@ parser! { } rule app_inst() -> Instance - = head:dot_inst() args:(__ a:dot_elem() { a })* - { if args.is_empty() { head } else { Instance::App{instance: Box::new(head), args } }} - + = subject:dot_inst() args:(__ a:dot_elem() { a })* + { + if args.is_empty() { + subject + } else { + match subject { + Instance::App { instance: inner_head, args: inner_args } => { + let mut all_args = inner_args; + all_args.extend(args); + Instance::App { instance: inner_head, args: all_args } + } + other => Instance::App { instance: Box::new(other), args }, + } + } + } rule instance() -> Instance = kw_for() _ ps:param_list() _ "," _ body:instance() |
