// parse the NETS section // TODO - refactor for reuse (create a parseSection()) func parseNets(db *dream.DBlock, tok_ch <-chan string) { frame := parse.TakeN(2, tok_ch) count, _ := strconv.Atoi(frame[0]) for i := 0; i < count; i++ { frame = parse.TakeUntil(";", tok_ch) net_name := frame[1] net := dream.DNet{Name: net_name} db.Nets[net_name] = net } _ = parse.TakeN(2, tok_ch) // consume the END... }
// parse the COMPONENTS section // TODO - refactor for reuse (create a parseSection()) func parseComponents(db *dream.DBlock, tok_ch <-chan string) { frame := parse.TakeN(2, tok_ch) count, _ := strconv.Atoi(frame[0]) for i := 0; i < count; i++ { frame = parse.TakeUntil(";", tok_ch) inst_name := frame[1] model_name := frame[2] comp := dream.DInst{InstName: inst_name, ModelName: model_name} db.Insts[inst_name] = comp } _ = parse.TakeN(2, tok_ch) // consume the END... }