// loadFile ... func loadFile(dir, file string) Index { text, err := ioutil.ReadFile(file) if err != nil { log.Fatalf("Problem reading source file %s (%v)", file, err) } x := NewIndex() src := NewSrcString(string(text)) for { see.Space(src) n_, u_ := see.SeePeer(src) if n_ == nil { break } n := n_.(string) // n is a string if u, ok := u_.(Circuit); ok { u.Include(Source{}, New().Grow("Dir", dir).Grow("File", file)) } x.Memorize(u_, n) } return x }
// LoadFile ... func (fty Faculty) LoadFile(dir, filePath string) { text, err := ioutil.ReadFile(filePath) if err != nil { log.Fatalf("Problem reading source file %s (%v)", filePath, err) } src := see.NewSrcString(string(text)) for { n_, u_ := see.SeePeer(src) if n_ == nil { break } n := n_.(string) // n is a string u := u_.(Circuit) u.Include(Genus_{}, &CircuitGenus{ Dir: dir, File: filePath, }, ) if _, ok := fty.Include(n, u); ok { log.Fatalf("file circuit overwrites %s", n) } } }