summaryrefslogtreecommitdiff
path: root/src/GF/Infra/CompactPrint.hs
blob: 56aaf4d64473f881cbf60104191c00c4bdebe5be (plain)
1
2
3
4
5
6
7
8
9
10
11
module GF.Infra.CompactPrint where
import Data.Char

compactPrint = tail . concat . map spaceIf . words 

spaceIf w = case w of
  _ | keyword w -> "\n" ++ w
  c:cs | isAlpha c || isDigit c -> " " ++ w
  _ -> w

keyword w = elem w ["cat","fun","lin","lincat","lindef","oper","param"]