| 55 | |
| 56 | public: |
| 57 | OpCodeParser() |
| 58 | { |
| 59 | for (unsigned int op = 0; op <= MAX_OPCODE; ++op) { |
| 60 | // Allow OP_RESERVED to get into mapOpNames |
| 61 | if (op < OP_NOP && op != OP_RESERVED) { |
| 62 | continue; |
| 63 | } |
| 64 | |
| 65 | std::string strName = GetOpName(static_cast<opcodetype>(op)); |
| 66 | if (strName == "OP_UNKNOWN") { |
| 67 | continue; |
| 68 | } |
| 69 | mapOpNames[strName] = static_cast<opcodetype>(op); |
| 70 | // Convenience: OP_ADD and just ADD are both recognized: |
| 71 | if (strName.starts_with("OP_")) { |
| 72 | mapOpNames[strName.substr(3)] = static_cast<opcodetype>(op); |
| 73 | } |
| 74 | } |
| 75 | } |
| 76 | opcodetype Parse(const std::string& s) const |
| 77 | { |
| 78 | auto it = mapOpNames.find(s); |
nothing calls this directly
no test coverage detected