parser {treesitter}R Documentation

Create a new parser

Description

parser() constructs a parser from a tree-sitter language object. You can use parser_parse() to parse language specific text with it.

Usage

parser(language)

Arguments

language

⁠[tree_sitter_language]⁠

A language object.

Value

A new parser.

Examples


language <- treesitter.r::language()
parser <- parser(language)
parser

text <- "1 + foo"
tree <- parser_parse(parser, text)
tree


[Package treesitter version 0.1.0 Index]