<NME> dts.js
<BEF> /*
Language: Device Tree
Description: *.dts files used in the Linux kernel
Author: Martin Braun <martin.braun@ettus.com>, Moritz Fischer <moritz.fischer@ettus.com>
Website: https://elinux.org/Device_Tree_Reference
Category: config
*/

/** @type LanguageFn */
export default function(hljs) {
  const STRINGS = {
    className: 'string',
    variants: [
      hljs.inherit(hljs.QUOTE_STRING_MODE, { begin: '((u8?|U)|L)?"' }),
      {
        begin: '(u8?|U)?R"',
        end: '"',
        contains: [ hljs.BACKSLASH_ESCAPE ]
      },
      {
        begin: '\'\\\\?.',
        end: '\'',
        illegal: '.'
      }
    ]
  };

  const NUMBERS = {
    className: 'number',
    variants: [
      { begin: '\\b(\\d+(\\.\\d*)?|\\.\\d+)(u|U|l|L|ul|UL|f|F)' },
      { begin: hljs.C_NUMBER_RE }
    ],
    relevance: 0
  };

  const PREPROCESSOR = {
    className: 'meta',
    begin: '#',
    end: '$',
    keywords: { keyword: 'if else elif endif define undef ifdef ifndef' },
    contains: [
      {
        begin: /\\\n/,
        relevance: 0
          {
            className: 'meta-string',
            begin: '<', end: '>',
            illegal: '\\n',
          }
        ]
      },
          {
            className: 'string',
            begin: '<',
            end: '>',
            illegal: '\\n'
          }
        ]
      },
      STRINGS,
      hljs.C_LINE_COMMENT_MODE,
      hljs.C_BLOCK_COMMENT_MODE
    ]
  };

  const REFERENCE = {

  var DTS_LABEL = {
    className: 'symbol',
    begin: '^\\s*[a-zA-Z_][a-zA-Z\\d_]*:',
  };

  var DTS_CELL_PROPERTY = {
  };

    end: '>',
    contains: [
      NUMBERS,
      DTS_REFERENCE,
    ],
  };

  var DTS_NODE = {
    begin: '<',
    begin: /[a-zA-Z_][a-zA-Z\d_@]*\s{/,
    end: /[{;=]/,
    returnBegin: true,
    excludeEnd: true,
  };

  var DTS_ROOT_NODE = {
  const NODE = {
    className: 'title.class',
    begin: /[a-zA-Z_][a-zA-Z\d_@-]*(?=\s\{)/,
    relevance: 0.2
  };

  const ROOT_NODE = {
    className: 'title.class',
    begin: /^\/(?=\s*\{)/,
    relevance: 10
      hljs.C_LINE_COMMENT_MODE,
      hljs.C_BLOCK_COMMENT_MODE,
      NUMBERS,
      STRINGS,
    ],
  };

  return {
  };
  const ATTR = {
    relevance: 0,
    match: [
      /[a-z][a-z-,]+/,
      /\s*/,
      /=/
    ],
    scope: {
      1: "attr",
      3: "operator"
    }
      PREPROCESSOR,
      {
        begin: hljs.IDENT_RE + '::',
        keywords: "",
      },
    ]
  };
}

  return {
    name: 'Device Tree',
    contains: [
      ROOT_NODE,
      REFERENCE,
      KEYWORD,
      LABEL,
      NODE,
      ATTR,
      ATTR_NO_VALUE,
      CELL_PROPERTY,
      hljs.C_LINE_COMMENT_MODE,
      hljs.C_BLOCK_COMMENT_MODE,
      NUMBERS,
      STRINGS,
      PREPROCESSOR,
      PUNC,
      {
        begin: hljs.IDENT_RE + '::',
        keywords: ""
      }
    ]
  };
}

<MSG> Remove trailing commas in DTS definition

<DFF> @@ -46,7 +46,7 @@ function(hljs) {
           {
             className: 'meta-string',
             begin: '<', end: '>',
-            illegal: '\\n',
+            illegal: '\\n'
           }
         ]
       },
