2

I am working on a product which has its own SQL like language to query the database. We call it Reporting language. Now, I want to have a text editor which does highlighting specific to my language .i.e I can specify the keywords (purple-colour), datatypes(red colour), comments green colour, and everything else black colour and so on.

Is there an existing tool whom I can give these specifications as input and output is a text editor which does this language specific highlighting.

Please do not hesitate replying any information even if its too basic. Thanks in advance.

Noufal Ibrahim
  • 71,383
  • 13
  • 135
  • 169
Mayank Jaiswal
  • 12,338
  • 7
  • 39
  • 41

2 Answers2

3

Emacs is the world's most configurable and extensible editor.

It is possible to define "modes" for emacs, which support editing documents that conform to a particular format. For example, there are existing emacs "modes" for

  • C/C++
  • Java
  • C#
  • VB.NET
  • perl
  • Powershell
  • SQL
  • .htaccess
  • html
  • css
  • javascript
  • xml
  • and many others

"Modes" can be something as simple as syntax highlighting (or as emacs calls it, fontification). Most modes, though, provide other features like autocompletion, syntax checking, template insertion, and compilation helpers. You define an emacs mode in elisp, which is a variant of LISP.

If your requirements are relatively simple, then you could produce an emacs mode in less than an hour. Most modes are open-source, so you can start with an existing mode, and change it to your purposes, or simply learn from it.

Also see A 'hello world' example for a major mode in Emacs?

Emacs is free, and open source, and runs on any platform.

Community
  • 1
  • 1
Cheeso
  • 189,189
  • 101
  • 473
  • 713
1

Syntax highlighting is just a tiny part of writing a text editor. You're going to have much more trouble writing a general text editor than making it do syntax highlighting. A "syntax highlighting editor generator" is too narrow an application to have a tool for it as far as I can tell.

Also, I don't expect my customers to switch editors just to edit a certain file format. You're much better of writing a mode for a popular (cross platform) editor like Emacs, vim or eclipse.

If you just want to display your language with syntax highlighting, use pygments which you can embed into (python) applications (e.g. https://gist.github.com/773300) or SyntaxHighlighter for web presentation.

Noufal Ibrahim
  • 71,383
  • 13
  • 135
  • 169