summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2012-11-23 18:44:08 +0000
committerhallgren <hallgren@chalmers.se>2012-11-23 18:44:08 +0000
commit53858fbc81fb2e1844bd43aa579a8b521f4606b5 (patch)
tree58af23dcd40022f4b942df18d31f4029e7470629
parent4432d7c36cd4ed61cdfde6f87cc8fea2494534b7 (diff)
Fix a prededence bug in GF grammar pretty printer
The pretty printer produced mkDet pre {"a"; "an" / vowel} Sg which is not accepted by the parser. The parser assigns pre { ... }, to prededence level 4, and this is now reflected in the pretty printer, so it prints mkDet (pre {"a"; "an" / vowel}) Sg (This caused a problem in GFSE since it parsers pretty printed grammars...)
-rw-r--r--src/compiler/GF/Grammar/Printer.hs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/compiler/GF/Grammar/Printer.hs b/src/compiler/GF/Grammar/Printer.hs
index f7257751e..a6c10a33d 100644
--- a/src/compiler/GF/Grammar/Printer.hs
+++ b/src/compiler/GF/Grammar/Printer.hs
@@ -206,7 +206,7 @@ ppTerm q d (ExtR x y) = prec d 3 (ppTerm q 3 x <+> text "**" <+> ppTerm q 4 y)
ppTerm q d (App x y) = prec d 4 (ppTerm q 4 x <+> ppTerm q 5 y)
ppTerm q d (V e es) = text "table" <+> ppTerm q 6 e <+> brackets (fsep (punctuate semi (map (ppTerm q 0) es)))
ppTerm q d (FV es) = text "variants" <+> braces (fsep (punctuate semi (map (ppTerm q 0) es)))
-ppTerm q d (Alts e xs) = text "pre" <+> braces (ppTerm q 0 e <> semi <+> fsep (punctuate semi (map (ppAltern q) xs)))
+ppTerm q d (Alts e xs) = prec d 4 (text "pre" <+> braces (ppTerm q 0 e <> semi <+> fsep (punctuate semi (map (ppAltern q) xs))))
ppTerm q d (Strs es) = text "strs" <+> braces (fsep (punctuate semi (map (ppTerm q 0) es)))
ppTerm q d (EPatt p) = prec d 4 (char '#' <+> ppPatt q 2 p)
ppTerm q d (EPattType t)=prec d 4 (text "pattern" <+> ppTerm q 0 t)