4

I want to create a custom Language, with its own custom Syntax Highlighting.

Notepad++, a Windows-only SciTE/Scintilla based text editor, allowed me to create a custom "Language", and now, in Linux, I want to reproduce the same thing.

I need(?) to use SciTE/Scintilla because (as far as I know) it is the only plain-text editor which can display different size fonts in the same text-file (e.g., default-font= 12pt, comment-font=24pt).

I used the comments font to display a complex script (alphabet) in a larger font. Please let me know if there is any other plain-text editor which does this.

I assume this is a feature of SciTE/Scintilla (and not of Notepad++). Some of the magic is possibly (probably?) done in files such as: /usr/share/scite/.properties

Notepad++ has a GUI interface to set up a new language or syntax, but I could use some direction on exactly how to go about it in SciTE.

Thanks...

2
  • 2
    Emacs also allows you to display fonts in different sizes. Not sure whether emacs qualifies as "plain" though.
    – sepp2k
    Oct 19, 2010 at 14:57
  • Thanks sepp2k... The "plain" referred to "plain text" vs "word processor embilished text"...
    – Peter.O
    Oct 19, 2010 at 19:21

3 Answers 3

2

I looked at it once, it's quite painful, because all is defined statically in the c++ source code.

You have to define a certain number of rules among the one already existing in scintilla, for things like... well it's quite mangled. You can quickly search for "scintilla lexer" on google, but you to understand that syntax highlighters are very sophisticated to code, just look at notepad++ and all its features: it's almost a code parser, which is found in compilers.

On top of that, a scintilla lexer can be made for any type of language.

Another problem is that coloring the text has to be platform agnostic, and again, I guess it favors windows (duh), and don't forget the font renderer, which can also be another thing.

I'm not sure scintilla has been ported to gnome or kde, has it ?

2
  • Thanks gokoon... There's nothing quite like the voice of experience (your experience ;) I'll give Scite(Scintilla) a miss (Scite is available in the Ubuntu repository) ... I would use notepad++ in wine but even though is many reports say it works flawlessly, that is not my expereince (maybe they haven't tried <Ctrl><NumPad+> / <Ctrl><NumPad-> .. it leave a trail of +/- chars for each keypress... and I've noticed a couple of there things... Oh well I'm surviving without it, but aybe Emacs will do what I want (as mentioned by sepp2k).. I've starting to look at Emacs only very recently....
    – Peter.O
    Feb 4, 2011 at 23:28
  • more general info... As Scite/Scintilla doesn't match my requreiemnts, I've now looked specifially at Emacs.. and it can do the job..(so I'm now on an Emacs learning curve... but I'll have a coffee before I start :) .... I posted another related question... so for anyone who is interested in this issue, here is the link: unix.stackexchange.com/questions/6922/…
    – Peter.O
    Feb 6, 2011 at 3:16
0

This probably will not suit your request, but jEdit has an extensive configuration for language highlighting if you want an editor that will highlight your new language.

2
  • I had a look at jEdit a couple of years ago. As I recall, it was a bit slow and didn't have that one particular thing I primarily want: ie. different sized font on the screen in one instance of a single text file, at the same time... but I will take another look at it.. It is only a download away :)... thanks.
    – Peter.O
    Oct 20, 2010 at 1:02
  • I just tried jEdit.. I must have had a slower computer 2 years ago; it seems fast enough (for me).. However Syntax Highlighting (Global) does not cater to Font-size, and a single set of colours apply to all languages. Font-size is a seperate single Global option. ...but jEdit it is certainly a nice looking editor :)
    – Peter.O
    Oct 20, 2010 at 1:48
0

AFAIK, Notepad++ is based upon Scintilla lexers.

I thought "new language" only meant "existing lexer, but new set of keywords"; but it seems more powerful.

What I found : (http://docs.activestate.com/komodo/4.4/udl.html)

Komodo's system for defining multi-language syntax lexing and user-defined syntax highlighting is called UDL (User Defined Languages). UDL files are written in a language called Luddite, then compiled into Scintilla lexers and packaged for use in Komodo.

So after defining your language in Notepad++ you should be able to get the compiled lexer and adding it to scite.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .