Highlighting various variable definitions... Velocity Syntax

Highlighting various variable definitions... Velocity Syntax

2
NewbieNewbie
2

    Oct 08, 2004#1

    Hello, hope someone can help me out!

    I'm using the word-file for Velocity downloaded from this site.

    I'm wondering if it would be possible to get several variable prefixes
    highlighted.

    Example:

    #if($myVar == 'foo') --> $myVar is highlighted

    #if($!myVar == 'foo') --> $myVar is NOT highlighted

    #if(!$myVar) --> $myVar is NOT highlighted

    #if(${myVar}) --> $myVar is NOT highlighted


    Any help would be much appreciated!
    Thanks - Alex!

    6,603548
    Grand MasterGrand Master
    6,603548

      Re: Highlighting various variable definitions... Velocity Sy

      Oct 08, 2004#2

      Never seen a velocity file, but after looking into the wordfile I know, why the first is highlighted and the rest not.

      The '!', '}' and '{' are word delimiting characters defined at /Delimiters=.

      In color group 4, you find the line ** $, which means, highlight all words starting with '$', which is possible because '$' is not a word delimiting character.

      So the first one is OK, because this is the word "$myVar".

      The second one is not highlighted, because UE interprets it as word "$" and word "myVar". The '!' is delimiting it into two words.

      The third one is highlighted, because of the same reason as first one. I tested it. Have you written it correct in your post?

      The last example is not highlighted, because UE interprets it as word "$" and word "myVar". The '{' is delimiting it into two words.


      If you really need, that your variable is highlighted on all 4 examples, you have to remove '!', '{' and '}' from the delimiters definition and modify color 4 to:

      /C4"Methods"
      ** !$ $ ${

      Don't know, if it is a good idea to remove '!', '{' and '}' from the delimiters definition. Estimate, it isn't.

      Better you add your variables to section /C4 manuelly.
      Best regards from an UC/UE/UES for Windows user from Austria

      2
      NewbieNewbie
      2

        Re: Highlighting various variable definitions... Velocity Sy

        Oct 11, 2004#3

        Excellent, thanks for your help - that solved my problem!

        Cheers - Alex!