1#include "tree_sitter/alloc.h"
2#include "tree_sitter/parser.h"
42static inline bool is_num_char(int32_t c) {
return c ==
'_' || iswdigit(c); }
44static inline void advance(TSLexer *lexer) { lexer->advance(lexer,
false); }
46static inline void skip(TSLexer *lexer) { lexer->advance(lexer,
true); }
49 bool has_content =
false;
51 if (lexer->lookahead ==
'\"' || lexer->lookahead ==
'\\') {
54 if (lexer->eof(lexer)) {
61 lexer->mark_end(lexer);
66 if (lexer->lookahead ==
'b' || lexer->lookahead ==
'c') {
69 if (lexer->lookahead !=
'r') {
74 uint8_t opening_hash_count = 0;
75 while (lexer->lookahead ==
'#') {
80 if (lexer->lookahead !=
'"') {
92 if (lexer->eof(lexer)) {
95 if (lexer->lookahead ==
'"') {
96 lexer->mark_end(lexer);
98 unsigned hash_count = 0;
99 while (lexer->lookahead ==
'#' && hash_count < scanner->opening_hash_count) {
130 bool has_fraction =
false, has_exponent =
false;
132 if (lexer->lookahead ==
'.') {
135 if (iswalpha(lexer->lookahead)) {
140 if (lexer->lookahead ==
'.') {
148 lexer->mark_end(lexer);
150 if (lexer->lookahead ==
'e' || lexer->lookahead ==
'E') {
153 if (lexer->lookahead ==
'+' || lexer->lookahead ==
'-') {
164 lexer->mark_end(lexer);
167 if (!has_exponent && !has_fraction) {
171 if (lexer->lookahead !=
'u' && lexer->lookahead !=
'i' && lexer->lookahead !=
'f') {
175 if (!iswdigit(lexer->lookahead)) {
179 while (iswdigit(lexer->lookahead)) {
183 lexer->mark_end(lexer);
190 if (lexer->eof(lexer)) {
193 if (lexer->lookahead ==
'\n') {
215 if (current ==
'*') {
222 if (current ==
'*') {
223 lexer->mark_end(lexer);
228 if (current ==
'/') {
247 char first = (char)lexer->lookahead;
261 lexer->mark_end(lexer);
263 if (lexer->lookahead ==
'/') {
268 if (lexer->lookahead !=
'*') {
282 if (lexer->lookahead ==
'/') {
302 while (!lexer->eof(lexer) && processing.
nestingDepth != 0) {
307 first = (char)lexer->lookahead;
308 switch (processing.
state) {
316 lexer->mark_end(lexer);
324 lexer->mark_end(lexer);
371 while (iswspace(lexer->lookahead)) {
376 (lexer->lookahead ==
'r' || lexer->lookahead ==
'b' || lexer->lookahead ==
'c')) {
388 if (valid_symbols[
FLOAT_LITERAL] && iswdigit(lexer->lookahead)) {
static bool scan_raw_string_start(Scanner *scanner, TSLexer *lexer)
static void advance(TSLexer *lexer)
void tree_sitter_rust_external_scanner_destroy(void *payload)
static bool process_block_comment(TSLexer *lexer, const bool *valid_symbols)
static bool process_float_literal(TSLexer *lexer)
void * tree_sitter_rust_external_scanner_create()
void tree_sitter_rust_external_scanner_deserialize(void *payload, const char *buffer, unsigned length)
static void process_continuing(BlockCommentProcessing *processing, char current)
static void process_left_forward_slash(BlockCommentProcessing *processing, char current)
static void skip(TSLexer *lexer)
static bool process_line_doc_content(TSLexer *lexer)
static bool is_num_char(int32_t c)
static void process_left_asterisk(BlockCommentProcessing *processing, char current, TSLexer *lexer)
static bool process_string(TSLexer *lexer)
@ RAW_STRING_LITERAL_START
@ RAW_STRING_LITERAL_CONTENT
bool tree_sitter_rust_external_scanner_scan(void *payload, TSLexer *lexer, const bool *valid_symbols)
unsigned tree_sitter_rust_external_scanner_serialize(void *payload, char *buffer)
static bool scan_raw_string_end(Scanner *scanner, TSLexer *lexer)
static bool scan_raw_string_content(Scanner *scanner, TSLexer *lexer)
uint8_t opening_hash_count