Use friendly_list in syntax error message

This commit is contained in:
Darren Burns
2022-08-18 10:28:55 +01:00
parent ec4445ee4d
commit 113ac87c9e
2 changed files with 3 additions and 2 deletions

View File

@@ -4,7 +4,7 @@ Screen {
#left_pane {
background: red;
width: 20;
width: 20
overflow: scroll scroll;
}

View File

@@ -12,6 +12,7 @@ import rich.repr
from rich.syntax import Syntax
from rich.text import Text
from ._error_tools import friendly_list
from .._loop import loop_last
@@ -203,7 +204,7 @@ class Tokenizer:
line = self.lines[line_no]
match = expect.match(line, col_no)
if match is None:
expected = ", ".join(" ".join(name.split("_")) for name in expect.names)
expected = friendly_list(" ".join(name.split("_")) for name in expect.names)
message = f"Expected one of {expected}.; Did you forget a semicolon at the end of a line?"
raise TokenError(
self.path,