Improved the visitor interface with generics.
Added a visitor class that fixes the first and last token pointers of some nodes.