diff options
| author | krasimir <krasimir@chalmers.se> | 2008-10-28 13:57:10 +0000 |
|---|---|---|
| committer | krasimir <krasimir@chalmers.se> | 2008-10-28 13:57:10 +0000 |
| commit | ebd98056ce9d478f0aca68d752a49d87f7431ec9 (patch) | |
| tree | 8174b823fe84309b81f6b1b04c3353a44cfa357c /src/PGF/Raw/Print.hs | |
| parent | 8e43cfb8a8ce4a6c4c608678633c0c5ec67adfff (diff) | |
binary serialization for PGF
Diffstat (limited to 'src/PGF/Raw/Print.hs')
| -rw-r--r-- | src/PGF/Raw/Print.hs | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/src/PGF/Raw/Print.hs b/src/PGF/Raw/Print.hs deleted file mode 100644 index d34adbc2b..000000000 --- a/src/PGF/Raw/Print.hs +++ /dev/null @@ -1,35 +0,0 @@ -module PGF.Raw.Print (printTree) where - -import PGF.CId -import PGF.Raw.Abstract - -import Data.List (intersperse) -import Numeric (showFFloat) -import qualified Data.ByteString.Char8 as BS - -printTree :: Grammar -> String -printTree g = prGrammar g "" - -prGrammar :: Grammar -> ShowS -prGrammar (Grm xs) = prRExpList xs - -prRExp :: Int -> RExp -> ShowS -prRExp _ (App x []) = showString x -prRExp n (App x xs) = p (showString x . showChar ' ' . prRExpList xs) - where p s = if n == 0 then s else showChar '(' . s . showChar ')' -prRExp _ (AInt x) = shows x -prRExp _ (AStr x) = showChar '"' . concatS (map mkEsc x) . showChar '"' -prRExp _ (AFlt x) = showFFloat Nothing x -prRExp _ AMet = showChar '?' - -mkEsc :: Char -> ShowS -mkEsc s = case s of - '"' -> showString "\\\"" - '\\' -> showString "\\\\" - _ -> showChar s - -prRExpList :: [RExp] -> ShowS -prRExpList = concatS . intersperse (showChar ' ') . map (prRExp 1) - -concatS :: [ShowS] -> ShowS -concatS = foldr (.) id |
