fix formatting of auto-gensym in Clojure/Fennel
commit29ae29cb36c3d7bf5ce790f05fe73d813b029493
authorGeorgi Kirilov <>
Mon, 2 Aug 2021 20:17:20 +0000 (2 23:17 +0300)
committerGeorgi Kirilov <>
Fri, 19 May 2023 15:26:42 +0000 (19 18:26 +0300)
tree884ccb1b82c9f5575a86cba73e2b03498fee6ec5
parent16517208e26d6028b93128db6214b55948516686
fix formatting of auto-gensym in Clojure/Fennel

In Clojure/Fennel syntax, # has double use:
 - prefix for sets/hashfn, respectively
 - suffix for auto-gensym

Prefixes are special to Parkour; upon encountering one, the parser knows
that a new sexp starts, even if there was no whitespace before it -
asdf,qwer are two sexps ("asdf" and ",qwer").
This is similar to how parens are enough to tell a list from the sexps
surrounding it - a(b c)d are atom, list, atom.
The feature here is that the autoformatter could get all the whitespace
right for you, while you are typing, or keep you from worsening it.

Unfortunately, my assumptions about prefixes were wrong; in some dialects
you are allowed to have prefix chars as part of an identifier, and in
others (Clojure/Fennel) - it is even official syntax (for auto-gensym).

Introducing "weak prefixes" makes it possible to selectively disable the
whitespace autocorrect around some of the prefixes.

Note that weak_prefix should be a subset of macro_prefix.
parser/clojure/init.lua
parser/fennel/init.lua
parser/init.lua
parser/scheme/init.lua