Parser class
Parser for a Tree-Sitter language.
Contents
The default constructor uses LUA_LANGUAGE.
Features not included (because we currently don't use them):
- Partial document parsing:
ts_parser_set_included_rangests_parser_included_ranges
- alternative parse sources (other than utf8 string)
- generalized
ts_parser_parse(with TSInput) ts_parser_parse_string_encoding
- generalized
- parsing timeout/cancellation
ts_parser_resetts_parser_set_timeout_microsts_parser_timeout_microsts_parser_set_cancellation_flagts_parser_cancellation_flag
- Grammar debug features:
ts_parser_set_loggerts_parser_loggerts_parser_print_dot_graphs
Constructors, destructors, conversion operators
Public functions
- auto raw() const -> TSParser*
- Returns the raw Tree-Sitter parser.
- auto language() const -> Language
- The Language the parser was created from.
- auto parse_string(std::string) const -> Tree
- Parse a string and return its syntax tree.
- auto parse_string(const TSTree* old_tree, std::string source) const -> Tree
- Parse a string and return its syntax tree.
Function documentation
TSParser* ts:: Parser:: raw() const
Returns the raw Tree-Sitter parser.
Tree ts:: Parser:: parse_string(std::string) const
Parse a string and return its syntax tree.
This takes the source code by copy (or move) and stores it in the tree.
Tree ts:: Parser:: parse_string(const TSTree* old_tree,
std::string source) const
Parse a string and return its syntax tree.
This takes the source code by copy (or move) and a previously parsed tree.