File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,9 @@ package goat
22
33import (
44 "bufio"
5+ "log"
56 "io"
7+ "os"
68)
79
810type (
@@ -156,14 +158,19 @@ func NewCanvas(in io.Reader) (c Canvas) {
156158 // https://go.dev/ref/spec#For_statements
157159 // But yet, counterintuitively, type of lineStr[_index_] is 'byte'.
158160 // https://go.dev/ref/spec#String_types
159- // XXXX Refactor to use []rune from above.
160161 for _ , r := range lineStr {
161162 //if r > 255 {
162163 // fmt.Printf("linestr=\"%s\"\n", lineStr)
163164 // fmt.Printf("r == 0x%x\n", r)
164165 //}
165166 if r == ' ' {
166- panic ("TAB character found on input" )
167+ file , isFile := in .(* os.File )
168+ fileName := "unknown"
169+ if isFile {
170+ fileName = file .Name ()
171+ }
172+ log .Panicf ("\n \t Found TAB in %s, row %d, column %d\n " ,
173+ fileName , height + 1 , w )
167174 }
168175 i := Index {w , height }
169176 c .data [i ] = r
You can’t perform that action at this time.
0 commit comments