mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 19:42:50 -06:00
added pretty printing for flags
This commit is contained in:
@@ -16,6 +16,7 @@ module GF.Grammar.Printer
|
|||||||
|
|
||||||
import GF.Infra.Ident
|
import GF.Infra.Ident
|
||||||
import GF.Infra.Modules
|
import GF.Infra.Modules
|
||||||
|
import GF.Infra.Option
|
||||||
import GF.Grammar.Grammar
|
import GF.Grammar.Grammar
|
||||||
import GF.Data.Operations
|
import GF.Data.Operations
|
||||||
import Text.PrettyPrint
|
import Text.PrettyPrint
|
||||||
@@ -28,7 +29,7 @@ ppModule (mn, ModInfo mtype mstat opts exts with opens jments _) =
|
|||||||
(let defs = tree2list jments
|
(let defs = tree2list jments
|
||||||
in if null defs
|
in if null defs
|
||||||
then hdr
|
then hdr
|
||||||
else hdr <+> lbrace $$ nest 2 (vcat (map ppJudgement defs)) $$ rbrace)
|
else hdr <+> lbrace $$ nest 2 (ppOptions opts $$ vcat (map ppJudgement defs)) $$ rbrace)
|
||||||
where
|
where
|
||||||
hdr = complModDoc <+> modTypeDoc <+> equals <+>
|
hdr = complModDoc <+> modTypeDoc <+> equals <+>
|
||||||
hsep (intersperse (text "**") $
|
hsep (intersperse (text "**") $
|
||||||
@@ -59,6 +60,10 @@ ppModule (mn, ModInfo mtype mstat opts exts with opens jments _) =
|
|||||||
|
|
||||||
ppWith (id,ext,opens) = ppExtends (id,ext) <+> text "with" <+> commaPunct ppOpenSpec opens
|
ppWith (id,ext,opens) = ppExtends (id,ext) <+> text "with" <+> commaPunct ppOpenSpec opens
|
||||||
|
|
||||||
|
ppOptions opts =
|
||||||
|
text "flags" $$
|
||||||
|
nest 2 (vcat [text option <+> equals <+> text (show value) <+> semi | (option,value) <- optionsGFO opts])
|
||||||
|
|
||||||
ppJudgement (id, AbsCat pcont pconstrs) =
|
ppJudgement (id, AbsCat pcont pconstrs) =
|
||||||
text "cat" <+> ppIdent id <+>
|
text "cat" <+> ppIdent id <+>
|
||||||
(case pcont of
|
(case pcont of
|
||||||
|
|||||||
Reference in New Issue
Block a user