Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to next message
koldo is currently offline  koldo
Messages: 3355
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 #43194 is a reply to message #43181] Tue, 03 June 2014 08:27 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
OK, it is now protected. However, I am not quite sure whether what you want to do is a good idea: There might arose a conflict of "C language id" integer if somebody else does the same.

Perhaps you could just put it into CSyntax?

That said, CSyntax was meant as sort of temporary solution to adapt the old code to the new scheme.
Re: To load a new syntax in CodeEditor [message #43195 is a reply to message #43194] Tue, 03 June 2014 12:53 Go to previous message
koldo is currently offline  koldo
Messages: 3355
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
Previous Topic: Closing parentheses for arguments list
Next Topic: [BUG / C++11 support] Braced initializer list and Assist++
Goto Forum:
  


Current Time: Fri Mar 29 11:13:06 CET 2024

Total time taken to generate the page: 0.01066 seconds