Is there any way to keep psiImplUtilClass smaller?
Thank you for an awesome plugin!
Our psiImplUtilClass is 2,000 lines long and growing. It made sense to use one single psiImplUtilClass it for a smaller, simpler grammar, but for us, this is beginning to get out of control. In some cases, it's also bad OO: many of my PSI elements do reference lookup, and I don't think it's a good idea to add multiple reference lookups to this already bloated file. Is there a better way?
Have you tried mixin classes? You should be able to specify a mixin for your type and tell Grammar-Kit to extract methods from that class.
Thank you for a quick answer. Just did that. Beautiful!
This leads me to a couple more questions.
- Is there any way to import a package name, so that I don't have to do a fully-qualified class name in every mixin? I only saw parser imports.
- I'd love to be able to do something like this: mixin(".*") = "com.dreambox.elements.My$1"
As usual, it would only generate mixins if corresponding classes exist. Doable?
BTW, one of your manuals says "to be continued".. would be great to learn more.
I don't think either of those features currently exist, although I'm not positive (I'm just a fellow Grammar-Kit user).
Ah, then thank you very much for your help.
BTW, maybe you also know how to remove those ugly error messages, short of changing name in every rule?
MyTokenType.DOT expected, got ";"
Any way to substitute token names with values?
Are you using Live Preview when you see that error? It has been a veery long time since I've used that now, but I believe that style of message only occurs in Live Preview mode.
In a proper run of your app, Grammar-Kit should make use of the 'debug name' you provide to the token's IElementType constructor.
No, I am getting this in tool tips in an actual IntelliJ. My generated GenElementTypes.java has the following:
IElementType DIVIDE = new MyTokenType("DIVIDE");
And, in .flex
"/" { return GenElementTypes.DIVIDE; }
LOL, a well asked question answers itself. The culprit was MyTokenType.toString(). DIVIDE is still not as good as / would have been, but much better now.
Ahh, yes, that would obviously get in the way of things also ;P
... As for the automatically generated debugName, I don't notice it, as I provide all of my IElementTypes.