Grammarkit/psi Implement custom language
Hello
i have some problem with grammar-kit/psi to recognize some part of code. This is an exemple of class that i wan't recognize with intelliJ plugin
#include "oop.h"
CLASS("PlayerClass")
PRIVATE STATIC_VARIABLE("string","Name");
PRIVATE VARIABLE("string","Chaine");
PUBLIC FUNCTION("string","constructor") {
MEMBER("Name","unname");
private _deuxiemeVar = "Test";
};
FUNC_GETVAR("Name");
FUNC_SETVAR("Name");
ENDCLASS;
Everything is define as bad char in psy tool. Is anyone could give an exemple? Like recognize my class.
Is it possible to intelliJ to make auto completion without psiElement?
Thanks
Please sign in to leave a comment.
Hi Minipopov,
PSI elements are the base for IntelliJ to parse your code. The parser will tokenize your code using Grammer file and then Lexer will use Lex/Flex file to map the actual token to grammar token and create a PSI element. I am not a pro here but I think you have to define a flex file to recognize your code. From the error message, I think you have already defined a flex file and probably it has a line similar to the below one. Hence you are getting Bad character error. You can remove this and define a proper lex file to match keywords and other tokens in your code.
I hope this helps.
Happy coding,
Thanks,
Ajit