ecl.js 9.9 KB

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