1
0
forked from GitHub/gf-core

printing of GFCC

This commit is contained in:
aarne
2006-10-07 15:56:54 +00:00
parent f9cc79eba6
commit 5028ea9d9b
2 changed files with 5 additions and 5 deletions

View File

@@ -4,9 +4,9 @@ Abs. Abstract ::= "abstract" "{" [AbsDef] "}" ;
Cnc. Concrete ::= "concrete" CId "{" [CncDef] "}" ; Cnc. Concrete ::= "concrete" CId "{" [CncDef] "}" ;
Fun. AbsDef ::= CId ":" Type "=" Exp ; Fun. AbsDef ::= CId ":" Type "=" Exp ;
AFl. AbsDef ::= "%" CId "=" String ; -- flag --AFl. AbsDef ::= "%" CId "=" String ; -- flag
Lin. CncDef ::= CId "=" Term ; Lin. CncDef ::= CId "=" Term ;
CFl. CncDef ::= "%" CId "=" String ; -- flag --CFl. CncDef ::= "%" CId "=" String ; -- flag
Typ. Type ::= [CId] "->" CId ; Typ. Type ::= [CId] "->" CId ;
Tr. Exp ::= "(" Atom [Exp] ")" ; Tr. Exp ::= "(" Atom [Exp] ")" ;

View File

@@ -29,7 +29,7 @@ render d = rend 0 (map ($ "") $ d []) "" where
t : "]" :ts -> showString t . showChar ']' . rend i ts t : "]" :ts -> showString t . showChar ']' . rend i ts
t :ts -> space t . rend i ts t :ts -> space t . rend i ts
_ -> id _ -> id
new i = showChar '\n' . replicateS (2*i) (showChar ' ') . dropWhile isSpace new i = showChar '\n' . replicateS (0) (showChar ' ') . dropWhile isSpace
space t = showString t . id ----(\s -> if null s then "" else (' ':s)) space t = showString t . id ----(\s -> if null s then "" else (' ':s))
parenth :: Doc -> Doc parenth :: Doc -> Doc
@@ -94,7 +94,7 @@ instance Print Grammar where
instance Print Header where instance Print Header where
prt i e = case e of prt i e = case e of
Hdr cid cids -> prPrec i 0 (concatD [doc (showString "grammar") , prt 0 cid , doc (showString "(") , prt 0 cids , doc (showString ")")]) Hdr cid cids -> prPrec i 0 (concatD [doc (showString "grammar ") , prt 0 cid , doc (showString "(") , prt 0 cids , doc (showString ")")])
instance Print Abstract where instance Print Abstract where
@@ -104,7 +104,7 @@ instance Print Abstract where
instance Print Concrete where instance Print Concrete where
prt i e = case e of prt i e = case e of
Cnc cid cncdefs -> prPrec i 0 (concatD [doc (showString "concrete") , prt 0 cid , doc (showString "{") , prt 0 cncdefs , doc (showString "}")]) Cnc cid cncdefs -> prPrec i 0 (concatD [doc (showString "concrete ") , prt 0 cid , doc (showString "{") , prt 0 cncdefs , doc (showString "}")])
prtList es = case es of prtList es = case es of
[] -> (concatD []) [] -> (concatD [])