the parser in the C runtime can now detect incomplete sentences just like the parser in the Haskell runtime. This is also reflected in all bindings.

This commit is contained in:
Krasimir Angelov
2017-09-06 12:38:42 +02:00
parent 18f2135785
commit 15d014abb8
13 changed files with 184 additions and 71 deletions

View File

@@ -37,18 +37,18 @@ execute cmd =
P lang s -> do pgf <- gets fst
c <- getConcr' pgf lang
case parse c (startCat pgf) s of
Left tok -> do put (pgf,[])
putln ("Parse error: "++tok)
Right ts -> do put (pgf,map show ts)
pop
ParseFailed _ tok -> do put (pgf,[])
putln ("Parse error: "++tok)
ParseOk ts -> do put (pgf,map show ts)
pop
T from to s -> do pgf <- gets fst
cfrom <- getConcr' pgf from
cto <- getConcr' pgf to
case parse cfrom (startCat pgf) s of
Left tok -> do put (pgf,[])
putln ("Parse error: "++tok)
Right ts -> do put (pgf,map (linearize cto.fst) ts)
pop
ParseFailed _ tok -> do put (pgf,[])
putln ("Parse error: "++tok)
ParseOk ts -> do put (pgf,map (linearize cto.fst) ts)
pop
I path -> do pgf <- liftIO (readPGF path)
putln . unwords . M.keys $ languages pgf
put (pgf,[])