thriftrw / thriftrw-go

A Thrift encoding code generator and library for Go
MIT License
101 stars 53 forks source link

idl: add column numbers to parse error positions #507

Closed jparise closed 3 years ago

jparise commented 3 years ago

Column numbers for parse errors are computed by tracking a new lineStart value in the lexer that tracks the start position (document byte offset) of the current line. We can then subtract this value from the existing token start (ts) value to compute the column (+1 for 1-based numbers).

codecov[bot] commented 3 years ago

Codecov Report

Merging #507 (3a05fd2) into dev (d7c4d71) will increase coverage by 0.00%. The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##              dev     #507   +/-   ##
=======================================
  Coverage   79.01%   79.02%           
=======================================
  Files         129      129           
  Lines       16089    16093    +4     
=======================================
+ Hits        12713    12717    +4     
  Misses       2066     2066           
  Partials     1310     1310           
Impacted Files Coverage Δ
ast/position.go 100.00% <100.00%> (ø)
idl/error.go 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update d7c4d71...3a05fd2. Read the comment docs.

abhinav commented 3 years ago

Thanks!