]> luflow.net public git repositories - flow-web.git/blob - static/highlight/languages/cos.js
Initial commit.
[flow-web.git] / static / highlight / languages / cos.js
1 /*! `cos` grammar compiled for Highlight.js 11.11.1 */
2 (function(){
3 var hljsGrammar = (function () {
4 'use strict';
5
6 /*
7 Language: Caché Object Script
8 Author: Nikita Savchenko <zitros.lab@gmail.com>
9 Category: enterprise, scripting
10 Website: https://cedocs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls
11 */
12
13 /** @type LanguageFn */
14 function cos(hljs) {
15 const STRINGS = {
16 className: 'string',
17 variants: [
18 {
19 begin: '"',
20 end: '"',
21 contains: [
22 { // escaped
23 begin: "\"\"",
24 relevance: 0
25 }
26 ]
27 }
28 ]
29 };
30
31 const NUMBERS = {
32 className: "number",
33 begin: "\\b(\\d+(\\.\\d*)?|\\.\\d+)",
34 relevance: 0
35 };
36
37 const COS_KEYWORDS =
38 'property parameter class classmethod clientmethod extends as break '
39 + 'catch close continue do d|0 else elseif for goto halt hang h|0 if job '
40 + 'j|0 kill k|0 lock l|0 merge new open quit q|0 read r|0 return set s|0 '
41 + 'tcommit throw trollback try tstart use view while write w|0 xecute x|0 '
42 + 'zkill znspace zn ztrap zwrite zw zzdump zzwrite print zbreak zinsert '
43 + 'zload zprint zremove zsave zzprint mv mvcall mvcrt mvdim mvprint zquit '
44 + 'zsync ascii';
45
46 // registered function - no need in them due to all functions are highlighted,
47 // but I'll just leave this here.
48
49 // "$bit", "$bitcount",
50 // "$bitfind", "$bitlogic", "$case", "$char", "$classmethod", "$classname",
51 // "$compile", "$data", "$decimal", "$double", "$extract", "$factor",
52 // "$find", "$fnumber", "$get", "$increment", "$inumber", "$isobject",
53 // "$isvaliddouble", "$isvalidnum", "$justify", "$length", "$list",
54 // "$listbuild", "$listdata", "$listfind", "$listfromstring", "$listget",
55 // "$listlength", "$listnext", "$listsame", "$listtostring", "$listvalid",
56 // "$locate", "$match", "$method", "$name", "$nconvert", "$next",
57 // "$normalize", "$now", "$number", "$order", "$parameter", "$piece",
58 // "$prefetchoff", "$prefetchon", "$property", "$qlength", "$qsubscript",
59 // "$query", "$random", "$replace", "$reverse", "$sconvert", "$select",
60 // "$sortbegin", "$sortend", "$stack", "$text", "$translate", "$view",
61 // "$wascii", "$wchar", "$wextract", "$wfind", "$wiswide", "$wlength",
62 // "$wreverse", "$xecute", "$zabs", "$zarccos", "$zarcsin", "$zarctan",
63 // "$zcos", "$zcot", "$zcsc", "$zdate", "$zdateh", "$zdatetime",
64 // "$zdatetimeh", "$zexp", "$zhex", "$zln", "$zlog", "$zpower", "$zsec",
65 // "$zsin", "$zsqr", "$ztan", "$ztime", "$ztimeh", "$zboolean",
66 // "$zconvert", "$zcrc", "$zcyc", "$zdascii", "$zdchar", "$zf",
67 // "$ziswide", "$zlascii", "$zlchar", "$zname", "$zposition", "$zqascii",
68 // "$zqchar", "$zsearch", "$zseek", "$zstrip", "$zwascii", "$zwchar",
69 // "$zwidth", "$zwpack", "$zwbpack", "$zwunpack", "$zwbunpack", "$zzenkaku",
70 // "$change", "$mv", "$mvat", "$mvfmt", "$mvfmts", "$mviconv",
71 // "$mviconvs", "$mvinmat", "$mvlover", "$mvoconv", "$mvoconvs", "$mvraise",
72 // "$mvtrans", "$mvv", "$mvname", "$zbitand", "$zbitcount", "$zbitfind",
73 // "$zbitget", "$zbitlen", "$zbitnot", "$zbitor", "$zbitset", "$zbitstr",
74 // "$zbitxor", "$zincrement", "$znext", "$zorder", "$zprevious", "$zsort",
75 // "device", "$ecode", "$estack", "$etrap", "$halt", "$horolog",
76 // "$io", "$job", "$key", "$namespace", "$principal", "$quit", "$roles",
77 // "$storage", "$system", "$test", "$this", "$tlevel", "$username",
78 // "$x", "$y", "$za", "$zb", "$zchild", "$zeof", "$zeos", "$zerror",
79 // "$zhorolog", "$zio", "$zjob", "$zmode", "$znspace", "$zparent", "$zpi",
80 // "$zpos", "$zreference", "$zstorage", "$ztimestamp", "$ztimezone",
81 // "$ztrap", "$zversion"
82
83 return {
84 name: 'Caché Object Script',
85 case_insensitive: true,
86 aliases: [ "cls" ],
87 keywords: COS_KEYWORDS,
88 contains: [
89 NUMBERS,
90 STRINGS,
91 hljs.C_LINE_COMMENT_MODE,
92 hljs.C_BLOCK_COMMENT_MODE,
93 {
94 className: "comment",
95 begin: /;/,
96 end: "$",
97 relevance: 0
98 },
99 { // Functions and user-defined functions: write $ztime(60*60*3), $$myFunc(10), $$^Val(1)
100 className: "built_in",
101 begin: /(?:\$\$?|\.\.)\^?[a-zA-Z]+/
102 },
103 { // Macro command: quit $$$OK
104 className: "built_in",
105 begin: /\$\$\$[a-zA-Z]+/
106 },
107 { // Special (global) variables: write %request.Content; Built-in classes: %Library.Integer
108 className: "built_in",
109 begin: /%[a-z]+(?:\.[a-z]+)*/
110 },
111 { // Global variable: set ^globalName = 12 write ^globalName
112 className: "symbol",
113 begin: /\^%?[a-zA-Z][\w]*/
114 },
115 { // Some control constructions: do ##class(Package.ClassName).Method(), ##super()
116 className: "keyword",
117 begin: /##class|##super|#define|#dim/
118 },
119 // sub-languages: are not fully supported by hljs by 11/15/2015
120 // left for the future implementation.
121 {
122 begin: /&sql\(/,
123 end: /\)/,
124 excludeBegin: true,
125 excludeEnd: true,
126 subLanguage: "sql"
127 },
128 {
129 begin: /&(js|jscript|javascript)</,
130 end: />/,
131 excludeBegin: true,
132 excludeEnd: true,
133 subLanguage: "javascript"
134 },
135 {
136 // this brakes first and last tag, but this is the only way to embed a valid html
137 begin: /&html<\s*</,
138 end: />\s*>/,
139 subLanguage: "xml"
140 }
141 ]
142 };
143 }
144
145 return cos;
146
147 })();
148
149 hljs.registerLanguage('cos', hljsGrammar);
150 })();