[R-gui] NEdit Highligth patterns for R

Philippe Grosjean philippe.grosjean@ifremer.fr
Fri, 11 Oct 2002 10:00:03 +0200


>Hi

>I've just submitted to the NEdit development team a R highligth patterns
>for NEdit (www.nedit.org).

>NEdit is a text editor for LINUX which I use to write small R functions.
>In my opinion is a very good tool for small scripts, maybe for huge
>projects is not the best.

>I'm attaching the R-5.1.pats file so you can try it.

>As usual contributions and comments are welcome.

>Regards

>EJ

Nice. But regarding synthax highlighting, I stick with two problems:

1) It would be interesting to highlight in different colors functions and
arguments... but they can have same name. Example: plot(x, col=2) -argument
'col' and col(x), function 'col'. For the moment, the only easy way I found
is to define argument followed by = in the dictionnary, like 'col=' for the
argument. However, space is allowed between 'col' and '=', and then the
argument is not correctly coloured. So, I add an automatic correction that
eliminates spaces before a single '=' sign. But now that '=' is also allowed
as asignment, it is problematic: col = 1, with 'col' being the name of a
variable (indeed, col <- 1) is now highlighted as an argument.

2) Of course, one could statically define the dictionnary with, let's say,
all functions and arguments in the base and recommended packages. I would
prefer a dynamic construction of the dictionnary: when a library is loaded,
terms are added, when it is unloaded, they are eliminated. This is only
possible with a bidirectionnal communication between the editor and the R
calculation kernel. I got this in SciViews but how to do that in Nedit or
other separate script editors?

Regards,

Philippe Grosjean

...........]<(({°<...............<°}))><...............................
( ( ( ( (
 ) ) ) ) )      Philippe Grosjean
( ( ( ( (
 ) ) ) ) )      IFREMER Nantes - DEL/AO
( ( ( ( (       rue de l'Ile d'Yeu, BP 21105, 44311 Nantes Cedex 3
 ) ) ) ) )      tel: (33) 02.40.37.42.29, fax: (33) 02.40.37.42.41
( ( ( ( (	    e-mail: philippe.grosjean@ifremer.fr
 ) ) ) ) )
( ( ( ( (       "I'm 100% confident that p is between 0 and 1"
 ) ) ) ) )                                L. Gonick & W. Smith (1993)
.......................................................................