Commit 5614f90e authored by Mccaskey, Alex's avatar Mccaskey, Alex
Browse files

fix bug where line was empty in staq compiler


Signed-off-by: Mccaskey, Alex's avatarAlex McCaskey <mccaskeyaj@ornl.gov>
parent c46fc6dd
Pipeline #136059 passed with stage
in 20 minutes and 35 seconds
......@@ -275,9 +275,10 @@ std::shared_ptr<IR> StaqCompiler::compile(const std::string &src,
std::string preamble = "include \"qelib1.inc\";";
auto preamble_start = src.find(preamble);
auto preamble_start = _src.find(preamble);
// Add any required missing pre-defines that we
// Add any required missing pre-defines that we
// know the impl for.
std::vector<std::string> added;
std::string extra_insts = "\n";
......@@ -288,7 +289,8 @@ std::shared_ptr<IR> StaqCompiler::compile(const std::string &src,
line.find("include") == std::string::npos &&
line.find("measure") == std::string::npos &&
line.find("qreg") == std::string::npos &&
line.find("creg") == std::string::npos) {
line.find("creg") == std::string::npos
&& !line.empty()) {
auto inst_name = split(line, ' ')[0];
if (inst_name.find("(") != std::string::npos) {
inst_name = inst_name.substr(0, inst_name.find("("));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment