pgf-shell: show the names of the concrete syntaxes after loading the grammar

This commit is contained in:
hallgren
2014-02-07 16:40:13 +00:00
parent 8de56530e0
commit 680bf64454
2 changed files with 8 additions and 5 deletions

View File

@@ -9,6 +9,7 @@
import Control.Monad(forever)
import Data.Char(isSpace)
import qualified Data.Map as M
import System.IO(hFlush,stdout)
import System.IO.Error(catchIOError)
import System.Environment
@@ -22,9 +23,10 @@ getPGF [path] = pgfShell =<< readPGF path
getPGF _ = putStrLn "Usage: pgf-shell <path to pgf>"
pgfShell pgf =
forever $ do performGC
putStr "> "; hFlush stdout
execute pgf =<< readLn
do putStrLn . unwords . map (show.fst) . M.toList $ languages pgf
forever $ do performGC
putStr "> "; hFlush stdout
execute pgf =<< readLn
execute pgf cmd =
case cmd of