File size: 729 Bytes
d1be154
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <ot/sdc/object.hpp>

namespace ot::sdc {

// Function: parse_port
Object parse_port(const std::string& line) {

  if(line.find("all_inputs") != std::string::npos) {
    return AllInputs{};
  }

  if(line.find("all_outputs") != std::string::npos) {
    return AllOutputs{};
  }

  const static std::regex ws_re("\\s+|\\n+|\\t+"); 
  
  auto itr = std::sregex_token_iterator(line.begin(), line.end(), ws_re, -1);
  auto end = std::sregex_token_iterator();
  //auto num = std::distance(itr, end);

  GetPorts get_ports;

  for(; itr != end; ++itr) {
    get_ports.ports.push_back(itr->str());
  }
  
  return get_ports;
}

};  // end of namespace sdc. ----------------------------------------------------------------------