From 07af8988d3e42bf7e18c06cf8c9dabaa34c60578 Mon Sep 17 00:00:00 2001 From: hallgren Date: Sun, 18 Mar 2012 20:12:26 +0000 Subject: PGF run-time library: function names in BracketedString (experimental) + Make room for function names in the BracketedString data structure. + Fill in function names when linearizing an abstract syntax tree to a BracketedString. + Fill in wildCId when it is not obvious what the function is. + Function bracketedLinearize: for compatibility with the other linearization functions, return Leaf "" instead of error "cannot linearize". + Export flattenBracketedString from module PGF. + PGFServce: make function names available in the JSON representation of BracketedString. --- src/runtime/haskell/PGF/VisualizeTree.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/runtime/haskell/PGF/VisualizeTree.hs') diff --git a/src/runtime/haskell/PGF/VisualizeTree.hs b/src/runtime/haskell/PGF/VisualizeTree.hs index 20fb6b925..6cc5e64eb 100644 --- a/src/runtime/haskell/PGF/VisualizeTree.hs +++ b/src/runtime/haskell/PGF/VisualizeTree.hs @@ -194,12 +194,12 @@ graphvizBracketedString = render . lin2tree getLeaves level parent bs = case bs of Leaf w -> [(level-1,parent,w)] - Bracket _ fid i _ bss -> concatMap (getLeaves (level+1) fid) bss + 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] + 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] @@ -247,7 +247,7 @@ genPreAlignment pgf langs = lin2align . linsBracketed getLeaves parent bs = case bs of Leaf w -> [(parent,w)] - Bracket _ fid _ _ bss -> concatMap (getLeaves fid) bss + Bracket _ fid _ _ _ bss -> concatMap (getLeaves fid) bss mkLayers (cs:css:rest) = let (lrest, rrest) = mkLayers (css:rest) in ((fields cs) : lrest, (map (mkLinks css) cs) : rrest) -- cgit v1.2.3