#733 '#' symbol doesn't is a valid comment in SQL

Completed
closed
Neil Hodgson
SciTE (231)
3
2010-12-09
2010-10-29
Anonymous
No

Hi!
I'm following and using this great editor since many years. But I'm afraid because '#' character continues present at SQL lexer sa a line comment (which is false almost in Oracle). It's possible modify this?

Discussion

  • Neil Hodgson
    Neil Hodgson
    2010-10-29

    To disable the '#' as a comment start, someone would have to implement an option in the LexSQL code. Since I do not use SQL currently, I will not be working on this myself.

     
  • Neil Hodgson
    Neil Hodgson
    2010-10-29

    • assigned_to: nobody --> nyamatongwe
    • priority: 5 --> 3
    • milestone: --> 632977
     
  • Carlos SS
    Carlos SS
    2010-10-30

    Ok, thanks for your answer.
    Can you modify 'scintilla/lexers/LexSQL.cxx' to include this:
    (in function "ColouriseSQLDoc")
    bool sqlNumbersignComment = styler.GetPropertyInt("sql.numbersign.comment", 1) != 0;

    (change )
    } else if (sc.ch == '#') {
    (to this)
    } else if (sc.ch == '#') && sqlNumbersignComment {

    This modification rely on new parameter "sql.numbersign.comment" that means:
    0 = # is a valid comment (for MySQL and others)
    1 = # isn't a valid comment (for Oracle and similar databases)

    I hope the effect with this new parameter will be the same until now. Without this parameter Scite should recognize "#" as a comment.

    What do you think? I'm right or wrong?

     
  • Carlos SS
    Carlos SS
    2010-10-30

    Hi another time!
    I want bring to you a possible solution for this:
    (in "ColouriseSQLDoc" function of "LexSQL.cxx" add:)

    // If "sql.numbersign.comment" Scite property is set to 0 a line beggining with '\#' will be a comment.
    bool sqlNumbersignComment = styler.GetPropertyInt\("sql.numbersign.comment", 1\) \!= 0;
    

    (few lines later in same function, replace:)
    } else if (sc.ch == '#') {
    (with:)
    // Oracle and others doesn't recognize '#' as a comment:
    } else if (sc.ch == '#' && sqlNumbersignComment) {

    (in "*propertiesToForward" structure of "SciteProps.cxx" add:)
    "sql.numbersign.comment",

    (in "knownIrregularProperties" array of "LexGen.py" add:)
    "sql.numbersign.comment",

    (in "sql.properties" add:)
    # Activate '#' based comments for MySQL with 1 or disable for Oracle with 0:
    sql.numbersign.comment=1

    I hope this helps!

     
  • Neil Hodgson
    Neil Hodgson
    2010-10-31

    Committed but with the name changed to lexer.sql.numbersign.comment since properties that start with lexer.<lexerName> will be automatically found by the scripts that update SciteProps.cxx and SciTEDoc.html.

     
  • Neil Hodgson
    Neil Hodgson
    2010-10-31

    • milestone: 632977 --> Completed
     
  • Perfect! Thank you for your fast answer. Regards.

     
  • Neil Hodgson
    Neil Hodgson
    2010-12-09

    • status: open --> closed