Menu

#119 feature request: extend possibilites of regexp

open
nobody
None
5
2009-06-30
2007-02-06
goebbe
No

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.

Discussion

  • Robert Schwenn

    Robert Schwenn - 2007-02-06
    • labels: 102669 -->
     
  • goebbe

    goebbe - 2007-09-24

    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>

     
  • goebbe

    goebbe - 2009-06-30
    • summary: feature request: extend possibilites for regexp --> feature request: extend possibilites of regexp
     
  • goebbe

    goebbe - 2009-06-30

    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)

     
  • goebbe

    goebbe - 2009-06-30

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

     

Log in to post a comment.