Skip to content

Commit

Permalink
feat: allow empty raw strings, add test with empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdgo committed Nov 21, 2024
1 parent 22a2c0e commit eaf34d3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/scanner.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ static bool scan_raw_string_content(TSLexer *lexer, Scanner *s) {
adv;
uint8_t level = consume_chars(lexer, '#');
lexer->log(lexer, "Consumed [%i] #\n", level);
if (level == s->level && len != 0) {
if (level == s->level) {
lexer->log(lexer, "Detected end\n" );
return true;
} else if (level == s->level && len == 0) {
Expand Down
16 changes: 16 additions & 0 deletions test/corpus/decl/raw-strings.nu
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,19 @@ r#####'string '#'##'#####
(raw_string_begin)
(raw_string_content)
(raw_string_end)))))

=====
raw-strings-005-empty-string
=====

r#''#

-----

(nu_script
(pipeline
(pipe_element
(val_string
(raw_string_begin)
(raw_string_content)
(raw_string_end)))))

0 comments on commit eaf34d3

Please sign in to comment.