Fix lexing a dot '.' as a symbol

Fixes #652
This commit is contained in:
Timmy Welch 2024-06-01 00:00:09 -07:00
parent 7bbc3f3e2c
commit 979a54e2b8
3 changed files with 39 additions and 2 deletions

View File

@ -414,7 +414,7 @@ def is_operator(character: str) -> bool:
def is_symbol(character: str) -> bool:
return unicodedata.category(character)[0] in "PS"
return unicodedata.category(character)[0] in "PS" and character != "."
def Lex(filename: str, allow_issue_start_with_letter: bool = False) -> Lexer:

View File

@ -891,7 +891,12 @@ def parse_series(p: Parser, i: filenamelexer.Item | None) -> ParserFunc:
break
prev_space = False
if (
current
and current[-1].typ == filenamelexer.ItemType.Dot
and p.peek().typ in (filenamelexer.ItemType.ArchiveType,)
):
current.pop()
p.series.append(current)
return parse

View File

@ -25,6 +25,38 @@ datadir = importlib.resources.files(__package__).joinpath("data")
cbz_path = datadir.joinpath("Cory Doctorow's Futuristic Tales of the Here and Now #001 - Anda's Game (2007).cbz")
names: list[tuple[str, str, dict[str, str | bool], tuple[bool, bool]]] = [
(
"Conceptions #1 Conceptions I.cbz",
"&",
{
"issue": "1",
"series": "Conceptions",
"title": "Conceptions I",
"volume": "",
"year": "",
"remainder": "",
"issue_count": "",
"alternate": "",
"archive": "cbz",
},
(False, True),
),
(
"Series #1 Stop it!.cbz",
"&",
{
"issue": "1",
"series": "Series",
"title": "Stop it!",
"volume": "",
"year": "",
"remainder": "",
"issue_count": "",
"alternate": "",
"archive": "cbz",
},
(False, True),
),
(
"Drystan & Esyllt #3",
"&",