PreviousNextTracker indexSee it online !

(41/212) 119 - feature request: extend possibilites of regexp

The following feature request is the outcome of bug:
"\[ 1094078 \] Repeated REGEXP per line"

If I understood right than the regexp-feature for syntax-highlighting has the following properties:
1. don't expand over more than two line
2. don't allow overlapping sequences (end sequence is ignored for the next matching expression)

I would like to have the possibility (optional) to:
- span over more than one line and (option1)
- allow for overlapping sequences in the text (option2)

Use case: I tried to implement syntax highlighting for SAS-statistics package. With the present feature set of Jedit I couldn't implement the underlying rules.

Here is a short description of the syntax highlighting for SAS:

Test case:
3\*4+4; \*comment1; 3\*4\*4; \*comment2; \*comment3;\*comment4;
3 \* 4 + 4 ; \*comment1; 3 \* 4 + 4 ; \*comment2;
\*
comment3
;
\*comment4; this is \* no comment;

Now I try to describe expected behaviour with my own words:
If there is only space (only space and/or newline) between the last ";"
sign and
the "\*" sign, then the "\*" sign starts a multi-line comment. The end of
the comment is always the next ";" sign.

From the comment on bug 1094078 I concluded that at the moment it is not possible to define corresponding rules in Jedit.

Submitted goebbe - 2007-02-06 08:52:48 Assigned
Priority 5 Labels
Status open Group None
Resolution None

Comments

2007-02-06 20:38:05
rschwenn

- **labels**: 102669 -->

2007-09-24 17:29:58
goebbe

Logged In: YES
user_id=1050273
Originator: YES

I am grateful to Redoute to provide the following code which is able to
reproduce the correct highlighting for the SAS-rules.

However I tried to implement a more complete highlighting mode for SAS and
failed when I tried to implement HIGHLIGHT_DIGITS="TRUE" and KEYWORDS since the
first keyword or digit is not recognised when the "COMMAND" rules apply.

Possibly this is due to my limited knowledge of Java/Jedit but I suspect this is due to the design
of syntax highlighting in Jedit.
I would be glad if anybody knows a solution to this within the current Jedit syntax highlighting
possibilities.

Anyway here is the code from Redoute which produces correct SAS-highlighting. Just in case somebody
can live without coherent keyword-highlighting and digit highlighting, this might be useful:

<?xml version="1.0"?>
<\!DOCTYPE MODE SYSTEM "xmode.dtd">
<MODE>
<RULES>
<SEQ TYPE="COMMENT1" DELEGATE="COMMENT">\*</SEQ>
<SEQ_REGEXP TYPE="KEYWORD1"
DELEGATE="COMMAND">\S</SEQ_REGEXP>
</RULES>
<RULES SET="COMMENT" DEFAULT="COMMENT1">
<SEQ TYPE="OPERATOR" DELEGATE="MAIN">;</SEQ>
</RULES>
<RULES SET="COMMAND" DEFAULT="KEYWORD1">
<SEQ TYPE="OPERATOR" DELEGATE="MAIN">;</SEQ>
</RULES>
</MODE>

2009-06-30 07:52:14
goebbe

- **summary**: feature request: extend possibilites for regexp --> feature request: extend possibilites of regexp

2009-06-30 07:52:14
goebbe

Most of the cases that are described in the example above (for the SAS language) are solved now, by using Jedit syntax highlighting and regexp.
See bug:
http://sourceforge.net/tracker/?func=detail&atid=300588&aid=2793540&group_id=588

However there are some cases for the described range comments that cannot be implemented by Jedit syntax highlighting.
I will attach a testfile (for SAS-mode) that contain such cases, in order to illustrate the problems.

As described above the feature request boils down to (optionally) allow the regexp feature in syntax-highlighting to:
- span over more than one line and (option1)
- allow for overlapping sequences in the text (option2)

2009-06-30 07:55:56
goebbe

test-file that illustrates the limitations of regexp in syntax-highlighting (last example)

sas_comment_test.sas (1.6Kio)