| 3942 | } |
| 3943 | |
| 3944 | bool HloParserImpl::ParseOpcode(HloOpcode* result) { |
| 3945 | VLOG(3) << "ParseOpcode"; |
| 3946 | if (lexer_.GetKind() != TokKind::kIdent) { |
| 3947 | return TokenError("expects opcode"); |
| 3948 | } |
| 3949 | std::string val = lexer_.GetStrVal(); |
| 3950 | auto status_or_result = StringToHloOpcode(val); |
| 3951 | if (!status_or_result.ok()) { |
| 3952 | return TokenError(StrFormat("expects opcode but sees: %s, error: %s", val, |
| 3953 | status_or_result.status().error_message())); |
| 3954 | } |
| 3955 | *result = status_or_result.ValueOrDie(); |
| 3956 | lexer_.Lex(); |
| 3957 | return true; |
| 3958 | } |
| 3959 | |
| 3960 | bool HloParserImpl::ParseFftType(FftType* result) { |
| 3961 | VLOG(3) << "ParseFftType"; |