
For things that would obviously be nice to have (I'm not sure 'document' is one of them), I think they should be added to the interface (IToken) but not required to be implemented. That way, when we derive our own token types, we can add the functionality and use the public interface to get to it, but we don't have to provide it if we don't want to (possibly at the loss of some features, or requiring a different workaround on our part).
Alternatively, it might be nice to think about a way of 'annotating' tokens with our own decorations - I've done on my AST by adding a SetDecoration<T>(T decoration) that stores a decoration (keyed by type) in a dictionary (this is very similar to WPF properties - though I didn't know so at the time :)), and a GetDecoration<T> that returns those decorations.
I use this to 'lazy load' several things in my AST as they are needed, but remember them for a given instance of the AST - without the AST nodes directly knowing about the stuff being kept (since the parser doesn't build this information itself). It's come in very handy for additional semantic information that is determined after the parse and computed on demand.
Kelly Leahy
Software Architect
Milliman, USA