<commit_before>package main

import (
	"os"
	"fmt"
	"syscall"
	"../parse"
	"../edit"
	"../eval"
	"../async"
)

func lackeol() {
	fmt.Println("\033[7m%\033[m")
}

func main() {
	fmt.Printf("My pid is %d\n", syscall.Getpid())

	tr, err := async.NewTimedReader(os.Stdin)
	if err != nil {
		panic(err)
	}

	ev := eval.NewEvaluator(os.Environ())
	cmd_no := 0

	for {
		cmd_no++
		name := fmt.Sprintf("<tty %d>", cmd_no)

		ed, err := edit.Init(os.Stdin, tr)
		if err != nil {
			panic(err)
		}

		lr := ed.ReadLine("das> ")
		err = ed.Cleanup()
		if err != nil {
			panic(err)
		}

		if lr.Eof {
			lackeol()
			break
		} else if lr.Err != nil {
			panic(lr.Err)
		}

		tree, pe := parse.Parse(name, lr.Line, false)
		if pe != nil {
			fmt.Print(pe.Pprint())
			continue
		}

		updates, err := ev.ExecPipeline(tree.Root.(*parse.ListNode))
		if err != nil {
			fmt.Println(err)
			continue
		}

		for i, update := range updates {
			for up := range update {
				switch up.Msg {
				case "0", "":
				default:
					fmt.Printf("Command #%d update: %s\n", i, up.Msg)
				}
			}
		}
	}
}
<commit_msg>Handle eval errors correctly.<commit_after>package main

import (
	"os"
	"fmt"
	"syscall"
	"../parse"
	"../edit"
	"../eval"
	"../async"
)

func lackeol() {
	fmt.Println("\033[7m%\033[m")
}

func main() {
	fmt.Printf("My pid is %d\n", syscall.Getpid())

	tr, err := async.NewTimedReader(os.Stdin)
	if err != nil {
		panic(err)
	}

	ev := eval.NewEvaluator(os.Environ())
	cmd_no := 0

	for {
		cmd_no++
		name := fmt.Sprintf("<tty %d>", cmd_no)

		ed, err := edit.Init(os.Stdin, tr)
		if err != nil {
			panic(err)
		}

		lr := ed.ReadLine("das> ")
		err = ed.Cleanup()
		if err != nil {
			panic(err)
		}

		if lr.Eof {
			lackeol()
			break
		} else if lr.Err != nil {
			panic(lr.Err)
		}

		tree, pe := parse.Parse(name, lr.Line, false)
		if pe != nil {
			fmt.Print(pe.Pprint())
			continue
		}

		updates, ee := ev.ExecPipeline(tree.Root.(*parse.ListNode))
		if ee != nil {
			fmt.Println(ee)
			continue
		}

		for i, update := range updates {
			for up := range update {
				switch up.Msg {
				case "0", "":
				default:
					fmt.Printf("Command #%d update: %s\n", i, up.Msg)
				}
			}
		}
	}
}

{'fraction_non_alphanumeric': 0.19471044231646148, 'fraction_numerical': 0.008207934336525308, 'mean_word_length': 2.4660347551342814, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1244117', 'n_tokens_mistral': 1088, 'n_tokens_neox': 933, 'n_words': 203}