diff --git a/src/syntax/parser.rs b/src/syntax/parser.rs index d966df98c..3b89e71c5 100644 --- a/src/syntax/parser.rs +++ b/src/syntax/parser.rs @@ -529,7 +529,9 @@ fn embedded_code_expr(p: &mut Parser) { p.unexpected(); } - let semi = p.eat_if(SyntaxKind::Semicolon); + let semi = + (stmt || p.directly_at(SyntaxKind::Semicolon)) && p.eat_if(SyntaxKind::Semicolon); + if stmt && !semi && !p.eof() && !p.at(SyntaxKind::RightBracket) { p.expected("semicolon or line break"); } diff --git a/tests/ref/text/space.png b/tests/ref/text/space.png index 09efda70e..cfbf886d9 100644 Binary files a/tests/ref/text/space.png and b/tests/ref/text/space.png differ diff --git a/tests/typ/text/space.typ b/tests/typ/text/space.typ index 21ee35723..b95da8720 100644 --- a/tests/typ/text/space.typ +++ b/tests/typ/text/space.typ @@ -10,6 +10,10 @@ K #if true [L] else []M \ #let c = true; N#while c [#(c = false)O] P \ #let c = true; Q #while c { c = false; "R" } S \ T#for _ in (none,) {"U"}V +#let foo = "A" ; \ +#foo;B \ +#foo; B \ +#foo ;B --- // Test spacing with comments.