Skip to content

Commit

Permalink
[ #366 ] Haskell printer: indentation after '}' was sometimes dropped
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasabel committed May 18, 2021
1 parent 2dbcb9b commit d19c4f4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions source/src/BNFC/Backend/Haskell/CFtoPrinter.hs
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,14 @@ prologue tokenText useGadt name absMod cf = map text $ concat
, " rend i p = \\case"
, " \"[\" :ts -> char '[' . rend i False ts"
, " \"(\" :ts -> char '(' . rend i False ts"
, " \"{\" :ts -> onNewLine i p . showChar '{' . new (i+1) ts"
, " \"{\" :ts -> onNewLine i p . showChar '{' . new (i+1) ts"
, " \"}\" : \";\":ts -> onNewLine (i-1) p . showString \"};\" . new (i-1) ts"
, " \"}\" :ts -> onNewLine (i-1) p . showChar '}' . new (i-1) ts"
, " \"}\" :ts -> onNewLine (i-1) p . showChar '}' . new (i-1) ts"
, " [\";\"] -> char ';'"
, " \";\" :ts -> char ';' . new i ts"
, " t : ts@(s:_) | closingOrPunctuation s -> showString t . rend i False ts"
, " t :ts -> pending . space t . rend i False ts"
, " t : ts@(s:_) | closingOrPunctuation s"
, " -> pending . showString t . rend i False ts"
, " t :ts -> pending . space t . rend i False ts"
, " [] -> id"
, " where"
, " -- Output character after pending indentation."
Expand Down

0 comments on commit d19c4f4

Please sign in to comment.