From 7babfd1da6808f65ae6369aef0dc246857822357 Mon Sep 17 00:00:00 2001 From: krasimir Date: Wed, 4 Mar 2009 13:41:33 +0000 Subject: qualified/unqualified mode for GF.Grammar.Printer. Used in the "cc" command --- src/GFI.hs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/GFI.hs') diff --git a/src/GFI.hs b/src/GFI.hs index e5926f5e9..486b807d0 100644 --- a/src/GFI.hs +++ b/src/GFI.hs @@ -95,12 +95,17 @@ loop opts gfenv0 = do system $ unwords ws loopNewCPU gfenv "cc":ws -> do - let - (style,term) = case ws of - ('-':w):ws2 -> (pTermPrintStyle w, ws2) - _ -> (TermPrintDefault, ws) - case pTerm (unwords term) >>= checkTerm sgr >>= computeTerm sgr of - Ok x -> putStrLn $ enc (showTerm style x) + let + pOpts style q ("-table" :ws) = pOpts TermPrintTable q ws + pOpts style q ("-all" :ws) = pOpts TermPrintAll q ws + pOpts style q ("-default":ws) = pOpts TermPrintDefault q ws + pOpts style q ("-unqual" :ws) = pOpts style Unqualified ws + pOpts style q ("-qual" :ws) = pOpts style Qualified ws + pOpts style q ws = (style,q,unwords ws) + + (style,q,s) = pOpts TermPrintDefault Qualified ws + case pTerm s >>= checkTerm sgr >>= computeTerm sgr of + Ok x -> putStrLn $ enc (showTerm style q x) Bad s -> putStrLn $ enc s loopNewCPU gfenv "dg":ws -> do -- cgit v1.2.3