From 890d45579300f39d50a5a18a9f6feed8634ae8ba Mon Sep 17 00:00:00 2001 From: krasimir Date: Wed, 27 Jan 2010 09:39:14 +0000 Subject: cleanup the code of the PGF interpreter and polish the binary serialization to match the preliminary specification --- src/runtime/haskell/PGF/Printer.hs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/runtime/haskell/PGF/Printer.hs') diff --git a/src/runtime/haskell/PGF/Printer.hs b/src/runtime/haskell/PGF/Printer.hs index 2f92dd8e0..ee0fd4070 100644 --- a/src/runtime/haskell/PGF/Printer.hs +++ b/src/runtime/haskell/PGF/Printer.hs @@ -40,34 +40,34 @@ ppCnc name cnc = nest 2 (text "productions" $$ nest 2 (vcat [ppProduction (fcat,prod) | (fcat,set) <- IntMap.toList (productions cnc), prod <- Set.toList set]) $$ text "functions" $$ - nest 2 (vcat (map ppFFun (assocs (functions cnc)))) $$ + nest 2 (vcat (map ppCncFun (assocs (cncfuns cnc)))) $$ text "sequences" $$ nest 2 (vcat (map ppSeq (assocs (sequences cnc)))) $$ - text "startcats" $$ - nest 2 (vcat (map ppStartCat (Map.toList (startCats cnc))))) $$ + text "categories" $$ + nest 2 (vcat (map ppCncCat (Map.toList (cnccats cnc))))) $$ char '}' -ppProduction (fcat,FApply funid args) = +ppProduction (fcat,PApply funid args) = ppFCat fcat <+> text "->" <+> ppFunId funid <> brackets (hcat (punctuate comma (map ppFCat args))) -ppProduction (fcat,FCoerce arg) = +ppProduction (fcat,PCoerce arg) = ppFCat fcat <+> text "->" <+> char '_' <> brackets (ppFCat arg) -ppProduction (fcat,FConst _ ss) = +ppProduction (fcat,PConst _ ss) = ppFCat fcat <+> text "->" <+> ppStrs ss -ppFFun (funid,FFun fun arr) = +ppCncFun (funid,CncFun fun arr) = ppFunId funid <+> text ":=" <+> parens (hcat (punctuate comma (map ppSeqId (elems arr)))) <+> brackets (ppCId fun) ppSeq (seqid,seq) = ppSeqId seqid <+> text ":=" <+> hsep (map ppSymbol (elems seq)) -ppStartCat (id,(start,end,labels)) = +ppCncCat (id,(CncCat start end labels)) = ppCId id <+> text ":=" <+> (text "range " <+> brackets (ppFCat start <+> text ".." <+> ppFCat end) $$ text "labels" <+> brackets (vcat (map (text . show) (elems labels)))) -ppSymbol (FSymCat d r) = char '<' <> int d <> comma <> int r <> char '>' -ppSymbol (FSymLit d r) = char '<' <> int d <> comma <> int r <> char '>' -ppSymbol (FSymKS ts) = ppStrs ts -ppSymbol (FSymKP ts alts) = text "pre" <+> braces (hsep (punctuate semi (ppStrs ts : map ppAlt alts))) +ppSymbol (SymCat d r) = char '<' <> int d <> comma <> int r <> char '>' +ppSymbol (SymLit d r) = char '<' <> int d <> comma <> int r <> char '>' +ppSymbol (SymKS ts) = ppStrs ts +ppSymbol (SymKP ts alts) = text "pre" <+> braces (hsep (punctuate semi (ppStrs ts : map ppAlt alts))) ppAlt (Alt ts ps) = ppStrs ts <+> char '/' <+> hsep (map (doubleQuotes . text) ps) -- cgit v1.2.3