Closed aroberge closed 3 years ago
Just thinking about how to go about this ... Perhaps what I can do is check if these attributes exist. If they do not exist, I can artificially add them, something like:
e.end_lineno = e.lineno (or None)
e.end_offset = e.offst + 1
This would likely make the analysis going forward much easier when new Python versions are introduced.
This has been taken care of in previous commits.
SyntaxErrors now include new arguments indicating the end of a range; the full arguments are
The
offset
attribute can now point to a location prior to that pointed at in previous Python version - where a single position (line, column) was shown instead of a range, highlighting part of an expression causing problems.This change makes it more useful for users of cPython ... but it messes up the analysis currently done by friendly which relies on a single "bad token" begin flagged.
I need to use this information to do the same kind of highlighting that cPython does. Additionally, I need to figure out how to use this information in a way that is compatible with the analysis I was doing before.
This is discussed in https://github.com/python/cpython/pull/25582/files, but has not made it to the What's New section yet.