State lawmakers are finalizing legislation to bring both medical and adult-recreational marijuana into the regulatory mainstream.