Just call the C lib 'the library' everywhere, don't call it a 'runtime'
This commit is contained in:
parent
38417fc8a1
commit
0f2347b318
25 changed files with 57 additions and 95 deletions
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef TREE_SITTER_RUNTIME_H_
|
||||
#define TREE_SITTER_RUNTIME_H_
|
||||
#ifndef TREE_SITTER_API_H_
|
||||
#define TREE_SITTER_API_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -153,4 +153,4 @@ uint32_t ts_language_version(const TSLanguage *);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // TREE_SITTER_RUNTIME_H_
|
||||
#endif // TREE_SITTER_API_H_
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
#ifndef TREE_SITTER_COMPILER_H_
|
||||
#define TREE_SITTER_COMPILER_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
typedef enum {
|
||||
TSCompileErrorTypeNone,
|
||||
TSCompileErrorTypeInvalidGrammar,
|
||||
TSCompileErrorTypeInvalidRegex,
|
||||
TSCompileErrorTypeUndefinedSymbol,
|
||||
TSCompileErrorTypeInvalidExtraToken,
|
||||
TSCompileErrorTypeInvalidExternalToken,
|
||||
TSCompileErrorTypeLexConflict,
|
||||
TSCompileErrorTypeParseConflict,
|
||||
TSCompileErrorTypeEpsilonRule,
|
||||
TSCompileErrorTypeInvalidTokenContents,
|
||||
TSCompileErrorTypeInvalidRuleName,
|
||||
TSCompileErrorTypeInvalidWordRule,
|
||||
} TSCompileErrorType;
|
||||
|
||||
typedef struct {
|
||||
char *code;
|
||||
char *error_message;
|
||||
TSCompileErrorType error_type;
|
||||
} TSCompileResult;
|
||||
|
||||
TSCompileResult ts_compile_grammar(const char *input, FILE *log_file);
|
||||
TSCompileResult ts_compile_property_sheet(const char *input, FILE *log_file);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // TREE_SITTER_COMPILER_H_
|
||||
|
|
@ -13,7 +13,7 @@ extern "C" {
|
|||
#define ts_builtin_sym_end 0
|
||||
#define TREE_SITTER_SERIALIZATION_BUFFER_SIZE 1024
|
||||
|
||||
#ifndef TREE_SITTER_RUNTIME_H_
|
||||
#ifndef TREE_SITTER_API_H_
|
||||
typedef uint16_t TSSymbol;
|
||||
typedef struct TSLanguage TSLanguage;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef RUNTIME_ALLOC_H_
|
||||
#define RUNTIME_ALLOC_H_
|
||||
#ifndef TREE_SITTER_ALLOC_H_
|
||||
#define TREE_SITTER_ALLOC_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -82,4 +82,4 @@ static inline void ts_free(void *buffer) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // RUNTIME_ALLOC_H_
|
||||
#endif // TREE_SITTER_ALLOC_H_
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef RUNTIME_ARRAY_H_
|
||||
#define RUNTIME_ARRAY_H_
|
||||
#ifndef TREE_SITTER_ARRAY_H_
|
||||
#define TREE_SITTER_ARRAY_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -132,4 +132,4 @@ static inline void array__splice(VoidArray *self, size_t element_size,
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // RUNTIME_ARRAY_H_
|
||||
#endif // TREE_SITTER_ARRAY_H_
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef RUNTIME_ATOMIC_H_
|
||||
#define RUNTIME_ATOMIC_H_
|
||||
#ifndef TREE_SITTER_ATOMIC_H_
|
||||
#define TREE_SITTER_ATOMIC_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
|
@ -27,4 +27,4 @@ static inline uint32_t atomic_dec(volatile uint32_t *p) {
|
|||
|
||||
#endif
|
||||
|
||||
#endif // RUNTIME_ATOMIC_H_
|
||||
#endif // TREE_SITTER_ATOMIC_H_
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef RUNTIME_ERROR_COSTS_H_
|
||||
#define RUNTIME_ERROR_COSTS_H_
|
||||
#ifndef TREE_SITTER_ERROR_COSTS_H_
|
||||
#define TREE_SITTER_ERROR_COSTS_H_
|
||||
|
||||
#define ERROR_STATE 0
|
||||
#define ERROR_COST_PER_RECOVERY 500
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef RUNTIME_GET_CHANGED_RANGES_H_
|
||||
#define RUNTIME_GET_CHANGED_RANGES_H_
|
||||
#ifndef TREE_SITTER_GET_CHANGED_RANGES_H_
|
||||
#define TREE_SITTER_GET_CHANGED_RANGES_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -33,4 +33,4 @@ unsigned ts_subtree_get_changed_ranges(
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // RUNTIME_GET_CHANGED_RANGES_H_
|
||||
#endif // TREE_SITTER_GET_CHANGED_RANGES_H_
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef RUNTIME_LANGUAGE_H_
|
||||
#define RUNTIME_LANGUAGE_H_
|
||||
#ifndef TREE_SITTER_LANGUAGE_H_
|
||||
#define TREE_SITTER_LANGUAGE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -91,4 +91,4 @@ ts_language_alias_sequence(const TSLanguage *self, unsigned id) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // RUNTIME_LANGUAGE_H_
|
||||
#endif // TREE_SITTER_LANGUAGE_H_
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
#ifndef RUNTIME_LENGTH_H_
|
||||
#define RUNTIME_LENGTH_H_
|
||||
#ifndef TREE_SITTER_LENGTH_H_
|
||||
#define TREE_SITTER_LENGTH_H_
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#include "./point.h"
|
||||
#include "tree_sitter/runtime.h"
|
||||
#include "tree_sitter/api.h"
|
||||
|
||||
typedef struct {
|
||||
uint32_t bytes;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef RUNTIME_LEXER_H_
|
||||
#define RUNTIME_LEXER_H_
|
||||
#ifndef TREE_SITTER_LEXER_H_
|
||||
#define TREE_SITTER_LEXER_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -7,7 +7,7 @@ extern "C" {
|
|||
|
||||
#include "./length.h"
|
||||
#include "./subtree.h"
|
||||
#include "tree_sitter/runtime.h"
|
||||
#include "tree_sitter/api.h"
|
||||
#include "tree_sitter/parser.h"
|
||||
|
||||
typedef struct {
|
||||
|
|
@ -45,4 +45,4 @@ TSRange *ts_lexer_included_ranges(const Lexer *self, uint32_t *count);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // RUNTIME_LEXER_H_
|
||||
#endif // TREE_SITTER_LEXER_H_
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
#include <stdbool.h>
|
||||
#include "tree_sitter/runtime.h"
|
||||
#include "tree_sitter/api.h"
|
||||
#include "./subtree.h"
|
||||
#include "./lexer.h"
|
||||
#include "./length.h"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef RUNTIME_POINT_H_
|
||||
#define RUNTIME_POINT_H_
|
||||
#ifndef TREE_SITTER_POINT_H_
|
||||
#define TREE_SITTER_POINT_H_
|
||||
|
||||
#include "tree_sitter/runtime.h"
|
||||
#include "tree_sitter/api.h"
|
||||
|
||||
#define POINT_MAX ((TSPoint) {UINT32_MAX, UINT32_MAX})
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
#ifndef RUNTIME_REDUCE_ACTION_H_
|
||||
#define RUNTIME_REDUCE_ACTION_H_
|
||||
#ifndef TREE_SITTER_REDUCE_ACTION_H_
|
||||
#define TREE_SITTER_REDUCE_ACTION_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "./array.h"
|
||||
#include "tree_sitter/runtime.h"
|
||||
#include "tree_sitter/api.h"
|
||||
|
||||
typedef struct {
|
||||
uint32_t count;
|
||||
|
|
@ -31,4 +31,4 @@ static inline void ts_reduce_action_set_add(ReduceActionSet *self,
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // RUNTIME_REDUCE_ACTION_H_
|
||||
#endif // TREE_SITTER_REDUCE_ACTION_H_
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef RUNTIME_PARSE_STACK_H_
|
||||
#define RUNTIME_PARSE_STACK_H_
|
||||
#ifndef TREE_SITTER_PARSE_STACK_H_
|
||||
#define TREE_SITTER_PARSE_STACK_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -132,4 +132,4 @@ void ts_stack_iterate(Stack *, StackVersion, StackIterateCallback, void *);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // RUNTIME_PARSE_STACK_H_
|
||||
#endif // TREE_SITTER_PARSE_STACK_H_
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef RUNTIME_SUBTREE_H_
|
||||
#define RUNTIME_SUBTREE_H_
|
||||
#ifndef TREE_SITTER_SUBTREE_H_
|
||||
#define TREE_SITTER_SUBTREE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -10,7 +10,7 @@ extern "C" {
|
|||
#include "./length.h"
|
||||
#include "./array.h"
|
||||
#include "./error_costs.h"
|
||||
#include "tree_sitter/runtime.h"
|
||||
#include "tree_sitter/api.h"
|
||||
#include "tree_sitter/parser.h"
|
||||
|
||||
extern TSStateId TS_TREE_STATE_NONE;
|
||||
|
|
@ -285,4 +285,4 @@ static inline MutableSubtree ts_subtree_to_mut_unsafe(Subtree self) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // RUNTIME_SUBTREE_H_
|
||||
#endif // TREE_SITTER_SUBTREE_H_
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#include "tree_sitter/runtime.h"
|
||||
#include "tree_sitter/api.h"
|
||||
#include "./array.h"
|
||||
#include "./get_changed_ranges.h"
|
||||
#include "./subtree.h"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef RUNTIME_TREE_H_
|
||||
#define RUNTIME_TREE_H_
|
||||
#ifndef TREE_SITTER_TREE_H_
|
||||
#define TREE_SITTER_TREE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -31,4 +31,4 @@ void ts_tree_set_cached_parent(const TSTree *, const TSNode *, const TSNode *);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // RUNTIME_TREE_H_
|
||||
#endif // TREE_SITTER_TREE_H_
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#include "tree_sitter/runtime.h"
|
||||
#include "tree_sitter/api.h"
|
||||
#include "./alloc.h"
|
||||
#include "./tree_cursor.h"
|
||||
#include "./language.h"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef RUNTIME_TREE_CURSOR_H_
|
||||
#define RUNTIME_TREE_CURSOR_H_
|
||||
#ifndef TREE_SITTER_TREE_CURSOR_H_
|
||||
#define TREE_SITTER_TREE_CURSOR_H_
|
||||
|
||||
#include "./subtree.h"
|
||||
|
||||
|
|
@ -17,4 +17,4 @@ typedef struct {
|
|||
|
||||
void ts_tree_cursor_init(TreeCursor *, TSNode);
|
||||
|
||||
#endif // RUNTIME_TREE_CURSOR_H_
|
||||
#endif // TREE_SITTER_TREE_CURSOR_H_
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef RUNTIME_UTF16_H_
|
||||
#define RUNTIME_UTF16_H_
|
||||
#ifndef TREE_SITTER_UTF16_H_
|
||||
#define TREE_SITTER_UTF16_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -18,4 +18,4 @@ utf8proc_ssize_t utf16_iterate(const utf8proc_uint8_t *, utf8proc_ssize_t, utf8p
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // RUNTIME_UTF16_H_
|
||||
#endif // TREE_SITTER_UTF16_H_
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
output_path=lib/binding/bindings.rs
|
||||
header_path='lib/include/tree_sitter/runtime.h'
|
||||
header_path='lib/include/tree_sitter/api.h'
|
||||
|
||||
bindgen \
|
||||
--no-layout-tests \
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ ${CC} \
|
|||
-I lib/src \
|
||||
-I lib/include \
|
||||
-I lib/utf8proc \
|
||||
lib/src/runtime.c \
|
||||
lib/src/lib.c \
|
||||
-o tree-sitter.o
|
||||
|
||||
ar rcs libtree-sitter.a tree-sitter.o
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#include <cassert>
|
||||
#include "tree_sitter/runtime.h"
|
||||
#include "tree_sitter/api.h"
|
||||
|
||||
extern "C" const TSLanguage *TS_LANG();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue