redshift.js 19 KB

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