COBOL Editor Prototype

This is a text editor written in Java using the Eclipse RCP framework.  It has (very basic) syntax highlighting, code folding and an extremely basic COBOL parser to provide syntax checking (I can’t take complete credit for the COBOL parser, a good portion of it was made by a coworker in Visual Basic and I ported it to Java).  Let me reiterate:  This is a prototype.  It’s functional, but definitely not enough to be usable.

An example of the basic display of the COBOL editor

This is a screenshot of the basic screen of this editor.  Syntax highlighting is handled by specifying various single line, word and end-of-line rules.  (Since the keywords are done via word rules, they’re not always highlighted correctly.  For instance, if you write “divisionaaa”, the “division” part will highlight.  It really shouldn’t highlight anything in that scenario.)

An example of code folding

This screenshot shows the code folding in action.  Code folding is done using a ProjectionViewer.  The sections and divisions are parsed out by the COBOL parser, and the annotations are passed into the viewer.  Eclipse handles the rest, so there’s no need to reinvent the wheel.

Error handling inside the editor

This screenshot shows off the error checking.  I don’t have the squiggly lines implemented, which would be nice, but at least you can see what lines have errors, and hover over the marker for the error text. (Also in this screenshot, you can see that the parser has issues with multiline COBOL statements.  It knows that the whole thing is a sentence, but I’d rather it know what line it starts on, instead of what line it ends on.)

The editor can be downloaded here, and the source is available here.

Comments are closed.