From f070a412a1256b39e60b3a819e18c61922a7fe79 Mon Sep 17 00:00:00 2001 From: peb Date: Thu, 14 Apr 2005 10:42:05 +0000 Subject: "Committed_by_peb" --- src/GF/Formalism/Utilities.hs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/GF/Formalism/Utilities.hs') diff --git a/src/GF/Formalism/Utilities.hs b/src/GF/Formalism/Utilities.hs index 166534bc4..a03464e04 100644 --- a/src/GF/Formalism/Utilities.hs +++ b/src/GF/Formalism/Utilities.hs @@ -4,9 +4,9 @@ -- Stability : (stable) -- Portability : (portable) -- --- > CVS $Date: 2005/04/11 13:52:50 $ +-- > CVS $Date: 2005/04/14 11:42:05 $ -- > CVS $Author: peb $ --- > CVS $Revision: 1.1 $ +-- > CVS $Revision: 1.2 $ -- -- Basic type declarations and functions for grammar formalisms ----------------------------------------------------------------------------- @@ -259,12 +259,18 @@ instance (Print s) => Print (Edge s) where prtList = prtSep "" instance (Print s) => Print (SyntaxTree s) where - prt (TNode s trees) = prt s ++ "^{" ++ prtSep " " trees ++ "}" + prt (TNode s trees) + | null trees = prt s + | otherwise = "(" ++ prt s ++ prtBefore " " trees ++ ")" prt (TMeta) = "?" prtList = prtAfter "\n" instance (Print s) => Print (SyntaxForest s) where - prt (FNode s forests) = prt s ++ "^{" ++ prtSep " | " (map (prtSep " ") forests) ++ "}" + prt (FNode s []) = "(" ++ prt s ++ " - ERROR: null forests)" + prt (FNode s [[]]) = prt s + prt (FNode s [forests]) = "(" ++ prt s ++ prtBefore " " forests ++ ")" + prt (FNode s children) = "{" ++ prtSep " | " [ prt s ++ prtBefore " " forests | + forests <- children ] ++ "}" prt (FMeta) = "?" prtList = prtAfter "\n" -- cgit v1.2.3