|
From: Romain F. <rom...@db...> - 2009-03-29 10:09:13
|
Kevin Hunter wrote: > At 4:53pm -0400 on Thu, 26 Mar 2009, Romain Francois wrote: > >> but this does not work because MARK_PREVIOUS does not know about >> DELEGATE. Is there another way I can achieve it ? >> > > Have you looked at the jEdit documentation on mode writing? > yes > http://www.jedit.org/users-guide/writing-modes.html > > Or, specifically, have you tried SEQ or SEQ_REGEXP? > I am probably misreading something. With the code below: <code> stop <- function( ... ){ print ("bla" ) } f <- function( x ){ stop( "ouch" ) } </code> I am interested in highlighting the first instance of "stop" in a way, and the second in another, because it is a function call. So the MARK_PREVIOUS seems to be the way to go for separating the token i am interested in (stop) and the opening bracket, except I want to further analyze the token to dispatch the content to a KEYWORD of my choice, so the idea was to delegate its interpretation to another ruleset containing the keywords. If I do a <SEQ DELEGATE="kw">stop</SEQ> then how is the "kw" ruleset going to know about whether there is a bracket after or not. I guess I could match stop[^\(]( with SEQ_REGEXP and then flush away the bracket in the kw ruleset, but it seems both inelegant and inefficient to me. > http://www.jedit.org/users-guide/mode-rule-seq.html > http://www.jedit.org/users-guide/mode-rule-seq-regexp.html > > Kevin > -- Romain Francois Independent R Consultant +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |