diff options
| author | tslil <tslil@posteo.de> | 2026-05-01 15:23:23 +0100 |
|---|---|---|
| committer | tslil <tslil@posteo.de> | 2026-05-01 20:06:16 +0100 |
| commit | 3ce914fdc62923c92812037297aee64747a9867e (patch) | |
| tree | fd449bf68b70a1dbd6398e47ece93ebe8bd15f4a /src/parser.rs | |
| parent | 0886a16d73145270e953b8c2e0a4452b518ea16e (diff) | |
wip on App again
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() |
