[Info-vax] highlight.js & DCL

Arne Vajhøj arne at vajhoej.dk
Sat Oct 12 21:28:50 EDT 2024


On 1/18/2022 7:56 PM, Arne Vajhøj wrote:
> Long shot, but has anyone added DCL support to highlight.js?
> 
> https://highlightjs.org/
> 
> (it hash all kinds of programming languages, bash, cmd
> etc. but no DCL)

I finally got to take a look at it.

Not so difficult.

First attempt attached below.

Arne

export default function(hljs) {
   const COMMENT = hljs.COMMENT(
     '!',
     '$',
     { relevance: 10 }
   );
   const KEYWORDS = [
     "if",
     "then",
     "else",
     "endif",
     "goto",
     "open",
     "read",
     "write",
     "close",
     "call",
     "subroutine",
     "return",
     "endsubroutine",
     "def",
     "define",
     "assign",
     "deassign",
     "set",
     "show",
     "on",
     "wait",
     "exit"
   ];
   const BUILT_INS = [
     "copy",
     "type",
     "append",
     "del",
     "delete",
     "pur",
     "purge",
     "ren",
     "rename",
     "dir",
     "directory",
     "cre",
     "create",
     "conv",
     "convert",
     "pipe",
     "edit",
     "link",
     "run",
     "for",
     "fortran",
     "pas",
     "pascal",
     "cc",
     "cxx",
     "bas",
     "basic",
     "cob",
     "cobol",
     "macro",
     "bliss",
     "java",
     "javax",
     "groovy",
     "groovyc",
     "kotlin",
     "kotlinc",
     "scala",
     "scalac",
     "python",
     "php",
     "sear",
     "search",
     "diff",
     "difference",
     "sort",
     "backup",
     "allocate",
     "deallocate",
     "mount",
     "dismount",
     "submit",
     "print",
     "logout"
   ];
   return {
     name: 'DCL (VMS)',
     aliases: [
         'dcl',
         'com'
     ],
     case_insensitive: true,
     keywords: {
         $pattern: /\b[a-z]+\b/,
         keyword: KEYWORDS,
         built_in: BUILT_INS
     },
     contains: [
         hljs.QUOTE_STRING_MODE,
         COMMENT
     ]
   };
}



More information about the Info-vax mailing list