From 700f8d9b99204cffecce255fee7d76aef42e8ce7 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Tue, 30 Jan 2024 23:06:47 +0900 Subject: [PATCH] allow @ in identifiers Identifiers can contain the @ symbol, a typical example is ``` put @resources << /ColorSpace @pgfcolorspaces >> ``` as found in documents created with LaTeX package pgf and colorspaces. At the moment a pdf containing the above will trigger an error: ``` pdfminer.psparser.PSSyntaxError: Invalid dictionary construct: [/'ColorSpace', /b'@', /b'pgfcolorspaces'] ``` since @ is parsed as separate token. --- pdfminer/psparser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pdfminer/psparser.py b/pdfminer/psparser.py index 83d15140..cf919d39 100755 --- a/pdfminer/psparser.py +++ b/pdfminer/psparser.py @@ -317,7 +317,7 @@ def _parse_main(self, s: bytes, i: int) -> int: self._curtoken = c self._parse1 = self._parse_float return j + 1 - elif c.isalpha(): + elif c.isalpha() or c == b"@": self._curtoken = c self._parse1 = self._parse_keyword return j + 1