Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change error message for unterminated strings with interpolation. #389

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions numbat/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ pub enum ParseErrorKind {
#[error("Expected 'else' in if-then-else condition")]
ExpectedElse,

#[error("Unterminated string interpolation")]
UnterminatedStringInterpolation,
#[error("Unterminated string")]
UnterminatedString,

#[error("Expected a string")]
ExpectedString,
Expand Down Expand Up @@ -1169,8 +1169,9 @@ impl<'a> Parser<'a> {
}

if !has_end {
span_full_string = span_full_string.extend(&self.last().unwrap().span);
return Err(ParseError::new(
ParseErrorKind::UnterminatedStringInterpolation,
ParseErrorKind::UnterminatedString,
span_full_string,
));
}
Expand Down Expand Up @@ -2537,10 +2538,7 @@ mod tests {
),
);

should_fail_with(
&["\"test {1"],
ParseErrorKind::UnterminatedStringInterpolation,
);
should_fail_with(&["\"test {1"], ParseErrorKind::UnterminatedString);
}

#[test]
Expand Down
Loading