diff options
| author | hallgren <hallgren@chalmers.se> | 2014-01-17 13:58:48 +0000 |
|---|---|---|
| committer | hallgren <hallgren@chalmers.se> | 2014-01-17 13:58:48 +0000 |
| commit | b0a40d82b93999516a004f458080b1bb80ba1e61 (patch) | |
| tree | d5cef76b5792f77f66b4ed2d5308fcd6c8df3b00 /src/runtime | |
| parent | 41e3b28bfa9215bf55caca8bf44b5702f853db3e (diff) | |
haskell-bind: change the type of CRuntimeFFI.getConcr
Change the type of getConcr from
getConcr :: PGF -> Language -> Concr
to
getConcr :: PGF -> Language -> Maybe Concr
This is to prevent programs from crashing later if you try to select a
concrete syntax that is not present in a grammar.
Diffstat (limited to 'src/runtime')
| -rw-r--r-- | src/runtime/haskell-bind/CRuntimeFFI.hsc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/runtime/haskell-bind/CRuntimeFFI.hsc b/src/runtime/haskell-bind/CRuntimeFFI.hsc index f1ee62db5..7554170ed 100644 --- a/src/runtime/haskell-bind/CRuntimeFFI.hsc +++ b/src/runtime/haskell-bind/CRuntimeFFI.hsc @@ -72,11 +72,11 @@ readPGF filepath = return PGF {pgfPool = pool, pgf = pgf} -getConcr :: PGF -> Language -> Concr +getConcr :: PGF -> Language -> Maybe Concr getConcr p (CId lang) = unsafePerformIO $ BS.useAsCString lang $ \lng -> do cnc <- pgf_get_language (pgf p) lng - return (Concr cnc p) + return (if cnc==nullPtr then Nothing else Just (Concr cnc p)) |
