1
1
mirror of https://github.com/github/semantic.git synced 2024-12-24 15:35:14 +03:00

Bind the C language in the where clause.

This commit is contained in:
Rob Rix 2015-12-16 18:11:23 -05:00
parent 2ca8e7ca11
commit 5755c314fb

View File

@ -44,12 +44,13 @@ data Language = Language { getTsLanguage :: Ptr TSLanguage, getConstructor :: Co
languageForType :: String -> Maybe Language languageForType :: String -> Maybe Language
languageForType mediaType = case mediaType of languageForType mediaType = case mediaType of
".h" -> Just . Language ts_language_c $ constructorForProductions mempty mempty ".h" -> c
".c" -> Just . Language ts_language_c $ constructorForProductions mempty mempty ".c" -> c
".js" -> Just . Language ts_language_javascript $ constructorForProductions ".js" -> Just . Language ts_language_javascript $ constructorForProductions
(Set.fromList [ "object" ]) (Set.fromList [ "object" ])
(Set.fromList [ "pair", "rel_op", "math_op", "bool_op", "bitwise_op", "type_op", "math_assignment", "assignment", "subscript_access", "member_access", "new_expression", "function_call", "function", "ternary" ]) (Set.fromList [ "pair", "rel_op", "math_op", "bool_op", "bitwise_op", "type_op", "math_assignment", "assignment", "subscript_access", "member_access", "new_expression", "function_call", "function", "ternary" ])
_ -> Nothing _ -> Nothing
where c = Just . Language ts_language_c $ constructorForProductions mempty mempty
parseTreeSitterFile :: Language -> Parser parseTreeSitterFile :: Language -> Parser
parseTreeSitterFile (Language language constructor) contents = do parseTreeSitterFile (Language language constructor) contents = do