Raymond Hettinger <raymond.hettin...@gmail.com> added the comment:

This idea seems reasonable.  Most of the AST nodes have a span and it would be 
nice to know what that is.  I'm sure we will find use cases though I doubt that 
many compiler syntax errors would benefit (since a syntax error means that we 
don't have a completely matched grammar rule).

BTW, does this information have to be added by the parser or could there be am 
AST module function that deduces the end locations from the start location of 
next sibling node or from the parent node?  If so, it may still be possible get 
the benefit without slowing down or complicating the parser logic.

Do we know what other languages do (carry the full span info in the AST or 
deduce the span after the fact)?  I don't know what the best practices are in 
this regard.

One other thought:  We should be careful not to impair existing AST 
capabilities that support code rewriting and movement (i.e. refactoring tools). 
 The copy_location() and fix_missing_locations() functions would need to be 
updated as well.

----------
nosy: +rhettinger

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33416>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to