From 5755c314fbe403bc688753c7a074bc33eaf6b015 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 16 Dec 2015 18:11:23 -0500 Subject: [PATCH] Bind the C language in the where clause. --- app/TreeSitter.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/TreeSitter.hs b/app/TreeSitter.hs index 56d0e8ed7..19ce0a04f 100644 --- a/app/TreeSitter.hs +++ b/app/TreeSitter.hs @@ -44,12 +44,13 @@ data Language = Language { getTsLanguage :: Ptr TSLanguage, getConstructor :: Co languageForType :: String -> Maybe Language languageForType mediaType = case mediaType of - ".h" -> Just . Language ts_language_c $ constructorForProductions mempty mempty - ".c" -> Just . Language ts_language_c $ constructorForProductions mempty mempty + ".h" -> c + ".c" -> c ".js" -> Just . Language ts_language_javascript $ constructorForProductions (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" ]) _ -> Nothing + where c = Just . Language ts_language_c $ constructorForProductions mempty mempty parseTreeSitterFile :: Language -> Parser parseTreeSitterFile (Language language constructor) contents = do