Add the table node, row selection and linked tables, and ship the misc registers as tables #19

Merged
lilleman merged 22 commits from table-node into main 2026-09-17 23:35:27 +02:00
2 changed files with 4 additions and 4 deletions
Showing only changes of commit 6b06445c32 - Show all commits
+1 -2
View File
@@ -223,8 +223,7 @@ func walkTable(t *table, tail []string, w pathWalk, descended bool) (node, error
if err != nil { if err != nil {
return nil, err return nil, err
} }
// Resolved before any draw, so a path that fails moves no seeded stream. A // A selector further down pins this table by ancestry, so the walk draws only
// selector further down pins this table by ancestry, so the walk draws only
// where none follows; drawing first could pick a row the selector is not inside. // where none follows; drawing first could pick a row the selector is not inside.
if w.pins != nil { if w.pins != nil {
if err := readRow(w.pins, t, sel, (descended || len(tail) > 0) && !hasSelector(tail)); err != nil { if err := readRow(w.pins, t, sel, (descended || len(tail) > 0) && !hasSelector(tail)); err != nil {
+3 -2
View File
@@ -150,10 +150,11 @@ func readTableOptions(m map[string]any) (tableOptionValues, error) {
func (t *table) parseRows(data string) error { func (t *table) parseRows(data string) error {
data = strings.TrimSuffix(strings.TrimPrefix(data, "\xEF\xBB\xBF"), "\n") data = strings.TrimSuffix(strings.TrimPrefix(data, "\xEF\xBB\xBF"), "\n")
header, rest, _ := strings.Cut(data, "\n") header, rest, _ := strings.Cut(data, "\n")
if data == "" { header = strings.TrimSuffix(header, "\r")
if header == "" {
return fmt.Errorf("has no header line naming its columns") return fmt.Errorf("has no header line naming its columns")
} }
t.columns = strings.Split(strings.TrimSuffix(header, "\r"), "\t") t.columns = strings.Split(header, "\t")
t.col = make(map[string]int, len(t.columns)) t.col = make(map[string]int, len(t.columns))
t.fields = make(map[string]node, len(t.columns)) t.fields = make(map[string]node, len(t.columns))
for i, name := range t.columns { for i, name := range t.columns {