redshift.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815
  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. define('vs/basic-languages/redshift/redshift',["require", "exports"], function (require, exports) {
  6. "use strict";
  7. Object.defineProperty(exports, "__esModule", { value: true });
  8. exports.language = exports.conf = void 0;
  9. exports.conf = {
  10. comments: {
  11. lineComment: '--',
  12. blockComment: ['/*', '*/']
  13. },
  14. brackets: [
  15. ['{', '}'],
  16. ['[', ']'],
  17. ['(', ')']
  18. ],
  19. autoClosingPairs: [
  20. { open: '{', close: '}' },
  21. { open: '[', close: ']' },
  22. { open: '(', close: ')' },
  23. { open: '"', close: '"' },
  24. { open: "'", close: "'" }
  25. ],
  26. surroundingPairs: [
  27. { open: '{', close: '}' },
  28. { open: '[', close: ']' },
  29. { open: '(', close: ')' },
  30. { open: '"', close: '"' },
  31. { open: "'", close: "'" }
  32. ]
  33. };
  34. exports.language = {
  35. defaultToken: '',
  36. tokenPostfix: '.sql',
  37. ignoreCase: true,
  38. brackets: [
  39. { open: '[', close: ']', token: 'delimiter.square' },
  40. { open: '(', close: ')', token: 'delimiter.parenthesis' }
  41. ],
  42. keywords: [
  43. 'AES128',
  44. 'AES256',
  45. 'ALL',
  46. 'ALLOWOVERWRITE',
  47. 'ANALYSE',
  48. 'ANALYZE',
  49. 'AND',
  50. 'ANY',
  51. 'ARRAY',
  52. 'AS',
  53. 'ASC',
  54. 'AUTHORIZATION',
  55. 'BACKUP',
  56. 'BETWEEN',
  57. 'BINARY',
  58. 'BLANKSASNULL',
  59. 'BOTH',
  60. 'BY',
  61. 'BYTEDICT',
  62. 'BZIP2',
  63. 'CASE',
  64. 'CAST',
  65. 'CHECK',
  66. 'COLLATE',
  67. 'COLUMN',
  68. 'CONSTRAINT',
  69. 'CREATE',
  70. 'CREDENTIALS',
  71. 'CROSS',
  72. 'CURRENT_DATE',
  73. 'CURRENT_TIME',
  74. 'CURRENT_TIMESTAMP',
  75. 'CURRENT_USER',
  76. 'CURRENT_USER_ID',
  77. 'DEFAULT',
  78. 'DEFERRABLE',
  79. 'DEFLATE',
  80. 'DEFRAG',
  81. 'DELTA',
  82. 'DELTA32K',
  83. 'DESC',
  84. 'DISABLE',
  85. 'DISTINCT',
  86. 'DO',
  87. 'ELSE',
  88. 'EMPTYASNULL',
  89. 'ENABLE',
  90. 'ENCODE',
  91. 'ENCRYPT',
  92. 'ENCRYPTION',
  93. 'END',
  94. 'EXCEPT',
  95. 'EXPLICIT',
  96. 'FALSE',
  97. 'FOR',
  98. 'FOREIGN',
  99. 'FREEZE',
  100. 'FROM',
  101. 'FULL',
  102. 'GLOBALDICT256',
  103. 'GLOBALDICT64K',
  104. 'GRANT',
  105. 'GROUP',
  106. 'GZIP',
  107. 'HAVING',
  108. 'IDENTITY',
  109. 'IGNORE',
  110. 'ILIKE',
  111. 'IN',
  112. 'INITIALLY',
  113. 'INNER',
  114. 'INTERSECT',
  115. 'INTO',
  116. 'IS',
  117. 'ISNULL',
  118. 'JOIN',
  119. 'LEADING',
  120. 'LEFT',
  121. 'LIKE',
  122. 'LIMIT',
  123. 'LOCALTIME',
  124. 'LOCALTIMESTAMP',
  125. 'LUN',
  126. 'LUNS',
  127. 'LZO',
  128. 'LZOP',
  129. 'MINUS',
  130. 'MOSTLY13',
  131. 'MOSTLY32',
  132. 'MOSTLY8',
  133. 'NATURAL',
  134. 'NEW',
  135. 'NOT',
  136. 'NOTNULL',
  137. 'NULL',
  138. 'NULLS',
  139. 'OFF',
  140. 'OFFLINE',
  141. 'OFFSET',
  142. 'OID',
  143. 'OLD',
  144. 'ON',
  145. 'ONLY',
  146. 'OPEN',
  147. 'OR',
  148. 'ORDER',
  149. 'OUTER',
  150. 'OVERLAPS',
  151. 'PARALLEL',
  152. 'PARTITION',
  153. 'PERCENT',
  154. 'PERMISSIONS',
  155. 'PLACING',
  156. 'PRIMARY',
  157. 'RAW',
  158. 'READRATIO',
  159. 'RECOVER',
  160. 'REFERENCES',
  161. 'RESPECT',
  162. 'REJECTLOG',
  163. 'RESORT',
  164. 'RESTORE',
  165. 'RIGHT',
  166. 'SELECT',
  167. 'SESSION_USER',
  168. 'SIMILAR',
  169. 'SNAPSHOT',
  170. 'SOME',
  171. 'SYSDATE',
  172. 'SYSTEM',
  173. 'TABLE',
  174. 'TAG',
  175. 'TDES',
  176. 'TEXT255',
  177. 'TEXT32K',
  178. 'THEN',
  179. 'TIMESTAMP',
  180. 'TO',
  181. 'TOP',
  182. 'TRAILING',
  183. 'TRUE',
  184. 'TRUNCATECOLUMNS',
  185. 'UNION',
  186. 'UNIQUE',
  187. 'USER',
  188. 'USING',
  189. 'VERBOSE',
  190. 'WALLET',
  191. 'WHEN',
  192. 'WHERE',
  193. 'WITH',
  194. 'WITHOUT'
  195. ],
  196. operators: [
  197. 'AND',
  198. 'BETWEEN',
  199. 'IN',
  200. 'LIKE',
  201. 'NOT',
  202. 'OR',
  203. 'IS',
  204. 'NULL',
  205. 'INTERSECT',
  206. 'UNION',
  207. 'INNER',
  208. 'JOIN',
  209. 'LEFT',
  210. 'OUTER',
  211. 'RIGHT'
  212. ],
  213. builtinFunctions: [
  214. 'current_schema',
  215. 'current_schemas',
  216. 'has_database_privilege',
  217. 'has_schema_privilege',
  218. 'has_table_privilege',
  219. 'age',
  220. 'current_time',
  221. 'current_timestamp',
  222. 'localtime',
  223. 'isfinite',
  224. 'now',
  225. 'ascii',
  226. 'get_bit',
  227. 'get_byte',
  228. 'set_bit',
  229. 'set_byte',
  230. 'to_ascii',
  231. 'approximate percentile_disc',
  232. 'avg',
  233. 'count',
  234. 'listagg',
  235. 'max',
  236. 'median',
  237. 'min',
  238. 'percentile_cont',
  239. 'stddev_samp',
  240. 'stddev_pop',
  241. 'sum',
  242. 'var_samp',
  243. 'var_pop',
  244. 'bit_and',
  245. 'bit_or',
  246. 'bool_and',
  247. 'bool_or',
  248. 'cume_dist',
  249. 'first_value',
  250. 'lag',
  251. 'last_value',
  252. 'lead',
  253. 'nth_value',
  254. 'ratio_to_report',
  255. 'dense_rank',
  256. 'ntile',
  257. 'percent_rank',
  258. 'rank',
  259. 'row_number',
  260. 'case',
  261. 'coalesce',
  262. 'decode',
  263. 'greatest',
  264. 'least',
  265. 'nvl',
  266. 'nvl2',
  267. 'nullif',
  268. 'add_months',
  269. 'at time zone',
  270. 'convert_timezone',
  271. 'current_date',
  272. 'date_cmp',
  273. 'date_cmp_timestamp',
  274. 'date_cmp_timestamptz',
  275. 'date_part_year',
  276. 'dateadd',
  277. 'datediff',
  278. 'date_part',
  279. 'date_trunc',
  280. 'extract',
  281. 'getdate',
  282. 'interval_cmp',
  283. 'last_day',
  284. 'months_between',
  285. 'next_day',
  286. 'sysdate',
  287. 'timeofday',
  288. 'timestamp_cmp',
  289. 'timestamp_cmp_date',
  290. 'timestamp_cmp_timestamptz',
  291. 'timestamptz_cmp',
  292. 'timestamptz_cmp_date',
  293. 'timestamptz_cmp_timestamp',
  294. 'timezone',
  295. 'to_timestamp',
  296. 'trunc',
  297. 'abs',
  298. 'acos',
  299. 'asin',
  300. 'atan',
  301. 'atan2',
  302. 'cbrt',
  303. 'ceil',
  304. 'ceiling',
  305. 'checksum',
  306. 'cos',
  307. 'cot',
  308. 'degrees',
  309. 'dexp',
  310. 'dlog1',
  311. 'dlog10',
  312. 'exp',
  313. 'floor',
  314. 'ln',
  315. 'log',
  316. 'mod',
  317. 'pi',
  318. 'power',
  319. 'radians',
  320. 'random',
  321. 'round',
  322. 'sin',
  323. 'sign',
  324. 'sqrt',
  325. 'tan',
  326. 'to_hex',
  327. 'bpcharcmp',
  328. 'btrim',
  329. 'bttext_pattern_cmp',
  330. 'char_length',
  331. 'character_length',
  332. 'charindex',
  333. 'chr',
  334. 'concat',
  335. 'crc32',
  336. 'func_sha1',
  337. 'initcap',
  338. 'left and rights',
  339. 'len',
  340. 'length',
  341. 'lower',
  342. 'lpad and rpads',
  343. 'ltrim',
  344. 'md5',
  345. 'octet_length',
  346. 'position',
  347. 'quote_ident',
  348. 'quote_literal',
  349. 'regexp_count',
  350. 'regexp_instr',
  351. 'regexp_replace',
  352. 'regexp_substr',
  353. 'repeat',
  354. 'replace',
  355. 'replicate',
  356. 'reverse',
  357. 'rtrim',
  358. 'split_part',
  359. 'strpos',
  360. 'strtol',
  361. 'substring',
  362. 'textlen',
  363. 'translate',
  364. 'trim',
  365. 'upper',
  366. 'cast',
  367. 'convert',
  368. 'to_char',
  369. 'to_date',
  370. 'to_number',
  371. 'json_array_length',
  372. 'json_extract_array_element_text',
  373. 'json_extract_path_text',
  374. 'current_setting',
  375. 'pg_cancel_backend',
  376. 'pg_terminate_backend',
  377. 'set_config',
  378. 'current_database',
  379. 'current_user',
  380. 'current_user_id',
  381. 'pg_backend_pid',
  382. 'pg_last_copy_count',
  383. 'pg_last_copy_id',
  384. 'pg_last_query_id',
  385. 'pg_last_unload_count',
  386. 'session_user',
  387. 'slice_num',
  388. 'user',
  389. 'version',
  390. 'abbrev',
  391. 'acosd',
  392. 'any',
  393. 'area',
  394. 'array_agg',
  395. 'array_append',
  396. 'array_cat',
  397. 'array_dims',
  398. 'array_fill',
  399. 'array_length',
  400. 'array_lower',
  401. 'array_ndims',
  402. 'array_position',
  403. 'array_positions',
  404. 'array_prepend',
  405. 'array_remove',
  406. 'array_replace',
  407. 'array_to_json',
  408. 'array_to_string',
  409. 'array_to_tsvector',
  410. 'array_upper',
  411. 'asind',
  412. 'atan2d',
  413. 'atand',
  414. 'bit',
  415. 'bit_length',
  416. 'bound_box',
  417. 'box',
  418. 'brin_summarize_new_values',
  419. 'broadcast',
  420. 'cardinality',
  421. 'center',
  422. 'circle',
  423. 'clock_timestamp',
  424. 'col_description',
  425. 'concat_ws',
  426. 'convert_from',
  427. 'convert_to',
  428. 'corr',
  429. 'cosd',
  430. 'cotd',
  431. 'covar_pop',
  432. 'covar_samp',
  433. 'current_catalog',
  434. 'current_query',
  435. 'current_role',
  436. 'currval',
  437. 'cursor_to_xml',
  438. 'diameter',
  439. 'div',
  440. 'encode',
  441. 'enum_first',
  442. 'enum_last',
  443. 'enum_range',
  444. 'every',
  445. 'family',
  446. 'format',
  447. 'format_type',
  448. 'generate_series',
  449. 'generate_subscripts',
  450. 'get_current_ts_config',
  451. 'gin_clean_pending_list',
  452. 'grouping',
  453. 'has_any_column_privilege',
  454. 'has_column_privilege',
  455. 'has_foreign_data_wrapper_privilege',
  456. 'has_function_privilege',
  457. 'has_language_privilege',
  458. 'has_sequence_privilege',
  459. 'has_server_privilege',
  460. 'has_tablespace_privilege',
  461. 'has_type_privilege',
  462. 'height',
  463. 'host',
  464. 'hostmask',
  465. 'inet_client_addr',
  466. 'inet_client_port',
  467. 'inet_merge',
  468. 'inet_same_family',
  469. 'inet_server_addr',
  470. 'inet_server_port',
  471. 'isclosed',
  472. 'isempty',
  473. 'isopen',
  474. 'json_agg',
  475. 'json_object',
  476. 'json_object_agg',
  477. 'json_populate_record',
  478. 'json_populate_recordset',
  479. 'json_to_record',
  480. 'json_to_recordset',
  481. 'jsonb_agg',
  482. 'jsonb_object_agg',
  483. 'justify_days',
  484. 'justify_hours',
  485. 'justify_interval',
  486. 'lastval',
  487. 'left',
  488. 'line',
  489. 'localtimestamp',
  490. 'lower_inc',
  491. 'lower_inf',
  492. 'lpad',
  493. 'lseg',
  494. 'make_date',
  495. 'make_interval',
  496. 'make_time',
  497. 'make_timestamp',
  498. 'make_timestamptz',
  499. 'masklen',
  500. 'mode',
  501. 'netmask',
  502. 'network',
  503. 'nextval',
  504. 'npoints',
  505. 'num_nonnulls',
  506. 'num_nulls',
  507. 'numnode',
  508. 'obj_description',
  509. 'overlay',
  510. 'parse_ident',
  511. 'path',
  512. 'pclose',
  513. 'percentile_disc',
  514. 'pg_advisory_lock',
  515. 'pg_advisory_lock_shared',
  516. 'pg_advisory_unlock',
  517. 'pg_advisory_unlock_all',
  518. 'pg_advisory_unlock_shared',
  519. 'pg_advisory_xact_lock',
  520. 'pg_advisory_xact_lock_shared',
  521. 'pg_backup_start_time',
  522. 'pg_blocking_pids',
  523. 'pg_client_encoding',
  524. 'pg_collation_is_visible',
  525. 'pg_column_size',
  526. 'pg_conf_load_time',
  527. 'pg_control_checkpoint',
  528. 'pg_control_init',
  529. 'pg_control_recovery',
  530. 'pg_control_system',
  531. 'pg_conversion_is_visible',
  532. 'pg_create_logical_replication_slot',
  533. 'pg_create_physical_replication_slot',
  534. 'pg_create_restore_point',
  535. 'pg_current_xlog_flush_location',
  536. 'pg_current_xlog_insert_location',
  537. 'pg_current_xlog_location',
  538. 'pg_database_size',
  539. 'pg_describe_object',
  540. 'pg_drop_replication_slot',
  541. 'pg_export_snapshot',
  542. 'pg_filenode_relation',
  543. 'pg_function_is_visible',
  544. 'pg_get_constraintdef',
  545. 'pg_get_expr',
  546. 'pg_get_function_arguments',
  547. 'pg_get_function_identity_arguments',
  548. 'pg_get_function_result',
  549. 'pg_get_functiondef',
  550. 'pg_get_indexdef',
  551. 'pg_get_keywords',
  552. 'pg_get_object_address',
  553. 'pg_get_owned_sequence',
  554. 'pg_get_ruledef',
  555. 'pg_get_serial_sequence',
  556. 'pg_get_triggerdef',
  557. 'pg_get_userbyid',
  558. 'pg_get_viewdef',
  559. 'pg_has_role',
  560. 'pg_identify_object',
  561. 'pg_identify_object_as_address',
  562. 'pg_index_column_has_property',
  563. 'pg_index_has_property',
  564. 'pg_indexam_has_property',
  565. 'pg_indexes_size',
  566. 'pg_is_in_backup',
  567. 'pg_is_in_recovery',
  568. 'pg_is_other_temp_schema',
  569. 'pg_is_xlog_replay_paused',
  570. 'pg_last_committed_xact',
  571. 'pg_last_xact_replay_timestamp',
  572. 'pg_last_xlog_receive_location',
  573. 'pg_last_xlog_replay_location',
  574. 'pg_listening_channels',
  575. 'pg_logical_emit_message',
  576. 'pg_logical_slot_get_binary_changes',
  577. 'pg_logical_slot_get_changes',
  578. 'pg_logical_slot_peek_binary_changes',
  579. 'pg_logical_slot_peek_changes',
  580. 'pg_ls_dir',
  581. 'pg_my_temp_schema',
  582. 'pg_notification_queue_usage',
  583. 'pg_opclass_is_visible',
  584. 'pg_operator_is_visible',
  585. 'pg_opfamily_is_visible',
  586. 'pg_options_to_table',
  587. 'pg_postmaster_start_time',
  588. 'pg_read_binary_file',
  589. 'pg_read_file',
  590. 'pg_relation_filenode',
  591. 'pg_relation_filepath',
  592. 'pg_relation_size',
  593. 'pg_reload_conf',
  594. 'pg_replication_origin_create',
  595. 'pg_replication_origin_drop',
  596. 'pg_replication_origin_oid',
  597. 'pg_replication_origin_progress',
  598. 'pg_replication_origin_session_is_setup',
  599. 'pg_replication_origin_session_progress',
  600. 'pg_replication_origin_session_reset',
  601. 'pg_replication_origin_session_setup',
  602. 'pg_replication_origin_xact_reset',
  603. 'pg_replication_origin_xact_setup',
  604. 'pg_rotate_logfile',
  605. 'pg_size_bytes',
  606. 'pg_size_pretty',
  607. 'pg_sleep',
  608. 'pg_sleep_for',
  609. 'pg_sleep_until',
  610. 'pg_start_backup',
  611. 'pg_stat_file',
  612. 'pg_stop_backup',
  613. 'pg_switch_xlog',
  614. 'pg_table_is_visible',
  615. 'pg_table_size',
  616. 'pg_tablespace_databases',
  617. 'pg_tablespace_location',
  618. 'pg_tablespace_size',
  619. 'pg_total_relation_size',
  620. 'pg_trigger_depth',
  621. 'pg_try_advisory_lock',
  622. 'pg_try_advisory_lock_shared',
  623. 'pg_try_advisory_xact_lock',
  624. 'pg_try_advisory_xact_lock_shared',
  625. 'pg_ts_config_is_visible',
  626. 'pg_ts_dict_is_visible',
  627. 'pg_ts_parser_is_visible',
  628. 'pg_ts_template_is_visible',
  629. 'pg_type_is_visible',
  630. 'pg_typeof',
  631. 'pg_xact_commit_timestamp',
  632. 'pg_xlog_location_diff',
  633. 'pg_xlog_replay_pause',
  634. 'pg_xlog_replay_resume',
  635. 'pg_xlogfile_name',
  636. 'pg_xlogfile_name_offset',
  637. 'phraseto_tsquery',
  638. 'plainto_tsquery',
  639. 'point',
  640. 'polygon',
  641. 'popen',
  642. 'pqserverversion',
  643. 'query_to_xml',
  644. 'querytree',
  645. 'quote_nullable',
  646. 'radius',
  647. 'range_merge',
  648. 'regexp_matches',
  649. 'regexp_split_to_array',
  650. 'regexp_split_to_table',
  651. 'regr_avgx',
  652. 'regr_avgy',
  653. 'regr_count',
  654. 'regr_intercept',
  655. 'regr_r2',
  656. 'regr_slope',
  657. 'regr_sxx',
  658. 'regr_sxy',
  659. 'regr_syy',
  660. 'right',
  661. 'row_security_active',
  662. 'row_to_json',
  663. 'rpad',
  664. 'scale',
  665. 'set_masklen',
  666. 'setseed',
  667. 'setval',
  668. 'setweight',
  669. 'shobj_description',
  670. 'sind',
  671. 'sprintf',
  672. 'statement_timestamp',
  673. 'stddev',
  674. 'string_agg',
  675. 'string_to_array',
  676. 'strip',
  677. 'substr',
  678. 'table_to_xml',
  679. 'table_to_xml_and_xmlschema',
  680. 'tand',
  681. 'text',
  682. 'to_json',
  683. 'to_regclass',
  684. 'to_regnamespace',
  685. 'to_regoper',
  686. 'to_regoperator',
  687. 'to_regproc',
  688. 'to_regprocedure',
  689. 'to_regrole',
  690. 'to_regtype',
  691. 'to_tsquery',
  692. 'to_tsvector',
  693. 'transaction_timestamp',
  694. 'ts_debug',
  695. 'ts_delete',
  696. 'ts_filter',
  697. 'ts_headline',
  698. 'ts_lexize',
  699. 'ts_parse',
  700. 'ts_rank',
  701. 'ts_rank_cd',
  702. 'ts_rewrite',
  703. 'ts_stat',
  704. 'ts_token_type',
  705. 'tsquery_phrase',
  706. 'tsvector_to_array',
  707. 'tsvector_update_trigger',
  708. 'tsvector_update_trigger_column',
  709. 'txid_current',
  710. 'txid_current_snapshot',
  711. 'txid_snapshot_xip',
  712. 'txid_snapshot_xmax',
  713. 'txid_snapshot_xmin',
  714. 'txid_visible_in_snapshot',
  715. 'unnest',
  716. 'upper_inc',
  717. 'upper_inf',
  718. 'variance',
  719. 'width',
  720. 'width_bucket',
  721. 'xml_is_well_formed',
  722. 'xml_is_well_formed_content',
  723. 'xml_is_well_formed_document',
  724. 'xmlagg',
  725. 'xmlcomment',
  726. 'xmlconcat',
  727. 'xmlelement',
  728. 'xmlexists',
  729. 'xmlforest',
  730. 'xmlparse',
  731. 'xmlpi',
  732. 'xmlroot',
  733. 'xmlserialize',
  734. 'xpath',
  735. 'xpath_exists'
  736. ],
  737. builtinVariables: [
  738. // NOT SUPPORTED
  739. ],
  740. pseudoColumns: [
  741. // NOT SUPPORTED
  742. ],
  743. tokenizer: {
  744. root: [
  745. { include: '@comments' },
  746. { include: '@whitespace' },
  747. { include: '@pseudoColumns' },
  748. { include: '@numbers' },
  749. { include: '@strings' },
  750. { include: '@complexIdentifiers' },
  751. { include: '@scopes' },
  752. [/[;,.]/, 'delimiter'],
  753. [/[()]/, '@brackets'],
  754. [
  755. /[\w@#$]+/,
  756. {
  757. cases: {
  758. '@keywords': 'keyword',
  759. '@operators': 'operator',
  760. '@builtinVariables': 'predefined',
  761. '@builtinFunctions': 'predefined',
  762. '@default': 'identifier'
  763. }
  764. }
  765. ],
  766. [/[<>=!%&+\-*/|~^]/, 'operator']
  767. ],
  768. whitespace: [[/\s+/, 'white']],
  769. comments: [
  770. [/--+.*/, 'comment'],
  771. [/\/\*/, { token: 'comment.quote', next: '@comment' }]
  772. ],
  773. comment: [
  774. [/[^*/]+/, 'comment'],
  775. // Not supporting nested comments, as nested comments seem to not be standard?
  776. // i.e. http://stackoverflow.com/questions/728172/are-there-multiline-comment-delimiters-in-sql-that-are-vendor-agnostic
  777. // [/\/\*/, { token: 'comment.quote', next: '@push' }], // nested comment not allowed :-(
  778. [/\*\//, { token: 'comment.quote', next: '@pop' }],
  779. [/./, 'comment']
  780. ],
  781. pseudoColumns: [
  782. [
  783. /[$][A-Za-z_][\w@#$]*/,
  784. {
  785. cases: {
  786. '@pseudoColumns': 'predefined',
  787. '@default': 'identifier'
  788. }
  789. }
  790. ]
  791. ],
  792. numbers: [
  793. [/0[xX][0-9a-fA-F]*/, 'number'],
  794. [/[$][+-]*\d*(\.\d*)?/, 'number'],
  795. [/((\d+(\.\d*)?)|(\.\d+))([eE][\-+]?\d+)?/, 'number']
  796. ],
  797. strings: [[/'/, { token: 'string', next: '@string' }]],
  798. string: [
  799. [/[^']+/, 'string'],
  800. [/''/, 'string'],
  801. [/'/, { token: 'string', next: '@pop' }]
  802. ],
  803. complexIdentifiers: [[/"/, { token: 'identifier.quote', next: '@quotedIdentifier' }]],
  804. quotedIdentifier: [
  805. [/[^"]+/, 'identifier'],
  806. [/""/, 'identifier'],
  807. [/"/, { token: 'identifier.quote', next: '@pop' }]
  808. ],
  809. scopes: [
  810. // NOT SUPPORTED
  811. ]
  812. }
  813. };
  814. });