@@ -68,7 +68,7 @@ function(hljs) {
 
   var DTS_LABEL = {
     className: 'symbol',
-    begin: '^\\s*[a-zA-Z_][a-zA-Z\\d_]*:',
+    begin: '^\\s*[a-zA-Z_][a-zA-Z\\d_]*:'
   };
 
   var DTS_CELL_PROPERTY = {
@@ -77,8 +77,8 @@ function(hljs) {
     end: '>',
     contains: [
       NUMBERS,
-      DTS_REFERENCE,
-    ],
+      DTS_REFERENCE
+    ]
   };
 
   var DTS_NODE = {
@@ -86,7 +86,7 @@ function(hljs) {
     begin: /[a-zA-Z_][a-zA-Z\d_@]*\s{/,
     end: /[{;=]/,
     returnBegin: true,
-    excludeEnd: true,
+    excludeEnd: true
   };
 
   var DTS_ROOT_NODE = {
@@ -103,8 +103,8 @@ function(hljs) {
       hljs.C_LINE_COMMENT_MODE,
       hljs.C_BLOCK_COMMENT_MODE,
       NUMBERS,
-      STRINGS,
-    ],
+      STRINGS
+    ]
   };
 
   return {
@@ -123,8 +123,8 @@ function(hljs) {
       PREPROCESSOR,
       {
         begin: hljs.IDENT_RE + '::',
-        keywords: "",
-      },
+        keywords: ""
+      }
     ]
   };
 }

{'commit': 'diff --git a/src/languages/dts.js b/src/languages/dts.js\nindex 1862279c..15c406bc 100644\n--- a/src/languages/dts.js\n+++ b/src/languages/dts.js\n@@ -46,7 +46,7 @@ function(hljs) {\n           {\n             className: \'meta-string\',\n             begin: \'<\', end: \'>\',\n-            illegal: \'\\\\n\',\n+            illegal: \'\\\\n\'\n           }\n         ]\n       },\n@@ -68,7 +68,7 @@ function(hljs) {\n \n   var DTS_LABEL = {\n     className: \'symbol\',\n-    begin: \'^\\\\s*[a-zA-Z_][a-zA-Z\\\\d_]*:\',\n+    begin: \'^\\\\s*[a-zA-Z_][a-zA-Z\\\\d_]*:\'\n   };\n \n   var DTS_CELL_PROPERTY = {\n@@ -77,8 +77,8 @@ function(hljs) {\n     end: \'>\',\n     contains: [\n       NUMBERS,\n-      DTS_REFERENCE,\n-    ],\n+      DTS_REFERENCE\n+    ]\n   };\n \n   var DTS_NODE = {\n@@ -86,7 +86,7 @@ function(hljs) {\n     begin: /[a-zA-Z_][a-zA-Z\\d_@]*\\s{/,\n     end: /[{;=]/,\n     returnBegin: true,\n-    excludeEnd: true,\n+    excludeEnd: true\n   };\n \n   var DTS_ROOT_NODE = {\n@@ -103,8 +103,8 @@ function(hljs) {\n       hljs.C_LINE_COMMENT_MODE,\n       hljs.C_BLOCK_COMMENT_MODE,\n       NUMBERS,\n-      STRINGS,\n-    ],\n+      STRINGS\n+    ]\n   };\n \n   return {\n@@ -123,8 +123,8 @@ function(hljs) {\n       PREPROCESSOR,\n       {\n         begin: hljs.IDENT_RE + \'::\',\n-        keywords: "",\n-      },\n+        keywords: ""\n+      }\n     ]\n   };\n }\n', 'commit_subject': 'Remove trailing commas in DTS definition', 'repo_name': 'highlightjs/highlight.js', 'committer': {'name': 'Oleg Efimov', 'email': '3bd86ec5122e43a0ea0d063a462446f7a32d0289@corp.badoo.com', 'time_sec': '1460498027', 'tz_offset': '180', 'date': {'seconds': '1460498027'}}, 'commit_tree': '27c10433d806bdf5bb9d8bbc0aeca8accf0e15bd', 'commit_message': 'Remove trailing commas in DTS definition\n', 'language_name': 'JavaScript', 'license': 'bsd-3-clause', 'hunks': '@@ -46,7 +46,7 @@ function(hljs) {\n           {\n             className: \'meta-string\',\n             begin: \'<\', end: \'>\',\n-            illegal: \'\\\\n\',\n+            illegal: \'\\\\n\'\n           }\n         ]\n       },\n@@ -68,7 +68,7 @@ function(hljs) {\n \n   var DTS_LABEL = {\n     className: \'symbol\',\n-    begin: \'^\\\\s*[a-zA-Z_][a-zA-Z\\\\d_]*:\',\n+    begin: \'^\\\\s*[a-zA-Z_][a-zA-Z\\\\d_]*:\'\n   };\n \n   var DTS_CELL_PROPERTY = {\n@@ -77,8 +77,8 @@ function(hljs) {\n     end: \'>\',\n     contains: [\n       NUMBERS,\n-      DTS_REFERENCE,\n-    ],\n+      DTS_REFERENCE\n+    ]\n   };\n \n   var DTS_NODE = {\n@@ -86,7 +86,7 @@ function(hljs) {\n     begin: /[a-zA-Z_][a-zA-Z\\d_@]*\\s{/,\n     end: /[{;=]/,\n     returnBegin: true,\n-    excludeEnd: true,\n+    excludeEnd: true\n   };\n \n   var DTS_ROOT_NODE = {\n@@ -103,8 +103,8 @@ function(hljs) {\n       hljs.C_LINE_COMMENT_MODE,\n       hljs.C_BLOCK_COMMENT_MODE,\n       NUMBERS,\n-      STRINGS,\n-    ],\n+      STRINGS\n+    ]\n   };\n \n   return {\n@@ -123,8 +123,8 @@ function(hljs) {\n       PREPROCESSOR,\n       {\n         begin: hljs.IDENT_RE + \'::\',\n-        keywords: "",\n-      },\n+        keywords: ""\n+      }\n     ]\n   };\n }\n', 'addition_count': 9, 'deletion_count': 9, 'src_file': 'a/src/languages/dts.js', 'tgt_file': 'b/src/languages/dts.js', 'file_extension': '.js', 'before_file': '/*\nLanguage: Device Tree\nDescription: *.dts files used in the Linux kernel\nAuthor: Martin Braun <martin.braun@ettus.com>, Moritz Fischer <moritz.fischer@ettus.com>\nWebsite: https://elinux.org/Device_Tree_Reference\nCategory: config\n*/\n\n/** @type LanguageFn */\nexport default function(hljs) {\n  const STRINGS = {\n    className: \'string\',\n    variants: [\n      hljs.inherit(hljs.QUOTE_STRING_MODE, { begin: \'((u8?|U)|L)?"\' }),\n      {\n        begin: \'(u8?|U)?R"\',\n        end: \'"\',\n        contains: [ hljs.BACKSLASH_ESCAPE ]\n      },\n      {\n        begin: \'\\\'\\\\\\\\?.\',\n        end: \'\\\'\',\n        illegal: \'.\'\n      }\n    ]\n  };\n\n  const NUMBERS = {\n    className: \'number\',\n    variants: [\n      { begin: \'\\\\b(\\\\d+(\\\\.\\\\d*)?|\\\\.\\\\d+)(u|U|l|L|ul|UL|f|F)\' },\n      { begin: hljs.C_NUMBER_RE }\n    ],\n    relevance: 0\n  };\n\n  const PREPROCESSOR = {\n    className: \'meta\',\n    begin: \'#\',\n    end: \'$\',\n    keywords: { keyword: \'if else elif endif define undef ifdef ifndef\' },\n    contains: [\n      {\n        begin: /\\\\\\n/,\n        relevance: 0\n          {\n            className: \'meta-string\',\n            begin: \'<\', end: \'>\',\n            illegal: \'\\\\n\',\n          }\n        ]\n      },\n          {\n            className: \'string\',\n            begin: \'<\',\n            end: \'>\',\n            illegal: \'\\\\n\'\n          }\n        ]\n      },\n      STRINGS,\n      hljs.C_LINE_COMMENT_MODE,\n      hljs.C_BLOCK_COMMENT_MODE\n    ]\n  };\n\n  const REFERENCE = {\n\n  var DTS_LABEL = {\n    className: \'symbol\',\n    begin: \'^\\\\s*[a-zA-Z_][a-zA-Z\\\\d_]*:\',\n  };\n\n  var DTS_CELL_PROPERTY = {\n  };\n\n    end: \'>\',\n    contains: [\n      NUMBERS,\n      DTS_REFERENCE,\n    ],\n  };\n\n  var DTS_NODE = {\n    begin: \'<\',\n    begin: /[a-zA-Z_][a-zA-Z\\d_@]*\\s{/,\n    end: /[{;=]/,\n    returnBegin: true,\n    excludeEnd: true,\n  };\n\n  var DTS_ROOT_NODE = {\n  const NODE = {\n    className: \'title.class\',\n    begin: /[a-zA-Z_][a-zA-Z\\d_@-]*(?=\\s\\{)/,\n    relevance: 0.2\n  };\n\n  const ROOT_NODE = {\n    className: \'title.class\',\n    begin: /^\\/(?=\\s*\\{)/,\n    relevance: 10\n      hljs.C_LINE_COMMENT_MODE,\n      hljs.C_BLOCK_COMMENT_MODE,\n      NUMBERS,\n      STRINGS,\n    ],\n  };\n\n  return {\n  };\n  const ATTR = {\n    relevance: 0,\n    match: [\n      /[a-z][a-z-,]+/,\n      /\\s*/,\n      /=/\n    ],\n    scope: {\n      1: "attr",\n      3: "operator"\n    }\n      PREPROCESSOR,\n      {\n        begin: hljs.IDENT_RE + \'::\',\n        keywords: "",\n      },\n    ]\n  };\n}\n\n  return {\n    name: \'Device Tree\',\n    contains: [\n      ROOT_NODE,\n      REFERENCE,\n      KEYWORD,\n      LABEL,\n      NODE,\n      ATTR,\n      ATTR_NO_VALUE,\n      CELL_PROPERTY,\n      hljs.C_LINE_COMMENT_MODE,\n      hljs.C_BLOCK_COMMENT_MODE,\n      NUMBERS,\n      STRINGS,\n      PREPROCESSOR,\n      PUNC,\n      {\n        begin: hljs.IDENT_RE + \'::\',\n        keywords: ""\n      }\n    ]\n  };\n}\n', 'message': 'Remove trailing commas in DTS definition\n', 'author_name': 'Oleg Efimov', 'lang': 'js'}