diff options
| author | aarne <unknown> | 2003-11-07 14:54:44 +0000 |
|---|---|---|
| committer | aarne <unknown> | 2003-11-07 14:54:44 +0000 |
| commit | 4c99687f217ce258f821d55e68f5403233f6dea7 (patch) | |
| tree | 04e2d94654dd4ceb4c5e988f18f979594876c730 /src/GF/Grammar/LookAbs.hs | |
| parent | 6ae3322b373c52e59fb34360345d1c1e35049c5f (diff) | |
Fixed treatment of predefined types (Int, String).
Fixed treatment of predefined types (Int, String).
Added treatment of new reserved words to reading old grammars.
Diffstat (limited to 'src/GF/Grammar/LookAbs.hs')
| -rw-r--r-- | src/GF/Grammar/LookAbs.hs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/GF/Grammar/LookAbs.hs b/src/GF/Grammar/LookAbs.hs index 43a8c580a..3cd8999ce 100644 --- a/src/GF/Grammar/LookAbs.hs +++ b/src/GF/Grammar/LookAbs.hs @@ -75,13 +75,20 @@ isPrimitiveFun gr (m,c) = case lookupAbsDef gr m c of lookupRef :: GFCGrammar -> Binds -> Term -> Err Val lookupRef gr binds at = case at of - Q m f -> lookupFunType gr m f >>= return . vClos - Vr i -> maybeErr ("unknown variable" +++ prt at) $ lookup i binds - _ -> prtBad "cannot refine with complex term" at --- + Q m f -> lookupFunType gr m f >>= return . vClos + Vr i -> maybeErr ("unknown variable" +++ prt at) $ lookup i binds + EInt _ -> return valAbsInt + K _ -> return valAbsString + _ -> prtBad "cannot refine with complex term" at --- refsForType :: (Val -> Type -> Bool) -> GFCGrammar -> Binds -> Val -> [(Term,Val)] refsForType compat gr binds val = + -- bound variables [(vr i, t) | (i,t) <- binds, Ok ty <- [val2exp t], compat val ty] ++ + -- integer and string literals + [(EInt i, val) | val == valAbsInt, i <- [0,1,2,5,11,1978]] ++ + [(K s, val) | val == valAbsString, s <- ["foo", "NN", "x"]] ++ + -- functions defined in the current abstract syntax [(qq f, vClos t) | (f,t) <- funsForType compat gr val] |
