diff options
| author | aarne <aarne@cs.chalmers.se> | 2007-09-20 21:51:54 +0000 |
|---|---|---|
| committer | aarne <aarne@cs.chalmers.se> | 2007-09-20 21:51:54 +0000 |
| commit | 6e4104ffa98279fcf105dd6386e1f7162f889fc0 (patch) | |
| tree | 4a137525f2ac44994260c5f2520bb6c526c96f14 /src/GF/Infra/CompactPrint.hs | |
| parent | 46013f103cf23d875aa3a2f853080a4fbe23ebd8 (diff) | |
compact printing of gf files
Diffstat (limited to 'src/GF/Infra/CompactPrint.hs')
| -rw-r--r-- | src/GF/Infra/CompactPrint.hs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/GF/Infra/CompactPrint.hs b/src/GF/Infra/CompactPrint.hs new file mode 100644 index 000000000..eb8be2292 --- /dev/null +++ b/src/GF/Infra/CompactPrint.hs @@ -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"] |
