1
0
forked from GitHub/gf-core

Changed CFGM format and printer to allow constants in profiles.

This commit is contained in:
bringert
2005-05-17 13:04:35 +00:00
parent 31044ec728
commit 8abf80dc4d
7 changed files with 148 additions and 132 deletions

View File

@@ -3,7 +3,7 @@ module GF.CFGM.PrintCFG where
-- pretty-printer generated by the BNF converter
import GF.CFGM.AbsCFG
import Data.Char
import Char
-- the top-level printing method
printTree :: Print a => a -> String
@@ -112,7 +112,7 @@ instance Print Flag where
instance Print Rule where
prt i e = case e of
Rule fun profile category symbols -> prPrec i 0 (concatD [prt 0 fun , doc (showString ":") , prt 0 profile , doc (showString ".") , prt 0 category , doc (showString "->") , prt 0 symbols])
Rule fun profiles category symbols -> prPrec i 0 (concatD [prt 0 fun , doc (showString ":") , prt 0 profiles , doc (showString ".") , prt 0 category , doc (showString "->") , prt 0 symbols])
prtList es = case es of
[] -> (concatD [])
@@ -124,14 +124,15 @@ instance Print Fun where
Coerce -> prPrec i 0 (concatD [doc (showString "_")])
instance Print Profiles where
prt i e = case e of
Profiles profiles -> prPrec i 0 (concatD [doc (showString "[") , prt 0 profiles , doc (showString "]")])
instance Print Profile where
prt i e = case e of
Profile intss -> prPrec i 0 (concatD [doc (showString "[") , prt 0 intss , doc (showString "]")])
instance Print Ints where
prt i e = case e of
Ints ns -> prPrec i 0 (concatD [doc (showString "[") , prt 0 ns , doc (showString "]")])
UnifyProfile ns -> prPrec i 0 (concatD [doc (showString "[") , prt 0 ns , doc (showString "]")])
ConstProfile id -> prPrec i 0 (concatD [prt 0 id])
prtList es = case es of
[] -> (concatD [])