1
0
forked from GitHub/gf-core

"Committed_by_peb"

This commit is contained in:
peb
2005-11-16 09:21:21 +00:00
parent 2cea1a25bb
commit 01c9d9ebf2
2 changed files with 16 additions and 13 deletions

View File

@@ -4,9 +4,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
-- > CVS $Date: 2005/10/05 11:56:42 $
-- > CVS $Date: 2005/11/16 10:21:21 $
-- > CVS $Author: peb $
-- > CVS $Revision: 1.1 $
-- > CVS $Revision: 1.2 $
--
-- Printing the type hierarchy of an abstract module in GraphViz format
-----------------------------------------------------------------------------
@@ -35,8 +35,9 @@ prtTypeGraph rules = "digraph TypeGraph {" ++++
"}"
prtTypeGraphRule :: SRule -> String
prtTypeGraphRule (Rule (Abs cat cats (Name fun _prof)) _)
= unlines [ prtSCat c ++ " -> " ++ prtSCat cat ++ ";" | c <- cats ]
prtTypeGraphRule (Rule abs@(Abs cat cats (Name fun _prof)) _)
= "// " ++ prt abs ++++
unlines [ prtSCat c ++ " -> " ++ prtSCat cat ++ ";" | c <- cats ]
prtFunctionGraph :: SGrammar -> String
prtFunctionGraph rules = "digraph FunctionGraph {" ++++
@@ -45,10 +46,12 @@ prtFunctionGraph rules = "digraph FunctionGraph {" ++++
"}"
prtFunctionGraphRule :: SRule -> String
prtFunctionGraphRule (Rule (Abs cat cats (Name fun _prof)) _)
= prt fun ++ " [shape=box, style=dashed];" ++++
prt fun ++ " -> " ++ prtSCat cat ++ ";" ++++
unlines [ prtSCat c ++ " -> " ++ prt fun ++ ";" | c <- cats ]
prtFunctionGraphRule (Rule abs@(Abs cat cats (Name fun _prof)) _)
= "// " ++ prt abs ++++
pfun ++ " [label=\"" ++ prt fun ++ "\", shape=box, style=dashed];" ++++
pfun ++ " -> " ++ prtSCat cat ++ ";" ++++
unlines [ prtSCat c ++ " -> " ++ pfun ++ ";" | c <- cats ]
where pfun = "GF_FUNCTION_" ++ prt fun
prtSCat (Decl var cat args) = prt cat

View File

@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
-- > CVS $Date: 2005/11/10 16:43:45 $
-- > CVS $Author: bringert $
-- > CVS $Revision: 1.84 $
-- > CVS $Date: 2005/11/16 10:21:21 $
-- > CVS $Author: peb $
-- > CVS $Revision: 1.85 $
--
-- A database for customizable GF shell commands.
--
@@ -294,8 +294,8 @@ customGrammarPrinter =
,(strCI "pinfo", Prt.prt . statePInfo)
,(strCI "abstract", Prt.prtAfter "\n" . Cnv.gfc2abstract . stateGrammarLang)
,(strCI "functiongraph",CnvTypeGraph.prtFunctionGraph . uncurry Cnv.gfc2simple . stateGrammarLangOpts)
,(strCI "typegraph", CnvTypeGraph.prtTypeGraph . uncurry Cnv.gfc2simple . stateGrammarLangOpts)
,(strCI "functiongraph",CnvTypeGraph.prtFunctionGraph . Cnv.gfc2simple noOptions . stateGrammarLang)
,(strCI "typegraph", CnvTypeGraph.prtTypeGraph . Cnv.gfc2simple noOptions . stateGrammarLang)
,(strCI "gfc-haskell", CnvHaskell.prtSGrammar . uncurry Cnv.gfc2simple . stateGrammarLangOpts)
,(strCI "mcfg-haskell", CnvHaskell.prtMGrammar . stateMCFG)