Zen-C
Loading...
Searching...
No Matches
lsp_index.h
Go to the documentation of this file.
1
2#ifndef LSP_INDEX_H
3#define LSP_INDEX_H
4
5#include "parser.h"
6
15
32
41
42// API.
44void lsp_index_free(LSPIndex *idx);
45void lsp_index_add_def(LSPIndex *idx, Token t, const char *hover, ASTNode *node);
46void lsp_index_add_ref(LSPIndex *idx, Token t, Token def_t, ASTNode *node);
47LSPRange *lsp_find_at(LSPIndex *idx, int line, int col);
48
49// Walker.
50void lsp_build_index(LSPIndex *idx, ASTNode *root);
51
52#endif
LSPIndex * lsp_index_new()
Definition lsp_index.c:7
void lsp_index_free(LSPIndex *idx)
Definition lsp_index.c:12
LSPRange * lsp_find_at(LSPIndex *idx, int line, int col)
Definition lsp_index.c:87
void lsp_index_add_def(LSPIndex *idx, Token t, const char *hover, ASTNode *node)
Definition lsp_index.c:46
void lsp_index_add_ref(LSPIndex *idx, Token t, Token def_t, ASTNode *node)
Definition lsp_index.c:67
void lsp_build_index(LSPIndex *idx, ASTNode *root)
Definition lsp_index.c:257
RangeType
Type of an indexed AST range.
Definition lsp_index.h:11
@ RANGE_REFERENCE
References a symbol.
Definition lsp_index.h:13
@ RANGE_DEFINITION
Defines a symbol.
Definition lsp_index.h:12
Definition ast.h:187
Index of a single file.
Definition lsp_index.h:37
LSPRange * head
First range in the file.
Definition lsp_index.h:38
LSPRange * tail
Last range in the file.
Definition lsp_index.h:39
A range in the source code mapping to semantic info.
Definition lsp_index.h:20
ASTNode * node
Associated AST node.
Definition lsp_index.h:29
int end_col
End column (approximated).
Definition lsp_index.h:24
int start_col
Start column (1-based).
Definition lsp_index.h:22
int def_line
Line of definition (if reference).
Definition lsp_index.h:26
int end_line
End line.
Definition lsp_index.h:23
RangeType type
Type of range (def or ref).
Definition lsp_index.h:25
struct LSPRange * next
Definition lsp_index.h:30
int start_line
Start line (1-based).
Definition lsp_index.h:21
int def_col
Column of definition (if reference).
Definition lsp_index.h:27
char * hover_text
Tooltip text / signature.
Definition lsp_index.h:28
Represents a source token.
Definition zprep.h:119