Switching lexer/parser implementations based on module config?

Hi all,

I'm currently developing an editing mode for Scheme in IntelliJ. I'd like to allow the user to switch between implementations (currently Kawa and SISC but I'd like to allow more), but Scheme implementations tend to customise the syntax a fair amount. Ideally I'd like the user to be able to select an implementation in their facet configuration, and to have that configuration determine which lexer and parser to use. Ideally I'd have one implementation of each per Scheme implementation, probably extending a common base. I can't see any obvious way to do this - is this even possible?



Having thought about this some more, the only way I can see to do this is by making it part of the project configuration. One thing is that when the user changes this config I'll need to either invalidate the project indexes or reload the whole project so that everything is reparsed. Is there a recommended way to do this?


In case anyone is interested, I found the answer in the community source code. See com.intellij.openapi.roots.impl.LanguageLevelProjectExtensionImpl.reloadProjectOnLanguageLevelChange().


Please sign in to leave a comment.