Ticket #4250: 0001-mcedit-added-syntax-highlighting-for-.json-files.patch

File 0001-mcedit-added-syntax-highlighting-for-.json-files.patch, 3.4 KB (added by pelya, 3 years ago)

The patch

  • misc/filehighlight.ini

    From a13754397478d84820c9638a132c91a5ca5a7e61 Mon Sep 17 00:00:00 2001
    From: Sergii Pylypenko <x.pelya.x@gmail.com>
    Date: Thu, 27 May 2021 23:12:16 +0300
    Subject: [PATCH] mcedit: added syntax highlighting for .json files
    
    ---
     misc/filehighlight.ini  |  2 +-
     misc/syntax/Syntax.in   |  3 +++
     misc/syntax/json.syntax | 39 +++++++++++++++++++++++++++++++++++++++
     3 files changed, 43 insertions(+), 1 deletion(-)
     create mode 100644 misc/syntax/json.syntax
    
    diff --git a/misc/filehighlight.ini b/misc/filehighlight.ini
    index b2731d756..014ab6f3a 100644
    a b  
    2828    extensions=7z;Z;ace;apk;arc;arj;ark;bz2;cab;cpio;deb;gz;lha;lz;lz4;lzh;lzma;rar;rpm;tar;tbz;tbz2;tgz;tlz;txz;tzst;xz;zip;zoo;zst 
    2929 
    3030[doc] 
    31     extensions=chm;css;ctl;diz;doc;docm;docx;dtd;fodg;fodp;fods;fodt;htm;html;letter;lsm;mail;man;me;msg;nroff;odg;odp;ods;odt;pdf;po;ppt;pptm;pptx;ps;rtf;sgml;shtml;tex;text;txt;xls;xlsm;xlsx;xml;xsd;xslt 
     31    extensions=chm;css;ctl;diz;doc;docm;docx;dtd;fodg;fodp;fods;fodt;htm;html;json;letter;lsm;mail;man;me;msg;nroff;odg;odp;ods;odt;pdf;po;ppt;pptm;pptx;ps;rtf;sgml;shtml;tex;text;txt;xls;xlsm;xlsx;xml;xsd;xslt 
    3232 
    3333[source] 
    3434    extensions=ada;asm;awk;bash;c;c++;caml;cc;cgi;cpp;cxx;diff;erl;go;h;h++;hh;hi;hpp;hs;inc;jasm;jav;java;js;m4;mak;mjs;ml;mli;mll;mlp;mly;pas;patch;php;phps;pl;pm;prg;py;rb;s;sas;sh;sl;st;swift;tcl;tk;xq 
  • misc/syntax/Syntax.in

    diff --git a/misc/syntax/Syntax.in b/misc/syntax/Syntax.in
    index 5bde4573f..d5b26d50f 100644
    a b include cs.syntax 
    136136file ..\*\\.(?i:m?js)$ JavaScript\sProgram ^#!.\*[\s/](node|nodejs)\\b 
    137137include js.syntax 
    138138 
     139file ..\*\\.(?i:json)$ JSON\sFile 
     140include json.syntax 
     141 
    139142file ..\*\\.(?i:ts)$ TypeScript\sProgram 
    140143include ts.syntax 
    141144 
  • new file misc/syntax/json.syntax

    diff --git a/misc/syntax/json.syntax b/misc/syntax/json.syntax
    new file mode 100644
    index 000000000..906a24749
    - +  
     1# 
     2# JavaScript syntax highlighting 
     3# for MC Editor/CoolEdit 
     4# 
     5# Author: Sergii Pylypenko <x.pelya.x@gmail.com> 
     6# 
     7 
     8context default 
     9 
     10    #========================= 
     11    # Constants 
     12    keyword whole true brightgreen 
     13    keyword whole false brightgreen 
     14    keyword whole null brightgreen 
     15 
     16    #========================= 
     17    # Numbers 
     18    keyword whole \[-\]\{0123456789\}\[0123456789\] brightgreen 
     19    keyword whole \[-\]\{0123456789\}\[0123456789\]\.\{0123456789\}\[0123456789\] brightgreen 
     20    keyword whole \[-\]\{0123456789\}\[0123456789\]\{eE\}\{0123456789\}\[0123456789\] brightgreen 
     21    keyword whole \[-\]\{0123456789\}\[0123456789\]\{eE\}\{\-\+\}\{0123456789\}\[0123456789\] brightgreen 
     22    keyword whole \[-\]\{0123456789\}\[0123456789\]\.\{0123456789\}\[0123456789\]\{eE\}\{0123456789\}\[0123456789\] brightgreen 
     23    keyword whole \[-\]\{0123456789\}\[0123456789\]\.\{0123456789\}\[0123456789\]\{eE\}\{\-\+\}\{0123456789\}\[0123456789\] brightgreen 
     24 
     25    #========================= 
     26    # Separators 
     27    keyword { brightcyan 
     28    keyword } brightcyan 
     29    keyword [ brightcyan 
     30    keyword ] brightcyan 
     31    keyword , brightcyan 
     32    keyword : brightcyan 
     33 
     34#============================= 
     35# Strings 
     36context " " green 
     37    spellcheck 
     38    keyword \\\{"\\/bfnrt\} brightgreen 
     39    keyword \\u\{0123456789ABCDEFabcdef\}\{0123456789ABCDEFabcdef\}\{0123456789ABCDEFabcdef\}\{0123456789ABCDEFabcdef\} brightgreen