Ivan Levkivskyi <levkivs...@gmail.com> added the comment:
> 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). This is mostly useful for code analysis tools and IDEs. > 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? There may be some other ways to do it, but currently I am adding both `end_lineno` and `end_col_offset` to AST, and `n_end_lineno` and `n_end_col_offset` in CST. The latter are needed to easily take care of situations like `a + (b )`, and other corner cases. I could imagine it is possible to live with only end position information in AST to save some memory, but then the code will be much harder to maintain. We can discuss details in the PR. > Do we know what other languages do (carry the full span info in the AST or > deduce the span after the fact)? I didn't do real research, but quick browsing shows carrying the end position info is quite common. But more importantly as Serhiy noted, deducing might be just not possible in some situations. > It is up to you Ivan. OK, I will close the other one as superseded by this issue. ---------- _______________________________________ 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