diff options
| author | hallgren <hallgren@chalmers.se> | 2012-11-23 18:44:08 +0000 |
|---|---|---|
| committer | hallgren <hallgren@chalmers.se> | 2012-11-23 18:44:08 +0000 |
| commit | 53858fbc81fb2e1844bd43aa579a8b521f4606b5 (patch) | |
| tree | 58af23dcd40022f4b942df18d31f4029e7470629 /src/compiler/GF/Grammar/Printer.hs | |
| parent | 4432d7c36cd4ed61cdfde6f87cc8fea2494534b7 (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...)
Diffstat (limited to 'src/compiler/GF/Grammar/Printer.hs')
| -rw-r--r-- | src/compiler/GF/Grammar/Printer.hs | 2 |
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)
|
