diff options
| author | Martin Haug <mhaug@live.de> | 2021-10-31 16:22:33 +0100 |
|---|---|---|
| committer | Martin Haug <mhaug@live.de> | 2021-11-05 13:44:49 +0100 |
| commit | c569e14c07902b23b7b3e29df4076cea1f4496cf (patch) | |
| tree | 0e15d7d38df988718a6172810aa0dadf3cc9b43e /src/syntax/mod.rs | |
| parent | 1c0ac793d2b9c403f1a8fa60a3748f4ff8623acb (diff) | |
Improve error handling
Diffstat (limited to 'src/syntax/mod.rs')
| -rw-r--r-- | src/syntax/mod.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/syntax/mod.rs b/src/syntax/mod.rs index ca5b6a1b..afa0ab86 100644 --- a/src/syntax/mod.rs +++ b/src/syntax/mod.rs @@ -162,6 +162,8 @@ pub enum NodeKind { BlockComment, /// Tokens that appear in the wrong place. Error(ErrorPosition, EcoString), + /// Unknown character sequences. + Unknown(EcoString), /// Template markup. Markup, /// A forced line break: `\`. @@ -375,10 +377,11 @@ impl NodeKind { Self::ImportExpr => "import expression", Self::ImportItems => "import items", Self::IncludeExpr => "include expression", - Self::Error(_, src) => match src.as_str() { + Self::Unknown(src) => match src.as_str() { "*/" => "end of block comment", _ => "invalid token", }, + Self::Error(_, _) => "parse error", } } } |
