benhoyt / goawk

A POSIX-compliant AWK interpreter written in Go, with CSV support
https://benhoyt.com/writings/goawk/
MIT License
1.95k stars 84 forks source link

Draft version of FileReader #151

Closed benhoyt closed 2 years ago

benhoyt commented 2 years ago

This implements a simple FileReader type that tracks files added to it with AddFile() and their number of source lines, and then lets you look up which file and file-line number a particular overall line number belongs to with FileLine().

It allows us to do away with errorFileLine and look up lines simply, without altering the parser or being invasive in that code.

Just a draft for comparing approaches. Needs comments and tests.

benhoyt commented 2 years ago

Closing in favour of #153