Append record stub gen code instead of prepending

The difficulty was to make sure incomplete code doesn't trigger code generation.

I've added a function to simplify new test case additions (in the case where the code generation is supposed to have no effect).

There's something quite ugly: I had to handle the case where FCS returns invalid range (whose end position is out of bounds) in the ``tryFindTokenLPosInRange`` function.