Home » U++ TheIDE » U++ TheIDE: CodeEditor, Assist++, Topic++ » To load a new syntax in CodeEditor
To load a new syntax in CodeEditor [message #43181] |
Thu, 29 May 2014 16:24 |
|
koldo
Messages: 3358 Registered: August 2008
|
Senior Veteran |
|
|
Hello all
I wanted to load a new language support in CodeEditor. As it is similar to C++, I wanted to use CSyntax. However LoadSyntax() is private so I cannot use it or subclass it.
Would it be possible to set it public or protected, or is there any way to add a new language (syntax)?
Best regards
Iñaki
|
|
|
|
Re: To load a new syntax in CodeEditor [message #43195 is a reply to message #43194] |
Tue, 03 June 2014 12:53 |
|
koldo
Messages: 3358 Registered: August 2008
|
Senior Veteran |
|
|
Hello Mirek
Now, with a public LoadSyntax(), the code I use to implement a new language ("my") is:
void CreateCSyntax(One<EditorSyntax>& e, int kind) {
CSyntax& s = e.Create<CSyntax>();
s.SetHighlight(kind);
}
...
static const char *my_keywords[] = {..., NULL};
static const char *my_names[] = {..., NULL};
int syntaxId = CSyntax::LoadSyntax(my_keywords, my_names);
EditorSyntax::Register("my", callback1(CreateCSyntax, syntaxId), "*.my", "MyLanguage");
...
myCode.Highlight("my");
How would have to be the best way to implement it?
Best regards
Iñaki
|
|
|
Goto Forum:
Current Time: Mon Apr 29 17:17:53 CEST 2024
Total time taken to generate the page: 0.02595 seconds
|