parser: Create a new parser

View source: R/parser.R

parserR 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


treesitter documentation built on June 24, 2024, 5:07 p.m.