1
1
mirror of https://github.com/github/semantic.git synced 2024-11-25 11:04:00 +03:00

Move LanguageModes & ASTMode into Data.Language.

This commit is contained in:
Rob Rix 2019-09-25 11:32:57 -04:00
parent 95b83e983c
commit d773ca8282
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7
2 changed files with 15 additions and 12 deletions

View File

@ -10,6 +10,8 @@ module Data.Language
, codeNavLanguages
, textToLanguage
, languageToText
, LanguageModes(..)
, ASTMode(..)
) where
import Data.Aeson
@ -137,3 +139,14 @@ textToLanguage = \case
"TSX" -> TSX
"PHP" -> PHP
_ -> Unknown
newtype LanguageModes = LanguageModes
{ pythonMode :: ASTMode
}
deriving (Eq, Ord, Show)
data ASTMode
= ALaCarte
| Precise
deriving (Bounded, Enum, Eq, Ord, Read, Show)

View File

@ -98,25 +98,15 @@ diffCommand = command "diff" (info diffArgumentsParser (progDesc "Compute change
filesOrStdin <- Right <$> some (Both <$> argument filePathReader (metavar "FILE_A") <*> argument filePathReader (metavar "FILE_B")) <|> pure (Left stdin)
pure $ Task.readBlobPairs filesOrStdin >>= renderer
newtype LanguageModes = LanguageModes
{ pythonMode :: ASTMode
}
deriving (Eq, Ord, Show)
data ASTMode
= ALaCarte
| Precise
deriving (Bounded, Enum, Eq, Ord, Read, Show)
parseCommand :: Mod CommandFields (Task.TaskEff Builder)
parseCommand = command "parse" (info parseArgumentsParser (progDesc "Generate parse trees for path(s)"))
where
parseArgumentsParser = do
language <- LanguageModes
language <- Language.LanguageModes
<$> option auto ( long "python-mode"
<> help "The AST representation to use for Python sources"
<> metavar "ALaCarte|Precise"
<> value ALaCarte
<> value Language.ALaCarte
<> showDefault)
renderer
<- flag (parseTermBuilder TermSExpression)