diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2018-06-16 01:58:52 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-06-16 01:58:52 +0200 |
commit | 97398edc05af108968b861ad39d4c7f9d7ba37ad (patch) | |
tree | a6d1704c88e0446d19d0ea010f53797bd0bac78b /compiler/layouter.nim | |
parent | a1bd4a6cbd820cac7b3534e03c27bcd960775e76 (diff) | |
download | Nim-97398edc05af108968b861ad39d4c7f9d7ba37ad.tar.gz |
nimpretty: render and/or/notin/in properly
Diffstat (limited to 'compiler/layouter.nim')
-rw-r--r-- | compiler/layouter.nim | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/compiler/layouter.nim b/compiler/layouter.nim index 8c6237294..90e9d6fd7 100644 --- a/compiler/layouter.nim +++ b/compiler/layouter.nim @@ -9,6 +9,7 @@ ## Layouter for nimpretty. Still primitive but useful. ## TODO +## - Fix 'echo ()' vs 'echo()' difference! ## - Make indentations consistent. ## - Align 'if' and 'case' expressions properly. @@ -132,13 +133,19 @@ proc emitTok*(em: var Emitter; L: TLexer; tok: TToken) = case tok.tokType of tokKeywordLow..tokKeywordHigh: - if endsInAlpha(em): wr(" ") + if endsInAlpha(em): + wr(" ") + elif not em.inquote and not endsInWhite(em): + wr(" ") + wr(TokTypeToStr[tok.tokType]) case tok.tokType of tkAnd: rememberSplit(splitAnd) of tkOr: rememberSplit(splitOr) - of tkIn: rememberSplit(splitIn) + of tkIn, tkNotin: + rememberSplit(splitIn) + wr(" ") else: discard of tkColon: |