forked from GitHub/gf-core
pgf-shell: show the names of the concrete syntaxes after loading the grammar
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
import Control.Monad(forever)
|
import Control.Monad(forever)
|
||||||
import Data.Char(isSpace)
|
import Data.Char(isSpace)
|
||||||
|
import qualified Data.Map as M
|
||||||
import System.IO(hFlush,stdout)
|
import System.IO(hFlush,stdout)
|
||||||
import System.IO.Error(catchIOError)
|
import System.IO.Error(catchIOError)
|
||||||
import System.Environment
|
import System.Environment
|
||||||
@@ -22,9 +23,10 @@ getPGF [path] = pgfShell =<< readPGF path
|
|||||||
getPGF _ = putStrLn "Usage: pgf-shell <path to pgf>"
|
getPGF _ = putStrLn "Usage: pgf-shell <path to pgf>"
|
||||||
|
|
||||||
pgfShell pgf =
|
pgfShell pgf =
|
||||||
forever $ do performGC
|
do putStrLn . unwords . map (show.fst) . M.toList $ languages pgf
|
||||||
putStr "> "; hFlush stdout
|
forever $ do performGC
|
||||||
execute pgf =<< readLn
|
putStr "> "; hFlush stdout
|
||||||
|
execute pgf =<< readLn
|
||||||
|
|
||||||
execute pgf cmd =
|
execute pgf cmd =
|
||||||
case cmd of
|
case cmd of
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ cabal-version: >=1.10
|
|||||||
library
|
library
|
||||||
exposed-modules: CId, CRuntimeFFI
|
exposed-modules: CId, CRuntimeFFI
|
||||||
other-modules: Gu, PgfLow
|
other-modules: Gu, PgfLow
|
||||||
build-depends: base >=4.5 && <4.7, bytestring >=0.9 && <0.11, pretty >=1.1 && <1.2
|
build-depends: base >=4.5 && <4.7, bytestring >=0.9 && <0.11,
|
||||||
|
pretty >=1.1 && <1.2, containers
|
||||||
-- hs-source-dirs:
|
-- hs-source-dirs:
|
||||||
build-tools: hsc2hs
|
build-tools: hsc2hs
|
||||||
extra-libraries: gu pgf
|
extra-libraries: gu pgf
|
||||||
@@ -29,7 +30,7 @@ library
|
|||||||
executable pgf-shell
|
executable pgf-shell
|
||||||
main-is: pgf-shell.hs
|
main-is: pgf-shell.hs
|
||||||
hs-source-dirs: examples
|
hs-source-dirs: examples
|
||||||
build-depends: base, haskell-bind
|
build-depends: base, haskell-bind, containers
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
if impl(ghc>=7.0)
|
if impl(ghc>=7.0)
|
||||||
ghc-options: -rtsopts
|
ghc-options: -rtsopts
|
||||||
|
|||||||
Reference in New Issue
Block a user