gristlabs / asttokens

Annotate Python AST trees with source text and token information
Apache License 2.0
172 stars 34 forks source link

Adjust With nodes to include the "with" text. #15

Closed dsagal closed 6 years ago

dsagal commented 6 years ago

Apparently in Python 2 the col_offset of With nodes starts after the "with " text, which is incorrect. It works correctly on Python 3. This PR fixes it for Python 2.

Builds on PR #14 by @FuegoFro, with a different implementation and more testing.