#2512 SAS Highlighting (multiline REGEXP)

minor bug
closed-fixed
Alan Ezust
5
2011-04-26
2006-02-22
Anonymous
No

The SAS editing mode does not correctly support SAS
comments. The following line will not be highlighted:

*This is a comment;

Furthermore, these types of comments can span multiple
lines, and do not necessarily start and the beginning
of line:
i=3*2; *multi-line
comment; *comment;

Since SPAN_REGEXP does not support multiline matches, I
do not believe there is not way to fix this currently.

Note that in my experience, the multi-line version of
this comment is not used ofter (/* */ is used instead).
I propose the following rule to be added to sas.xml to
correctly highlight some of these comments:

<SPAN TYPE="COMMENT2" AT_LINE_START="TRUE">
<BEGIN>*</BEGIN>
<END>;</END>
</SPAN>

This should correctly highlight the following as a
comment. Current sas.xml does not, and botches the rest
of the file (unclosed quote):
*Don't use apostrophes!;

- Xavier (xavier AT noreality [D] net)
jEdit 4.3pre3

Discussion

  • Robert Schwenn
    Robert Schwenn
    2007-02-15

    Logged In: YES
    user_id=1486645
    Originator: NO

    In feature request #1653057 (http://sourceforge.net/tracker/index.php?func=detail&aid=1653057&group_id=588&atid=350588) a SAS-comment was defined as follows:

    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.

    It this was correct, Your proposal would highlight a line that is not a comment, because there's no semicolon and optional whitespace before the "*".

    What to do?

     
  • goebbe
    goebbe
    2007-09-24

    Logged In: YES
    user_id=1050273
    Originator: NO

    I propose to include something similar to the suggested change - even though this will not work in all
    cases described in feature request #1653057.

    The following important (for SAS-programming only) case is covered:
    If you have some command in a SAS-programme, as:
    command;

    Then you can just comment this line out by putting a "*" sign at the start of the line.
    *commented command;

    Limitations of the proposed change:
    - Note that these type of comments in SAS can normally span multi-line comments. The requested extension does not cover the case of multi-line comments of this kind. See bug #14363222 for a discussion.
    - multiple comments per line are not highlighted correctly.

    Note: Multiple comments per line could be possible if some regexp-guru could define a rule which makes sure that there is either no space between the last ; and the * OR only white space between the last ; and the *

    Despite the limitations the proposed extension of the SAS-mode would allow correct highlighting for an important subcase.

    The following modification of the suggestion would also allow white space before the first comment in a line:
    <SPAN TYPE="COMMENT1" AT_WHITESPACE_END="TRUE" EXCLUDE_MATCH="FALSE">
    <BEGIN>*</BEGIN>
    <END>;</END>
    </SPAN>

    This would cover for example the following cases:
    no comment;
    no comment;
    *comment;
    *comment;

     
  • goebbe
    goebbe
    2009-06-30

    The SAS-mode has received a major rework and has just been submitted:
    http://sourceforge.net/tracker/?func=detail&atid=300588&aid=2793540&group_id=588

    The *comment; -types of comments have been implemented for a wide range of use cases.
    This includes the following cases:
    * comment; var= 3 * x ; * comment;
    *comment; * comment; var= 3 * x
    var=3 *x; *comment; *comment;

    I suggest to close this bug, since the described bug is solved.

     
  • goebbe
    goebbe
    2011-04-26

    The fixed SAS-mode is included in Jedit 4.4pre1.

     
  • Alan Ezust
    Alan Ezust
    2011-04-26

    Thanks for the ping, goebbe! I am closing it now.

     
  • Alan Ezust
    Alan Ezust
    2011-04-26

    • assigned_to: nobody --> gerardsmyth
    • status: open --> closed-fixed
     
  • Alan Ezust
    Alan Ezust
    2011-04-26

    • assigned_to: gerardsmyth --> ezust