Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- parseByteString :: Unmarshal t => Ptr Language -> ByteString -> IO (Either String t)
- newtype FieldName = FieldName {}
- class Unmarshal a where
- unmarshalNodes :: (MonadFail m, Carrier sig m, Member (Reader ByteString) sig, Member (Reader (Ptr Cursor)) sig, MonadIO m) => [Node] -> m a
- class SymbolMatching a where
- symbolMatch :: Proxy a -> Node -> Bool
- showFailure :: Proxy a -> Node -> String
- step :: (Carrier sig m, Member (Reader (Ptr Cursor)) sig, MonadIO m) => m Bool
- push :: (Carrier sig m, Member (Reader (Ptr Cursor)) sig, MonadIO m) => m a -> m (Maybe a)
- goto :: (Carrier sig m, Member (Reader (Ptr Cursor)) sig, MonadIO m) => TSNode -> m ()
- peekNode :: (Carrier sig m, Member (Reader (Ptr Cursor)) sig, MonadIO m) => m (Maybe Node)
- peekFieldName :: (Carrier sig m, Member (Reader (Ptr Cursor)) sig, MonadIO m) => m (Maybe FieldName)
- getFields :: (Carrier sig m, Member (Reader (Ptr Cursor)) sig, MonadIO m) => m (Map FieldName [Node])
Documentation
parseByteString :: Unmarshal t => Ptr Language -> ByteString -> IO (Either String t) Source #
class Unmarshal a where Source #
Unmarshal is the process of iterating over tree-sitter’s parse trees using its tree cursor API and producing Haskell ASTs for the relevant nodes.
Datatypes which can be constructed from tree-sitter parse trees may use the default definition of unmarshalNode
providing that they have a suitable Generic
instance.
Nothing
unmarshalNodes :: (MonadFail m, Carrier sig m, Member (Reader ByteString) sig, Member (Reader (Ptr Cursor)) sig, MonadIO m) => [Node] -> m a Source #
unmarshalNodes :: (MonadFail m, Carrier sig m, GUnmarshal (Rep a), Generic a, Member (Reader ByteString) sig, Member (Reader (Ptr Cursor)) sig, MonadIO m) => [Node] -> m a Source #
Instances
Unmarshal () Source # | |
Defined in TreeSitter.Unmarshal unmarshalNodes :: (MonadFail m, Carrier sig m, Member (Reader ByteString) sig, Member (Reader (Ptr Cursor)) sig, MonadIO m) => [Node] -> m () Source # | |
Unmarshal Text Source # | |
Defined in TreeSitter.Unmarshal unmarshalNodes :: (MonadFail m, Carrier sig m, Member (Reader ByteString) sig, Member (Reader (Ptr Cursor)) sig, MonadIO m) => [Node] -> m Text Source # | |
Unmarshal Range Source # | |
Defined in TreeSitter.Unmarshal unmarshalNodes :: (MonadFail m, Carrier sig m, Member (Reader ByteString) sig, Member (Reader (Ptr Cursor)) sig, MonadIO m) => [Node] -> m Range Source # | |
Unmarshal Span Source # | |
Defined in TreeSitter.Unmarshal unmarshalNodes :: (MonadFail m, Carrier sig m, Member (Reader ByteString) sig, Member (Reader (Ptr Cursor)) sig, MonadIO m) => [Node] -> m Span Source # | |
Unmarshal a => Unmarshal [a] Source # | |
Defined in TreeSitter.Unmarshal unmarshalNodes :: (MonadFail m, Carrier sig m, Member (Reader ByteString) sig, Member (Reader (Ptr Cursor)) sig, MonadIO m) => [Node] -> m [a] Source # | |
Unmarshal a => Unmarshal (Maybe a) Source # | |
Defined in TreeSitter.Unmarshal unmarshalNodes :: (MonadFail m, Carrier sig m, Member (Reader ByteString) sig, Member (Reader (Ptr Cursor)) sig, MonadIO m) => [Node] -> m (Maybe a) Source # | |
Unmarshal a => Unmarshal (NonEmpty a) Source # | |
Defined in TreeSitter.Unmarshal unmarshalNodes :: (MonadFail m, Carrier sig m, Member (Reader ByteString) sig, Member (Reader (Ptr Cursor)) sig, MonadIO m) => [Node] -> m (NonEmpty a) Source # | |
(Unmarshal a, Unmarshal b, SymbolMatching a, SymbolMatching b) => Unmarshal (Either a b) Source # | |
Defined in TreeSitter.Unmarshal unmarshalNodes :: (MonadFail m, Carrier sig m, Member (Reader ByteString) sig, Member (Reader (Ptr Cursor)) sig, MonadIO m) => [Node] -> m (Either a b) Source # | |
(Unmarshal a, Unmarshal b) => Unmarshal (a, b) Source # | Instance for pairs of annotations |
Defined in TreeSitter.Unmarshal unmarshalNodes :: (MonadFail m, Carrier sig m, Member (Reader ByteString) sig, Member (Reader (Ptr Cursor)) sig, MonadIO m) => [Node] -> m (a, b) Source # |
class SymbolMatching a where Source #
symbolMatch :: Proxy a -> Node -> Bool Source #
showFailure :: Proxy a -> Node -> String Source #
Provide error message describing the node symbol vs. the symbols this can match
Instances
SymbolMatching a => SymbolMatching ([a] :: Type) Source # | |
Defined in TreeSitter.Unmarshal | |
SymbolMatching a => SymbolMatching (Maybe a :: Type) Source # | |
Defined in TreeSitter.Unmarshal | |
(SymbolMatching a, SymbolMatching b) => SymbolMatching (Either a b :: Type) Source # | |
Defined in TreeSitter.Unmarshal | |
(SymbolMatching f, SymbolMatching g) => SymbolMatching (f :+: g :: k -> Type) Source # | |
Defined in TreeSitter.Unmarshal | |
SymbolMatching k2 => SymbolMatching (M1 C c (M1 S s (K1 i k2 :: k1 -> Type)) :: k1 -> Type) Source # | |
step :: (Carrier sig m, Member (Reader (Ptr Cursor)) sig, MonadIO m) => m Bool Source #
Advance the cursor to the next sibling of the current node.
push :: (Carrier sig m, Member (Reader (Ptr Cursor)) sig, MonadIO m) => m a -> m (Maybe a) Source #
Run an action over the children of the current node.
goto :: (Carrier sig m, Member (Reader (Ptr Cursor)) sig, MonadIO m) => TSNode -> m () Source #
Move the cursor to point at the passed TSNode
.