diff options
| author | bringert <unknown> | 2004-09-29 15:53:46 +0000 |
|---|---|---|
| committer | bringert <unknown> | 2004-09-29 15:53:46 +0000 |
| commit | 7492cfd236352bab4beb8fcc2763cec5825c9bea (patch) | |
| tree | 8c766761ca416a987bf22c721b19f11461569c4a /src/GF/CFGM/PrintCFG.hs | |
| parent | df2c63c5596db36f0c1899cced6b7ee2e946741e (diff) | |
Updated to simple CFGM grammar, use CFGM pretty printer when printing cfgm grammars.
Diffstat (limited to 'src/GF/CFGM/PrintCFG.hs')
| -rw-r--r-- | src/GF/CFGM/PrintCFG.hs | 52 |
1 files changed, 6 insertions, 46 deletions
diff --git a/src/GF/CFGM/PrintCFG.hs b/src/GF/CFGM/PrintCFG.hs index 3ff89234d..ba8f6f6a6 100644 --- a/src/GF/CFGM/PrintCFG.hs +++ b/src/GF/CFGM/PrintCFG.hs @@ -82,6 +82,10 @@ instance Print Ident where prt _ (Ident i) = doc (showString i) +instance Print SingleQuoteString where + prt _ (SingleQuoteString i) = doc (showString i) + + instance Print Grammars where prt i e = case e of @@ -138,56 +142,12 @@ instance Print Symbol where instance Print Name where prt i e = case e of - Name identparams category -> prPrec i 0 (concatD [prt 0 identparams , prt 0 category]) + Name singlequotestring -> prPrec i 0 (concatD [prt 0 singlequotestring]) instance Print Category where prt i e = case e of - Category identparam id projs -> prPrec i 0 (concatD [prt 0 identparam , doc (showString ".") , prt 0 id , prt 0 projs]) - - -instance Print IdentParam where - prt i e = case e of - IdentParam id fields -> prPrec i 0 (concatD [prt 0 id , doc (showString "{") , prt 0 fields , doc (showString "}")]) + Category singlequotestring -> prPrec i 0 (concatD [prt 0 singlequotestring]) - prtList es = case es of - [] -> (concatD []) - x:xs -> (concatD [prt 0 x , doc (showString "/") , prt 0 xs]) - -instance Print Field where - prt i e = case e of - Field keyvalue -> prPrec i 0 (concatD [doc (showString ".") , prt 0 keyvalue]) - - prtList es = case es of - [] -> (concatD []) - x:xs -> (concatD [prt 0 x , doc (showString ";") , prt 0 xs]) - -instance Print Proj where - prt i e = case e of - Proj param -> prPrec i 0 (concatD [doc (showString "!") , prt 0 param]) - - prtList es = case es of - [] -> (concatD []) - x:xs -> (concatD [prt 0 x , prt 0 xs]) - -instance Print KeyValue where - prt i e = case e of - KeyValue id param -> prPrec i 0 (concatD [prt 0 id , doc (showString "=") , prt 0 param]) - - prtList es = case es of - [] -> (concatD []) - [x] -> (concatD [prt 0 x]) - x:xs -> (concatD [prt 0 x , doc (showString ";") , prt 0 xs]) - -instance Print Param where - prt i e = case e of - ParamSimple id -> prPrec i 0 (concatD [prt 0 id]) - ParamPatt id params -> prPrec i 0 (concatD [prt 0 id , doc (showString "(") , prt 0 params , doc (showString ")")]) - ParamRec keyvalues -> prPrec i 0 (concatD [doc (showString "{") , prt 0 keyvalues , doc (showString "}")]) - - prtList es = case es of - [] -> (concatD []) - [x] -> (concatD [prt 0 x]) - x:xs -> (concatD [prt 0 x , doc (showString ",") , prt 0 xs]) |
