diff --git a/src/TreeSitter.hs b/src/TreeSitter.hs index 88a584280..fc6d63d21 100644 --- a/src/TreeSitter.hs +++ b/src/TreeSitter.hs @@ -30,7 +30,6 @@ import qualified Text.Parser.TreeSitter as TS import SourceSpan import Info - -- | Returns a TreeSitter parser for the given language and TreeSitter grammar. treeSitterParser :: Language -> Ptr TS.Language -> Source -> IO (Term (Syntax.Syntax Text) (Record DefaultFields)) treeSitterParser language grammar source = bracket ts_document_new ts_document_free $ \ document -> do @@ -41,6 +40,7 @@ treeSitterParser language grammar source = bracket ts_document_new ts_document_f term <- documentToTerm language document source pure term + -- | Parse 'Source' with the given 'TS.Language' and return its AST. parseToAST :: (Bounded grammar, Enum grammar) => Ptr TS.Language -> Source -> IO (A.AST grammar) parseToAST language source = bracket ts_document_new ts_document_free $ \ document -> do