added an regexp for rewriting the error output

This commit is contained in:
Özgür Kesim 2024-12-10 17:16:15 +01:00
parent 26f349fd57
commit 998763e427
Signed by: oec
GPG Key ID: F136A7F922D018D7

View File

@ -20,7 +20,8 @@ var (
fl_lang = flag.String("l", "C", "Language") fl_lang = flag.String("l", "C", "Language")
fl_verbose = flag.Bool("v", false, "Verbosity on") fl_verbose = flag.Bool("v", false, "Verbosity on")
pos_rx = regexp.MustCompile(`.* orig line is ([\d]+), orig col is ([\d])`) pos_rx = regexp.MustCompile(`.* orig line is ([\d]+), orig col is ([\d]+)`)
grb_rx = regexp.MustCompile(`stdin:([\d]+) Garbage in col ([\d]+)`)
) )
func main() { func main() {
@ -65,6 +66,7 @@ func main() {
if len(samfile) != 0 { if len(samfile) != 0 {
str = strings.ReplaceAll(str, "stdin, open_line is ", samfile+":") str = strings.ReplaceAll(str, "stdin, open_line is ", samfile+":")
str = pos_rx.ReplaceAllString(str, fmt.Sprintf("%s:$1:#$2", samfile)) str = pos_rx.ReplaceAllString(str, fmt.Sprintf("%s:$1:#$2", samfile))
str = grb_rx.ReplaceAllString(str, fmt.Sprintf("%s:$1:#$2", samfile))
} }
log.Fatal("error: " + str) log.Fatal("error: " + str)
} }