[Oberon] Re. PET ? IDE & syntax coloUring ?

Chris Burrows chris at cfbsoftware.com
Wed Nov 15 00:39:46 MET 2006


> I previously mentioned the advantage of syntax colouring.
> The type that I've seen, is with coloured reserved words and special 
> tokens ; and bracket matching hi-lighting.

I also find 'syntax colouring' very useful. However, having just
finished implementing a 'smart' Oberon-aware IDE for Gardens Point
Component Pascal for .NET I can appreciate the difficulties of
implementing full-featured syntax colouring 'on the fly'. 

Colouring keywords and reserved words is not too bad. Where it starts to
get tricky is when colouring strings are involved, but at least these
are limited to the current line. The trickiest part is colouring
comments.  e.g. if you have just inserted '*' into your text, it has to
inspect the previous character to check if it is a '('. If it is, it
then has to scan and colour all of the subsequent text, possibly to the
end of file until the next closing comment pair '*)' Conversely, delete
an '*' and you have to check whether a comment has now been removed or
not. It would have to do this sort of processing on every keystroke, cut
and paste etc. etc.

I'm not saying it can't be done - I'm just pointing out that it is a
significant programming exercise.

A phased implementation of syntax-colouring might be more feasible. I
have seen partial solutions that are much easier to implement but still
give useful feedback. e.g. the first step might be just to bold
'breaking' keywords e.g. RETURN, EXIT. Another example - POW! Oberon
justs colours comments and strings.

> As previously asserted, I don't see why 'keys' should be selected,
> when 'whole constructs' could be offered. 
> And the different constructs could be differently coloured.
> But the nesting level would determine the colour, rather than the 
> construct type.

I have this facility available to me in several development systems that
I use (e.g. Delphi, Visual Studio, Blackbox Component Pascal but I don't
make any use of it. Maybe my 30-year Pascal / Modula-2 / Oberon / CP
programming habits are too ingrained, but, even with my two-finger,
one-thumb typing technique I find it quicker to let my fingers
automatically type the constructs instead of having to jump around in
pre-defined templates. Remembering all of those shortcuts is a challenge
as well!

Implementing my own IDE made me really stop and think what it was that I
found indispensable in an Oberon-based programming editor. Apart from
all the usual Windows editing features (cut, copy, past, undo,
auto-indent etc. etc.)the three 'smart' Oberon-aware features that I
find extremely useful and eventually implemented were:

1. Auto-capitalisation of keywords. e.g. type in begin and it
automatically converts it to BEGIN for you as you type.
Auto-capitalisation happens when all of the following conditions apply

The RETURN key is pressed or one of the following characters is typed: 


(    left-parenthesis   

 )   right-parenthesis  

;    semi-colon

|    vertical bar

,    comma

The word is a reserved word or predeclared identifier 
The word consists entirely of lowercase letters 
The word is not contained in a comment or string  

2. A Procedures Index (Similar to 'TAGS' functionality on other systems)

When working on a source code file, an alphabetically-sorted list of
procedures is automatically maintained in a separate window.
Double-click on a procedure name and it automatically takes you to the
definition of that procedure in the source code file.

3. An Imports Index

An alphabetically-sorted list of imports in the current source file is
automatically maintained in a separate window. Double-click on an import
name and it automatically opens the corresponding source file in a
separate window.

A picture is worth a thousand words - there's a screenshot of CPIde at:


Of course, this is only directly of any use to anybody who is doing .NET
development in Component Pascal on Microsoft Windows, but the concepts
may be of use for whoever is working on PET or similar programming


Chris Burrows
CFB Software

More information about the Oberon mailing list