summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris White <white238@llnl.gov>2022-09-26 15:47:45 -0700
committerGitHub <noreply@github.com>2022-09-26 22:47:45 +0000
commit777271da18c0e2319dcfc653bc6c65254d7f5b4a (patch)
tree4924e24809c921b95720eb9c0f052243d268c48b /lib
parentde9fc038f7e2622f3b55b2fb1d9724058724eeca (diff)
downloadspack-777271da18c0e2319dcfc653bc6c65254d7f5b4a.tar.gz
spack-777271da18c0e2319dcfc653bc6c65254d7f5b4a.tar.bz2
spack-777271da18c0e2319dcfc653bc6c65254d7f5b4a.tar.xz
spack-777271da18c0e2319dcfc653bc6c65254d7f5b4a.zip
improve lexing error (#32832)
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/parse.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/spack/spack/parse.py b/lib/spack/spack/parse.py
index 10f460e776..61260bc837 100644
--- a/lib/spack/spack/parse.py
+++ b/lib/spack/spack/parse.py
@@ -78,7 +78,9 @@ class Lexer(object):
break
if remainder and not remainder_used:
- raise LexError("Invalid character", word, word.index(remainder))
+ msg = "Invalid character, '{0}',".format(remainder[0])
+ msg += " in '{0}' at index {1}".format(word, word.index(remainder))
+ raise LexError(msg, word, word.index(remainder))
return tokens