Tapatalk

Syntax highlighting between different languages

Syntax highlighting between different languages

1
NewbieNewbie
1

    May 01, 2006#1

    How do I get ultraedit to automatically select the right syntax highlights to use when I open up a code file because I alternate between php and js a lot and I have to keep reloading the wordfile each time I swap between the two languages.

    6,685587
    Grand MasterGrand Master
    6,685587

      May 02, 2006#2

      UltraEdit supports multi-language syntax highlighting only for HTML files including server based HTML files like PHP, JSP, ASP,  etc.

      The language definition for HTML must be with the keyword HTML_LANG in the definition line and all possible file extensions to enable the multi-language syntax highlighting. There can be seen in the standard wordfile.txt of UltraEdit  version 12.00:

      /L3"HTML" HTML_LANG Nocase Noquote Block Comment On = <!-- Block Comment Off = -->  File Extensions = HTM HTML SHTML HTT HTA HTX CFM JSP PHP PHTML ASP

      It's important that no other language definition in the same wordfile has the keyword HTML_LANG.

      You see at the language definition line above that PHP is associated with HTML and not with the PHP language definition.

      There can be seen in the standard wordfile.txt (or in later UE versions in *.uew files in the wordfiles directory) also the following definitions:

      /L4"Java" JAVA_LANG Line Comment = // Block Comment On = /* Block Comment Off = */ Escape Char = \ File Extensions = JAV JAVA

      /L5"Perl"
      PERL_LANG Line Comment = # Line Comment Preceding Chars = [~[^]^^$/\(] Escape Char = \ File Extensions = CGI PL PM PLX

      /L8"PHP"
      PHP_LANG Nocase EnableMLS Line Comment = // Line Comment Alt = # Block Comment On = /* Block Comment Off = */ Escape Char = \ String Chars = "' File Extensions = INC PHP3 PHP4

      /L9"JavaScript"
      JSCRIPT_LANG Line Comment = // Block Comment On = /* Block Comment Off = */ Escape Char = \ String Chars = '" File Extensions = JS

      /L10"VBScript Active Server Pages"
      ASP_LANG Nocase Line Comment = ' Line Comment Alt = REM Block Comment On = /* Block Comment Off = */ Block Comment On Alt = <!-- Block Comment Off Alt = --> String Chars = " File Extensions =

      /L11"CSS"
      CSS_LANG Nocase Noquote Block Comment On = /* Block Comment Off = */ File Extensions = CSS

      The important keywords are the *_LANG keywords listed also in syntax.txt in the UltraEdit program directory respectively in help of UltraEdit on page Syntax Highlighting. Each of this keyword has to exist only once in the wordfile.

      UltraEdit/UEStudio first applies the HTML language highlighting after opening an HTML, PHP, ... file . If it finds the code for an other language within this file, it highlights this part with the appropriate language settings defined by the *_LANG keyword. The codes for another language are built-in in uedit32.exe and cannot be defined. These codes should be known by a PHP or JS programmer.

      JavaScript is for example:

      Code: Select all

      <!-- HTML code -->
      <script type="text/javascript">
      /* javascript code */
      </script>
      <!-- HTML code -->