From ac0f15103f6c413f5b9004e0e3bdd95df9fbe5f0 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Fri, 27 Sep 2019 19:06:19 -0400 Subject: [PATCH] Add a field for a Java mode. --- src/Data/Language.hs | 9 ++++++--- src/Semantic/CLI.hs | 7 ++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Data/Language.hs b/src/Data/Language.hs index b1cda7da7..a19a8b52d 100644 --- a/src/Data/Language.hs +++ b/src/Data/Language.hs @@ -143,14 +143,16 @@ textToLanguage = \case _ -> Unknown -newtype PerLanguageModes = PerLanguageModes - { pythonMode :: LanguageMode +data PerLanguageModes = PerLanguageModes + { javaMode :: LanguageMode + , pythonMode :: LanguageMode } deriving (Eq, Ord, Show) defaultLanguageModes :: PerLanguageModes defaultLanguageModes = PerLanguageModes - { pythonMode = ALaCarte + { javaMode = ALaCarte + , pythonMode = ALaCarte } data LanguageMode @@ -160,5 +162,6 @@ data LanguageMode modeForLanguage :: PerLanguageModes -> Language -> LanguageMode modeForLanguage modes = \case + Java -> javaMode modes Python -> pythonMode modes _ -> ALaCarte diff --git a/src/Semantic/CLI.hs b/src/Semantic/CLI.hs index d2c7bda2e..39182acfa 100644 --- a/src/Semantic/CLI.hs +++ b/src/Semantic/CLI.hs @@ -103,7 +103,12 @@ parseCommand = command "parse" (info parseArgumentsParser (progDesc "Generate pa where parseArgumentsParser = do languageModes <- Language.PerLanguageModes - <$> option auto ( long "python-mode" + <$> option auto ( long "java-mode" + <> help "The AST representation to use for Java sources" + <> metavar "ALaCarte|Precise" + <> value Language.ALaCarte + <> showDefault) + <*> option auto ( long "python-mode" <> help "The AST representation to use for Python sources" <> metavar "ALaCarte|Precise" <> value Language.ALaCarte