pgsql.ts 17 KB

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