From b5d9ae552d64cc887f2d92fc2ba198911eb67735 Mon Sep 17 00:00:00 2001 From: krasimir Date: Wed, 17 Feb 2010 10:20:49 +0000 Subject: [PATCH] -output-format=pgf_pretty now prints the flags as well --- src/runtime/haskell/PGF/Printer.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/runtime/haskell/PGF/Printer.hs b/src/runtime/haskell/PGF/Printer.hs index d3ce0469e..353b06f86 100644 --- a/src/runtime/haskell/PGF/Printer.hs +++ b/src/runtime/haskell/PGF/Printer.hs @@ -20,10 +20,14 @@ ppPGF pgf = ppAbs (absname pgf) (abstract pgf) $$ ppAll ppCnc (concretes pgf) ppAbs :: Language -> Abstr -> Doc ppAbs name a = text "abstract" <+> ppCId name <+> char '{' $$ - nest 2 (ppAll ppCat (cats a) $$ + nest 2 (ppAll ppFlag (aflags a) $$ + ppAll ppCat (cats a) $$ ppAll ppFun (funs a)) $$ char '}' +ppFlag :: CId -> Literal -> Doc +ppFlag flag value = text "flag" <+> ppCId flag <+> char '=' <+> ppLit value ; + ppCat :: CId -> [Hypo] -> Doc ppCat c hyps = text "cat" <+> ppCId c <+> hsep (snd (mapAccumL (ppHypo 4) [] hyps)) @@ -38,7 +42,8 @@ ppFun f (t,_,Nothing) = text "data" <+> ppCId f <+> colon <+> ppType 0 [] t ppCnc :: Language -> Concr -> Doc ppCnc name cnc = text "concrete" <+> ppCId name <+> char '{' $$ - nest 2 (text "productions" $$ + nest 2 (ppAll ppFlag (cflags cnc) $$ + text "productions" $$ nest 2 (vcat [ppProduction (fcat,prod) | (fcat,set) <- IntMap.toList (productions cnc), prod <- Set.toList set]) $$ text "functions" $$ nest 2 (vcat (map ppCncFun (assocs (cncfuns cnc)))) $$