diff --git a/topiary-cli/tests/samples/expected/nickel.ncl b/topiary-cli/tests/samples/expected/nickel.ncl index 892c1a78..2ecddef0 100644 --- a/topiary-cli/tests/samples/expected/nickel.ncl +++ b/topiary-cli/tests/samples/expected/nickel.ncl @@ -139,7 +139,17 @@ 1 else 3 - ) + ), + let x = 1, y = 2 in x + y, + let + x = 1, + y = 2, + in x + y, + let rec + x = 1, + y = 2, + in + x + y, ], # Nickel standard library as of 44aef1672a09a76a71946fbf822713747ab7b9df diff --git a/topiary-cli/tests/samples/input/nickel.ncl b/topiary-cli/tests/samples/input/nickel.ncl index 14acfe0f..cb458972 100644 --- a/topiary-cli/tests/samples/input/nickel.ncl +++ b/topiary-cli/tests/samples/input/nickel.ncl @@ -127,7 +127,19 @@ bar == 'Goodbye if x == 1 then 1 else - 3) + 3), + + let x = 1, y = 2 in x + y, + + let x = 1, + y = 2, + in x + y, + + let + rec x = 1, + y = 2, + in + x + y, ], # Nickel standard library as of 44aef1672a09a76a71946fbf822713747ab7b9df diff --git a/topiary-queries/queries/nickel.scm b/topiary-queries/queries/nickel.scm index 43faa6d9..9d828029 100644 --- a/topiary-queries/queries/nickel.scm +++ b/topiary-queries/queries/nickel.scm @@ -589,12 +589,33 @@ . ) +; Allow newlines after the comma (or semicolon) following a container +; element. ( (#scope_id! "container") [ - "," - ";" - ] @append_spaced_scoped_softline + (record_field) + (record_last_field) + (field_pattern) + (last_field_pat) + (match_branch) + (term) + (pattern) + (last_elem_pat) + (enum) + ] + . + ["," ";"] @append_spaced_scoped_softline + . + (comment)? @do_nothing +) + +; Enums and records can have a `;` at the very beginning; allow spaces after +; these ones also. +(_ + (#scope_id! "container") + . + ";" @append_spaced_scoped_softline . (comment)? @do_nothing )