summaryrefslogtreecommitdiff
path: root/src/GF/UseGrammar
diff options
context:
space:
mode:
authoraarne <unknown>2004-08-13 13:21:46 +0000
committeraarne <unknown>2004-08-13 13:21:46 +0000
commit69aa3248d2ea878ef45e9e8c177381730d949c32 (patch)
treeb412e7238c9690fab1867159b5c6a1e4336fb59a /src/GF/UseGrammar
parenta7605447420a6acdde087a6bd7be6ef2d0dd12cd (diff)
unique ref
Diffstat (limited to 'src/GF/UseGrammar')
-rw-r--r--src/GF/UseGrammar/Editing.hs3
-rw-r--r--src/GF/UseGrammar/Randomized.hs5
2 files changed, 5 insertions, 3 deletions
diff --git a/src/GF/UseGrammar/Editing.hs b/src/GF/UseGrammar/Editing.hs
index b740d6d08..45e180b0d 100644
--- a/src/GF/UseGrammar/Editing.hs
+++ b/src/GF/UseGrammar/Editing.hs
@@ -232,6 +232,7 @@ contextRefinements gr = refineAllNodes contextRefine where
uniqueRefine :: CGrammar -> Action
uniqueRefine gr state = case refinementsState gr state of
+ [(e,(_,True))] -> Bad "only circular refinement"
[(e,_)] -> refineWithAtom False gr e state
_ -> Bad "no unique refinement"
@@ -347,7 +348,7 @@ solveAll gr st0 = do
-- active refinements
-refinementsState :: CGrammar -> State -> [(Term,Val)]
+refinementsState :: CGrammar -> State -> [(Term,(Val,Bool))]
refinementsState gr state =
let filt = possibleRefVal gr state in
if actIsMeta state
diff --git a/src/GF/UseGrammar/Randomized.hs b/src/GF/UseGrammar/Randomized.hs
index a347560a0..e1999ee55 100644
--- a/src/GF/UseGrammar/Randomized.hs
+++ b/src/GF/UseGrammar/Randomized.hs
@@ -36,8 +36,9 @@ mkStateFromInts ints gr = mkRandomState ints where
testErr (isCompleteState state) "not completed"
return state
mkRandomState (n:ns) state = do
- let refs = refinementsState gr state
- testErr (not (null refs)) $ "no refinements available for" +++
+ let refs = refinementsState gr state
+ refs0 = map (not . snd . snd) refs
+ testErr (not (null refs0)) $ "no nonrecursive refinements available for" +++
prt (actVal state)
(ref,_) <- (refs !? (n `mod` (length refs)))
state1 <- refineWithAtom False gr ref state