1
1
mirror of https://github.com/github/semantic.git synced 2025-01-01 11:46:14 +03:00

doParse handles the PerLanguageModes.

This commit is contained in:
Rob Rix 2019-10-01 12:32:13 -04:00
parent 785d52314a
commit 152e94a844
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -109,18 +109,22 @@ withSomeTerm :: (forall t . c t => t ann -> a) -> SomeTerm c ann -> a
withSomeTerm with (SomeTerm term) = with term
doParse :: ParseEffects sig m => [Text] -> Blob -> m (SomeTerm Precise.ToTags Loc)
doParse symbolsToSummarize blob = case blobLanguage blob of
Go -> SomeTerm . ALaCarteTerm (blobLanguage blob) symbolsToSummarize <$> parse Parser.goParser blob
Haskell -> SomeTerm . ALaCarteTerm (blobLanguage blob) symbolsToSummarize <$> parse Parser.haskellParser blob
JavaScript -> SomeTerm . ALaCarteTerm (blobLanguage blob) symbolsToSummarize <$> parse Parser.tsxParser blob
JSON -> SomeTerm . ALaCarteTerm (blobLanguage blob) symbolsToSummarize <$> parse Parser.jsonParser blob
JSX -> SomeTerm . ALaCarteTerm (blobLanguage blob) symbolsToSummarize <$> parse Parser.tsxParser blob
Markdown -> SomeTerm . ALaCarteTerm (blobLanguage blob) symbolsToSummarize <$> parse Parser.markdownParser blob
Python -> SomeTerm . ALaCarteTerm (blobLanguage blob) symbolsToSummarize <$> parse Parser.pythonParser blob
Ruby -> SomeTerm . ALaCarteTerm (blobLanguage blob) symbolsToSummarize <$> parse Parser.rubyParser blob
TypeScript -> SomeTerm . ALaCarteTerm (blobLanguage blob) symbolsToSummarize <$> parse Parser.typescriptParser blob
TSX -> SomeTerm . ALaCarteTerm (blobLanguage blob) symbolsToSummarize <$> parse Parser.tsxParser blob
PHP -> SomeTerm . ALaCarteTerm (blobLanguage blob) symbolsToSummarize <$> parse Parser.phpParser blob
_ -> noLanguageForBlob (blobPath blob)
doParse symbolsToSummarize blob = do
modes <- ask @PerLanguageModes
case blobLanguage blob of
Go -> SomeTerm . ALaCarteTerm (blobLanguage blob) symbolsToSummarize <$> parse Parser.goParser blob
Haskell -> SomeTerm . ALaCarteTerm (blobLanguage blob) symbolsToSummarize <$> parse Parser.haskellParser blob
JavaScript -> SomeTerm . ALaCarteTerm (blobLanguage blob) symbolsToSummarize <$> parse Parser.tsxParser blob
JSON -> SomeTerm . ALaCarteTerm (blobLanguage blob) symbolsToSummarize <$> parse Parser.jsonParser blob
JSX -> SomeTerm . ALaCarteTerm (blobLanguage blob) symbolsToSummarize <$> parse Parser.tsxParser blob
Markdown -> SomeTerm . ALaCarteTerm (blobLanguage blob) symbolsToSummarize <$> parse Parser.markdownParser blob
Python
| Precise <- pythonMode modes -> SomeTerm <$> parse Parser.precisePythonParser blob
| otherwise -> SomeTerm . ALaCarteTerm (blobLanguage blob) symbolsToSummarize <$> parse Parser.pythonParser blob
Ruby -> SomeTerm . ALaCarteTerm (blobLanguage blob) symbolsToSummarize <$> parse Parser.rubyParser blob
TypeScript -> SomeTerm . ALaCarteTerm (blobLanguage blob) symbolsToSummarize <$> parse Parser.typescriptParser blob
TSX -> SomeTerm . ALaCarteTerm (blobLanguage blob) symbolsToSummarize <$> parse Parser.tsxParser blob
PHP -> SomeTerm . ALaCarteTerm (blobLanguage blob) symbolsToSummarize <$> parse Parser.phpParser blob
_ -> noLanguageForBlob (blobPath blob)
type ParseEffects sig m = (Member (Error SomeException) sig, Member (Reader PerLanguageModes) sig, Member Parse sig, Member (Reader Config) sig, Carrier sig m)