| 741 | } |
| 742 | |
| 743 | bool Parser::parseStepRepeat(const QString& gLine) |
| 744 | { |
| 745 | /* |
| 746 | * <SR open> = %SRX<Repeats>Y<Repeats>I<Step>J<Step>*% |
| 747 | * <SR close> = %SR*% |
| 748 | * <SR statement> = <SR open>{<single command>|<region statement>}<SR close> |
| 749 | */ |
| 750 | auto data { toU16StrView(gLine) }; |
| 751 | static constexpr ctll::fixed_string ptrnStepRepeat(R"(^%SRX(\d+)Y(\d+)I(.\d*\.?\d*)J(.\d*\.?\d*)\*%$)"); // fixed_string("^%SRX(\d+)Y(\d+)I(.\d*\.?\d*)J(.\d*\.?\d*)\*%$"); |
| 752 | if (auto [whole, srx, sry, sri, srj] = ctre::match<ptrnStepRepeat>(data); whole) { |
| 753 | if (m_abSrIdStack.top().workingType == WorkingType::StepRepeat) |
| 754 | closeStepRepeat(); |
| 755 | m_stepRepeat.reset(); |
| 756 | m_stepRepeat.x = CtreCapTo(srx); |
| 757 | m_stepRepeat.y = CtreCapTo(sry); |
| 758 | m_stepRepeat.i = CtreCapTo(sri), m_stepRepeat.i *= uScale; |
| 759 | m_stepRepeat.j = CtreCapTo(srj), m_stepRepeat.j *= uScale; |
| 760 | if (m_state.format()->unitMode == Inches) { |
| 761 | m_stepRepeat.i *= 25.4; |
| 762 | m_stepRepeat.j *= 25.4; |
| 763 | } |
| 764 | if (m_stepRepeat.x > 1 || m_stepRepeat.y > 1) |
| 765 | m_abSrIdStack.push({ WorkingType::StepRepeat, 0 }); |
| 766 | return true; |
| 767 | } |
| 768 | |
| 769 | static constexpr ctll::fixed_string ptrnStepRepeatEnd(R"(^%SR\*%$)"); // fixed_string("^%SR\*%$"); |
| 770 | if (ctre::match<ptrnStepRepeatEnd>(data)) { |
| 771 | if (m_abSrIdStack.top().workingType == WorkingType::StepRepeat) |
| 772 | closeStepRepeat(); |
| 773 | return true; |
| 774 | } |
| 775 | |
| 776 | return false; |
| 777 | } |
| 778 | |
| 779 | void Parser::closeStepRepeat() |
| 780 | { |
nothing calls this directly
no test coverage detected