datacamp / sqlwhat

https://sqlwhat.readthedocs.io
GNU Affero General Public License v3.0
3 stars 8 forks source link

AST node -> position in raw submission text #26

Closed machow closed 7 years ago

machow commented 7 years ago

for ctx = ast_node._ctx, should be able to use something like

start = ctx.start     # starting token
start.start              # it's first letter
start.stop
start.line

stop = ctx.stop      # stopping token
# etc..

(I'm not sure what happens if a token spans multiple lines, but also can't think of when that would happen)

machow commented 7 years ago

deployed in 0.0.6 d638c4e1f473d5359dc04a8cc0745c686da4716c