summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Command/Commands2.hs
diff options
context:
space:
mode:
authorKrasimir Angelov <kr.angelov@gmail.com>2017-09-06 12:38:42 +0200
committerKrasimir Angelov <kr.angelov@gmail.com>2017-09-06 12:38:42 +0200
commit15d014abb825837f0fd7c9e17d5907001135faaf (patch)
treebc569f465432042702dfaa240746b8c6db609588 /src/compiler/GF/Command/Commands2.hs
parent18f2135785a71a1e93519a060d40b7ba523cf03b (diff)
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.
Diffstat (limited to 'src/compiler/GF/Command/Commands2.hs')
-rw-r--r--src/compiler/GF/Command/Commands2.hs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/compiler/GF/Command/Commands2.hs b/src/compiler/GF/Command/Commands2.hs
index c8e6fbff3..995d2d560 100644
--- a/src/compiler/GF/Command/Commands2.hs
+++ b/src/compiler/GF/Command/Commands2.hs
@@ -636,10 +636,12 @@ pgfCommands = Map.fromList [
cncs = optConcs env opts
parsed rs = Piped (Exprs ts,unlines msgs)
where
- ts = [hsExpr t|Right ts<-rs,(t,p)<-takeOptNum opts ts]
- msgs = concatMap (either err ok) rs
- err msg = ["Parse failed: "++msg]
- ok = map (PGF2.showExpr [] . fst).takeOptNum opts
+ ts = [hsExpr t|ParseOk ts<-rs,(t,p)<-takeOptNum opts ts]
+ msgs = concatMap mkMsg rs
+
+ mkMsg (ParseOk ts) = (map (PGF2.showExpr [] . fst).takeOptNum opts) ts
+ mkMsg (ParseFailed _ tok) = ["Parse failed: "++tok]
+ mkMsg (ParseIncomplete) = ["The sentence is incomplete"]
optLins env opts ts = case opts of
_ | isOpt "groups" opts ->