diff options
| author | krasimir <krasimir@chalmers.se> | 2010-02-17 10:20:49 +0000 |
|---|---|---|
| committer | krasimir <krasimir@chalmers.se> | 2010-02-17 10:20:49 +0000 |
| commit | b5d9ae552d64cc887f2d92fc2ba198911eb67735 (patch) | |
| tree | 6df6c4d32c21062c9c98c9e989ae9c41e40e8ec9 /src/runtime/haskell/PGF/Printer.hs | |
| parent | 32f9499f2e7403d7f48887ebdb30e2eddeb8199a (diff) | |
-output-format=pgf_pretty now prints the flags as well
Diffstat (limited to 'src/runtime/haskell/PGF/Printer.hs')
| -rw-r--r-- | src/runtime/haskell/PGF/Printer.hs | 9 |
1 files 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)))) $$ |
