@ 261101.7 · fetching

261029.1 · b95235bbfa19defc68c21353ce4014ec9e9976df

A tree page's buffer guess stays near its size, and a helper's crash shows

The builder grew 512 bytes a line before the parse, so a 1 MiB file of blank lines took 512 MB, a file with no grammar paid it too, and a tree of 16k lines overran the cache it was charged to. The guess now waits for the first node and keeps to 20 bytes a byte of source, and a buffer well past its rows is copied down before the cache counts it.

A helper that dies or times out mid-line now reports its own message or the timeout, not the cut line's field count.

reading declarations

Changes to syntax_test.go. All files

syntax_test.go

@@ -63,13 +63,14 @@ func TestSyntaxBadOutput(t *testing.T) { 		{`printf '0\tsource_file\t\t0\t0\n'`, "a line of 5 fields"}, 		{`printf '0\tsource_file\t\t0\t-1\t3\t0\n'`, "a bad number: -1"}, 		{`printf '0\tsource_file\t\t0\t0\t3\t0\n'; echo 'E5: broke' >&2; exit 5`, "E5: broke"},+		{`printf '0\tsource_file\t\t0'; echo 'E5: broke' >&2; exit 5`, "E5: broke"}, 	} { 		dir := t.TempDir() 		script := "#!/bin/sh\ncat >/dev/null\n" + tc.script + "\n" 		if err := os.WriteFile(filepath.Join(dir, progName+"-syntax"), []byte(script), 0o755); err != nil { 			t.Fatal(err) 		}-		t.Setenv("PATH", dir)+		t.Setenv("PATH", dir+string(os.PathListSeparator)+os.Getenv("PATH")) 		if _, err := syntaxPage(context.Background(), "a.go", "a.go", []byte("x\n")); err == nil || !strings.Contains(err.Error(), tc.want) { 			t.Errorf("%s: %v, want %q", tc.script, err, tc.want) 		}