I NEED TO REDO THE LEX FUNCTION LETZGO :(((((((
This commit is contained in:
parent
c7fe19a7d5
commit
61fd72480e
20 changed files with 5173 additions and 12 deletions
|
|
@ -14,8 +14,8 @@
|
|||
#include "../static/headers/symbols.h"
|
||||
#include "./parser.h"
|
||||
|
||||
bool lex_keywords_main(TSLexer *lexer, TSStateId state);
|
||||
bool lex_normal_main(TSLexer *lexer, TSStateId state);
|
||||
// bool lex_keywords_main(TSLexer *lexer, TSStateId state);
|
||||
// bool lex_normal_main(TSLexer *lexer, TSStateId state);
|
||||
bool tree_sitter_sh_external_scanner_scan(void *ctx, TSLexer *lexer, const bool *ret);
|
||||
void *create_external_scanner_states(void);
|
||||
void *create_field_names(void);
|
||||
|
|
@ -33,6 +33,8 @@ void *create_symbols_metadata(void);
|
|||
void *create_parse_table(void);
|
||||
void *create_small_parse_table(void);
|
||||
void *create_small_parse_table_map(void);
|
||||
bool ts_lex_keywords(TSLexer *lexer, TSStateId state);
|
||||
bool ts_lex_keywords(TSLexer *lexer, TSStateId state);
|
||||
|
||||
uint32_t tree_sitter_sh_external_scanner_serialize(void *ctx, char *s);
|
||||
void tree_sitter_sh_external_scanner_deserialize(void *ctx, const char *s, uint32_t val);
|
||||
|
|
@ -68,8 +70,8 @@ static void init_language(TSLanguage *language)
|
|||
language->alias_sequences = create_alias_sequences();
|
||||
language->lex_modes = create_lex_modes();
|
||||
language->primary_state_ids = create_primary_state_ids();
|
||||
language->lex_fn = lex_normal_main;
|
||||
language->keyword_lex_fn = lex_keywords_main;
|
||||
language->lex_fn = ts_lex;
|
||||
language->keyword_lex_fn = ts_lex_keywords;
|
||||
language->keyword_capture_token = sym_word;
|
||||
language->external_scanner = init_scanner();
|
||||
}
|
||||
|
|
|
|||
5162
parser/src/lex.c
Normal file
5162
parser/src/lex.c
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -12,6 +12,6 @@
|
|||
#include "./tree.c"
|
||||
#include "./tree_cursor.c"
|
||||
#include "./wasm_store.c"
|
||||
|
||||
#include "./lex.c"
|
||||
#include "./create_language.c"
|
||||
#include "./scanner.c"
|
||||
|
|
|
|||
|
|
@ -26,20 +26,18 @@ static inline uint32_t ts_decode_ascii(const uint8_t *string, uint32_t length, i
|
|||
|
||||
static inline uint32_t ts_decode_utf8(const uint8_t *string, uint32_t length, int32_t *code_point)
|
||||
{
|
||||
return (ts_decode_ascii(string, length, code_point));
|
||||
/*
|
||||
return (ts_decode_ascii(string, length, code_point));
|
||||
/*
|
||||
uint32_t i = 0;
|
||||
U8_NEXT(string, i, length, *code_point);
|
||||
printf("[UTF8]read %i bytes\n", i);
|
||||
return i;
|
||||
*/
|
||||
*/
|
||||
}
|
||||
|
||||
static inline uint32_t ts_decode_utf16(const uint8_t *string, uint32_t length, int32_t *code_point)
|
||||
{
|
||||
uint32_t i = 0;
|
||||
U16_NEXT(((uint16_t *)string), i, length, *code_point);
|
||||
printf("[UTF16]read %i bytes\n", i);
|
||||
return i * 2;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue