~lattis/muon

20986952b7ff159465ef78b090c26587fbe07dc0 — Stone Tickle a month ago 24c401f
fix quotes inside multiline strings
2 files changed, 13 insertions(+), 0 deletions(-)

M src/lang/lexer.c
M tests/multiline.meson
M src/lang/lexer.c => src/lang/lexer.c +6 -0
@@ 547,6 547,12 @@ lex_string_char(struct lexer *lexer, struct token **tok, bool multiline, bool fs
		++(*quotes);
		got_quote = false;
	} else {
		uint32_t i;
		for (i = 0; i < *quotes; ++i) {
			str[token->n] = '\'';
			++token->n;
		}

		*quotes = 0;
	}


M tests/multiline.meson => tests/multiline.meson +7 -0
@@ 4,3 4,10 @@ def'''
assert(single_line == 'test')
assert(multi_line == '''abc
def''')

quote1 = ''' ' '''.strip()
assert(quote1 == '\'')

quote2 = ''' '' '' '''.strip()
dbl = '\'\''
assert(quote2 == ' '.join([dbl, dbl]))