diff options
| author | kr.angelov <kr.angelov@gmail.com> | 2014-04-04 11:46:40 +0000 |
|---|---|---|
| committer | kr.angelov <kr.angelov@gmail.com> | 2014-04-04 11:46:40 +0000 |
| commit | bd892b8a1dd74b7f1b0fd66f498bc7c9fef1bf78 (patch) | |
| tree | 26e0e5c5458d86866ea67ffca56e3a767f5df5ff /src/runtime/haskell-bind/examples/pgf-shell.hs | |
| parent | dafaef7fec8ac776a56bb269a7c4e6ba1228d923 (diff) | |
fix the haskell binding to handle parse errors
Diffstat (limited to 'src/runtime/haskell-bind/examples/pgf-shell.hs')
| -rw-r--r-- | src/runtime/haskell-bind/examples/pgf-shell.hs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/runtime/haskell-bind/examples/pgf-shell.hs b/src/runtime/haskell-bind/examples/pgf-shell.hs index e111076d4..bb15508c7 100644 --- a/src/runtime/haskell-bind/examples/pgf-shell.hs +++ b/src/runtime/haskell-bind/examples/pgf-shell.hs @@ -34,10 +34,14 @@ execute pgf cmd = L lang tree -> do c <- getConcr' pgf lang putStrLn $ linearize c tree P lang s -> do c <- getConcr' pgf lang - printl $ parse c (startCat pgf) s + case parse c (startCat pgf) s of + Left tok -> putStrLn ("parse error: "++tok) + Right ts -> printl ts T from to s -> do cfrom <- getConcr' pgf from cto <- getConcr' pgf to - putl [linearize cto t|(t,_)<-parse cfrom (startCat pgf) s] + putl [linearize cto t|(t,_)<-case parse cfrom (startCat pgf) s of + Left _ -> [] + Right ts -> ts] _ -> putStrLn "Huh?" `catch` print |
