Skip to content

Commit 03b823b

Browse files
committed
Less conservative char escaping
With the !isempty check, terminal newlines as appear in styled"stuff\ " or similar are not eaten, and so parsed as "stuff\\\n". This differs to the EBNF and standard string parsing (which we aim to emulate), which parses "stuff\ " as "stuff". While the !isempty check is a nice sign that I wa sbeing careful writing the code here, it's actually safe when the state is empty, and no errors appear in the syntax fuzzing tests. So, all in all, it seems like we're better off without the !isempty check.
1 parent 8985a37 commit 03b823b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/styledmarkup.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ function escaped!(state::State, i::Int, char::Char)
285285
if char in ('{', '}', '\\') || (char == '$' && ismacro(state))
286286
deleteat!(state.bytes, i + state.offset - 1)
287287
state.offset -= ncodeunits('\\')
288-
elseif char ('\n', '\r') && !isempty(state.s)
288+
elseif char ('\n', '\r')
289289
skipped = 0
290290
if char == '\r' && isnextchar(state, '\n')
291291
popfirst!(state.s)

0 commit comments

Comments
 (0)