pyhcl icon indicating copy to clipboard operation
pyhcl copied to clipboard

Parse errors say "column xxx", but the number reported is the position within the file, not within the line

Open richardfearn opened this issue 1 year ago • 1 comments
trafficstars

ply only tracks the position of tokens in the whole file (lexpos), but this is used incorrectly as a column number in the errors reported by pyhcl.

See this in the ply documentation:

https://github.com/dabeaz/ply/blob/master/doc/ply.md#line-numbers-and-positional-information

It should be possible to calculate the actual column number using lexpos.

richardfearn avatar Jan 05 '24 11:01 richardfearn

Seems reasonable, happy to accept a PR with a fix.

virtuald avatar Jan 05 '24 18:01 virtuald