diff options
| author | bringert <unknown> | 2004-09-29 08:27:28 +0000 |
|---|---|---|
| committer | bringert <unknown> | 2004-09-29 08:27:28 +0000 |
| commit | df2c63c5596db36f0c1899cced6b7ee2e946741e (patch) | |
| tree | eece388341c371e9b1c552663493e2fb05dacd6f /src/GF/CFGM/PrintCFG.hs | |
| parent | 01f872bf5db46863565c44c7f40b337217d35e8e (diff) | |
Updated to latest CFG specification from gfc2java
Diffstat (limited to 'src/GF/CFGM/PrintCFG.hs')
| -rw-r--r-- | src/GF/CFGM/PrintCFG.hs | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/src/GF/CFGM/PrintCFG.hs b/src/GF/CFGM/PrintCFG.hs index e7ecb1f6a..3ff89234d 100644 --- a/src/GF/CFGM/PrintCFG.hs +++ b/src/GF/CFGM/PrintCFG.hs @@ -132,7 +132,8 @@ instance Print Symbol where TermS str -> prPrec i 0 (concatD [prt 0 str]) prtList es = case es of - [] -> (concatD []) + [] -> (concatD [doc (showString ".")]) + [x] -> (concatD [prt 0 x]) x:xs -> (concatD [prt 0 x , prt 0 xs]) instance Print Name where @@ -142,23 +143,51 @@ instance Print Name where instance Print Category where prt i e = case e of - Category identparam id params -> prPrec i 0 (concatD [prt 0 identparam , doc (showString ".") , prt 0 id , prt 0 params]) + 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 params -> prPrec i 0 (concatD [prt 0 id , doc (showString "{") , prt 0 params , doc (showString "}")]) + IdentParam id fields -> prPrec i 0 (concatD [prt 0 id , doc (showString "{") , prt 0 fields , doc (showString "}")]) prtList es = case es of [] -> (concatD []) x:xs -> (concatD [prt 0 x , doc (showString "/") , prt 0 xs]) -instance Print Param where +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 - Param id -> prPrec i 0 (concatD [doc (showString "!") , prt 0 id]) + 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]) + |
