mirror of https://github.com/Hilbis/Hilbish
fix: add newline at the beginning of file buffer when there is shebang
this makes the line count in error messages line up properlylua5.4
parent
8a34783fee
commit
e6563fbd8b
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue