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:
parent
95b83e983c
commit
d773ca8282
@ -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)
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user