def parse_result
      s0 = @current_pos
      if match_str("まで") != :failed
        s2 = match_digits!
        if s2 != :failed
          if match_str("手") != :failed
            s4 = @current_pos
            if match_str("で") != :failed
              if parse_turn != :failed
                if match_str("手の") != :failed
                  s8 = parse_result_toryo
                  s8 = parse_result_illegal if s8 == :failed
                  s4 = if s8 != :failed
                         @reported_pos = s4
                         s8
                       else
                         @current_pos = s4
                         :failed
                       end
                else
                  @current_pos = s4
                  s4 = :failed
                end
              else
                @current_pos = s4
                s4 = :failed
              end
            else
              @current_pos = s4
              s4 = :failed
            end
            if s4 == :failed
              s4 = parse_result_timeup
              if s4 == :failed
                s4 = parse_result_chudan
                if s4 == :failed
                  s4 = parse_result_jishogi
                  if s4 == :failed
                    s4 = parse_result_sennichite
                    if s4 == :failed
                      s4 = parse_result_tsumi
                      s4 = parse_result_fuzumi if s4 == :failed
                    end
                  end
                end
              end
            end
            if s4 != :failed
              if parse_nl != :failed || eos?
                @reported_pos = s0
                s4
              else
                @current_pos = s0
                :failed
              end
            else
              @current_pos = s0
              :failed
            end
          else
            @current_pos = s0
            :failed
          end
        else
          @current_pos = s0
          :failed
        end
      else
        @current_pos = s0
        :failed
      end
    end
def parse_result
      s0 = @current_pos
      if match_str("まで") != :failed
        s2 = match_digits!
        if s2 != :failed
          if match_str("手") != :failed
            s4 = @current_pos
            if match_str("で") != :failed
              if parse_turn != :failed
                if match_str("手の") != :failed
                  s8 = parse_result_toryo
                  s8 = parse_result_illegal if s8 == :failed
                  s4 = if s8 != :failed
                         @reported_pos = s4
                         s8
                       else
                         @current_pos = s4
                         :failed
                       end
                else
                  @current_pos = s4
                  s4 = :failed
                end
              else
                @current_pos = s4
                s4 = :failed
              end
            else
              @current_pos = s4
              s4 = :failed
            end
            if s4 == :failed
              s4 = parse_result_timeup
              if s4 == :failed
                s4 = parse_result_chudan
                if s4 == :failed
                  s4 = parse_result_jishogi
                  if s4 == :failed
                    s4 = parse_result_sennichite
                    if s4 == :failed
                      s4 = parse_result_tsumi
                      s4 = parse_result_fuzumi if s4 == :failed
                    end
                  end
                end
              end
            end
            if s4 != :failed
              if parse_nl != :failed || eos?
                @reported_pos = s0
                s4
              else
                @current_pos = s0
                :failed
              end
            else
              @current_pos = s0
              :failed
            end
          else
            @current_pos = s0
            :failed
          end
        else
          @current_pos = s0
          :failed
        end
      else
        @current_pos = s0
        :failed
      end
    end
result : "まで" [0-9]+ "手" (
            "で" (turn "手の" (result_toryo | result_illegal)) |
            result_timeup | result_chudan | result_jishogi |
            result_sennichite | result_tsumi | result_fuzumi
          ) nl