summaryrefslogtreecommitdiff
path: root/src/GF/Grammar
diff options
context:
space:
mode:
authorkrasimir <krasimir@chalmers.se>2009-09-14 12:16:02 +0000
committerkrasimir <krasimir@chalmers.se>2009-09-14 12:16:02 +0000
commit62ef772a2c996f2d7d17529eeee845be90586a78 (patch)
tree3d415cb7c1a10a98172fa2c1192b9ac353f5935e /src/GF/Grammar
parentcc151c42790e02d60d6a0ab18c9c56da76f0ea51 (diff)
CheckGrammar is now using the printer in GF.Grammar.Printer. Fixed bug that was hiding the warnings
Diffstat (limited to 'src/GF/Grammar')
-rw-r--r--src/GF/Grammar/Lookup.hs6
-rw-r--r--src/GF/Grammar/MMacros.hs2
-rw-r--r--src/GF/Grammar/Macros.hs4
-rw-r--r--src/GF/Grammar/Parser.hs2
-rw-r--r--src/GF/Grammar/Parser.y14
-rw-r--r--src/GF/Grammar/Printer.hs2
6 files changed, 15 insertions, 15 deletions
diff --git a/src/GF/Grammar/Lookup.hs b/src/GF/Grammar/Lookup.hs
index b136eee83..f6cf60873 100644
--- a/src/GF/Grammar/Lookup.hs
+++ b/src/GF/Grammar/Lookup.hs
@@ -54,16 +54,16 @@ unlock c = unlockRecord c -- return
-- to look up a constant etc in a search tree --- why here? AR 29/5/2008
lookupIdent :: Ident -> BinTree Ident b -> Err b
lookupIdent c t =
- case lookupTree prIdent c t of
+ case lookupTree showIdent c t of
Ok v -> return v
- Bad _ -> Bad ("unknown identifier" +++ prIdent c)
+ Bad _ -> Bad ("unknown identifier" +++ showIdent c)
lookupIdentInfo :: ModInfo Ident a -> Ident -> Err a
lookupIdentInfo mo i = lookupIdent i (jments mo)
lookupIdentInfoIn :: ModInfo Ident a -> Ident -> Ident -> Err a
lookupIdentInfoIn mo m i =
- err (\s -> Bad (s +++ "in module" +++ prIdent m)) return $ lookupIdentInfo mo i
+ err (\s -> Bad (s +++ "in module" +++ showIdent m)) return $ lookupIdentInfo mo i
lookupResDef :: SourceGrammar -> Ident -> Ident -> Err Term
lookupResDef gr m c = liftM fst $ lookupResDefKind gr m c
diff --git a/src/GF/Grammar/MMacros.hs b/src/GF/Grammar/MMacros.hs
index f00859ffd..84b365225 100644
--- a/src/GF/Grammar/MMacros.hs
+++ b/src/GF/Grammar/MMacros.hs
@@ -214,7 +214,7 @@ freeVarsExp e = case e of
_ -> [] --- thus applies to abstract syntax only
ident2string :: Ident -> String
-ident2string = prIdent
+ident2string = showIdent
{-
tree :: (TrNode,[Tree]) -> Tree
tree = Tr
diff --git a/src/GF/Grammar/Macros.hs b/src/GF/Grammar/Macros.hs
index c7a9cfa73..b195292eb 100644
--- a/src/GF/Grammar/Macros.hs
+++ b/src/GF/Grammar/Macros.hs
@@ -350,10 +350,10 @@ float2term = EFloat
-- | create a terminal from identifier
ident2terminal :: Ident -> Term
-ident2terminal = K . prIdent
+ident2terminal = K . showIdent
symbolOfIdent :: Ident -> String
-symbolOfIdent = prIdent
+symbolOfIdent = showIdent
symid :: Ident -> String
symid = symbolOfIdent
diff --git a/src/GF/Grammar/Parser.hs b/src/GF/Grammar/Parser.hs
index 699870f18..e9d0d7c3a 100644
--- a/src/GF/Grammar/Parser.hs
+++ b/src/GF/Grammar/Parser.hs
@@ -753,7 +753,7 @@ happyReduction_3 (happy_x_4 `HappyStk`
Ok x -> return x
Bad msg -> fail msg
let poss = buildTree [(i,(fname,mkSrcSpan p)) | (i,p,_) <- jments]
- fname = prIdent id ++ ".gf"
+ fname = showIdent id ++ ".gf"
mkSrcSpan :: (Posn, Posn) -> (Int,Int)
mkSrcSpan (Pn l1 _, Pn l2 _) = (l1,l2)
diff --git a/src/GF/Grammar/Parser.y b/src/GF/Grammar/Parser.y
index c25693652..e08169a17 100644
--- a/src/GF/Grammar/Parser.y
+++ b/src/GF/Grammar/Parser.y
@@ -117,7 +117,7 @@ ModDef
Ok x -> return x
Bad msg -> fail msg
let poss = buildTree [(i,(fname,mkSrcSpan p)) | (i,p,_) <- jments]
- fname = prIdent id ++ ".gf"
+ fname = showIdent id ++ ".gf"
mkSrcSpan :: (Posn, Posn) -> (Int,Int)
mkSrcSpan (Pn l1 _, Pn l2 _) = (l1,l2)
@@ -278,7 +278,7 @@ TermDef
FlagDef :: { Options }
FlagDef
- : Posn Ident '=' Ident Posn {% case parseModuleOptions ["--" ++ prIdent $2 ++ "=" ++ prIdent $4] of
+ : Posn Ident '=' Ident Posn {% case parseModuleOptions ["--" ++ showIdent $2 ++ "=" ++ showIdent $4] of
Ok x -> return x
Bad msg -> failLoc $1 msg }
@@ -626,7 +626,7 @@ listCatDef id pos cont size = [catd,nilfund,consfund]
mkId x i = if isWildIdent x then (varX i) else x
tryLoc (c,mty,Just e) = return (c,(mty,e))
-tryLoc (c,_ ,_ ) = fail ("local definition of" +++ prIdent c +++ "without value")
+tryLoc (c,_ ,_ ) = fail ("local definition of" +++ showIdent c +++ "without value")
mkR [] = return $ RecType [] --- empty record always interpreted as record type
mkR fs@(f:_) =
@@ -635,10 +635,10 @@ mkR fs@(f:_) =
_ -> mapM tryR fs >>= return . R
where
tryRT (lab,Just ty,Nothing) = return (ident2label lab,ty)
- tryRT (lab,_ ,_ ) = fail $ "illegal record type field" +++ prIdent lab --- manifest fields ?!
+ tryRT (lab,_ ,_ ) = fail $ "illegal record type field" +++ showIdent lab --- manifest fields ?!
tryR (lab,mty,Just t) = return (ident2label lab,(mty,t))
- tryR (lab,_ ,_ ) = fail $ "illegal record field" +++ prIdent lab
+ tryR (lab,_ ,_ ) = fail $ "illegal record field" +++ showIdent lab
mkOverload pdt pdf@(Just df) =
case appForm df of
@@ -660,8 +660,8 @@ mkOverload pdt pdf = [ResOper pdt pdf]
isOverloading t =
case t of
- Vr keyw | prIdent keyw == "overload" -> True -- overload is a "soft keyword"
- _ -> False
+ Vr keyw | showIdent keyw == "overload" -> True -- overload is a "soft keyword"
+ _ -> False
type SrcSpan = (Posn,Posn)
diff --git a/src/GF/Grammar/Printer.hs b/src/GF/Grammar/Printer.hs
index 5f46d4321..e366f45d5 100644
--- a/src/GF/Grammar/Printer.hs
+++ b/src/GF/Grammar/Printer.hs
@@ -235,7 +235,7 @@ ppDDecl q (id,typ)
| id == identW = ppTerm q 6 typ
| otherwise = parens (ppIdent id <+> colon <+> ppTerm q 0 typ)
-ppIdent = text . prIdent
+ppIdent = text . showIdent
ppQIdent q m id =
case q of