diff options
| author | bringert <unknown> | 2005-06-17 13:15:16 +0000 |
|---|---|---|
| committer | bringert <unknown> | 2005-06-17 13:15:16 +0000 |
| commit | 2c48a10236bb19d8b04382cb1e957ce18b9d29fd (patch) | |
| tree | 1194fc1981b5cd2a144b72f4fff261edfeb1af2e /src/GF/Canon/TestGFC.hs | |
| parent | 05b5ffe5bf03a870f6fe0728ace6c0d8de69b89e (diff) | |
Changed name of Con constructor in GFC.cf to avoid errors on Windows when generating Java code with BNFC for the GFC grammar. CON is a reserved filename on Windows. Con was changed to Par, and all the code using was changed too.
Diffstat (limited to 'src/GF/Canon/TestGFC.hs')
| -rw-r--r-- | src/GF/Canon/TestGFC.hs | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/src/GF/Canon/TestGFC.hs b/src/GF/Canon/TestGFC.hs index 7af035f69..7c89d64e8 100644 --- a/src/GF/Canon/TestGFC.hs +++ b/src/GF/Canon/TestGFC.hs @@ -1,9 +1,8 @@ - -- automatically generated by BNF Converter -module GF.Canon.TestGFC where +module Main where -import System.IO ( stdin, hGetContents ) +import IO ( stdin, hGetContents ) import System ( getArgs, getProgName ) import GF.Canon.LexGFC @@ -11,6 +10,8 @@ import GF.Canon.ParGFC import GF.Canon.SkelGFC import GF.Canon.PrintGFC import GF.Canon.AbsGFC +import GF.Infra.Ident + import GF.Data.ErrM @@ -29,18 +30,29 @@ runFile v p f = putStrLn f >> readFile f >>= run v p run :: (Print a, Show a) => Verbosity -> ParseFun a -> String -> IO () run v p s = let ts = myLLexer s in case p ts of - Bad s -> do putStrLn "\nParse Failed...\n" - putStrV v "Tokens:" - putStrV v $ show ts - putStrLn s + Bad s -> do putStrLn "\nParse Failed...\n" + putStrV v "Tokens:" + putStrV v $ show ts + putStrLn s Ok tree -> do putStrLn "\nParse Successful!" - putStrV v $ "\n[Abstract Syntax]\n\n" ++ show tree - putStrV v $ "\n[Linearized tree]\n\n" ++ printTree tree + showTree v tree + +showTree :: (Show a, Print a) => Int -> a -> IO () +showTree v tree + = do + putStrV v $ "\n[Abstract Syntax]\n\n" ++ show tree + putStrV v $ "\n[Linearized tree]\n\n" ++ printTree tree + main :: IO () main = do args <- getArgs case args of [] -> hGetContents stdin >>= run 2 pCanon "-s":fs -> mapM_ (runFile 0 pCanon) fs fs -> mapM_ (runFile 2 pCanon) fs + + + + + |
