Latest javascript supports multiline text. How to add it in syntax highlighting?

Latest javascript supports multiline text. How to add it in syntax highlighting?

413
Basic UserBasic User
413

    Sep 07, 2017#1

    Hello.
    The latest javascript engine supports multiline string when enclosed in ` (back-tick)

    Strings in " and ' are still single line strings only.

    How do we go about adding such support to existing syntax highlighting file?

    Thank you.

    6,603548
    Grand MasterGrand Master
    6,603548

      Sep 08, 2017#2

      I'm sorry, but I think there is no satisfactory solution for adding ` as begin/end of a multi-line string for syntax highlighting. The reasons:
      • Highlighting of multi-line character sequences in a file works only for strings delimited with the characters defined with String Chars =, for block comments and for alternate block comments. javascript.uew does currently not have an alternate block comment definition. But Block Comment On Alt = ` Block Comment Off Alt = ` does not work as the block comment starting string must be different to block comment ending string.
      • String Chars = allows only the definition of 1 or 2 characters which define begin and end of a string.
        Escape Char = defines the escape character.
        String Literal Prefix = defines the character which when found left to begin of string disables interpreting the defined escape character as an escape character.
        The usage of either EnableMLS (default) or DisableMLS defines if the strings delimited by the 1 or 2 string characters can span over multiple lines or not.
        So it is not possible to specify a third string delimiting character which is for multi-line strings and specify that " and ' should be interpreted as string delimiters with escape character \ of strings within a line.
      • /Marker Characters = can be used to define two characters to highlight everything on a line between the two characters and the marker characters itself with a color.
        But a marker characters definition is not useful for single line JavaScript string highlighting.
        It is not possible to specify " as marker character as this character is used as delimiter character of the marker characters definition. So it would be only possible to define /Marker Characters = "''"
        But highlighting with marker characters does not support the definition of an escape character.
      Conclusion: I don't see any chance to get a satisfactory multi-line string highlighting for JavaScript code using ` with the features of syntax highlighting offered by UltraEdit for Windows v24.20 and former versions of UltraEdit. The UltraEdit developers would need to add an additional feature specific for JavaScript or for general usage whereby I am not aware of any language which defines 3 different delimiters for strings whereby two are for single line strings and 1 is for multi-line strings.

      A not optimal solution would be using the attached javascript.uew with:

      Code: Select all

      /L9"JavaScript" JSCRIPT_LANG Line Comment = // Block Comment On = /* Block Comment Off = */ Escape Char = \ String Chars = `" EnableMLS File Extensions = JS TS
      /Delimiters = ! "	%&'()*+,-./:;<=>?@[\]^{|}~`
      /Marker Characters = "''"
      /C8"Single Quoted Strings"
      ''
      /C9"Multi-line Strings"
      `
      
      Note: There is a single horizontal tab character in delimiters list between " and %.

      This definition produces a string highlighting with UltraEdit for Windows up to v23.00.0.59 as displayed below:

      javascript_string_highlighting.png (8.41KiB)
      JavaScript string highlighting with UE v22.20 with my theme (left side) and with UE v23.00 with default theme Slate (right side).

      But it does not work as expected with UltraEdit for Windows v23.10.0.1 to v24.20.0.27 as I have just found out. The marker characters highlighting with identical begin/end marker character is broken in those versions of UltraEdit. I have reported this issue by email to IDM support.
      javascript_wordfile.zip (3.98 KiB)   44
      javascript.uew of UE 24.20 modified as posted.
      Best regards from an UC/UE/UES for Windows user from Austria