From a27dd5fef4d47aba96230d6e8b934054017718c3 Mon Sep 17 00:00:00 2001 From: aarne Date: Tue, 7 Dec 2010 16:05:37 +0000 Subject: [PATCH] shell command pg -pgf writes current pgf into a file --- src/compiler/GF/Command/Commands.hs | 3 +++ src/compiler/GFC.hs | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/compiler/GF/Command/Commands.hs b/src/compiler/GF/Command/Commands.hs index fbcefcba8..17099be68 100644 --- a/src/compiler/GF/Command/Commands.hs +++ b/src/compiler/GF/Command/Commands.hs @@ -34,6 +34,7 @@ import GF.Command.Messages import GF.Text.Lexing import GF.Text.Transliterations import GF.Quiz +import GFC (writePGF) import GF.Command.TreeOperations ---- temporary place for typecheck and compute @@ -555,6 +556,7 @@ allCommands env@(pgf, mos) = Map.fromList [ ("fullform", "print the fullform lexicon"), ("funs", "show just the names and types of abstract syntax functions"), ("missing","show just the names of functions that have no linearization"), + ("pgf", "write current pgf image in file"), ("words", "print the list of words") ], examples = [ @@ -1075,6 +1077,7 @@ allCommands env@(pgf, mos) = Map.fromList [ _ -> fromExprs es prGrammar opts + | isOpt "pgf" opts = dieIOE (writePGF noOptions pgf) >> return void ---- opts | isOpt "cats" opts = return $ fromString $ unwords $ map showCId $ categories pgf | isOpt "funs" opts = return $ fromString $ unlines $ map showFun $ funsigs pgf | isOpt "fullform" opts = return $ fromString $ concatMap (morpho "" prFullFormLexicon) $ optLangs opts diff --git a/src/compiler/GFC.hs b/src/compiler/GFC.hs index 0cd8a343b..c5e4f2800 100644 --- a/src/compiler/GFC.hs +++ b/src/compiler/GFC.hs @@ -1,4 +1,4 @@ -module GFC (mainGFC) where +module GFC (mainGFC, writePGF) where -- module Main where import PGF