summaryrefslogtreecommitdiff
path: root/src/GF/UseGrammar
diff options
context:
space:
mode:
authoraarne <unknown>2005-10-05 19:02:19 +0000
committeraarne <unknown>2005-10-05 19:02:19 +0000
commita78acc722ec26be2be20f22f74e98329d57008b1 (patch)
tree218294b2a57d3b6f8edce7730b9aa97d7537fadf /src/GF/UseGrammar
parent1703bb826e314eb78c15f846af1e76784f7759e2 (diff)
grep etc
Diffstat (limited to 'src/GF/UseGrammar')
-rw-r--r--src/GF/UseGrammar/Custom.hs8
-rw-r--r--src/GF/UseGrammar/Information.hs18
2 files changed, 20 insertions, 6 deletions
diff --git a/src/GF/UseGrammar/Custom.hs b/src/GF/UseGrammar/Custom.hs
index f5ed30009..8db581d18 100644
--- a/src/GF/UseGrammar/Custom.hs
+++ b/src/GF/UseGrammar/Custom.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date: 2005/10/05 11:56:42 $
--- > CVS $Author: peb $
--- > CVS $Revision: 1.76 $
+-- > CVS $Date: 2005/10/05 20:02:20 $
+-- > CVS $Author: aarne $
+-- > CVS $Revision: 1.77 $
--
-- A database for customizable GF shell commands.
--
@@ -63,6 +63,7 @@ import GF.Data.Zipper
import GF.UseGrammar.Statistics
import GF.UseGrammar.Morphology
+import GF.UseGrammar.Information
import GF.API.GrammarToHaskell
-----import GrammarToCanon (showCanon, showCanonOpt)
-----import qualified GrammarToGFC as GFC
@@ -307,6 +308,7 @@ customMultiGrammarPrinter =
,(strCI "header", const (MC.prCanonMGr . unoptimizeCanon))
,(strCI "cfgm", prCanonAsCFGM)
,(strCI "graph", visualizeCanonGrammar)
+ ,(strCI "missing", const missingLinCanonGrammar)
-- to prolog format:
,(strCI "gfc-prolog", CnvProlog.prtSMulti)
diff --git a/src/GF/UseGrammar/Information.hs b/src/GF/UseGrammar/Information.hs
index 446173aa2..094eb698c 100644
--- a/src/GF/UseGrammar/Information.hs
+++ b/src/GF/UseGrammar/Information.hs
@@ -5,16 +5,19 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date: 2005/05/30 18:39:45 $
+-- > CVS $Date: 2005/10/05 20:02:20 $
-- > CVS $Author: aarne $
--- > CVS $Revision: 1.6 $
+-- > CVS $Revision: 1.7 $
--
-- information on module, category, function, operation, parameter,...
-- AR 16\/9\/2003.
-- uses source grammar
-----------------------------------------------------------------------------
-module GF.UseGrammar.Information (showInformation) where
+module GF.UseGrammar.Information (
+ showInformation,
+ missingLinCanonGrammar
+ ) where
import GF.Grammar.Grammar
import GF.Infra.Ident
@@ -25,6 +28,7 @@ import GF.CF.PPrCF
import GF.Compile.ShellState
import GF.Grammar.PrGrammar
import GF.Grammar.Lookup
+import GF.Grammar.Macros (zIdent)
import qualified GF.Canon.GFC as GFC
import qualified GF.Canon.AbsGFC as AbsGFC
@@ -141,3 +145,11 @@ ownConstants = map fst . filter isOwn . tree2list where
AnyInd _ _ -> False
_ -> True
+missingLinCanonGrammar :: GFC.CanonGrammar -> String
+missingLinCanonGrammar cgr =
+ unlines $ concat [prt_ c : missing js | (c,js) <- concretes] where
+ missing js = map ((" " ++) . prt_) $ filter (not . flip isInBinTree js) abstract
+ abstract = err (const []) (map fst . tree2list . jments) $ lookupModMod cgr absId
+ absId = maybe (zIdent "") id $ greatestAbstract cgr
+ concretes = [(cnc,jments mo) |
+ cnc <- allConcretes cgr absId, Ok mo <- [lookupModMod cgr cnc]]