mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-22 11:19:32 -06:00
compact printing of gf files
This commit is contained in:
11
src/GF/Infra/CompactPrint.hs
Normal file
11
src/GF/Infra/CompactPrint.hs
Normal 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"]
|
||||
Reference in New Issue
Block a user