Move mask parsing from lexer to parser