summaryrefslogtreecommitdiff
path: root/src-3.0/GF/Infra
diff options
context:
space:
mode:
authorkrasimir <krasimir@chalmers.se>2008-06-12 13:11:38 +0000
committerkrasimir <krasimir@chalmers.se>2008-06-12 13:11:38 +0000
commit79cbcdad2d5751e086990d8d98dfef4fcb4a8612 (patch)
treed845eac86e756b7ad5a8f35131d44f57a599a66a /src-3.0/GF/Infra
parent0a6085a7e2699fca3c8d6d38a08b3072430f8b5e (diff)
add generation of erasing PMCFG grammars
Diffstat (limited to 'src-3.0/GF/Infra')
-rw-r--r--src-3.0/GF/Infra/Option.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src-3.0/GF/Infra/Option.hs b/src-3.0/GF/Infra/Option.hs
index 5be0d4f7c..ed5c24c81 100644
--- a/src-3.0/GF/Infra/Option.hs
+++ b/src-3.0/GF/Infra/Option.hs
@@ -122,6 +122,7 @@ data ModuleFlags = ModuleFlags {
optSpeechLanguage :: Maybe String,
optLexer :: Maybe String,
optUnlexer :: Maybe String,
+ optErasing :: Bool,
optBuildParser :: Bool,
optWarnings :: [Warning],
optDump :: [Dump]
@@ -176,6 +177,7 @@ moduleOptionsGFO :: ModuleOptions -> [(String,String)]
moduleOptionsGFO (ModuleOptions o) =
maybe [] (\x -> [("language",x)]) (optSpeechLanguage mfs)
++ maybe [] (\x -> [("startcat",x)]) (optStartCat mfs)
+ ++ (if optErasing mfs then [("erasing","on")] else [])
where mfs = o defaultModuleFlags
@@ -262,6 +264,7 @@ defaultModuleFlags = ModuleFlags {
optSpeechLanguage = Nothing,
optLexer = Nothing,
optUnlexer = Nothing,
+ optErasing = False,
optBuildParser = True,
optWarnings = [],
optDump = []
@@ -311,6 +314,7 @@ moduleOptDescr =
Option [] ["coding"] (ReqArg coding "ENCODING")
("Character encoding of the source grammar, ENCODING = "
++ concat (intersperse " | " (map fst encodings)) ++ "."),
+ Option [] ["erasing"] (onOff erasing False) "Generate erasing grammar (default off).",
Option [] ["parser"] (onOff parser True) "Build parser (default on).",
Option [] ["startcat"] (ReqArg startcat "CAT") "Grammar start category.",
Option [] ["language"] (ReqArg language "LANG") "Set the speech language flag to LANG in the generated grammar.",
@@ -339,6 +343,7 @@ moduleOptDescr =
coding x = case lookup x encodings of
Just c -> set $ \o -> o { optEncoding = c }
Nothing -> fail $ "Unknown character encoding: " ++ x
+ erasing x = set $ \o -> o { optErasing = x }
parser x = set $ \o -> o { optBuildParser = x }
startcat x = set $ \o -> o { optStartCat = Just x }
language x = set $ \o -> o { optSpeechLanguage = Just x }