Data Structures | Macros | Functions
treesitter.c File Reference
#include <assert.h>
#include <inttypes.h>
#include <lauxlib.h>
#include <lua.h>
#include <lualib.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include "nvim/api/private/helpers.h"
#include "nvim/buffer.h"
#include "nvim/lua/treesitter.h"
#include "nvim/memline.h"
#include "tree_sitter/api.h"

Data Structures

struct  TSLua_cursor
 

Macros

#define TS_META_PARSER   "treesitter_parser"
 
#define TS_META_TREE   "treesitter_tree"
 
#define TS_META_NODE   "treesitter_node"
 
#define TS_META_QUERY   "treesitter_query"
 
#define TS_META_QUERYCURSOR   "treesitter_querycursor"
 
#define TS_META_TREECURSOR   "treesitter_treecursor"
 
#define BUFSIZE   128
 
#define BUFSIZE   256
 

Functions

void tslua_init (lua_State *L)
 
int tslua_has_language (lua_State *L)
 
int tslua_add_language (lua_State *L)
 
int tslua_inspect_lang (lua_State *L)
 
int tslua_push_parser (lua_State *L)
 
void push_tree (lua_State *L, TSTree *tree, bool do_copy)
 
int tslua_parse_query (lua_State *L)
 

Macro Definition Documentation

◆ BUFSIZE [1/2]

#define BUFSIZE   128

◆ BUFSIZE [2/2]

#define BUFSIZE   256

◆ TS_META_NODE

#define TS_META_NODE   "treesitter_node"

◆ TS_META_PARSER

#define TS_META_PARSER   "treesitter_parser"

◆ TS_META_QUERY

#define TS_META_QUERY   "treesitter_query"

◆ TS_META_QUERYCURSOR

#define TS_META_QUERYCURSOR   "treesitter_querycursor"

◆ TS_META_TREE

#define TS_META_TREE   "treesitter_tree"

◆ TS_META_TREECURSOR

#define TS_META_TREECURSOR   "treesitter_treecursor"

Function Documentation

◆ push_tree()

void push_tree ( lua_State *  L,
TSTree *  tree,
bool  do_copy 
)

push tree interface on lua stack.

This makes a copy of the tree, so ownership of the argument is unaffected.

◆ tslua_add_language()

int tslua_add_language ( lua_State *  L)

◆ tslua_has_language()

int tslua_has_language ( lua_State *  L)

◆ tslua_init()

void tslua_init ( lua_State *  L)

init the tslua library

all global state is stored in the regirstry of the lua_State

◆ tslua_inspect_lang()

int tslua_inspect_lang ( lua_State *  L)

◆ tslua_parse_query()

int tslua_parse_query ( lua_State *  L)

◆ tslua_push_parser()

int tslua_push_parser ( lua_State *  L)