Add improved source-mapping implementation

This PR is the successor of #603 and #786. IMO this is already better than the current implementation, so I dare anyone to try it out. IMO we could include this "as is" in the next version to get this moving in the right direction, since the current implementation does not really work anyway IMHO. The whole feature is very complex, so I cannot give any guarantee that it will work for all mappings. But IMHO the current state of this PR is satisfactory and we could move on from that!