diff options
author | Akshay <[email protected]> | 2021-03-29 05:54:49 +0100 |
---|---|---|
committer | Akshay <[email protected]> | 2021-03-29 05:54:49 +0100 |
commit | 992141878227439cd517d05b68f15e57d77452a5 (patch) | |
tree | d754797718cbe3b551e2abd737ccd1d0986d6b55 /src/lisp/error.rs | |
parent | 9632fdd69442b10972cc1f71f7a2f11ecc1ca47a (diff) |
fix: handle unterminated strings gracefully
Diffstat (limited to 'src/lisp/error.rs')
-rw-r--r-- | src/lisp/error.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lisp/error.rs b/src/lisp/error.rs index a360eb2..6d28c22 100644 --- a/src/lisp/error.rs +++ b/src/lisp/error.rs | |||
@@ -30,9 +30,9 @@ impl ParseError { | |||
30 | pub fn new(span: Span, kind: ParseErrorKind) -> Self { | 30 | pub fn new(span: Span, kind: ParseErrorKind) -> Self { |
31 | Self { span, kind } | 31 | Self { span, kind } |
32 | } | 32 | } |
33 | pub fn fmt(&self, f: &mut fmt::Formatter<'_>, text: &str) -> fmt::Result { | 33 | pub fn display(&self, text: &str) -> String { |
34 | let SpanDisplay { line, col, .. } = SpanDisplay::highlight_span(self.span, text); | 34 | let SpanDisplay { line, col, .. } = SpanDisplay::highlight_span(self.span, text); |
35 | write!(f, "line {}, col {}: {}", line, col, self.kind) | 35 | format!("line {}, col {}: {}", line, col, self.kind) |
36 | } | 36 | } |
37 | } | 37 | } |
38 | 38 | ||