summaryrefslogtreecommitdiff
path: root/src/GF/Grammar/PrGrammar.hs
diff options
context:
space:
mode:
authoraarne <unknown>2005-04-28 15:42:47 +0000
committeraarne <unknown>2005-04-28 15:42:47 +0000
commit830f7c14bc0a7c9a22ec73759e315087a658f8ee (patch)
tree9ebbbc2fe852c4a93dcf3b93e0ef5486a64b38e3 /src/GF/Grammar/PrGrammar.hs
parent8b7e450f1cf8d88909b8ce78218c44b9b102e928 (diff)
library adjustments, error message clean-up
Diffstat (limited to 'src/GF/Grammar/PrGrammar.hs')
-rw-r--r--src/GF/Grammar/PrGrammar.hs19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/GF/Grammar/PrGrammar.hs b/src/GF/Grammar/PrGrammar.hs
index 297790a76..3d1404660 100644
--- a/src/GF/Grammar/PrGrammar.hs
+++ b/src/GF/Grammar/PrGrammar.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date: 2005/04/21 16:22:27 $
--- > CVS $Author: bringert $
--- > CVS $Revision: 1.13 $
+-- > CVS $Date: 2005/04/28 16:42:49 $
+-- > CVS $Author: aarne $
+-- > CVS $Revision: 1.14 $
--
-- AR 7\/12\/1999 - 1\/4\/2000 - 10\/5\/2003
--
@@ -29,7 +29,8 @@ module GF.Grammar.PrGrammar (Print(..),
tree2string, prprTree,
prConstrs, prConstraints,
prMetaSubst, prEnv, prMSubst,
- prExp, prPatt, prOperSignature
+ prExp, prPatt, prOperSignature,
+ lookupIdent, lookupIdentInfo
) where
import GF.Data.Operations
@@ -266,3 +267,13 @@ prRefinement t = case t of
prOperSignature :: (QIdent,Type) -> String
prOperSignature (f, t) = prQIdent f +++ ":" +++ prt t
+
+-- to look up a constant etc in a search tree
+
+lookupIdent :: Ident -> BinTree (Ident,b) -> Err b
+lookupIdent c t = case lookupTree prt c t of
+ Ok v -> return v
+ _ -> prtBad "unknown identifier" c
+
+lookupIdentInfo :: Module Ident f a -> Ident -> Err a
+lookupIdentInfo mo i = lookupIdent i (jments mo)