|
From: John S. <leg...@gm...> - 2009-02-19 23:25:11
|
Hi Douglas: Haha, I ended up doing something similar after reading up on my regex :D It works well enough now, but it can still be flaky. Maybe changes in how the tags work could improve the situation. I too noticed the problem with highlighting to the end of the line. I was expecting NO_LINE_BREAK to be a condition (i.e., don't apply the SPAN at all if it would cross a line break), whereas it just stops/continues the highlighting. As for SPAN_REGEXP not caring about escaping the ')' in the END tag, I believe that is because only the BEGIN tag is interpreted as a regex, whereas the END tag is interpreted as just a string. If I'm not mistaken, there was a thread on this and it should be changed in pre17. Cheers, John 2009/2/17 Douglas Silas <ds...@gm...> > John, > > There seems to be a bug in the behavior of the SPAN_REGEXP tag. > > If we do this, for example: > > <SPAN_REGEXP > NO_LINE_BREAK="TRUE" > TYPE="OPERATOR"> > <BEGIN>:</BEGIN> > <END>)</END> > </SPAN_REGEXP> > > Then all lines which contain a colon will be highlighted until the end of > the line (or further, if NO_LINE_BREAK is false or not present). Also, if we > wanted to specify an actual parenthesis, then we should need to escape it: > "\)". SPAN_REGEXP doesn't seem to care, for some reason, that we don't > escape the parenthesis. > > Despite the apparent bug, you should be able to use the following, using > (relunctant) lookahead, to highlight between a colon and an end-parenthesis: > > <SPAN_REGEXP > NO_LINE_BREAK="TRUE" > TYPE="OPERATOR"> > <BEGIN>:(?=.*?\))</BEGIN> > <END>)</END> > </SPAN_REGEXP> > > Someone else should probably comment on the apparent bug. > > Cheers, > > Silas > > On Tue, Feb 17, 2009 at 12:47 AM, John Smith <leg...@gm...> wrote: > >> Hi: >> >> I'm using jEdit 4.3pre16 on Ubuntu 8.10. I'm trying to modify the ML edit >> mode, but I'm facing a problem. I try to write the following (the actual >> code contains some regular expression, but I've just removed it to make it >> easier): >> >> <SPAN_REGEXP .... > >> <BEGIN>:</BEGIN> >> <END>)</END> >> </SPAN_REGEXP> >> >> However, it fails to highlight stuff between ':' and ')'. I have to >> write: >> >> >> <SPAN_REGEXP .... HASH_CHAR=":" > >> <BEGIN>:</BEGIN> >> <END>)</END> >> </SPAN_REGEXP> >> >> in order to get it to work. What is weird is if I try to do something >> like: >> >> <SPAN_REGEXP .... > >> <BEGIN>a</BEGIN> >> <END>)</END> >> </SPAN_REGEXP> >> >> it will highlight stuff between 'a' and ')'. Is this a bug? >> >> In addition, I was wondering what is the purpose of the >> HASH_CHAR/HASH_CHARS attribute? Using my above example, it just duplicates >> what you already have to put in the regular expression for the <BEGIN> tag. >> >> Cheers, >> legit >> >> >> ------------------------------------------------------------------------------ >> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, >> CA >> -OSBC tackles the biggest issue in open source: Open Sourcing the >> Enterprise >> -Strategies to boost innovation and cut costs with open source >> participation >> -Receive a $600 discount off the registration fee with the source code: >> SFAD >> http://p.sf.net/sfu/XcvMzF8H >> -- >> ----------------------------------------------- >> jEdit Users' List >> jEd...@li... >> https://lists.sourceforge.net/lists/listinfo/jedit-users >> >> > |