compact printing of gf files

This commit is contained in:
aarne
2007-09-20 21:51:54 +00:00
parent 46013f103c
commit 6e4104ffa9
5 changed files with 34 additions and 2 deletions

View File

@@ -0,0 +1,11 @@
module GF.Infra.CompactPrint where
import Data.Char
compactPrint = 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","oper","param"]