Merge branch 'master' into changed-ranges
This commit is contained in:
commit
eed54d95e1
28 changed files with 218 additions and 208 deletions
|
|
@ -5,20 +5,16 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "tree_sitter/runtime.h"
|
||||
|
||||
#define TS_STATE_ERROR 0
|
||||
#define TS_DEBUG_BUFFER_SIZE 512
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef unsigned short TSSymbol;
|
||||
typedef unsigned short TSStateId;
|
||||
|
||||
typedef struct {
|
||||
size_t bytes;
|
||||
size_t chars;
|
||||
TSPoint extent;
|
||||
} TSLength;
|
||||
#define ts_builtin_sym_error ((TSSymbol)-1)
|
||||
#define ts_builtin_sym_end 0
|
||||
#define ts_builtin_sym_start 1
|
||||
|
||||
typedef struct {
|
||||
bool visible : 1;
|
||||
|
|
@ -27,23 +23,10 @@ typedef struct {
|
|||
bool structural : 1;
|
||||
} TSSymbolMetadata;
|
||||
|
||||
typedef struct TSLexer {
|
||||
void (*advance)(struct TSLexer *, TSStateId, bool);
|
||||
|
||||
TSLength current_position;
|
||||
TSLength token_start_position;
|
||||
|
||||
const char *chunk;
|
||||
size_t chunk_start;
|
||||
size_t chunk_size;
|
||||
|
||||
size_t lookahead_size;
|
||||
typedef struct {
|
||||
void (*advance)(void *, TSStateId, bool);
|
||||
int32_t lookahead;
|
||||
TSSymbol result_symbol;
|
||||
|
||||
TSInput input;
|
||||
TSLogger logger;
|
||||
char debug_buffer[TS_DEBUG_BUFFER_SIZE];
|
||||
} TSLexer;
|
||||
|
||||
typedef enum {
|
||||
|
|
@ -75,7 +58,7 @@ typedef union {
|
|||
};
|
||||
} TSParseActionEntry;
|
||||
|
||||
struct TSLanguage {
|
||||
typedef struct TSLanguage {
|
||||
size_t symbol_count;
|
||||
const char **symbol_names;
|
||||
const TSSymbolMetadata *symbol_metadata;
|
||||
|
|
@ -83,7 +66,7 @@ struct TSLanguage {
|
|||
const TSParseActionEntry *parse_actions;
|
||||
const TSStateId *lex_states;
|
||||
bool (*lex_fn)(TSLexer *, TSStateId);
|
||||
};
|
||||
} TSLanguage;
|
||||
|
||||
/*
|
||||
* Lexer Macros
|
||||
|
|
@ -94,18 +77,18 @@ struct TSLanguage {
|
|||
next_state: \
|
||||
lookahead = lexer->lookahead;
|
||||
|
||||
#define ADVANCE(state_value) \
|
||||
{ \
|
||||
#define ADVANCE(state_value) \
|
||||
{ \
|
||||
lexer->advance(lexer, state_value, false); \
|
||||
state = state_value; \
|
||||
goto next_state; \
|
||||
state = state_value; \
|
||||
goto next_state; \
|
||||
}
|
||||
|
||||
#define SKIP(state_value) \
|
||||
{ \
|
||||
#define SKIP(state_value) \
|
||||
{ \
|
||||
lexer->advance(lexer, state_value, true); \
|
||||
state = state_value; \
|
||||
goto next_state; \
|
||||
state = state_value; \
|
||||
goto next_state; \
|
||||
}
|
||||
|
||||
#define ACCEPT_TOKEN(symbol_value) \
|
||||
|
|
|
|||
|
|
@ -114,10 +114,6 @@ size_t ts_document_parse_count(const TSDocument *);
|
|||
size_t ts_language_symbol_count(const TSLanguage *);
|
||||
const char *ts_language_symbol_name(const TSLanguage *, TSSymbol);
|
||||
|
||||
#define ts_builtin_sym_error ((TSSymbol)-1)
|
||||
#define ts_builtin_sym_end 0
|
||||
#define ts_builtin_sym_start 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue