1
1
mirror of https://github.com/github/semantic.git synced 2024-11-29 02:44:36 +03:00

Use withParser to define parseToAST.

This commit is contained in:
Rob Rix 2019-09-26 12:35:21 -04:00
parent b563f20edb
commit c399f0d637
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -60,7 +60,7 @@ parseToAST :: ( Bounded grammar
-> Ptr TS.Language
-> Blob
-> m (Maybe (AST [] grammar))
parseToAST parseTimeout language b@Blob{..} = bracket (liftIO TS.ts_parser_new) (liftIO . TS.ts_parser_delete) $ \ parser -> do
parseToAST parseTimeout language b@Blob{..} = withParser language $ \ parser -> do
compatible <- liftIO $ do
let timeoutMicros = fromIntegral $ toMicroseconds parseTimeout
TS.ts_parser_set_timeout_micros parser timeoutMicros