summaryrefslogtreecommitdiff
path: root/src/GF/UseGrammar
diff options
context:
space:
mode:
authoraarne <unknown>2003-10-08 10:09:58 +0000
committeraarne <unknown>2003-10-08 10:09:58 +0000
commita979508aa75a3f2b93072d214ca9c75ed874a39c (patch)
tree74add47e62a9b5fdb1720a365754f738c3de4b93 /src/GF/UseGrammar
parent889e5a92e4e0c40ab249f9f86d0fa2647132d87a (diff)
Restored printnames.
Diffstat (limited to 'src/GF/UseGrammar')
-rw-r--r--src/GF/UseGrammar/Editing.hs14
-rw-r--r--src/GF/UseGrammar/Session.hs2
2 files changed, 14 insertions, 2 deletions
diff --git a/src/GF/UseGrammar/Editing.hs b/src/GF/UseGrammar/Editing.hs
index 93038e9a0..cd9fec9a4 100644
--- a/src/GF/UseGrammar/Editing.hs
+++ b/src/GF/UseGrammar/Editing.hs
@@ -164,9 +164,21 @@ noMoreMetas = err (const True) (const False) . goNextMeta
replaceSubTree :: Tree -> Action
replaceSubTree tree state = changeLoc state tree
+refineOrReplaceWithTree :: Bool -> CGrammar -> Tree -> Action
+refineOrReplaceWithTree der gr tree state = case actMeta state of
+ Ok m -> refineWithTreeReal der gr tree m state
+ _ -> do
+ let tree1 = addBinds (actBinds state) $ tree
+ state' <- replaceSubTree tree1 state
+ reCheckState gr state'
+
refineWithTree :: Bool -> CGrammar -> Tree -> Action
refineWithTree der gr tree state = do
- m <- errIn "move pointer to meta" $ actMeta state
+ m <- errIn "move pointer to meta" $ actMeta state
+ refineWithTreeReal der gr tree m state
+
+refineWithTreeReal :: Bool -> CGrammar -> Tree -> Meta -> Action
+refineWithTreeReal der gr tree m state = do
state' <- replaceSubTree tree state
let cs0 = allConstrs state'
(cs,ms) = splitConstraints cs0
diff --git a/src/GF/UseGrammar/Session.hs b/src/GF/UseGrammar/Session.hs
index 051630149..81158a515 100644
--- a/src/GF/UseGrammar/Session.hs
+++ b/src/GF/UseGrammar/Session.hs
@@ -96,7 +96,7 @@ refineByExps der gr trees = case trees of
refineByTrees :: Bool -> CGrammar -> [Tree] -> ECommand
refineByTrees der gr trees = case trees of
- [t] -> action2commandNext (refineWithTree der gr t)
+ [t] -> action2commandNext (refineOrReplaceWithTree der gr t)
_ -> changeCands $ map tree2exp trees
replaceByTrees :: CGrammar -> [Exp] -> ECommand