Stab at pre-processing #r directives. Fixes #140

Feedback appreciated :smile: