Syntax Highlighting SQL - HINT

Syntax Highlighting SQL - HINT

3
NewbieNewbie
3

    Mar 12, 2008#1

    We make extensive use of HINTs in our SQL-statements.
    Hints look like comments, but are a bit different: /*+ hint */
    Notice the + sign in the beginnen.

    If we're to open a SQL-file with comments and hints the all look alike and could be confusing for the reader.

    Is there any way to add this to the language-definition(s) for syntax-highlighting?
    If so: how.

    Marc

    344
    MasterMaster
    344

      Mar 12, 2008#2

      Hi Marc,

      1st I am no syntax highlighting specialist at all.
      But the hint collides with the

      Code: Select all

      Block Comment On = /* Block Comment Off = */
      setting because the + sign is recognized as one possible content of the comment.
      And the content of the comment is no more interpreted once again by syntax coloring, so I can't figure out a proper solution here ...
      Normally using all newest english version incl. each hotfix. Win 10 64 bit

      236
      MasterMaster
      236

        Mar 12, 2008#3

        Well, another example for the need to make regexes available for wordfiles (in other areas than function/member/variable strings). If UE were to accept regexes, you could go and define your block comments as "/\*(?!\+)", and bam! - only /* not followed by a + will match. Write to IDM and request this feature.

        3
        NewbieNewbie
        3

          Mar 13, 2008#4

          Bego: Well, that's what I figured out too, I was hoping to find some guru's here who had the same problem and solved it for me :D

          Pietzcker: So actually you were waiting for me to do the request :D

          But all in all thanks for the fast responses.

          236
          MasterMaster
          236

            Mar 13, 2008#5

            MarcS wrote: So actually you were waiting for me to do the request :D
            Waiting, no - hoping, yes. I myself have made that request already (and several times, too), but the more people ask for it at IDM support, the higher the chance that it will get pushed upwards on the to-do list. So if you add your voice to the choir, we might get lucky faster.

            Best regards,
            Tim

            6,677581
            Grand MasterGrand Master
            6,677581

              Mar 13, 2008#6

              There is no need for a regular expression to solve this syntax highlighting problem. Use following in your language definition line:

              Block Comment On = /*+ Block Comment Off = */ Block Comment On Alt = /* Block Comment Off Alt = */ NestBlockComments

              Now hints, line comments and alternate line comments are highlighted with the comment color and block comments with the alternate block comment color. NestBlockComments makes sure that this highlighting works also if a hint is inside a block comment. Don't know if SQL has also line comments and you are not happy that hints and line comments have the same color. But this cannot be changed, sorry.
              Best regards from an UC/UE/UES for Windows user from Austria

              236
              MasterMaster
              236

                Mar 13, 2008#7

                Good to know that there is a workaround. But if there was a third kind of comment/hint, this workaround would fail. If comment detection were regex-based, it would be a lot more elegant. Same thing with nested comments, multi-line strings etc. - using regexes would make things easier for the developers and more transparent for us users. No need to make UE's code more and more baroque in order to comply with all kinds of special situations - just hand it to the regex engine.

                Slowly, this thread is drifting into the My Two Cents forum... :)
                Tim

                3
                NewbieNewbie
                3

                  Mar 13, 2008#8

                  I've received the same workaround from the tech guys as Mofi posted.

                  Now that we know there is some kind of workaround we've added it and granted ourselves a few days to evaluate it before we're pass it on to the rest of our gang.

                  True that line comments & hints now look alike, and that could be more confusing than that we've planned.

                  Still, I second pietzcker motion: regexp will give us more power 8)