Consolidate token cursor functionality

Previously, there was a split in the token cursors -- an internal version was defined for the R code model, and a separate set was defined for the C++ code model. This PR unifies the implementations by moving the relevant logic from the token cursor defined in the R code model into the 'base' token cursor class, and uses that.