2
2
mirror of https://github.com/Hilbis/Hilbish synced 2025-04-21 13:03:22 +00:00

fix: add newline at the beginning of file buffer when there is shebang

this makes the line count in error messages line up properly
This commit is contained in:
TorchedSammy 2022-04-02 20:59:55 -04:00
parent 8a34783fee
commit e6563fbd8b
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD

View File

@ -71,15 +71,16 @@ func DoFile(rtm *rt.Runtime, path string) error {
return err
}
var buf []byte
if c == byte('#') {
// shebang - skip that line
_, err := reader.ReadBytes('\n')
if err != nil && err != io.EOF {
return err
}
buf = []byte{'\n'}
}
var buf []byte
for {
line, err := reader.ReadBytes('\n')
if err != nil {