ecl.js 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  1. /*!-----------------------------------------------------------------------------
  2. * Copyright (c) Microsoft Corporation. All rights reserved.
  3. * Version: 0.31.1(337587859b1c171314b40503171188b6cea6a32a)
  4. * Released under the MIT license
  5. * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
  6. *-----------------------------------------------------------------------------*/
  7. // src/basic-languages/ecl/ecl.ts
  8. var conf = {
  9. comments: {
  10. lineComment: "//",
  11. blockComment: ["/*", "*/"]
  12. },
  13. brackets: [
  14. ["{", "}"],
  15. ["[", "]"],
  16. ["(", ")"]
  17. ],
  18. autoClosingPairs: [
  19. { open: "{", close: "}" },
  20. { open: "[", close: "]" },
  21. { open: "(", close: ")" },
  22. { open: "'", close: "'", notIn: ["string", "comment"] },
  23. { open: '"', close: '"', notIn: ["string", "comment"] }
  24. ],
  25. surroundingPairs: [
  26. { open: "{", close: "}" },
  27. { open: "[", close: "]" },
  28. { open: "(", close: ")" },
  29. { open: "<", close: ">" },
  30. { open: "'", close: "'" },
  31. { open: '"', close: '"' }
  32. ]
  33. };
  34. var language = {
  35. defaultToken: "",
  36. tokenPostfix: ".ecl",
  37. ignoreCase: true,
  38. brackets: [
  39. { open: "{", close: "}", token: "delimiter.curly" },
  40. { open: "[", close: "]", token: "delimiter.square" },
  41. { open: "(", close: ")", token: "delimiter.parenthesis" },
  42. { open: "<", close: ">", token: "delimiter.angle" }
  43. ],
  44. pounds: [
  45. "append",
  46. "break",
  47. "declare",
  48. "demangle",
  49. "end",
  50. "for",
  51. "getdatatype",
  52. "if",
  53. "inmodule",
  54. "loop",
  55. "mangle",
  56. "onwarning",
  57. "option",
  58. "set",
  59. "stored",
  60. "uniquename"
  61. ].join("|"),
  62. keywords: [
  63. "__compressed__",
  64. "after",
  65. "all",
  66. "and",
  67. "any",
  68. "as",
  69. "atmost",
  70. "before",
  71. "beginc",
  72. "best",
  73. "between",
  74. "case",
  75. "cluster",
  76. "compressed",
  77. "compression",
  78. "const",
  79. "counter",
  80. "csv",
  81. "default",
  82. "descend",
  83. "embed",
  84. "encoding",
  85. "encrypt",
  86. "end",
  87. "endc",
  88. "endembed",
  89. "endmacro",
  90. "enum",
  91. "escape",
  92. "except",
  93. "exclusive",
  94. "expire",
  95. "export",
  96. "extend",
  97. "fail",
  98. "few",
  99. "fileposition",
  100. "first",
  101. "flat",
  102. "forward",
  103. "from",
  104. "full",
  105. "function",
  106. "functionmacro",
  107. "group",
  108. "grouped",
  109. "heading",
  110. "hole",
  111. "ifblock",
  112. "import",
  113. "in",
  114. "inner",
  115. "interface",
  116. "internal",
  117. "joined",
  118. "keep",
  119. "keyed",
  120. "last",
  121. "left",
  122. "limit",
  123. "linkcounted",
  124. "literal",
  125. "little_endian",
  126. "load",
  127. "local",
  128. "locale",
  129. "lookup",
  130. "lzw",
  131. "macro",
  132. "many",
  133. "maxcount",
  134. "maxlength",
  135. "min skew",
  136. "module",
  137. "mofn",
  138. "multiple",
  139. "named",
  140. "namespace",
  141. "nocase",
  142. "noroot",
  143. "noscan",
  144. "nosort",
  145. "not",
  146. "noxpath",
  147. "of",
  148. "onfail",
  149. "only",
  150. "opt",
  151. "or",
  152. "outer",
  153. "overwrite",
  154. "packed",
  155. "partition",
  156. "penalty",
  157. "physicallength",
  158. "pipe",
  159. "prefetch",
  160. "quote",
  161. "record",
  162. "repeat",
  163. "retry",
  164. "return",
  165. "right",
  166. "right1",
  167. "right2",
  168. "rows",
  169. "rowset",
  170. "scan",
  171. "scope",
  172. "self",
  173. "separator",
  174. "service",
  175. "shared",
  176. "skew",
  177. "skip",
  178. "smart",
  179. "soapaction",
  180. "sql",
  181. "stable",
  182. "store",
  183. "terminator",
  184. "thor",
  185. "threshold",
  186. "timelimit",
  187. "timeout",
  188. "token",
  189. "transform",
  190. "trim",
  191. "type",
  192. "unicodeorder",
  193. "unordered",
  194. "unsorted",
  195. "unstable",
  196. "update",
  197. "use",
  198. "validate",
  199. "virtual",
  200. "whole",
  201. "width",
  202. "wild",
  203. "within",
  204. "wnotrim",
  205. "xml",
  206. "xpath"
  207. ],
  208. functions: [
  209. "abs",
  210. "acos",
  211. "aggregate",
  212. "allnodes",
  213. "apply",
  214. "ascii",
  215. "asin",
  216. "assert",
  217. "asstring",
  218. "atan",
  219. "atan2",
  220. "ave",
  221. "build",
  222. "buildindex",
  223. "case",
  224. "catch",
  225. "choose",
  226. "choosen",
  227. "choosesets",
  228. "clustersize",
  229. "combine",
  230. "correlation",
  231. "cos",
  232. "cosh",
  233. "count",
  234. "covariance",
  235. "cron",
  236. "dataset",
  237. "dedup",
  238. "define",
  239. "denormalize",
  240. "dictionary",
  241. "distribute",
  242. "distributed",
  243. "distribution",
  244. "ebcdic",
  245. "enth",
  246. "error",
  247. "evaluate",
  248. "event",
  249. "eventextra",
  250. "eventname",
  251. "exists",
  252. "exp",
  253. "fail",
  254. "failcode",
  255. "failmessage",
  256. "fetch",
  257. "fromunicode",
  258. "fromxml",
  259. "getenv",
  260. "getisvalid",
  261. "global",
  262. "graph",
  263. "group",
  264. "hash",
  265. "hash32",
  266. "hash64",
  267. "hashcrc",
  268. "hashmd5",
  269. "having",
  270. "httpcall",
  271. "httpheader",
  272. "if",
  273. "iff",
  274. "index",
  275. "intformat",
  276. "isvalid",
  277. "iterate",
  278. "join",
  279. "keydiff",
  280. "keypatch",
  281. "keyunicode",
  282. "length",
  283. "library",
  284. "limit",
  285. "ln",
  286. "loadxml",
  287. "local",
  288. "log",
  289. "loop",
  290. "map",
  291. "matched",
  292. "matchlength",
  293. "matchposition",
  294. "matchtext",
  295. "matchunicode",
  296. "max",
  297. "merge",
  298. "mergejoin",
  299. "min",
  300. "nofold",
  301. "nolocal",
  302. "nonempty",
  303. "normalize",
  304. "nothor",
  305. "notify",
  306. "output",
  307. "parallel",
  308. "parse",
  309. "pipe",
  310. "power",
  311. "preload",
  312. "process",
  313. "project",
  314. "pull",
  315. "random",
  316. "range",
  317. "rank",
  318. "ranked",
  319. "realformat",
  320. "recordof",
  321. "regexfind",
  322. "regexreplace",
  323. "regroup",
  324. "rejected",
  325. "rollup",
  326. "round",
  327. "roundup",
  328. "row",
  329. "rowdiff",
  330. "sample",
  331. "sequential",
  332. "set",
  333. "sin",
  334. "sinh",
  335. "sizeof",
  336. "soapcall",
  337. "sort",
  338. "sorted",
  339. "sqrt",
  340. "stepped",
  341. "stored",
  342. "sum",
  343. "table",
  344. "tan",
  345. "tanh",
  346. "thisnode",
  347. "topn",
  348. "tounicode",
  349. "toxml",
  350. "transfer",
  351. "transform",
  352. "trim",
  353. "truncate",
  354. "typeof",
  355. "ungroup",
  356. "unicodeorder",
  357. "variance",
  358. "wait",
  359. "which",
  360. "workunit",
  361. "xmldecode",
  362. "xmlencode",
  363. "xmltext",
  364. "xmlunicode"
  365. ],
  366. typesint: ["integer", "unsigned"].join("|"),
  367. typesnum: ["data", "qstring", "string", "unicode", "utf8", "varstring", "varunicode"],
  368. typesone: [
  369. "ascii",
  370. "big_endian",
  371. "boolean",
  372. "data",
  373. "decimal",
  374. "ebcdic",
  375. "grouped",
  376. "integer",
  377. "linkcounted",
  378. "pattern",
  379. "qstring",
  380. "real",
  381. "record",
  382. "rule",
  383. "set of",
  384. "streamed",
  385. "string",
  386. "token",
  387. "udecimal",
  388. "unicode",
  389. "unsigned",
  390. "utf8",
  391. "varstring",
  392. "varunicode"
  393. ].join("|"),
  394. operators: ["+", "-", "/", ":=", "<", "<>", "=", ">", "\\", "and", "in", "not", "or"],
  395. symbols: /[=><!~?:&|+\-*\/\^%]+/,
  396. escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
  397. tokenizer: {
  398. root: [
  399. [/@typesint[4|8]/, "type"],
  400. [/#(@pounds)/, "type"],
  401. [/@typesone/, "type"],
  402. [
  403. /[a-zA-Z_$][\w-$]*/,
  404. {
  405. cases: {
  406. "@functions": "keyword.function",
  407. "@keywords": "keyword",
  408. "@operators": "operator"
  409. }
  410. }
  411. ],
  412. { include: "@whitespace" },
  413. [/[{}()\[\]]/, "@brackets"],
  414. [/[<>](?!@symbols)/, "@brackets"],
  415. [
  416. /@symbols/,
  417. {
  418. cases: {
  419. "@operators": "delimiter",
  420. "@default": ""
  421. }
  422. }
  423. ],
  424. [/[0-9_]*\.[0-9_]+([eE][\-+]?\d+)?/, "number.float"],
  425. [/0[xX][0-9a-fA-F_]+/, "number.hex"],
  426. [/0[bB][01]+/, "number.hex"],
  427. [/[0-9_]+/, "number"],
  428. [/[;,.]/, "delimiter"],
  429. [/"([^"\\]|\\.)*$/, "string.invalid"],
  430. [/"/, "string", "@string"],
  431. [/'[^\\']'/, "string"],
  432. [/(')(@escapes)(')/, ["string", "string.escape", "string"]],
  433. [/'/, "string.invalid"]
  434. ],
  435. whitespace: [
  436. [/[ \t\v\f\r\n]+/, ""],
  437. [/\/\*/, "comment", "@comment"],
  438. [/\/\/.*$/, "comment"]
  439. ],
  440. comment: [
  441. [/[^\/*]+/, "comment"],
  442. [/\*\//, "comment", "@pop"],
  443. [/[\/*]/, "comment"]
  444. ],
  445. string: [
  446. [/[^\\']+/, "string"],
  447. [/@escapes/, "string.escape"],
  448. [/\\./, "string.escape.invalid"],
  449. [/'/, "string", "@pop"]
  450. ]
  451. }
  452. };
  453. export {
  454. conf,
  455. language
  456. };