Highlighting of floating point values

Highlighting of floating point values

17
Basic UserBasic User
17

    Dec 10, 2012#1

    It seems like numerical constants cannot be recognized by default, e.g. 12.3, 20, 0.001, 1.2E5, 4E-5, 20., .302, .256e+5

    Is there a way to have them recognized as one 'token' each?

    Thanks.

    6,606548
    Grand MasterGrand Master
    6,606548

      Dec 10, 2012#2

      Strings starting with a digit are automatically highlighted with built-in color group Numbers. Open Advanced - Configuration - Editor Display - Syntax Highlighting. The syntax highlighting language used for highlighting active file is already preselected in language selection drop down list. Therefore you need to select only the color group Numbers and assign any color you want for numbers.

      Please note that you have to exit UltraEdit after changing settings for a wordfile currently edited. UltraEdit saves modified settings only on exit into a wordfile. But UltraEdit detects if a loaded wordfile is edited in same instance of UltraEdit and reloads them immediately after save for applying the updated wordfile immediately to the other files. So when making changes on color settings and continue editing the wordfile, the modified color settings are lost on next save of the edited wordfile as with reloading the wordfile also the existing color settings in the wordfile are reloaded replacing the color settings currently used for syntax highlighting after closing the configuration dialog only saved on exit of UltraEdit.

      The readme announcement contains as chapter 7.5 the question Can negative numbers also be highlighted as numbers? with the appropriate answer. After adding a color group for numbers starting with a minus sign (well, usually the hyphen character is used as minus sign), you will have all positive and all negative numbers highlighted. For example installed css.uew contains such a substring definition at bottom for negative numbers.

      What might not be highlighted completely as number are floating point values. The reason is that the decimal point is often also put into the list of word delimiting characters because of being also the punctuation mark like the hyphen which has interpreted additionally as minus sign depending on context. There are 2 possibilities to solve not complete syntax highlighting of floating point values:
      1. Character . is removed from the line starting with /Delimiters = if the language you create the wordfile for does not interpret anywhere else the point as word delimiter or a point is surrounded anywhere except in floating point numbers by other word delimiters.
        BTW: Same option is available for hyphen character. If - is always a non delimiting character except when interpreted as minus sign and as minus sign there are always other word delimiting characters (like spaces or brackets) around character -, this character should be removed also from the word delimiters list.
      2. Character . remains in the list of word delimiting characters and strings starting with . and a digit are defined in the wordfile as substrings.
        /C8"Floating Point Numbers"
        ** -0 -1 -2 -3 -4 -5 -6 -7 -8 -9 .0 .1 .2 .3 .4 .5 .6 .7 .8 .9
      Depending on the presence of . and - in the list of word delimiters and the substring definitons UltraEdit reads a floating point number like -5.256e-3 either as
      • -5.256e-3
        with - and . being word delimiters and no substring definition for strings starting with a hyphen or point and a digit.
      • -5.256e-3
        with a substring definition for strings starting with a hyphen independent of presence of - in list of delimiters, but . is still a word delimiter, but no substring definitions for strings starting with a point and a digit.
      • -5.256e-3
        with a substring definition for strings starting with a hyphen or a point independent of presence of - and . in list of delimiters.
      • -5.256e-3
        with . not in list of delimiters and a substring definition for negative numbers is defined independent of presence of - in list of delimiters.
      Whatever variant you choose, setting the same color for built-in color group Numbers and defined color group Negative Numbers or Floating Point Numbers results in highlighting all floating point numbers as number independent of the format.

      For numbers starting with a plus sign or containing a plus character you can use same method as for numbers starting with a minus sign or containing a minus sign.

      17
      Basic UserBasic User
      17

        Dec 10, 2012#3

        Thanks Mofi.