From d6d4ae3a6b32b783e37cdc789c7cbe800ad34d9e Mon Sep 17 00:00:00 2001 From: "kr.angelov" Date: Fri, 19 Apr 2013 11:13:07 +0000 Subject: [PATCH] =?UTF-8?q?remove=20the=20dead=20code=20left=20behind=20by?= =?UTF-8?q?=20Peter=20Ljungl=C3=B6f=20in=20VisualizeTree?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/GF/Command/Commands.hs | 8 ++-- src/runtime/haskell/PGF/VisualizeTree.hs | 53 +----------------------- 2 files changed, 4 insertions(+), 57 deletions(-) diff --git a/src/compiler/GF/Command/Commands.hs b/src/compiler/GF/Command/Commands.hs index 802b36a81..7311443f6 100644 --- a/src/compiler/GF/Command/Commands.hs +++ b/src/compiler/GF/Command/Commands.hs @@ -988,11 +988,9 @@ allCommands = Map.fromList [ nodeEdgeStyle = valStrOpts "nodeedgestyle" "solid" opts, leafEdgeStyle = valStrOpts "leafedgestyle" "dashed" opts } - let grph = if null es then [] - else if isOpt "old" opts then - graphvizParseTreeOld pgf lang (head es) - else - graphvizParseTree pgf lang gvOptions (head es) + let grph = if null es + then [] + else graphvizParseTree pgf lang gvOptions (head es) if isFlag "view" opts || isFlag "format" opts then do let file s = "_grph." ++ s let view = optViewGraph opts diff --git a/src/runtime/haskell/PGF/VisualizeTree.hs b/src/runtime/haskell/PGF/VisualizeTree.hs index d0fc3a9e3..6bfee1f39 100644 --- a/src/runtime/haskell/PGF/VisualizeTree.hs +++ b/src/runtime/haskell/PGF/VisualizeTree.hs @@ -1,18 +1,12 @@ ---------------------------------------------------------------------- -- | -- Module : VisualizeTree --- Maintainer : AR +-- Maintainer : KA -- Stability : (stable) -- Portability : (portable) -- --- > CVS $Date: --- > CVS $Author: --- > CVS $Revision: --- -- Print a graph of an abstract syntax tree in Graphviz DOT format -- Based on BB's VisualizeGrammar --- FIXME: change this to use GF.Visualization.Graphviz, --- instead of rolling its own. ----------------------------------------------------------------------------- module PGF.VisualizeTree @@ -20,7 +14,6 @@ module PGF.VisualizeTree , graphvizDefaults , graphvizAbstractTree , graphvizParseTree - , graphvizParseTreeOld , graphvizDependencyTree , graphvizBracketedString , graphvizAlignment @@ -290,50 +283,6 @@ graphvizBracketedString opts bs = render graphviz_code space - -graphvizParseTreeOld :: PGF -> Language -> Tree -> String -graphvizParseTreeOld pgf lang = graphvizBracketedStringOld . bracketedLinearize pgf lang - - -graphvizBracketedStringOld :: BracketedString -> String -graphvizBracketedStringOld = render . lin2tree - where - lin2tree bs = - text "graph {" $$ - space $$ - nest 2 (text "rankdir=BU ;" $$ - text "node [shape = record, color = white] ;" $$ - space $$ - vcat (nodes bs)) $$ - text "}" - where - nodes bs = zipWith mkStruct [0..] (interns ++ [zipWith (\i (l,p,w) -> (l,p,i,w)) [99990..] leaves]) - - nil = -1 - - leaves = getLeaves 0 nil bs - interns = getInterns 0 [(nil,bs)] - - getLeaves level parent bs = - case bs of - Leaf w -> [(level-1,parent,w)] - Bracket _ fid i _ _ bss -> concatMap (getLeaves (level+1) fid) bss - - getInterns level [] = [] - getInterns level nodes = - nub [(level-1,parent,fid,showCId cat) | (parent,Bracket cat fid _ _ _ _) <- nodes] : - getInterns (level+1) [(fid,child) | (_,Bracket _ fid _ _ _ children) <- nodes, child <- children] - - mkStruct l cs = struct l <> text "[label = \"" <> fields cs <> text "\"] ;" $$ - vcat [link pl pid l id | (pl,pid,id,_) <- cs] - link pl pid l id - | pl < 0 = empty - | otherwise = struct pl <> colon <> tag pid <> colon <> char 's' <+> - text "--" <+> - struct l <> colon <> tag id <> colon <> char 'n' <+> semi - fields cs = hsep (intersperse (char '|') [tbrackets (tag id) <> text c | (_,_,id,c) <- cs]) - - type Rel = (Int,[Int]) -- possibly needs changes after clearing about many-to-many on this level