From 3ce914fdc62923c92812037297aee64747a9867e Mon Sep 17 00:00:00 2001 From: tslil Date: Fri, 1 May 2026 15:23:23 +0100 Subject: wip on App again --- src/parser.rs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/parser.rs') 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() -- cgit v1.3.1