Skip to content

Commit

Permalink
Consider trivia when testing string interpolation double brace (#283)
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnnyMorganz authored Aug 26, 2023
1 parent cce846a commit 75c0dc5
Show file tree
Hide file tree
Showing 4 changed files with 1,576 additions and 6 deletions.
14 changes: 8 additions & 6 deletions full-moon/src/ast/parsers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1311,12 +1311,14 @@ fn parse_interpolated_string(

loop {
// Could be done in the tokenizer, but our error tooling there is a lot worse
if matches!(
state.peek().token_type,
TokenType::Symbol {
symbol: Symbol::LeftBrace
}
) {
if current.trailing_trivia.is_empty()
&& matches!(
state.peek().token_type,
TokenType::Symbol {
symbol: Symbol::LeftBrace
}
)
{
return Err(InternalAstError::UnexpectedToken {
token: state.peek().clone(),
additional: Some("unexpected double brace for interpolated string. try \\{ if you meant to escape".into()),
Expand Down
Loading

0 comments on commit 75c0dc5

Please sign in to comment.