Files
gf-core/src/GF/Infra/CompactPrint.hs
2007-09-21 12:00:31 +00:00

12 lines
283 B
Haskell

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"]