Extracting keywords from grammar for highlighting [message #649150] |
Mon, 17 January 2011 17:21  |
Eclipse User |
|
|
|
I have replaced the default ITokenScanner by my own RuleBasedScanner. One thing that the RuleBasedScanner needs is a list of tokens from the grammar. I thought it would be nice if I automatically extract that information from the grammar. So I added a IGrammarAccess field to my derived scanner.
@Inject
private IGrammarAccess grammarAccess;
From there, I can get at the rules and the tokens.
However, now during startup Guice is complaining (I suspect it has something to do with circular dependencies but I'm not sure.)
java.lang.NullPointerException
at com.sigasi.xtext.ui.VHDLLangTokenScanner.getKeywords(VHDLLangTokenScanner.java:134)
at com.sigasi.xtext.ui.VHDLLangTokenScanner.<init>(VHDLLangTokenScanner.java:78)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:530)
...
Any suggestions to get at the grammar would be greatly appreciated.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.45771 seconds