|
LLDB mainline
|
#include "tree_sitter/parser.h"#include <string.h>#include <wctype.h>Go to the source code of this file.
Classes | |
| struct | ScannerState |
Macros | |
| #define | TOKEN_COUNT 33 |
| #define | OPERATOR_COUNT 20 |
| #define | RESERVED_OP_COUNT 31 |
| #define | NON_CONSUMING_CROSS_SEMI_CHAR_COUNT 3 |
| #define | DIRECTIVE_COUNT 4 |
Enumerations | |
| enum | TokenType { BLOCK_COMMENT , RAW_STR_PART , RAW_STR_CONTINUING_INDICATOR , RAW_STR_END_PART , IMPLICIT_SEMI , EXPLICIT_SEMI , ARROW_OPERATOR , DOT_OPERATOR , CONJUNCTION_OPERATOR , DISJUNCTION_OPERATOR , NIL_COALESCING_OPERATOR , EQUAL_SIGN , EQ_EQ , PLUS_THEN_WS , MINUS_THEN_WS , BANG , THROWS_KEYWORD , RETHROWS_KEYWORD , DEFAULT_KEYWORD , WHERE_KEYWORD , ELSE_KEYWORD , CATCH_KEYWORD , AS_KEYWORD , AS_QUEST , AS_BANG , ASYNC_KEYWORD , CUSTOM_OPERATOR , HASH_SYMBOL , DIRECTIVE_IF , DIRECTIVE_ELSEIF , DIRECTIVE_ELSE , DIRECTIVE_ENDIF , FAKE_TRY_BANG } |
| enum | IllegalTerminatorGroup { ALPHANUMERIC , OPERATOR_SYMBOLS , OPERATOR_OR_DOT , NON_WHITESPACE } |
| enum | ParseDirective { CONTINUE_PARSING_NOTHING_FOUND , CONTINUE_PARSING_TOKEN_FOUND , CONTINUE_PARSING_SLASH_CONSUMED , STOP_PARSING_NOTHING_FOUND , STOP_PARSING_TOKEN_FOUND , STOP_PARSING_END_OF_FILE } |
| All possible results of having performed some sort of parsing. More... | |
Functions | |
| static bool | is_cross_semi_token (enum TokenType op) |
| void * | tree_sitter_swift_external_scanner_create () |
| void | tree_sitter_swift_external_scanner_destroy (void *payload) |
| void | tree_sitter_swift_external_scanner_reset (void *payload) |
| unsigned | tree_sitter_swift_external_scanner_serialize (void *payload, char *buffer) |
| void | tree_sitter_swift_external_scanner_deserialize (void *payload, const char *buffer, unsigned length) |
| static void | advance (TSLexer *lexer) |
| static bool | should_treat_as_wspace (int32_t character) |
| static int32_t | encountered_op_count (bool *encountered_operator) |
| static bool | any_reserved_ops (uint8_t *encountered_reserved_ops) |
| static bool | is_legal_custom_operator (int32_t char_idx, int32_t first_char, int32_t cur_char) |
| static bool | eat_operators (TSLexer *lexer, const bool *valid_symbols, bool mark_end, const int32_t prior_char, enum TokenType *symbol_result) |
| static enum ParseDirective | eat_comment (TSLexer *lexer, const bool *valid_symbols, bool mark_end, enum TokenType *symbol_result) |
| static enum ParseDirective | eat_whitespace (TSLexer *lexer, const bool *valid_symbols, enum TokenType *symbol_result) |
| static enum TokenType | find_possible_compiler_directive (TSLexer *lexer) |
| static bool | eat_raw_str_part (struct ScannerState *state, TSLexer *lexer, const bool *valid_symbols, enum TokenType *symbol_result) |
| bool | tree_sitter_swift_external_scanner_scan (void *payload, TSLexer *lexer, const bool *valid_symbols) |
Variables | |
| const char * | OPERATORS [OPERATOR_COUNT] |
| enum IllegalTerminatorGroup | OP_ILLEGAL_TERMINATORS [OPERATOR_COUNT] |
| enum TokenType | OP_SYMBOLS [OPERATOR_COUNT] |
| const uint64_t | OP_SYMBOL_SUPPRESSOR [OPERATOR_COUNT] |
| const char * | RESERVED_OPS [RESERVED_OP_COUNT] |
| const uint32_t | NON_CONSUMING_CROSS_SEMI_CHARS [NON_CONSUMING_CROSS_SEMI_CHAR_COUNT] |
| const char * | DIRECTIVES [OPERATOR_COUNT] = {"if", "elseif", "else", "endif"} |
| enum TokenType | DIRECTIVE_SYMBOLS [DIRECTIVE_COUNT] |
| #define DIRECTIVE_COUNT 4 |
Definition at line 642 of file Swift/tree-sitter-swift/scanner.c.
Referenced by find_possible_compiler_directive().
| #define NON_CONSUMING_CROSS_SEMI_CHAR_COUNT 3 |
Definition at line 160 of file Swift/tree-sitter-swift/scanner.c.
Referenced by eat_whitespace().
| #define OPERATOR_COUNT 20 |
Definition at line 43 of file Swift/tree-sitter-swift/scanner.c.
Referenced by eat_operators(), and encountered_op_count().
| #define RESERVED_OP_COUNT 31 |
Definition at line 124 of file Swift/tree-sitter-swift/scanner.c.
Referenced by any_reserved_ops(), and eat_operators().
| #define TOKEN_COUNT 33 |
Definition at line 5 of file Swift/tree-sitter-swift/scanner.c.
Referenced by eat_operators().
| Enumerator | |
|---|---|
| ALPHANUMERIC | |
| OPERATOR_SYMBOLS | |
| OPERATOR_OR_DOT | |
| NON_WHITESPACE | |
Definition at line 50 of file Swift/tree-sitter-swift/scanner.c.
| enum ParseDirective |
All possible results of having performed some sort of parsing.
A parser can return a result along two dimensions:
These are flattened into a single enum together. When the function returns one of the TOKEN_FOUND cases, it will always populate its symbol_result field. When it returns one of the STOP_PARSING cases, callers should immediately return (with the value, if there is one).
| Enumerator | |
|---|---|
| CONTINUE_PARSING_NOTHING_FOUND | |
| CONTINUE_PARSING_TOKEN_FOUND | |
| CONTINUE_PARSING_SLASH_CONSUMED | |
| STOP_PARSING_NOTHING_FOUND | |
| STOP_PARSING_TOKEN_FOUND | |
| STOP_PARSING_END_OF_FILE | |
Definition at line 177 of file Swift/tree-sitter-swift/scanner.c.
| enum TokenType |
Definition at line 7 of file Swift/tree-sitter-swift/scanner.c.
|
static |
Definition at line 228 of file Swift/tree-sitter-swift/scanner.c.
Referenced by eat_comment(), and eat_raw_str_part().
|
static |
Definition at line 245 of file Swift/tree-sitter-swift/scanner.c.
References RESERVED_OP_COUNT.
Referenced by eat_operators().
|
static |
Definition at line 473 of file Swift/tree-sitter-swift/scanner.c.
References advance(), BLOCK_COMMENT, CONTINUE_PARSING_NOTHING_FOUND, CONTINUE_PARSING_SLASH_CONSUMED, STOP_PARSING_END_OF_FILE, and STOP_PARSING_TOKEN_FOUND.
Referenced by eat_whitespace(), and tree_sitter_swift_external_scanner_scan().
|
static |
Definition at line 310 of file Swift/tree-sitter-swift/scanner.c.
References ALPHANUMERIC, any_reserved_ops(), CUSTOM_OPERATOR, encountered_op_count(), is_legal_custom_operator(), NON_WHITESPACE, OP_ILLEGAL_TERMINATORS, OP_SYMBOL_SUPPRESSOR, OP_SYMBOLS, OPERATOR_COUNT, OPERATOR_OR_DOT, OPERATOR_SYMBOLS, OPERATORS, RESERVED_OP_COUNT, RESERVED_OPS, and TOKEN_COUNT.
Referenced by eat_whitespace(), and tree_sitter_swift_external_scanner_scan().
|
static |
Definition at line 697 of file Swift/tree-sitter-swift/scanner.c.
References advance(), find_possible_compiler_directive(), ScannerState::ongoing_raw_str_hash_count, RAW_STR_CONTINUING_INDICATOR, RAW_STR_END_PART, and RAW_STR_PART.
Referenced by tree_sitter_swift_external_scanner_scan().
|
static |
Definition at line 527 of file Swift/tree-sitter-swift/scanner.c.
References CONTINUE_PARSING_NOTHING_FOUND, CONTINUE_PARSING_SLASH_CONSUMED, CONTINUE_PARSING_TOKEN_FOUND, eat_comment(), eat_operators(), EXPLICIT_SEMI, IMPLICIT_SEMI, NON_CONSUMING_CROSS_SEMI_CHAR_COUNT, NON_CONSUMING_CROSS_SEMI_CHARS, should_treat_as_wspace(), STOP_PARSING_END_OF_FILE, STOP_PARSING_NOTHING_FOUND, and STOP_PARSING_TOKEN_FOUND.
Referenced by tree_sitter_swift_external_scanner_scan().
|
static |
Definition at line 234 of file Swift/tree-sitter-swift/scanner.c.
References OPERATOR_COUNT.
Referenced by eat_operators().
|
static |
Definition at line 648 of file Swift/tree-sitter-swift/scanner.c.
References DIRECTIVE_COUNT, DIRECTIVE_SYMBOLS, DIRECTIVES, and HASH_SYMBOL.
Referenced by eat_raw_str_part().
Definition at line 131 of file Swift/tree-sitter-swift/scanner.c.
References ARROW_OPERATOR, AS_BANG, AS_KEYWORD, AS_QUEST, ASYNC_KEYWORD, BANG, CATCH_KEYWORD, CONJUNCTION_OPERATOR, CUSTOM_OPERATOR, DEFAULT_KEYWORD, DISJUNCTION_OPERATOR, DOT_OPERATOR, ELSE_KEYWORD, EQ_EQ, EQUAL_SIGN, MINUS_THEN_WS, NIL_COALESCING_OPERATOR, PLUS_THEN_WS, RETHROWS_KEYWORD, THROWS_KEYWORD, and WHERE_KEYWORD.
Referenced by tree_sitter_swift_external_scanner_scan().
|
static |
Definition at line 255 of file Swift/tree-sitter-swift/scanner.c.
Referenced by eat_operators().
|
static |
Definition at line 230 of file Swift/tree-sitter-swift/scanner.c.
Referenced by eat_whitespace().
| void * tree_sitter_swift_external_scanner_create | ( | ) |
Definition at line 190 of file Swift/tree-sitter-swift/scanner.c.
| void tree_sitter_swift_external_scanner_deserialize | ( | void * | payload, |
| const char * | buffer, | ||
| unsigned | length ) |
Definition at line 214 of file Swift/tree-sitter-swift/scanner.c.
References ScannerState::ongoing_raw_str_hash_count.
| void tree_sitter_swift_external_scanner_destroy | ( | void * | payload | ) |
Definition at line 194 of file Swift/tree-sitter-swift/scanner.c.
| void tree_sitter_swift_external_scanner_reset | ( | void * | payload | ) |
Definition at line 198 of file Swift/tree-sitter-swift/scanner.c.
References ScannerState::ongoing_raw_str_hash_count.
| bool tree_sitter_swift_external_scanner_scan | ( | void * | payload, |
| TSLexer * | lexer, | ||
| const bool * | valid_symbols ) |
Definition at line 793 of file Swift/tree-sitter-swift/scanner.c.
References CONTINUE_PARSING_SLASH_CONSUMED, CONTINUE_PARSING_TOKEN_FOUND, eat_comment(), eat_operators(), eat_raw_str_part(), eat_whitespace(), is_cross_semi_token(), STOP_PARSING_END_OF_FILE, STOP_PARSING_NOTHING_FOUND, and STOP_PARSING_TOKEN_FOUND.
| unsigned tree_sitter_swift_external_scanner_serialize | ( | void * | payload, |
| char * | buffer ) |
Definition at line 203 of file Swift/tree-sitter-swift/scanner.c.
References ScannerState::ongoing_raw_str_hash_count.
| enum TokenType DIRECTIVE_SYMBOLS[DIRECTIVE_COUNT] |
Definition at line 645 of file Swift/tree-sitter-swift/scanner.c.
Referenced by find_possible_compiler_directive().
| const char* DIRECTIVES[OPERATOR_COUNT] = {"if", "elseif", "else", "endif"} |
Definition at line 643 of file Swift/tree-sitter-swift/scanner.c.
Referenced by find_possible_compiler_directive().
| const uint32_t NON_CONSUMING_CROSS_SEMI_CHARS[NON_CONSUMING_CROSS_SEMI_CHAR_COUNT] |
Definition at line 162 of file Swift/tree-sitter-swift/scanner.c.
Referenced by eat_whitespace().
| enum IllegalTerminatorGroup OP_ILLEGAL_TERMINATORS[OPERATOR_COUNT] |
Definition at line 57 of file Swift/tree-sitter-swift/scanner.c.
Referenced by eat_operators().
| const uint64_t OP_SYMBOL_SUPPRESSOR[OPERATOR_COUNT] |
Definition at line 101 of file Swift/tree-sitter-swift/scanner.c.
Referenced by eat_operators().
| enum TokenType OP_SYMBOLS[OPERATOR_COUNT] |
Definition at line 80 of file Swift/tree-sitter-swift/scanner.c.
Referenced by eat_operators().
| const char* OPERATORS[OPERATOR_COUNT] |
Definition at line 45 of file Swift/tree-sitter-swift/scanner.c.
Referenced by eat_operators().
| const char* RESERVED_OPS[RESERVED_OP_COUNT] |
Definition at line 126 of file Swift/tree-sitter-swift/scanner.c.
Referenced by eat_operators().