forked from GitHub/gf-core
added showPGF in the Haskell API
This commit is contained in:
@@ -19,7 +19,7 @@
|
|||||||
#include <gu/exn.h>
|
#include <gu/exn.h>
|
||||||
|
|
||||||
module PGF2 (-- * PGF
|
module PGF2 (-- * PGF
|
||||||
PGF,readPGF,
|
PGF,readPGF,showPGF,
|
||||||
|
|
||||||
-- * Identifiers
|
-- * Identifiers
|
||||||
CId,
|
CId,
|
||||||
@@ -137,6 +137,17 @@ readPGF fpath =
|
|||||||
pgfFPtr <- newForeignPtr gu_pool_finalizer pool
|
pgfFPtr <- newForeignPtr gu_pool_finalizer pool
|
||||||
return (PGF pgf (touchForeignPtr pgfFPtr))
|
return (PGF pgf (touchForeignPtr pgfFPtr))
|
||||||
|
|
||||||
|
showPGF :: PGF -> String
|
||||||
|
showPGF p =
|
||||||
|
unsafePerformIO $
|
||||||
|
withGuPool $ \tmpPl ->
|
||||||
|
do (sb,out) <- newOut tmpPl
|
||||||
|
exn <- gu_new_exn tmpPl
|
||||||
|
pgf_print (pgf p) out exn
|
||||||
|
touchPGF p
|
||||||
|
s <- gu_string_buf_freeze sb tmpPl
|
||||||
|
peekUtf8CString s
|
||||||
|
|
||||||
-- | List of all languages available in the grammar.
|
-- | List of all languages available in the grammar.
|
||||||
languages :: PGF -> Map.Map ConcName Concr
|
languages :: PGF -> Map.Map ConcName Concr
|
||||||
languages p =
|
languages p =
|
||||||
|
|||||||
Reference in New Issue
Block a user