Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Syntax Highlighting tool/language that works with multiple editors

Is there any tool that would allow me to specify syntax highlighting for a given language, then generate syntax highlighting files for some of the more common editors?

I ask because I'm developing a domain-specific language, and I'd like to provide syntax highlighting support for said language. However, I don't want to write separate syntax highlighting files for each editor (Vim, Notepad++, Visual Studio, etc.).

This type of translation seems possible, as the core concepts for syntax highlighting generally independent of what editor you're using. I just don't know if such a thing already exists.

like image 532
simplyletgo Avatar asked Jan 22 '12 20:01

simplyletgo


3 Answers

Quite a lot of editors use scintilla (http://www.scintilla.org/) for source code editing and syntax highlighting: for instance Notepad++ on windows, gedit in gnome, Code::blocks. You may therefore consider adding a syntax definition to Scintilla. As far as I understand this is a matter of writing a xml definition of a lexer for your language (see for instance this page for Code::Blocks)

like image 75
user1001031 Avatar answered Nov 15 '22 13:11

user1001031


(Old question/answers but here you go) Seems like it's worth checking out Iro, "a development tool designed to simplify the creation of syntax highlighters across many platforms" - see this medium post: "Introducing Iro — An Easier Way To Create Syntax Highlighters" - https://medium.com/@model_train/creating-universal-syntax-highlighters-with-iro-549501698fd2

EDIT: removed the eeyo . io link in my initial post above. Just keeping the medium one. Thanks @usmanharoon for the heads-up.

like image 28
carueda Avatar answered Nov 15 '22 13:11

carueda


I don't know of anything like that, but in my opinion it would be quite easy to produce. For example, one can create an XML-based universal format (in form of a DTD/XSL scheme) and use editor-specific XSLT transformations. Then, each editor creator (or someone else) would create an XSLT file for his editor. And for each new language, an XML would be created.

The biggest problem is to specify such a language that would satisfy at least these criteria:

  • Completeness: it should contain all possible features of syntax highlighting configuration.
  • Ease of use: it shouldn't be overly complicated for simple languages.
  • Openness and standardization: it should be popular to be useful. To be popular, it should be open and standardized.
like image 1
Marek Kurdej Avatar answered Nov 15 '22 11:11

Marek Kurdej