views:

419

answers:

5

I'm looking for an editor - not an IDE - that has just syntax highlighting. Word completion would be nice for the keywords I specify as well, but I could give up that feature. It only needs to be Windows compatible.

The situation is that I have an extremely narrow domain specific language that only has around 25 keywords; it doesn't even have conditionals. I would like the keywords to be highlighted so that the user knows when they've written a keyword correctly. And to help ensure that they don't need to specifically memorize each keyword, that's where word-completion would be nice.

I'm going under the assumption that the user has the computer skills of your typical grandparent -- I've easily made syntax files for this DSL in Vim and PSPad, but I feel that those have way too many features to be "usable" for this target audience. The functionality of Notepad (plus coloring) would be just about adequate.

I'm also open to writing a simple editor from scratch, if there is a library that already does most of the work I've explained here - i.e. I just tell it what to highlight in what color, possibly using regular expressions.


Updates: I've looked at SciTE a bit -- it is very much like what I'm looking for, except that creating the new syntax file (properties file) is becoming quite a hassle. My syntax is rather simple: a short sample script might have the form of:

CommandA
CommandB Num1 Num2

CommandC

It doesn't quite fit into Python or a Basic language, but I'm not going to write a lexer for it either. But the simplicity of SciTE and its ability to run external programs with the file are two high points.

Notepad++ is decent too -- I think it's a bit too full-featured for the intended purpose, but that's not too bad in itself. I had already tried setting up a syntax file for it, but I'm having a couple issues that just shouldn't even pop up. For example, I've chosen a color for the number style. If I put the number 3, it shows up fine. If I put 3.0, the .0 part is in the default color, not the number color. If I do 0x80, only the first zero is colored, let alone the x80; so of course 0xff isn't colored right either. Also, # is my line-comment character. If I have a line such as

# foo bar

the whole line is blue, which is proper. But if there isn't a space (#foo bar), then the whole line stays black. My last gripe is that auto-completion seems to only pick up on words already used in the file, not the keywords that haven't been used yet.

Am I missing something obvious with the syntax configuration here? I've had poor luck searching Google for what I think should be obvious answers in regards to Notepad++ syntax.

+4  A: 

Use the Scintilla library, as seen the SciTE editor. It has a systems for custom syntax highlighting and for autocompletion.

You might be able to use SciTE as it is, or you could easily modify it or write your own shell for the Scintilla editor component.

It comes with commercial-friendly Open Source licence.

RichieHindle
+4  A: 

use notepad plus plus... with language plugin.. it read the keywords from a text file

Umair Ahmed
+2  A: 

NotePad++ satisfies all of your requirements, and more.

from the link:

Notepad++ is a free (as in "free speech" and also as in "free beer")

it also has auto-completion and user defined syntax highlighting.

akf
A: 

crimsoneditor and jedit work well

A: 

After digging through the Wikipedia article on text editors, I've found that Programmer's Notepad will best suit my needs. Keyword completion is based only on the defined keywords; the syntax file was simple to set up; and I can disable the "complicated" features by default, turning it into just what I need.

Mark Rushakoff