1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 06:11:49 +03:00

Add a field for a Java mode.

This commit is contained in:
Rob Rix 2019-09-27 19:06:19 -04:00
parent 1ec65b4858
commit ac0f15103f
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7
2 changed files with 12 additions and 4 deletions

View File

@ -143,14 +143,16 @@ textToLanguage = \case
_ -> Unknown _ -> Unknown
newtype PerLanguageModes = PerLanguageModes data PerLanguageModes = PerLanguageModes
{ pythonMode :: LanguageMode { javaMode :: LanguageMode
, pythonMode :: LanguageMode
} }
deriving (Eq, Ord, Show) deriving (Eq, Ord, Show)
defaultLanguageModes :: PerLanguageModes defaultLanguageModes :: PerLanguageModes
defaultLanguageModes = PerLanguageModes defaultLanguageModes = PerLanguageModes
{ pythonMode = ALaCarte { javaMode = ALaCarte
, pythonMode = ALaCarte
} }
data LanguageMode data LanguageMode
@ -160,5 +162,6 @@ data LanguageMode
modeForLanguage :: PerLanguageModes -> Language -> LanguageMode modeForLanguage :: PerLanguageModes -> Language -> LanguageMode
modeForLanguage modes = \case modeForLanguage modes = \case
Java -> javaMode modes
Python -> pythonMode modes Python -> pythonMode modes
_ -> ALaCarte _ -> ALaCarte

View File

@ -103,7 +103,12 @@ parseCommand = command "parse" (info parseArgumentsParser (progDesc "Generate pa
where where
parseArgumentsParser = do parseArgumentsParser = do
languageModes <- Language.PerLanguageModes 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" <> help "The AST representation to use for Python sources"
<> metavar "ALaCarte|Precise" <> metavar "ALaCarte|Precise"
<> value Language.ALaCarte <> value Language.ALaCarte