mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-05-27 08:58:55 -06:00
add morphodict into Setup.hs
This commit is contained in:
@@ -25,6 +25,7 @@ data LangInfo = LangInfo
|
||||
, langSymbolic :: Bool
|
||||
, langCompatibility :: Bool
|
||||
, langSynopsis :: Bool -- ^ include in RGL synopsis
|
||||
, langMorphodict :: Bool
|
||||
} deriving (Show,Eq)
|
||||
|
||||
-- | Load language information from default config file
|
||||
@@ -55,6 +56,7 @@ loadLangsFrom configFile = do
|
||||
, langSymbolic = boolBit bits 8 True
|
||||
, langCompatibility = boolBit bits 9 False
|
||||
, langSynopsis = boolBit bits 10 False
|
||||
, langMorphodict = boolBit bits 11 False
|
||||
}
|
||||
|
||||
-- | Separate a string on a character
|
||||
|
||||
22
Setup.hs
22
Setup.hs
@@ -1,4 +1,4 @@
|
||||
{-# LANGUAGE CPP #-}
|
||||
{-# LANGUAGE CPP, LambdaCase #-}
|
||||
|
||||
-- | Main build script for RGL
|
||||
|
||||
@@ -150,11 +150,12 @@ getRGLBuildSubDir mode =
|
||||
case mode of
|
||||
Present -> "present"
|
||||
AllTenses -> "alltenses"
|
||||
MorphoDict -> "morphodict"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Build modes
|
||||
|
||||
data Mode = Present | AllTenses
|
||||
data Mode = Present | AllTenses | MorphoDict
|
||||
deriving (Show,Eq)
|
||||
|
||||
all_modes :: [String]
|
||||
@@ -187,6 +188,7 @@ rglCommands =
|
||||
, RGLCommand "lang" False $ gfcp [l,s]
|
||||
, RGLCommand "api" False $ gfcp [t,sc]
|
||||
, RGLCommand "compat" False $ gfcp [c]
|
||||
, RGLCommand "morphodict" False $ gfcp [m]
|
||||
|
||||
-- Special command, invoked when command ends in .gf
|
||||
, RGLCommand "modules" False $ \modes args bi -> do
|
||||
@@ -223,14 +225,20 @@ rglCommands =
|
||||
s mode args = (symbol,optml mode langTry args)
|
||||
c mode args = (compat,optml AllTenses langCompatibility args)
|
||||
t mode args = (try,optml mode langTry args)
|
||||
m mode args = (morphodict,optml mode langMorphodict args)
|
||||
sc mode args = (symbolic,optml mode langSymbolic args)
|
||||
|
||||
optml :: Mode -> (LangInfo -> Bool) -> [String] -> ([LangInfo] -> [LangInfo])
|
||||
optml mode pred args =
|
||||
\langsAll ->
|
||||
let langsDefault = filter (if mode == Present then langPresent else const True) (filter pred langsAll)
|
||||
let langsDefault = filter (mode2langinfo mode) (filter pred langsAll)
|
||||
in getOptLangs langsAll langsDefault args
|
||||
|
||||
mode2langinfo = \case
|
||||
Present -> langPresent
|
||||
MorphoDict -> langMorphodict
|
||||
_ -> const True
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Getting module paths/names
|
||||
|
||||
@@ -260,6 +268,9 @@ syntax l = sourceDir </> "api" </> ("Syntax" ++ langCode l ++ ".gf")
|
||||
symbolic :: LangInfo -> FilePath
|
||||
symbolic l = sourceDir </> "api" </> ("Symbolic" ++ langCode l ++ ".gf")
|
||||
|
||||
morphodict :: LangInfo -> FilePath
|
||||
morphodict l = sourceDir </> "morphodict" </> ("MorphoDict" ++ langCode l ++ ".gf")
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Argument helpers
|
||||
|
||||
@@ -303,7 +314,8 @@ getOptMode args =
|
||||
where
|
||||
explicit_modes =
|
||||
[Present | have "present"] ++
|
||||
[AllTenses|have "alltenses"]
|
||||
[AllTenses | have "alltenses"] ++
|
||||
[MorphoDict | have "morphodict"]
|
||||
have mode = mode `elem` args
|
||||
|
||||
-- | List of languages overriding the default definitions
|
||||
@@ -367,7 +379,7 @@ gfcn bi mode summary files = do
|
||||
let dir = getRGLBuildDir bi mode
|
||||
preproc = case mode of
|
||||
Present -> "--preproc=mkPresent"
|
||||
AllTenses -> ""
|
||||
_ -> ""
|
||||
createDirectoryIfMissing True dir
|
||||
if length files > 0
|
||||
then do
|
||||
|
||||
Reference in New Issue
Block a user