1
0
forked from GitHub/gf-core

GF/src is now for 2.9, and the new sources are in src-3.0 - keep it this way until the release of GF 3

This commit is contained in:
aarne
2008-05-21 09:26:44 +00:00
parent b24ca795ca
commit 2bab9286f1
536 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
module Main where
import System.Environment (getArgs)
import Transfer.Syntax.Lex
import Transfer.Syntax.Layout
prTokens :: [Token] -> String
prTokens = prTokens_ 1 1
where
prTokens_ _ _ [] = ""
prTokens_ l c (t@(PT (Pn _ l' c') _):ts) =
replicate (l'-l) '\n'
++ replicate (if l' == l then c'-c else c'-1) ' '
++ s ++ prTokens_ l' (c'+length s) ts
where s = prToken t
-- prTokens_ l c (Err p:ts) =
layout :: String -> String
layout s = prTokens ts'
-- ++ "\n" ++ show ts'
where ts = tokens s
ts' = resolveLayout True ts
main :: IO ()
main = do args <- getArgs
case args of
[] -> getContents >>= putStrLn . layout
fs -> mapM_ (\f -> readFile f >>= putStrLn . layout) fs