1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 00:42:33 +03:00

Use languageForType to select a parser.

This commit is contained in:
Rob Rix 2015-12-15 14:40:49 -05:00
parent 31fcf6e33c
commit cbf313f011

View File

@ -10,11 +10,7 @@ import Control.Comonad.Cofree
type Parser = String -> IO (Term String Info)
parserForType :: String -> Parser
parserForType mediaType = maybe lineByLineParser parseTreeSitterFile $ case mediaType of
".h" -> Just ts_language_c
".c" -> Just ts_language_c
".js" -> Just ts_language_javascript
_ -> Nothing
parserForType mediaType = maybe lineByLineParser parseTreeSitterFile $ languageForType mediaType
lineByLineParser :: Parser
lineByLineParser input = return . root . Indexed $ case foldl annotateLeaves ([], 0) lines of