Basically I’d like to write an overlay mode that takes advantage of the previous mode’s parsing. In other words, imagine stream but returning tokens instead of chars. That way I can say if this is a token of this type that follows a token of this type, then return “blah”.
No, but you can do this if you directly/manually wrap a mode, rather than using the overlay addon.
Are there any examples of manually wrapping a mode?
Maybe this one:
http://codemirror.net/mode/yaml-frontmatter/yaml-frontmatter.js