// 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... }
// parse the DESIGN statement func parseDesign(db *dream.DBlock, tok_ch <-chan string) { frame := parse.TakeN(2, tok_ch) db.Design = frame[0] }
// parse the UNITS DISTANCE MICRONS statement func parseUnits(db *dream.DBlock, tok_ch <-chan string) { frame := parse.TakeN(4, tok_ch) db.DBU, _ = strconv.Atoi(frame[2]) }
// parse the VERSION statement func parseVersion(db *dream.DBlock, tok_ch <-chan string) { frame := parse.TakeN(2, tok_ch) db.Version, _ = strconv.ParseFloat(frame[0], 32) }