Skip to content
Prev 14 / 1236 Next

[R-gui] NEdit Highligth patterns for R

(Apologies if anyone sees this twice; my first attempt seemed to
disappear.)
On Fri, 11 Oct 2002 10:00:03 +0200, Philippe Grosjean wrote:

            
This can be done without bidirectional communication.  R already
maintains the dictionaries you need, so you could query R to find out
how to colour each identifier.

Distinguishing between local and global identifiers is hard.  To do
that the editor needs to parse the code to see if you're in a
function, and to see what local identifiers have been defined.  But in
the editor, functions aren't fully written, so you need a parser that
can handle lots of syntax errors and still do useful things, or at
least one that can keep building the parse tree until it hits an error
and save the partial results at that point.  

Adding flexibility like this to the parser would have lots of side
benefits.  It would let you write a debugger that knows the source
file line corresponding to each bit of code being executed, editors
could jump to syntax errors in the source file, hints about function
arguments could be made available in the editor, etc.

Duncan Murdoch