| 98 | } |
| 99 | |
| 100 | bool Parser::parseComment(const QString& line) |
| 101 | { |
| 102 | if (line.startsWith(';')) { |
| 103 | qDebug() << "line" << line; |
| 104 | auto data { toU16StrView(line) }; |
| 105 | static constexpr ctll::fixed_string regexComment(R"(^;(.*)$)"); // fixed_string("^;(.*)$"); |
| 106 | // static constexpr ctll::fixed_string regexFormat(R"(.*(?:FORMAT|format).*(\d).(\d))"); // fixed_string(".*(?:FORMAT|format).*(\d).(\d)"); |
| 107 | static constexpr ctll::fixed_string regexTool(R"(\s*(?:HOLESIZE|holesize)\s*(\d+\.?\d*)\s*=\s*(\d+\.?\d*).*)"); // fixed_string("\s*(?:HOLESIZE|holesize)\s*(\d+\.?\d*)\s*=\s*(\d+\.?\d*).*"); |
| 108 | if (auto [match, comment] = ctre::match<regexComment>(data); match) { |
| 109 | // if (auto [matchFormat, integer, decimal] = ctre::match<regexFormat>(comment); matchFormat) { |
| 110 | // file->m_format.integer = CtreCapTo(integer).toInt(); |
| 111 | // file->m_format.decimal = CtreCapTo(decimal).toInt(); |
| 112 | // } |
| 113 | if (auto [matchTool, tool, diam] = ctre::match<regexTool>(comment); matchTool) { |
| 114 | qDebug() << "regexTool" << matchTool.data(); |
| 115 | const int tCode = static_cast<int>(CtreCapTo(tool).toDouble()); |
| 116 | file->m_tools[tCode] = CtreCapTo(diam).toDouble(); |
| 117 | file->m_tools[tCode] *= 0.0254 * (1.0 / 25.4); |
| 118 | m_state.tCode = tCode; //m_state.tCode = file->m_tools.firstKey(); |
| 119 | } |
| 120 | return true; |
| 121 | } |
| 122 | } |
| 123 | return false; |
| 124 | } |
| 125 | |
| 126 | bool Parser::parseGCode(const QString& line) |
| 127 | { |
nothing calls this directly
no test coverage detected