Editing sources with an editor with smart syntax highlighting
My favorite editor is Jed. It seems to be an Emacs clone but I am not on speaking terms with the Emacs family so I cannot acknowledge that assertion. Still, it's a mighty fine editor and that's what counts. Jed reads the file extension and if it sees one that it knows, it starts in script mode and makes life easier for the programmer. Let's make some sources and see how the editor helps me. The editor images are not texts. They are images, produced with a screenshot program.
Syntax highlighting
We are going to make the 'Scope.java' source code and start out with an empty file called 'Scope.java' and
enter the first line "class Scope":
Now we need a curly brace "{" to open the definition of the class. Just press '{' and see what happens:
After the '{' brace, the editor knows how to indent and that's just what it does. Time to type in the
definition of the global variable. Enter 'static double pi = 3.14':
When the editor finds a keyword, it makes it red. Numbers are yellow. Unrecognized tokens (variables,
procedures and misspelled keywords) remain white. Time to add the 'main' routine body:
Now add another '{' (no need to press 'Enter'). The editor jumps to the next line and to the next indent:
Fill up the main procedure body...
Nothing special so far. Now close the main routine with the '}' token. Just press it once and see what happens:
The editor unindents the line and tracks back to the latest '{' token (and rests the cursor there for a
second) so you can see that this '}' matches that '{'. Unindenting is automatic.
Hit '}' once more and the editor adds a new line, unindents the right amount, rests on the matching '{' for a
second and then goes back to the new editing position.
Jed does this with any kind of brace, round, curly or angular. It always tracks back to the one matching
yours. Even in nested braces. It comes in very handy.
Page created on 5 June 2010 and
Page equipped with FroogleBuster technology