diff --git a/.github/workflows/coveralls.yaml b/.github/workflows/coveralls.yaml index 88686d657c..e117a921eb 100644 --- a/.github/workflows/coveralls.yaml +++ b/.github/workflows/coveralls.yaml @@ -13,10 +13,10 @@ jobs: node-version: [18.x] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} diff --git a/.github/workflows/webpack.yaml b/.github/workflows/webpack.yaml index 667b7d4940..b98d2f9637 100644 --- a/.github/workflows/webpack.yaml +++ b/.github/workflows/webpack.yaml @@ -2,7 +2,6 @@ name: webpack on: pull_request: - branches: [master, develop] jobs: build: @@ -13,10 +12,10 @@ jobs: node-version: [18.x] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} diff --git a/src/languages/bigquery/bigquery.functions.ts b/src/languages/bigquery/bigquery.functions.ts index c3b43d9b15..8a0663421b 100644 --- a/src/languages/bigquery/bigquery.functions.ts +++ b/src/languages/bigquery/bigquery.functions.ts @@ -1,544 +1,597 @@ -import { flatKeywordList } from '../../utils.js'; - -export const functions = flatKeywordList({ +export const functions: string[] = [ // https://cloud.google.com/bigquery/docs/reference/standard-sql/aead_encryption_functions - aead: [ - 'KEYS.NEW_KEYSET', - 'KEYS.ADD_KEY_FROM_RAW_BYTES', - 'AEAD.DECRYPT_BYTES', - 'AEAD.DECRYPT_STRING', - 'AEAD.ENCRYPT', - 'KEYS.KEYSET_CHAIN', - 'KEYS.KEYSET_FROM_JSON', - 'KEYS.KEYSET_TO_JSON', - 'KEYS.ROTATE_KEYSET', - 'KEYS.KEYSET_LENGTH', - ], + 'KEYS.NEW_KEYSET', + 'KEYS.ADD_KEY_FROM_RAW_BYTES', + 'AEAD.DECRYPT_BYTES', + 'AEAD.DECRYPT_STRING', + 'AEAD.ENCRYPT', + 'KEYS.KEYSET_CHAIN', + 'KEYS.KEYSET_FROM_JSON', + 'KEYS.KEYSET_TO_JSON', + 'KEYS.ROTATE_KEYSET', + 'KEYS.KEYSET_LENGTH', + // https://cloud.google.com/bigquery/docs/reference/standard-sql/aggregate_analytic_functions - aggregateAnalytic: [ - 'ANY_VALUE', - 'ARRAY_AGG', - 'AVG', - 'CORR', - 'COUNT', - 'COUNTIF', - 'COVAR_POP', - 'COVAR_SAMP', - 'MAX', - 'MIN', - 'ST_CLUSTERDBSCAN', - 'STDDEV_POP', - 'STDDEV_SAMP', - 'STRING_AGG', - 'SUM', - 'VAR_POP', - 'VAR_SAMP', - ], + 'ANY_VALUE', + 'ARRAY_AGG', + 'AVG', + 'CORR', + 'COUNT', + 'COUNTIF', + 'COVAR_POP', + 'COVAR_SAMP', + 'MAX', + 'MIN', + 'ST_CLUSTERDBSCAN', + 'STDDEV_POP', + 'STDDEV_SAMP', + 'STRING_AGG', + 'SUM', + 'VAR_POP', + 'VAR_SAMP', + // https://cloud.google.com/bigquery/docs/reference/standard-sql/aggregate_functions - aggregate: [ - 'ANY_VALUE', - 'ARRAY_AGG', - 'ARRAY_CONCAT_AGG', - 'AVG', - 'BIT_AND', - 'BIT_OR', - 'BIT_XOR', - 'COUNT', - 'COUNTIF', - 'LOGICAL_AND', - 'LOGICAL_OR', - 'MAX', - 'MIN', - 'STRING_AGG', - 'SUM', - ], + 'ANY_VALUE', + 'ARRAY_AGG', + 'ARRAY_CONCAT_AGG', + 'AVG', + 'BIT_AND', + 'BIT_OR', + 'BIT_XOR', + 'COUNT', + 'COUNTIF', + 'LOGICAL_AND', + 'LOGICAL_OR', + 'MAX', + 'MIN', + 'STRING_AGG', + 'SUM', + // https://cloud.google.com/bigquery/docs/reference/standard-sql/approximate_aggregate_functions - approximateAggregate: [ - 'APPROX_COUNT_DISTINCT', - 'APPROX_QUANTILES', - 'APPROX_TOP_COUNT', - 'APPROX_TOP_SUM', - ], + 'APPROX_COUNT_DISTINCT', + 'APPROX_QUANTILES', + 'APPROX_TOP_COUNT', + 'APPROX_TOP_SUM', + // https://cloud.google.com/bigquery/docs/reference/standard-sql/array_functions - array: [ - // 'ARRAY', - 'ARRAY_CONCAT', - 'ARRAY_LENGTH', - 'ARRAY_TO_STRING', - 'GENERATE_ARRAY', - 'GENERATE_DATE_ARRAY', - 'GENERATE_TIMESTAMP_ARRAY', - 'ARRAY_REVERSE', - 'OFFSET', - 'SAFE_OFFSET', - 'ORDINAL', - 'SAFE_ORDINAL', - ], + // 'ARRAY', + 'ARRAY_CONCAT', + 'ARRAY_LENGTH', + 'ARRAY_TO_STRING', + 'GENERATE_ARRAY', + 'GENERATE_DATE_ARRAY', + 'GENERATE_TIMESTAMP_ARRAY', + 'ARRAY_REVERSE', + 'OFFSET', + 'SAFE_OFFSET', + 'ORDINAL', + 'SAFE_ORDINAL', + // https://cloud.google.com/bigquery/docs/reference/standard-sql/bit_functions - bitwise: ['BIT_COUNT'], + 'BIT_COUNT', + // https://cloud.google.com/bigquery/docs/reference/standard-sql/conversion_functions - conversion: [ - // 'CASE', - 'PARSE_BIGNUMERIC', - 'PARSE_NUMERIC', - 'SAFE_CAST', - ], + // 'CASE', + 'PARSE_BIGNUMERIC', + 'PARSE_NUMERIC', + 'SAFE_CAST', + // https://cloud.google.com/bigquery/docs/reference/standard-sql/date_functions - date: [ - 'CURRENT_DATE', - 'EXTRACT', - 'DATE', - 'DATE_ADD', - 'DATE_SUB', - 'DATE_DIFF', - 'DATE_TRUNC', - 'DATE_FROM_UNIX_DATE', - 'FORMAT_DATE', - 'LAST_DAY', - 'PARSE_DATE', - 'UNIX_DATE', - ], + 'CURRENT_DATE', + 'EXTRACT', + 'DATE', + 'DATE_ADD', + 'DATE_SUB', + 'DATE_DIFF', + 'DATE_TRUNC', + 'DATE_FROM_UNIX_DATE', + 'FORMAT_DATE', + 'LAST_DAY', + 'PARSE_DATE', + 'UNIX_DATE', + // https://cloud.google.com/bigquery/docs/reference/standard-sql/datetime_functions - datetime: [ - 'CURRENT_DATETIME', - 'DATETIME', - 'EXTRACT', - 'DATETIME_ADD', - 'DATETIME_SUB', - 'DATETIME_DIFF', - 'DATETIME_TRUNC', - 'FORMAT_DATETIME', - 'LAST_DAY', - 'PARSE_DATETIME', - ], + 'CURRENT_DATETIME', + 'DATETIME', + 'EXTRACT', + 'DATETIME_ADD', + 'DATETIME_SUB', + 'DATETIME_DIFF', + 'DATETIME_TRUNC', + 'FORMAT_DATETIME', + 'LAST_DAY', + 'PARSE_DATETIME', + // https://cloud.google.com/bigquery/docs/reference/standard-sql/debugging_functions - debugging: ['ERROR'], + 'ERROR', + // https://cloud.google.com/bigquery/docs/reference/standard-sql/federated_query_functions - federatedQuery: ['EXTERNAL_QUERY'], + 'EXTERNAL_QUERY', + // https://cloud.google.com/bigquery/docs/reference/standard-sql/geography_functions - geography: [ - 'S2_CELLIDFROMPOINT', - 'S2_COVERINGCELLIDS', - 'ST_ANGLE', - 'ST_AREA', - 'ST_ASBINARY', - 'ST_ASGEOJSON', - 'ST_ASTEXT', - 'ST_AZIMUTH', - 'ST_BOUNDARY', - 'ST_BOUNDINGBOX', - 'ST_BUFFER', - 'ST_BUFFERWITHTOLERANCE', - 'ST_CENTROID', - 'ST_CENTROID_AGG', - 'ST_CLOSESTPOINT', - 'ST_CLUSTERDBSCAN', - 'ST_CONTAINS', - 'ST_CONVEXHULL', - 'ST_COVEREDBY', - 'ST_COVERS', - 'ST_DIFFERENCE', - 'ST_DIMENSION', - 'ST_DISJOINT', - 'ST_DISTANCE', - 'ST_DUMP', - 'ST_DWITHIN', - 'ST_ENDPOINT', - 'ST_EQUALS', - 'ST_EXTENT', - 'ST_EXTERIORRING', - 'ST_GEOGFROM', - 'ST_GEOGFROMGEOJSON', - 'ST_GEOGFROMTEXT', - 'ST_GEOGFROMWKB', - 'ST_GEOGPOINT', - 'ST_GEOGPOINTFROMGEOHASH', - 'ST_GEOHASH', - 'ST_GEOMETRYTYPE', - 'ST_INTERIORRINGS', - 'ST_INTERSECTION', - 'ST_INTERSECTS', - 'ST_INTERSECTSBOX', - 'ST_ISCOLLECTION', - 'ST_ISEMPTY', - 'ST_LENGTH', - 'ST_MAKELINE', - 'ST_MAKEPOLYGON', - 'ST_MAKEPOLYGONORIENTED', - 'ST_MAXDISTANCE', - 'ST_NPOINTS', - 'ST_NUMGEOMETRIES', - 'ST_NUMPOINTS', - 'ST_PERIMETER', - 'ST_POINTN', - 'ST_SIMPLIFY', - 'ST_SNAPTOGRID', - 'ST_STARTPOINT', - 'ST_TOUCHES', - 'ST_UNION', - 'ST_UNION_AGG', - 'ST_WITHIN', - 'ST_X', - 'ST_Y', - ], + 'S2_CELLIDFROMPOINT', + 'S2_COVERINGCELLIDS', + 'ST_ANGLE', + 'ST_AREA', + 'ST_ASBINARY', + 'ST_ASGEOJSON', + 'ST_ASTEXT', + 'ST_AZIMUTH', + 'ST_BOUNDARY', + 'ST_BOUNDINGBOX', + 'ST_BUFFER', + 'ST_BUFFERWITHTOLERANCE', + 'ST_CENTROID', + 'ST_CENTROID_AGG', + 'ST_CLOSESTPOINT', + 'ST_CLUSTERDBSCAN', + 'ST_CONTAINS', + 'ST_CONVEXHULL', + 'ST_COVEREDBY', + 'ST_COVERS', + 'ST_DIFFERENCE', + 'ST_DIMENSION', + 'ST_DISJOINT', + 'ST_DISTANCE', + 'ST_DUMP', + 'ST_DWITHIN', + 'ST_ENDPOINT', + 'ST_EQUALS', + 'ST_EXTENT', + 'ST_EXTERIORRING', + 'ST_GEOGFROM', + 'ST_GEOGFROMGEOJSON', + 'ST_GEOGFROMTEXT', + 'ST_GEOGFROMWKB', + 'ST_GEOGPOINT', + 'ST_GEOGPOINTFROMGEOHASH', + 'ST_GEOHASH', + 'ST_GEOMETRYTYPE', + 'ST_INTERIORRINGS', + 'ST_INTERSECTION', + 'ST_INTERSECTS', + 'ST_INTERSECTSBOX', + 'ST_ISCOLLECTION', + 'ST_ISEMPTY', + 'ST_LENGTH', + 'ST_MAKELINE', + 'ST_MAKEPOLYGON', + 'ST_MAKEPOLYGONORIENTED', + 'ST_MAXDISTANCE', + 'ST_NPOINTS', + 'ST_NUMGEOMETRIES', + 'ST_NUMPOINTS', + 'ST_PERIMETER', + 'ST_POINTN', + 'ST_SIMPLIFY', + 'ST_SNAPTOGRID', + 'ST_STARTPOINT', + 'ST_TOUCHES', + 'ST_UNION', + 'ST_UNION_AGG', + 'ST_WITHIN', + 'ST_X', + 'ST_Y', + // https://cloud.google.com/bigquery/docs/reference/standard-sql/hash_functions - hash: ['FARM_FINGERPRINT', 'MD5', 'SHA1', 'SHA256', 'SHA512'], + 'FARM_FINGERPRINT', + 'MD5', + 'SHA1', + 'SHA256', + 'SHA512', + // https://cloud.google.com/bigquery/docs/reference/standard-sql/hll_functions - hll: ['HLL_COUNT.INIT', 'HLL_COUNT.MERGE', 'HLL_COUNT.MERGE_PARTIAL', 'HLL_COUNT.EXTRACT'], + 'HLL_COUNT.INIT', + 'HLL_COUNT.MERGE', + 'HLL_COUNT.MERGE_PARTIAL', + 'HLL_COUNT.EXTRACT', + // https://cloud.google.com/bigquery/docs/reference/standard-sql/interval_functions - interval: ['MAKE_INTERVAL', 'EXTRACT', 'JUSTIFY_DAYS', 'JUSTIFY_HOURS', 'JUSTIFY_INTERVAL'], + 'MAKE_INTERVAL', + 'EXTRACT', + 'JUSTIFY_DAYS', + 'JUSTIFY_HOURS', + 'JUSTIFY_INTERVAL', + // https://cloud.google.com/bigquery/docs/reference/standard-sql/json_functions - json: [ - 'JSON_EXTRACT', - 'JSON_QUERY', - 'JSON_EXTRACT_SCALAR', - 'JSON_VALUE', - 'JSON_EXTRACT_ARRAY', - 'JSON_QUERY_ARRAY', - 'JSON_EXTRACT_STRING_ARRAY', - 'JSON_VALUE_ARRAY', - 'TO_JSON_STRING', - ], + 'JSON_EXTRACT', + 'JSON_QUERY', + 'JSON_EXTRACT_SCALAR', + 'JSON_VALUE', + 'JSON_EXTRACT_ARRAY', + 'JSON_QUERY_ARRAY', + 'JSON_EXTRACT_STRING_ARRAY', + 'JSON_VALUE_ARRAY', + 'TO_JSON_STRING', + // https://cloud.google.com/bigquery/docs/reference/standard-sql/mathematical_functions - math: [ - 'ABS', - 'SIGN', - 'IS_INF', - 'IS_NAN', - 'IEEE_DIVIDE', - 'RAND', - 'SQRT', - 'POW', - 'POWER', - 'EXP', - 'LN', - 'LOG', - 'LOG10', - 'GREATEST', - 'LEAST', - 'DIV', - 'SAFE_DIVIDE', - 'SAFE_MULTIPLY', - 'SAFE_NEGATE', - 'SAFE_ADD', - 'SAFE_SUBTRACT', - 'MOD', - 'ROUND', - 'TRUNC', - 'CEIL', - 'CEILING', - 'FLOOR', - 'COS', - 'COSH', - 'ACOS', - 'ACOSH', - 'SIN', - 'SINH', - 'ASIN', - 'ASINH', - 'TAN', - 'TANH', - 'ATAN', - 'ATANH', - 'ATAN2', - 'RANGE_BUCKET', - ], + 'ABS', + 'SIGN', + 'IS_INF', + 'IS_NAN', + 'IEEE_DIVIDE', + 'RAND', + 'SQRT', + 'POW', + 'POWER', + 'EXP', + 'LN', + 'LOG', + 'LOG10', + 'GREATEST', + 'LEAST', + 'DIV', + 'SAFE_DIVIDE', + 'SAFE_MULTIPLY', + 'SAFE_NEGATE', + 'SAFE_ADD', + 'SAFE_SUBTRACT', + 'MOD', + 'ROUND', + 'TRUNC', + 'CEIL', + 'CEILING', + 'FLOOR', + 'COS', + 'COSH', + 'ACOS', + 'ACOSH', + 'SIN', + 'SINH', + 'ASIN', + 'ASINH', + 'TAN', + 'TANH', + 'ATAN', + 'ATANH', + 'ATAN2', + 'RANGE_BUCKET', + // https://cloud.google.com/bigquery/docs/reference/standard-sql/navigation_functions - navigation: [ - 'FIRST_VALUE', - 'LAST_VALUE', - 'NTH_VALUE', - 'LEAD', - 'LAG', - 'PERCENTILE_CONT', - 'PERCENTILE_DISC', - ], + 'FIRST_VALUE', + 'LAST_VALUE', + 'NTH_VALUE', + 'LEAD', + 'LAG', + 'PERCENTILE_CONT', + 'PERCENTILE_DISC', + // https://cloud.google.com/bigquery/docs/reference/standard-sql/net_functions - net: [ - 'NET.IP_FROM_STRING', - 'NET.SAFE_IP_FROM_STRING', - 'NET.IP_TO_STRING', - 'NET.IP_NET_MASK', - 'NET.IP_TRUNC', - 'NET.IPV4_FROM_INT64', - 'NET.IPV4_TO_INT64', - 'NET.HOST', - 'NET.PUBLIC_SUFFIX', - 'NET.REG_DOMAIN', - ], + 'NET.IP_FROM_STRING', + 'NET.SAFE_IP_FROM_STRING', + 'NET.IP_TO_STRING', + 'NET.IP_NET_MASK', + 'NET.IP_TRUNC', + 'NET.IPV4_FROM_INT64', + 'NET.IPV4_TO_INT64', + 'NET.HOST', + 'NET.PUBLIC_SUFFIX', + 'NET.REG_DOMAIN', + // https://cloud.google.com/bigquery/docs/reference/standard-sql/numbering_functions - numbering: ['RANK', 'DENSE_RANK', 'PERCENT_RANK', 'CUME_DIST', 'NTILE', 'ROW_NUMBER'], + 'RANK', + 'DENSE_RANK', + 'PERCENT_RANK', + 'CUME_DIST', + 'NTILE', + 'ROW_NUMBER', + // https://cloud.google.com/bigquery/docs/reference/standard-sql/security_functions - security: ['SESSION_USER'], + 'SESSION_USER', + // https://cloud.google.com/bigquery/docs/reference/standard-sql/statistical_aggregate_functions - statisticalAggregate: [ - 'CORR', - 'COVAR_POP', - 'COVAR_SAMP', - 'STDDEV_POP', - 'STDDEV_SAMP', - 'STDDEV', - 'VAR_POP', - 'VAR_SAMP', - 'VARIANCE', - ], + 'CORR', + 'COVAR_POP', + 'COVAR_SAMP', + 'STDDEV_POP', + 'STDDEV_SAMP', + 'STDDEV', + 'VAR_POP', + 'VAR_SAMP', + 'VARIANCE', + // https://cloud.google.com/bigquery/docs/reference/standard-sql/string_functions - string: [ - 'ASCII', - 'BYTE_LENGTH', - 'CHAR_LENGTH', - 'CHARACTER_LENGTH', - 'CHR', - 'CODE_POINTS_TO_BYTES', - 'CODE_POINTS_TO_STRING', - 'CONCAT', - 'CONTAINS_SUBSTR', - 'ENDS_WITH', - 'FORMAT', - 'FROM_BASE32', - 'FROM_BASE64', - 'FROM_HEX', - 'INITCAP', - 'INSTR', - 'LEFT', - 'LENGTH', - 'LPAD', - 'LOWER', - 'LTRIM', - 'NORMALIZE', - 'NORMALIZE_AND_CASEFOLD', - 'OCTET_LENGTH', - 'REGEXP_CONTAINS', - 'REGEXP_EXTRACT', - 'REGEXP_EXTRACT_ALL', - 'REGEXP_INSTR', - 'REGEXP_REPLACE', - 'REGEXP_SUBSTR', - 'REPLACE', - 'REPEAT', - 'REVERSE', - 'RIGHT', - 'RPAD', - 'RTRIM', - 'SAFE_CONVERT_BYTES_TO_STRING', - 'SOUNDEX', - 'SPLIT', - 'STARTS_WITH', - 'STRPOS', - 'SUBSTR', - 'SUBSTRING', - 'TO_BASE32', - 'TO_BASE64', - 'TO_CODE_POINTS', - 'TO_HEX', - 'TRANSLATE', - 'TRIM', - 'UNICODE', - 'UPPER', - ], + 'ASCII', + 'BYTE_LENGTH', + 'CHAR_LENGTH', + 'CHARACTER_LENGTH', + 'CHR', + 'CODE_POINTS_TO_BYTES', + 'CODE_POINTS_TO_STRING', + 'CONCAT', + 'CONTAINS_SUBSTR', + 'ENDS_WITH', + 'FORMAT', + 'FROM_BASE32', + 'FROM_BASE64', + 'FROM_HEX', + 'INITCAP', + 'INSTR', + 'LEFT', + 'LENGTH', + 'LPAD', + 'LOWER', + 'LTRIM', + 'NORMALIZE', + 'NORMALIZE_AND_CASEFOLD', + 'OCTET_LENGTH', + 'REGEXP_CONTAINS', + 'REGEXP_EXTRACT', + 'REGEXP_EXTRACT_ALL', + 'REGEXP_INSTR', + 'REGEXP_REPLACE', + 'REGEXP_SUBSTR', + 'REPLACE', + 'REPEAT', + 'REVERSE', + 'RIGHT', + 'RPAD', + 'RTRIM', + 'SAFE_CONVERT_BYTES_TO_STRING', + 'SOUNDEX', + 'SPLIT', + 'STARTS_WITH', + 'STRPOS', + 'SUBSTR', + 'SUBSTRING', + 'TO_BASE32', + 'TO_BASE64', + 'TO_CODE_POINTS', + 'TO_HEX', + 'TRANSLATE', + 'TRIM', + 'UNICODE', + 'UPPER', + // https://cloud.google.com/bigquery/docs/reference/standard-sql/time_functions - time: [ - 'CURRENT_TIME', - 'TIME', - 'EXTRACT', - 'TIME_ADD', - 'TIME_SUB', - 'TIME_DIFF', - 'TIME_TRUNC', - 'FORMAT_TIME', - 'PARSE_TIME', - ], + 'CURRENT_TIME', + 'TIME', + 'EXTRACT', + 'TIME_ADD', + 'TIME_SUB', + 'TIME_DIFF', + 'TIME_TRUNC', + 'FORMAT_TIME', + 'PARSE_TIME', + // https://cloud.google.com/bigquery/docs/reference/standard-sql/timestamp_functions - timestamp: [ - 'CURRENT_TIMESTAMP', - 'EXTRACT', - 'STRING', - 'TIMESTAMP', - 'TIMESTAMP_ADD', - 'TIMESTAMP_SUB', - 'TIMESTAMP_DIFF', - 'TIMESTAMP_TRUNC', - 'FORMAT_TIMESTAMP', - 'PARSE_TIMESTAMP', - 'TIMESTAMP_SECONDS', - 'TIMESTAMP_MILLIS', - 'TIMESTAMP_MICROS', - 'UNIX_SECONDS', - 'UNIX_MILLIS', - 'UNIX_MICROS', - ], + 'CURRENT_TIMESTAMP', + 'EXTRACT', + 'STRING', + 'TIMESTAMP', + 'TIMESTAMP_ADD', + 'TIMESTAMP_SUB', + 'TIMESTAMP_DIFF', + 'TIMESTAMP_TRUNC', + 'FORMAT_TIMESTAMP', + 'PARSE_TIMESTAMP', + 'TIMESTAMP_SECONDS', + 'TIMESTAMP_MILLIS', + 'TIMESTAMP_MICROS', + 'UNIX_SECONDS', + 'UNIX_MILLIS', + 'UNIX_MICROS', + // https://cloud.google.com/bigquery/docs/reference/standard-sql/uuid_functions - uuid: ['GENERATE_UUID'], + 'GENERATE_UUID', + // https://cloud.google.com/bigquery/docs/reference/standard-sql/conditional_expressions - conditional: ['COALESCE', 'IF', 'IFNULL', 'NULLIF'], + 'COALESCE', + 'IF', + 'IFNULL', + 'NULLIF', + // https://cloud.google.com/bigquery/docs/reference/legacy-sql - legacyAggregate: [ - 'AVG', - 'BIT_AND', - 'BIT_OR', - 'BIT_XOR', - 'CORR', - 'COUNT', - 'COVAR_POP', - 'COVAR_SAMP', - 'EXACT_COUNT_DISTINCT', - 'FIRST', - 'GROUP_CONCAT', - 'GROUP_CONCAT_UNQUOTED', - 'LAST', - 'MAX', - 'MIN', - 'NEST', - 'NTH', - 'QUANTILES', - 'STDDEV', - 'STDDEV_POP', - 'STDDEV_SAMP', - 'SUM', - 'TOP', - 'UNIQUE', - 'VARIANCE', - 'VAR_POP', - 'VAR_SAMP', - ], - legacyBitwise: ['BIT_COUNT'], - legacyCasting: ['BOOLEAN', 'BYTES', 'CAST', 'FLOAT', 'HEX_STRING', 'INTEGER', 'STRING'], - legacyComparison: [ - // expr 'IN', - 'COALESCE', - 'GREATEST', - 'IFNULL', - 'IS_INF', - 'IS_NAN', - 'IS_EXPLICITLY_DEFINED', - 'LEAST', - 'NVL', - ], - legacyDatetime: [ - 'CURRENT_DATE', - 'CURRENT_TIME', - 'CURRENT_TIMESTAMP', - 'DATE', - 'DATE_ADD', - 'DATEDIFF', - 'DAY', - 'DAYOFWEEK', - 'DAYOFYEAR', - 'FORMAT_UTC_USEC', - 'HOUR', - 'MINUTE', - 'MONTH', - 'MSEC_TO_TIMESTAMP', - 'NOW', - 'PARSE_UTC_USEC', - 'QUARTER', - 'SEC_TO_TIMESTAMP', - 'SECOND', - 'STRFTIME_UTC_USEC', - 'TIME', - 'TIMESTAMP', - 'TIMESTAMP_TO_MSEC', - 'TIMESTAMP_TO_SEC', - 'TIMESTAMP_TO_USEC', - 'USEC_TO_TIMESTAMP', - 'UTC_USEC_TO_DAY', - 'UTC_USEC_TO_HOUR', - 'UTC_USEC_TO_MONTH', - 'UTC_USEC_TO_WEEK', - 'UTC_USEC_TO_YEAR', - 'WEEK', - 'YEAR', - ], - legacyIp: ['FORMAT_IP', 'PARSE_IP', 'FORMAT_PACKED_IP', 'PARSE_PACKED_IP'], - legacyJson: ['JSON_EXTRACT', 'JSON_EXTRACT_SCALAR'], - legacyMath: [ - 'ABS', - 'ACOS', - 'ACOSH', - 'ASIN', - 'ASINH', - 'ATAN', - 'ATANH', - 'ATAN2', - 'CEIL', - 'COS', - 'COSH', - 'DEGREES', - 'EXP', - 'FLOOR', - 'LN', - 'LOG', - 'LOG2', - 'LOG10', - 'PI', - 'POW', - 'RADIANS', - 'RAND', - 'ROUND', - 'SIN', - 'SINH', - 'SQRT', - 'TAN', - 'TANH', - ], - legacyRegex: ['REGEXP_MATCH', 'REGEXP_EXTRACT', 'REGEXP_REPLACE'], - legacyString: [ - 'CONCAT', - // expr CONTAINS 'str' - 'INSTR', - 'LEFT', - 'LENGTH', - 'LOWER', - 'LPAD', - 'LTRIM', - 'REPLACE', - 'RIGHT', - 'RPAD', - 'RTRIM', - 'SPLIT', - 'SUBSTR', - 'UPPER', - ], - legacyTableWildcard: ['TABLE_DATE_RANGE', 'TABLE_DATE_RANGE_STRICT', 'TABLE_QUERY'], - legacyUrl: ['HOST', 'DOMAIN', 'TLD'], - legacyWindow: [ - 'AVG', - 'COUNT', - 'MAX', - 'MIN', - 'STDDEV', - 'SUM', - 'CUME_DIST', - 'DENSE_RANK', - 'FIRST_VALUE', - 'LAG', - 'LAST_VALUE', - 'LEAD', - 'NTH_VALUE', - 'NTILE', - 'PERCENT_RANK', - 'PERCENTILE_CONT', - 'PERCENTILE_DISC', - 'RANK', - 'RATIO_TO_REPORT', - 'ROW_NUMBER', - ], - legacyMisc: [ - 'CURRENT_USER', - 'EVERY', - 'FROM_BASE64', - 'HASH', - 'FARM_FINGERPRINT', - 'IF', - 'POSITION', - 'SHA1', - 'SOME', - 'TO_BASE64', - ], - other: ['BQ.JOBS.CANCEL', 'BQ.REFRESH_MATERIALIZED_VIEW'], - ddl: ['OPTIONS'], - pivot: ['PIVOT', 'UNPIVOT'], + // legacyAggregate + 'AVG', + 'BIT_AND', + 'BIT_OR', + 'BIT_XOR', + 'CORR', + 'COUNT', + 'COVAR_POP', + 'COVAR_SAMP', + 'EXACT_COUNT_DISTINCT', + 'FIRST', + 'GROUP_CONCAT', + 'GROUP_CONCAT_UNQUOTED', + 'LAST', + 'MAX', + 'MIN', + 'NEST', + 'NTH', + 'QUANTILES', + 'STDDEV', + 'STDDEV_POP', + 'STDDEV_SAMP', + 'SUM', + 'TOP', + 'UNIQUE', + 'VARIANCE', + 'VAR_POP', + 'VAR_SAMP', + + // legacyBitwise + 'BIT_COUNT', + + // legacyCasting + 'BOOLEAN', + 'BYTES', + 'CAST', + 'FLOAT', + 'HEX_STRING', + 'INTEGER', + 'STRING', + + // legacyComparison + // expr 'IN', + 'COALESCE', + 'GREATEST', + 'IFNULL', + 'IS_INF', + 'IS_NAN', + 'IS_EXPLICITLY_DEFINED', + 'LEAST', + 'NVL', + + // legacyDatetime + 'CURRENT_DATE', + 'CURRENT_TIME', + 'CURRENT_TIMESTAMP', + 'DATE', + 'DATE_ADD', + 'DATEDIFF', + 'DAY', + 'DAYOFWEEK', + 'DAYOFYEAR', + 'FORMAT_UTC_USEC', + 'HOUR', + 'MINUTE', + 'MONTH', + 'MSEC_TO_TIMESTAMP', + 'NOW', + 'PARSE_UTC_USEC', + 'QUARTER', + 'SEC_TO_TIMESTAMP', + 'SECOND', + 'STRFTIME_UTC_USEC', + 'TIME', + 'TIMESTAMP', + 'TIMESTAMP_TO_MSEC', + 'TIMESTAMP_TO_SEC', + 'TIMESTAMP_TO_USEC', + 'USEC_TO_TIMESTAMP', + 'UTC_USEC_TO_DAY', + 'UTC_USEC_TO_HOUR', + 'UTC_USEC_TO_MONTH', + 'UTC_USEC_TO_WEEK', + 'UTC_USEC_TO_YEAR', + 'WEEK', + 'YEAR', + + // legacyIp + 'FORMAT_IP', + 'PARSE_IP', + 'FORMAT_PACKED_IP', + 'PARSE_PACKED_IP', + + // legacyJson + 'JSON_EXTRACT', + 'JSON_EXTRACT_SCALAR', + + // legacyMath + 'ABS', + 'ACOS', + 'ACOSH', + 'ASIN', + 'ASINH', + 'ATAN', + 'ATANH', + 'ATAN2', + 'CEIL', + 'COS', + 'COSH', + 'DEGREES', + 'EXP', + 'FLOOR', + 'LN', + 'LOG', + 'LOG2', + 'LOG10', + 'PI', + 'POW', + 'RADIANS', + 'RAND', + 'ROUND', + 'SIN', + 'SINH', + 'SQRT', + 'TAN', + 'TANH', + + // legacyRegex + 'REGEXP_MATCH', + 'REGEXP_EXTRACT', + 'REGEXP_REPLACE', + + // legacyString + 'CONCAT', + // expr CONTAINS 'str' + 'INSTR', + 'LEFT', + 'LENGTH', + 'LOWER', + 'LPAD', + 'LTRIM', + 'REPLACE', + 'RIGHT', + 'RPAD', + 'RTRIM', + 'SPLIT', + 'SUBSTR', + 'UPPER', + + // legacyTableWildcard + 'TABLE_DATE_RANGE', + 'TABLE_DATE_RANGE_STRICT', + 'TABLE_QUERY', + + // legacyUrl + 'HOST', + 'DOMAIN', + 'TLD', + + // legacyWindow + 'AVG', + 'COUNT', + 'MAX', + 'MIN', + 'STDDEV', + 'SUM', + 'CUME_DIST', + 'DENSE_RANK', + 'FIRST_VALUE', + 'LAG', + 'LAST_VALUE', + 'LEAD', + 'NTH_VALUE', + 'NTILE', + 'PERCENT_RANK', + 'PERCENTILE_CONT', + 'PERCENTILE_DISC', + 'RANK', + 'RATIO_TO_REPORT', + 'ROW_NUMBER', + + // legacyMisc + 'CURRENT_USER', + 'EVERY', + 'FROM_BASE64', + 'HASH', + 'FARM_FINGERPRINT', + 'IF', + 'POSITION', + 'SHA1', + 'SOME', + 'TO_BASE64', + + // other + 'BQ.JOBS.CANCEL', + 'BQ.REFRESH_MATERIALIZED_VIEW', + + // ddl + 'OPTIONS', + + // pivot + 'PIVOT', + 'UNPIVOT', + // Data types with parameters like VARCHAR(100) // https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#parameterized_data_types - dataTypes: ['BYTES', 'NUMERIC', 'DECIMAL', 'BIGNUMERIC', 'BIGDECIMAL', 'STRING'], -}); + 'BYTES', + 'NUMERIC', + 'DECIMAL', + 'BIGNUMERIC', + 'BIGDECIMAL', + 'STRING', +]; diff --git a/src/languages/bigquery/bigquery.keywords.ts b/src/languages/bigquery/bigquery.keywords.ts index b776a24a48..9e864a4870 100644 --- a/src/languages/bigquery/bigquery.keywords.ts +++ b/src/languages/bigquery/bigquery.keywords.ts @@ -1,145 +1,148 @@ -import { flatKeywordList } from '../../utils.js'; - -export const keywords = flatKeywordList({ +export const keywords: string[] = [ // https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical#reserved_keywords - keywords: [ - 'ALL', - 'AND', - 'ANY', - 'ARRAY', - 'AS', - 'ASC', - 'ASSERT_ROWS_MODIFIED', - 'AT', - 'BETWEEN', - 'BY', - 'CASE', - 'CAST', - 'COLLATE', - 'CONTAINS', - 'CREATE', - 'CROSS', - 'CUBE', - 'CURRENT', - 'DEFAULT', - 'DEFINE', - 'DESC', - 'DISTINCT', - 'ELSE', - 'END', - 'ENUM', - 'ESCAPE', - 'EXCEPT', - 'EXCLUDE', - 'EXISTS', - 'EXTRACT', - 'FALSE', - 'FETCH', - 'FOLLOWING', - 'FOR', - 'FROM', - 'FULL', - 'GROUP', - 'GROUPING', - 'GROUPS', - 'HASH', - 'HAVING', - 'IF', - 'IGNORE', - 'IN', - 'INNER', - 'INTERSECT', - 'INTERVAL', - 'INTO', - 'IS', - 'JOIN', - 'LATERAL', - 'LEFT', - 'LIKE', - 'LIMIT', - 'LOOKUP', - 'MERGE', - 'NATURAL', - 'NEW', - 'NO', - 'NOT', - 'NULL', - 'NULLS', - 'OF', - 'ON', - 'OR', - 'ORDER', - 'OUTER', - 'OVER', - 'PARTITION', - 'PRECEDING', - 'PROTO', - 'RANGE', - 'RECURSIVE', - 'RESPECT', - 'RIGHT', - 'ROLLUP', - 'ROWS', - 'SELECT', - 'SET', - 'SOME', - 'STRUCT', - 'TABLE', - 'TABLESAMPLE', - 'THEN', - 'TO', - 'TREAT', - 'TRUE', - 'UNBOUNDED', - 'UNION', - 'UNNEST', - 'USING', - 'WHEN', - 'WHERE', - 'WINDOW', - 'WITH', - 'WITHIN', - ], - datatypes: [ - 'ARRAY', // parametric, ARRAY - 'BOOL', - 'BYTES', // parameterised, BYTES(Length) - 'DATE', - 'DATETIME', - 'GEOGRAPHY', - 'INTERVAL', - 'INT64', - 'INT', - 'SMALLINT', - 'INTEGER', - 'BIGINT', - 'TINYINT', - 'BYTEINT', - 'NUMERIC', // parameterised, NUMERIC(Precision[, Scale]) - 'DECIMAL', // parameterised, DECIMAL(Precision[, Scale]) - 'BIGNUMERIC', // parameterised, BIGNUMERIC(Precision[, Scale]) - 'BIGDECIMAL', // parameterised, BIGDECIMAL(Precision[, Scale]) - 'FLOAT64', - 'STRING', // parameterised, STRING(Length) - 'STRUCT', // parametric, STRUCT - 'TIME', - 'TIMEZONE', - ], + 'ALL', + 'AND', + 'ANY', + 'ARRAY', + 'AS', + 'ASC', + 'ASSERT_ROWS_MODIFIED', + 'AT', + 'BETWEEN', + 'BY', + 'CASE', + 'CAST', + 'COLLATE', + 'CONTAINS', + 'CREATE', + 'CROSS', + 'CUBE', + 'CURRENT', + 'DEFAULT', + 'DEFINE', + 'DESC', + 'DISTINCT', + 'ELSE', + 'END', + 'ENUM', + 'ESCAPE', + 'EXCEPT', + 'EXCLUDE', + 'EXISTS', + 'EXTRACT', + 'FALSE', + 'FETCH', + 'FOLLOWING', + 'FOR', + 'FROM', + 'FULL', + 'GROUP', + 'GROUPING', + 'GROUPS', + 'HASH', + 'HAVING', + 'IF', + 'IGNORE', + 'IN', + 'INNER', + 'INTERSECT', + 'INTERVAL', + 'INTO', + 'IS', + 'JOIN', + 'LATERAL', + 'LEFT', + 'LIKE', + 'LIMIT', + 'LOOKUP', + 'MERGE', + 'NATURAL', + 'NEW', + 'NO', + 'NOT', + 'NULL', + 'NULLS', + 'OF', + 'ON', + 'OR', + 'ORDER', + 'OUTER', + 'OVER', + 'PARTITION', + 'PRECEDING', + 'PROTO', + 'RANGE', + 'RECURSIVE', + 'RESPECT', + 'RIGHT', + 'ROLLUP', + 'ROWS', + 'SELECT', + 'SET', + 'SOME', + 'STRUCT', + 'TABLE', + 'TABLESAMPLE', + 'THEN', + 'TO', + 'TREAT', + 'TRUE', + 'UNBOUNDED', + 'UNION', + 'UNNEST', + 'USING', + 'WHEN', + 'WHERE', + 'WINDOW', + 'WITH', + 'WITHIN', + + // datatypes + 'ARRAY', // parametric, ARRAY + 'BOOL', + 'BYTES', // parameterised, BYTES(Length) + 'DATE', + 'DATETIME', + 'GEOGRAPHY', + 'INTERVAL', + 'INT64', + 'INT', + 'SMALLINT', + 'INTEGER', + 'BIGINT', + 'TINYINT', + 'BYTEINT', + 'NUMERIC', // parameterised, NUMERIC(Precision[, Scale]) + 'DECIMAL', // parameterised, DECIMAL(Precision[, Scale]) + 'BIGNUMERIC', // parameterised, BIGNUMERIC(Precision[, Scale]) + 'BIGDECIMAL', // parameterised, BIGDECIMAL(Precision[, Scale]) + 'FLOAT64', + 'STRING', // parameterised, STRING(Length) + 'STRUCT', // parametric, STRUCT + 'TIME', + 'TIMEZONE', + // https://cloud.google.com/bigquery/docs/reference/standard-sql/conversion_functions#formatting_syntax - stringFormat: ['HEX', 'BASEX', 'BASE64M', 'ASCII', 'UTF-8', 'UTF8'], - misc: ['SAFE'], + 'HEX', + 'BASEX', + 'BASE64M', + 'ASCII', + 'UTF-8', + 'UTF8', + + // misc + 'SAFE', + // https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language - ddl: [ - 'LIKE', // CREATE TABLE LIKE - 'COPY', // CREATE TABLE COPY - 'CLONE', // CREATE TABLE CLONE - 'IN', - 'OUT', - 'INOUT', - 'RETURNS', - 'LANGUAGE', - 'CASCADE', - 'RESTRICT', - 'DETERMINISTIC', - ], -}); + 'LIKE', // CREATE TABLE LIKE + 'COPY', // CREATE TABLE COPY + 'CLONE', // CREATE TABLE CLONE + 'IN', + 'OUT', + 'INOUT', + 'RETURNS', + 'LANGUAGE', + 'CASCADE', + 'RESTRICT', + 'DETERMINISTIC', +]; diff --git a/src/languages/db2/db2.functions.ts b/src/languages/db2/db2.functions.ts index 3e2876c990..fc45871741 100644 --- a/src/languages/db2/db2.functions.ts +++ b/src/languages/db2/db2.functions.ts @@ -1,359 +1,358 @@ -import { flatKeywordList } from '../../utils.js'; - -export const functions = flatKeywordList({ +export const functions: string[] = [ // https://www.ibm.com/docs/en/db2/11.5?topic=bif-aggregate-functions - aggregate: [ - 'ARRAY_AGG', - 'AVG', - 'CORRELATION', - 'COUNT', - 'COUNT_BIG', - 'COVARIANCE', - 'COVARIANCE_SAMP', - 'CUME_DIST', - 'GROUPING', - 'LISTAGG', - 'MAX', - 'MEDIAN', - 'MIN', - 'PERCENTILE_CONT', - 'PERCENTILE_DISC', - 'PERCENT_RANK', - 'REGR_AVGX', - 'REGR_AVGY', - 'REGR_COUNT', - 'REGR_INTERCEPT', - 'REGR_ICPT', - 'REGR_R2', - 'REGR_SLOPE', - 'REGR_SXX', - 'REGR_SXY', - 'REGR_SYY', - 'STDDEV', - 'STDDEV_SAMP', - 'SUM', - 'VARIANCE', - 'VARIANCE_SAMP', - 'XMLAGG', - 'XMLGROUP', - ], + 'ARRAY_AGG', + 'AVG', + 'CORRELATION', + 'COUNT', + 'COUNT_BIG', + 'COVARIANCE', + 'COVARIANCE_SAMP', + 'CUME_DIST', + 'GROUPING', + 'LISTAGG', + 'MAX', + 'MEDIAN', + 'MIN', + 'PERCENTILE_CONT', + 'PERCENTILE_DISC', + 'PERCENT_RANK', + 'REGR_AVGX', + 'REGR_AVGY', + 'REGR_COUNT', + 'REGR_INTERCEPT', + 'REGR_ICPT', + 'REGR_R2', + 'REGR_SLOPE', + 'REGR_SXX', + 'REGR_SXY', + 'REGR_SYY', + 'STDDEV', + 'STDDEV_SAMP', + 'SUM', + 'VARIANCE', + 'VARIANCE_SAMP', + 'XMLAGG', + 'XMLGROUP', + // https://www.ibm.com/docs/en/db2/11.5?topic=bif-scalar-functions - scalar: [ - 'ABS', - 'ABSVAL', - 'ACOS', - 'ADD_DAYS', - 'ADD_HOURS', - 'ADD_MINUTES', - 'ADD_MONTHS', - 'ADD_SECONDS', - 'ADD_YEARS', - 'AGE', - 'ARRAY_DELETE', - 'ARRAY_FIRST', - 'ARRAY_LAST', - 'ARRAY_NEXT', - 'ARRAY_PRIOR', - 'ASCII', - 'ASCII_STR', - 'ASIN', - 'ATAN', - 'ATAN2', - 'ATANH', - 'BIGINT', - 'BINARY', - 'BITAND', - 'BITANDNOT', - 'BITOR', - 'BITXOR', - 'BITNOT', - 'BLOB', - 'BOOLEAN', - 'BPCHAR', - 'BSON_TO_JSON', - 'BTRIM', - 'CARDINALITY', - 'CEILING', - 'CEIL', - 'CHAR', - 'CHARACTER_LENGTH', - 'CHR', - 'CLOB', - 'COALESCE', - 'COLLATION_KEY', - 'COLLATION_KEY_BIT', - 'COMPARE_DECFLOAT', - 'CONCAT', - 'COS', - 'COSH', - 'COT', - 'CURSOR_ROWCOUNT', - 'DATAPARTITIONNUM', - 'DATE', - 'DATETIME', - 'DATE_PART', - 'DATE_TRUNC', - 'DAY', - 'DAYNAME', - 'DAYOFMONTH', - 'DAYOFWEEK', - 'DAYOFWEEK_ISO', - 'DAYOFYEAR', - 'DAYS', - 'DAYS_BETWEEN', - 'DAYS_TO_END_OF_MONTH', - 'DBCLOB', - 'DBPARTITIONNUM', - 'DECFLOAT', - 'DECFLOAT_FORMAT', - 'DECIMAL', - 'DEC', - 'DECODE', - 'DECRYPT_BIN', - 'DECRYPT_CHAR', - 'DEGREES', - 'DEREF', - 'DIFFERENCE', - 'DIGITS', - 'DOUBLE_PRECISION', - 'DOUBLE', - 'EMPTY_BLOB', - 'EMPTY_CLOB', - 'EMPTY_DBCLOB', - 'EMPTY_NCLOB', - 'ENCRYPT', - 'EVENT_MON_STATE', - 'EXP', - 'EXTRACT', - 'FIRST_DAY', - 'FLOAT', - 'FLOAT4', - 'FLOAT8', - 'FLOOR', - 'FROM_UTC_TIMESTAMP', - 'GENERATE_UNIQUE', - 'GETHINT', - 'GRAPHIC', - 'GREATEST', - 'HASH', - 'HASH4', - 'HASH8', - 'HASHEDVALUE', - 'HEX', - 'HEXTORAW', - 'HOUR', - 'HOURS_BETWEEN', - 'IDENTITY_VAL_LOCAL', - 'IFNULL', - 'INITCAP', - 'INSERT', - 'INSTR', - 'INSTR2', - 'INSTR4', - 'INSTRB', - 'INT', - 'INTERVAL', - 'INTEGER', - 'INT2', - 'INT4', - 'INT8', - 'INTNAND', - 'INTNOR', - 'INTNXOR', - 'INTNNOT', - 'ISNULL', - 'JSON_ARRAY', - 'JSON_OBJECT', - 'JSON_QUERY', - 'JSON_TO_BSON', - 'JSON_VALUE', - 'JULIAN_DAY', - 'LAST_DAY', - 'LCASE', - 'LEAST', - 'LEFT', - 'LENGTH', - 'LENGTH2', - 'LENGTH4', - 'LENGTHB', - 'LN', - 'LOCATE', - 'LOCATE_IN_STRING', - 'LOG10', - 'LONG_VARCHAR', - 'LONG_VARGRAPHIC', - 'LOWER', - 'LPAD', - 'LTRIM', - 'MAX', - 'MAX_CARDINALITY', - 'MICROSECOND', - 'MIDNIGHT_SECONDS', - 'MIN', - 'MINUTE', - 'MINUTES_BETWEEN', - 'MOD', - 'MONTH', - 'MONTHNAME', - 'MONTHS_BETWEEN', - 'MULTIPLY_ALT', - 'NCHAR', - 'NCHR', - 'NCLOB', - 'NVARCHAR', - 'NEXT_DAY', - 'NEXT_MONTH', - 'NEXT_QUARTER', - 'NEXT_WEEK', - 'NEXT_YEAR', - 'NORMALIZE_DECFLOAT', - 'NOW', - 'NULLIF', - 'NUMERIC', - 'NVL', - 'NVL2', - 'OCTET_LENGTH', - 'OVERLAY', - 'PARAMETER', - 'POSITION', - 'POSSTR', - 'POW', - 'POWER', - 'QUANTIZE', - 'QUARTER', - 'QUOTE_IDENT', - 'QUOTE_LITERAL', - 'RADIANS', - 'RAISE_ERROR', - 'RAND', - 'RANDOM', - 'RAWTOHEX', - 'REAL', - 'REC2XML', - 'REGEXP_COUNT', - 'REGEXP_EXTRACT', - 'REGEXP_INSTR', - 'REGEXP_LIKE', - 'REGEXP_MATCH_COUNT', - 'REGEXP_REPLACE', - 'REGEXP_SUBSTR', - 'REPEAT', - 'REPLACE', - 'RID and RID_BIT', - 'RIGHT', - 'ROUND', - 'ROUND_TIMESTAMP', - 'RPAD', - 'RTRIM', - 'SECLABEL', - 'SECLABEL_BY_NAME', - 'SECLABEL_TO_CHAR', - 'SECOND', - 'SECONDS_BETWEEN', - 'SIGN', - 'SIN', - 'SINH', - 'SMALLINT', - 'SOUNDEX', - 'SPACE', - 'SQRT', - 'STRIP', - 'STRLEFT', - 'STRPOS', - 'STRRIGHT', - 'SUBSTR', - 'SUBSTR2', - 'SUBSTR4', - 'SUBSTRB', - 'SUBSTRING', - 'TABLE_NAME', - 'TABLE_SCHEMA', - 'TAN', - 'TANH', - 'THIS_MONTH', - 'THIS_QUARTER', - 'THIS_WEEK', - 'THIS_YEAR', - 'TIME', - 'TIMESTAMP', - 'TIMESTAMP_FORMAT', - 'TIMESTAMP_ISO', - 'TIMESTAMPDIFF', - 'TIMEZONE', - 'TO_CHAR', - 'TO_CLOB', - 'TO_DATE', - 'TO_HEX', - 'TO_MULTI_BYTE', - 'TO_NCHAR', - 'TO_NCLOB', - 'TO_NUMBER', - 'TO_SINGLE_BYTE', - 'TO_TIMESTAMP', - 'TO_UTC_TIMESTAMP', - 'TOTALORDER', - 'TRANSLATE', - 'TRIM', - 'TRIM_ARRAY', - 'TRUNC_TIMESTAMP', - 'TRUNCATE', - 'TRUNC', - 'TYPE_ID', - 'TYPE_NAME', - 'TYPE_SCHEMA', - 'UCASE', - 'UNICODE_STR', - 'UPPER', - 'VALUE', - 'VARBINARY', - 'VARCHAR', - 'VARCHAR_BIT_FORMAT', - 'VARCHAR_FORMAT', - 'VARCHAR_FORMAT_BIT', - 'VARGRAPHIC', - 'VERIFY_GROUP_FOR_USER', - 'VERIFY_ROLE_FOR_USER', - 'VERIFY_TRUSTED_CONTEXT_ROLE_FOR_USER', - 'WEEK', - 'WEEK_ISO', - 'WEEKS_BETWEEN', - 'WIDTH_BUCKET', - 'XMLATTRIBUTES', - 'XMLCOMMENT', - 'XMLCONCAT', - 'XMLDOCUMENT', - 'XMLELEMENT', - 'XMLFOREST', - 'XMLNAMESPACES', - 'XMLPARSE', - 'XMLPI', - 'XMLQUERY', - 'XMLROW', - 'XMLSERIALIZE', - 'XMLTEXT', - 'XMLVALIDATE', - 'XMLXSROBJECTID', - 'XSLTRANSFORM', - 'YEAR', - 'YEARS_BETWEEN', - 'YMD_BETWEEN', - ], + 'ABS', + 'ABSVAL', + 'ACOS', + 'ADD_DAYS', + 'ADD_HOURS', + 'ADD_MINUTES', + 'ADD_MONTHS', + 'ADD_SECONDS', + 'ADD_YEARS', + 'AGE', + 'ARRAY_DELETE', + 'ARRAY_FIRST', + 'ARRAY_LAST', + 'ARRAY_NEXT', + 'ARRAY_PRIOR', + 'ASCII', + 'ASCII_STR', + 'ASIN', + 'ATAN', + 'ATAN2', + 'ATANH', + 'BIGINT', + 'BINARY', + 'BITAND', + 'BITANDNOT', + 'BITOR', + 'BITXOR', + 'BITNOT', + 'BLOB', + 'BOOLEAN', + 'BPCHAR', + 'BSON_TO_JSON', + 'BTRIM', + 'CARDINALITY', + 'CEILING', + 'CEIL', + 'CHAR', + 'CHARACTER_LENGTH', + 'CHR', + 'CLOB', + 'COALESCE', + 'COLLATION_KEY', + 'COLLATION_KEY_BIT', + 'COMPARE_DECFLOAT', + 'CONCAT', + 'COS', + 'COSH', + 'COT', + 'CURSOR_ROWCOUNT', + 'DATAPARTITIONNUM', + 'DATE', + 'DATETIME', + 'DATE_PART', + 'DATE_TRUNC', + 'DAY', + 'DAYNAME', + 'DAYOFMONTH', + 'DAYOFWEEK', + 'DAYOFWEEK_ISO', + 'DAYOFYEAR', + 'DAYS', + 'DAYS_BETWEEN', + 'DAYS_TO_END_OF_MONTH', + 'DBCLOB', + 'DBPARTITIONNUM', + 'DECFLOAT', + 'DECFLOAT_FORMAT', + 'DECIMAL', + 'DEC', + 'DECODE', + 'DECRYPT_BIN', + 'DECRYPT_CHAR', + 'DEGREES', + 'DEREF', + 'DIFFERENCE', + 'DIGITS', + 'DOUBLE_PRECISION', + 'DOUBLE', + 'EMPTY_BLOB', + 'EMPTY_CLOB', + 'EMPTY_DBCLOB', + 'EMPTY_NCLOB', + 'ENCRYPT', + 'EVENT_MON_STATE', + 'EXP', + 'EXTRACT', + 'FIRST_DAY', + 'FLOAT', + 'FLOAT4', + 'FLOAT8', + 'FLOOR', + 'FROM_UTC_TIMESTAMP', + 'GENERATE_UNIQUE', + 'GETHINT', + 'GRAPHIC', + 'GREATEST', + 'HASH', + 'HASH4', + 'HASH8', + 'HASHEDVALUE', + 'HEX', + 'HEXTORAW', + 'HOUR', + 'HOURS_BETWEEN', + 'IDENTITY_VAL_LOCAL', + 'IFNULL', + 'INITCAP', + 'INSERT', + 'INSTR', + 'INSTR2', + 'INSTR4', + 'INSTRB', + 'INT', + 'INTERVAL', + 'INTEGER', + 'INT2', + 'INT4', + 'INT8', + 'INTNAND', + 'INTNOR', + 'INTNXOR', + 'INTNNOT', + 'ISNULL', + 'JSON_ARRAY', + 'JSON_OBJECT', + 'JSON_QUERY', + 'JSON_TO_BSON', + 'JSON_VALUE', + 'JULIAN_DAY', + 'LAST_DAY', + 'LCASE', + 'LEAST', + 'LEFT', + 'LENGTH', + 'LENGTH2', + 'LENGTH4', + 'LENGTHB', + 'LN', + 'LOCATE', + 'LOCATE_IN_STRING', + 'LOG10', + 'LONG_VARCHAR', + 'LONG_VARGRAPHIC', + 'LOWER', + 'LPAD', + 'LTRIM', + 'MAX', + 'MAX_CARDINALITY', + 'MICROSECOND', + 'MIDNIGHT_SECONDS', + 'MIN', + 'MINUTE', + 'MINUTES_BETWEEN', + 'MOD', + 'MONTH', + 'MONTHNAME', + 'MONTHS_BETWEEN', + 'MULTIPLY_ALT', + 'NCHAR', + 'NCHR', + 'NCLOB', + 'NVARCHAR', + 'NEXT_DAY', + 'NEXT_MONTH', + 'NEXT_QUARTER', + 'NEXT_WEEK', + 'NEXT_YEAR', + 'NORMALIZE_DECFLOAT', + 'NOW', + 'NULLIF', + 'NUMERIC', + 'NVL', + 'NVL2', + 'OCTET_LENGTH', + 'OVERLAY', + 'PARAMETER', + 'POSITION', + 'POSSTR', + 'POW', + 'POWER', + 'QUANTIZE', + 'QUARTER', + 'QUOTE_IDENT', + 'QUOTE_LITERAL', + 'RADIANS', + 'RAISE_ERROR', + 'RAND', + 'RANDOM', + 'RAWTOHEX', + 'REAL', + 'REC2XML', + 'REGEXP_COUNT', + 'REGEXP_EXTRACT', + 'REGEXP_INSTR', + 'REGEXP_LIKE', + 'REGEXP_MATCH_COUNT', + 'REGEXP_REPLACE', + 'REGEXP_SUBSTR', + 'REPEAT', + 'REPLACE', + 'RID and RID_BIT', + 'RIGHT', + 'ROUND', + 'ROUND_TIMESTAMP', + 'RPAD', + 'RTRIM', + 'SECLABEL', + 'SECLABEL_BY_NAME', + 'SECLABEL_TO_CHAR', + 'SECOND', + 'SECONDS_BETWEEN', + 'SIGN', + 'SIN', + 'SINH', + 'SMALLINT', + 'SOUNDEX', + 'SPACE', + 'SQRT', + 'STRIP', + 'STRLEFT', + 'STRPOS', + 'STRRIGHT', + 'SUBSTR', + 'SUBSTR2', + 'SUBSTR4', + 'SUBSTRB', + 'SUBSTRING', + 'TABLE_NAME', + 'TABLE_SCHEMA', + 'TAN', + 'TANH', + 'THIS_MONTH', + 'THIS_QUARTER', + 'THIS_WEEK', + 'THIS_YEAR', + 'TIME', + 'TIMESTAMP', + 'TIMESTAMP_FORMAT', + 'TIMESTAMP_ISO', + 'TIMESTAMPDIFF', + 'TIMEZONE', + 'TO_CHAR', + 'TO_CLOB', + 'TO_DATE', + 'TO_HEX', + 'TO_MULTI_BYTE', + 'TO_NCHAR', + 'TO_NCLOB', + 'TO_NUMBER', + 'TO_SINGLE_BYTE', + 'TO_TIMESTAMP', + 'TO_UTC_TIMESTAMP', + 'TOTALORDER', + 'TRANSLATE', + 'TRIM', + 'TRIM_ARRAY', + 'TRUNC_TIMESTAMP', + 'TRUNCATE', + 'TRUNC', + 'TYPE_ID', + 'TYPE_NAME', + 'TYPE_SCHEMA', + 'UCASE', + 'UNICODE_STR', + 'UPPER', + 'VALUE', + 'VARBINARY', + 'VARCHAR', + 'VARCHAR_BIT_FORMAT', + 'VARCHAR_FORMAT', + 'VARCHAR_FORMAT_BIT', + 'VARGRAPHIC', + 'VERIFY_GROUP_FOR_USER', + 'VERIFY_ROLE_FOR_USER', + 'VERIFY_TRUSTED_CONTEXT_ROLE_FOR_USER', + 'WEEK', + 'WEEK_ISO', + 'WEEKS_BETWEEN', + 'WIDTH_BUCKET', + 'XMLATTRIBUTES', + 'XMLCOMMENT', + 'XMLCONCAT', + 'XMLDOCUMENT', + 'XMLELEMENT', + 'XMLFOREST', + 'XMLNAMESPACES', + 'XMLPARSE', + 'XMLPI', + 'XMLQUERY', + 'XMLROW', + 'XMLSERIALIZE', + 'XMLTEXT', + 'XMLVALIDATE', + 'XMLXSROBJECTID', + 'XSLTRANSFORM', + 'YEAR', + 'YEARS_BETWEEN', + 'YMD_BETWEEN', + // https://www.ibm.com/docs/en/db2/11.5?topic=bif-table-functions - table: ['BASE_TABLE', 'JSON_TABLE', 'UNNEST', 'XMLTABLE'], + 'BASE_TABLE', + 'JSON_TABLE', + 'UNNEST', + 'XMLTABLE', + // https://www.ibm.com/docs/en/db2/11.5?topic=expressions-olap-specification // Additional function names not already present in the aggregate functions list - olap: [ - 'RANK', - 'DENSE_RANK', - 'NTILE', - 'LAG', - 'LEAD', - 'ROW_NUMBER', - 'FIRST_VALUE', - 'LAST_VALUE', - 'NTH_VALUE', - 'RATIO_TO_REPORT', - ], + 'RANK', + 'DENSE_RANK', + 'NTILE', + 'LAG', + 'LEAD', + 'ROW_NUMBER', + 'FIRST_VALUE', + 'LAST_VALUE', + 'NTH_VALUE', + 'RATIO_TO_REPORT', + // Type casting - cast: ['CAST'], -}); + 'CAST', +]; diff --git a/src/languages/db2/db2.keywords.ts b/src/languages/db2/db2.keywords.ts index db80836baa..f9b17582b4 100644 --- a/src/languages/db2/db2.keywords.ts +++ b/src/languages/db2/db2.keywords.ts @@ -1,414 +1,410 @@ -import { flatKeywordList } from '../../utils.js'; - -export const keywords = flatKeywordList({ +export const keywords: string[] = [ // https://www.ibm.com/docs/en/db2/11.5?topic=sql-reserved-schema-names-reserved-words - standard: [ - 'ACTIVATE', - 'ADD', - 'AFTER', - 'ALIAS', - 'ALL', - 'ALLOCATE', - 'ALLOW', - 'ALTER', - 'AND', - 'ANY', - 'AS', - 'ASENSITIVE', - 'ASSOCIATE', - 'ASUTIME', - 'AT', - 'ATTRIBUTES', - 'AUDIT', - 'AUTHORIZATION', - 'AUX', - 'AUXILIARY', - 'BEFORE', - 'BEGIN', - 'BETWEEN', - 'BINARY', - 'BUFFERPOOL', - 'BY', - 'CACHE', - 'CALL', - 'CALLED', - 'CAPTURE', - 'CARDINALITY', - 'CASCADED', - 'CASE', - 'CAST', - 'CCSID', - 'CHAR', - 'CHARACTER', - 'CHECK', - 'CLONE', - 'CLOSE', - 'CLUSTER', - 'COLLECTION', - 'COLLID', - 'COLUMN', - 'COMMENT', - 'COMMIT', - 'CONCAT', - 'CONDITION', - 'CONNECT', - 'CONNECTION', - 'CONSTRAINT', - 'CONTAINS', - 'CONTINUE', - 'COUNT', - 'COUNT_BIG', - 'CREATE', - 'CROSS', - 'CURRENT', - 'CURRENT_DATE', - 'CURRENT_LC_CTYPE', - 'CURRENT_PATH', - 'CURRENT_SCHEMA', - 'CURRENT_SERVER', - 'CURRENT_TIME', - 'CURRENT_TIMESTAMP', - 'CURRENT_TIMEZONE', - 'CURRENT_USER', - 'CURSOR', - 'CYCLE', - 'DATA', - 'DATABASE', - 'DATAPARTITIONNAME', - 'DATAPARTITIONNUM', - 'DATE', - 'DAY', - 'DAYS', - 'DB2GENERAL', - 'DB2GENRL', - 'DB2SQL', - 'DBINFO', - 'DBPARTITIONNAME', - 'DBPARTITIONNUM', - 'DEALLOCATE', - 'DECLARE', - 'DEFAULT', - 'DEFAULTS', - 'DEFINITION', - 'DELETE', - 'DENSERANK', - 'DENSE_RANK', - 'DESCRIBE', - 'DESCRIPTOR', - 'DETERMINISTIC', - 'DIAGNOSTICS', - 'DISABLE', - 'DISALLOW', - 'DISCONNECT', - 'DISTINCT', - 'DO', - 'DOCUMENT', - 'DOUBLE', - 'DROP', - 'DSSIZE', - 'DYNAMIC', - 'EACH', - 'EDITPROC', - 'ELSE', - 'ELSEIF', - 'ENABLE', - 'ENCODING', - 'ENCRYPTION', - 'END', - 'END-EXEC', - 'ENDING', - 'ERASE', - 'ESCAPE', - 'EVERY', - 'EXCEPT', - 'EXCEPTION', - 'EXCLUDING', - 'EXCLUSIVE', - 'EXECUTE', - 'EXISTS', - 'EXIT', - 'EXPLAIN', - 'EXTENDED', - 'EXTERNAL', - 'EXTRACT', - 'FENCED', - 'FETCH', - 'FIELDPROC', - 'FILE', - 'FINAL', - 'FIRST1', - 'FOR', - 'FOREIGN', - 'FREE', - 'FROM', - 'FULL', - 'FUNCTION', - 'GENERAL', - 'GENERATED', - 'GET', - 'GLOBAL', - 'GO', - 'GOTO', - 'GRANT', - 'GRAPHIC', - 'GROUP', - 'HANDLER', - 'HASH', - 'HASHED_VALUE', - 'HAVING', - 'HINT', - 'HOLD', - 'HOUR', - 'HOURS', - 'IDENTITY', - 'IF', - 'IMMEDIATE', - 'IMPORT', - 'IN', - 'INCLUDING', - 'INCLUSIVE', - 'INCREMENT', - 'INDEX', - 'INDICATOR', - 'INDICATORS', - 'INF', - 'INFINITY', - 'INHERIT', - 'INNER', - 'INOUT', - 'INSENSITIVE', - 'INSERT', - 'INTEGRITY', - 'INTERSECT', - 'INTO', - 'IS', - 'ISNULL', - 'ISOBID', - 'ISOLATION', - 'ITERATE', - 'JAR', - 'JAVA', - 'JOIN', - 'KEEP', - 'KEY', - 'LABEL', - 'LANGUAGE', - 'LAST3', - 'LATERAL', - 'LC_CTYPE', - 'LEAVE', - 'LEFT', - 'LIKE', - 'LIMIT', - 'LINKTYPE', - 'LOCAL', - 'LOCALDATE', - 'LOCALE', - 'LOCALTIME', - 'LOCALTIMESTAMP', - 'LOCATOR', - 'LOCATORS', - 'LOCK', - 'LOCKMAX', - 'LOCKSIZE', - 'LONG', - 'LOOP', - 'MAINTAINED', - 'MATERIALIZED', - 'MAXVALUE', - 'MICROSECOND', - 'MICROSECONDS', - 'MINUTE', - 'MINUTES', - 'MINVALUE', - 'MODE', - 'MODIFIES', - 'MONTH', - 'MONTHS', - 'NAN', - 'NEW', - 'NEW_TABLE', - 'NEXTVAL', - 'NO', - 'NOCACHE', - 'NOCYCLE', - 'NODENAME', - 'NODENUMBER', - 'NOMAXVALUE', - 'NOMINVALUE', - 'NONE', - 'NOORDER', - 'NORMALIZED', - 'NOT2', - 'NOTNULL', - 'NULL', - 'NULLS', - 'NUMPARTS', - 'OBID', - 'OF', - 'OFF', - 'OFFSET', - 'OLD', - 'OLD_TABLE', - 'ON', - 'OPEN', - 'OPTIMIZATION', - 'OPTIMIZE', - 'OPTION', - 'OR', - 'ORDER', - 'OUT', - 'OUTER', - 'OVER', - 'OVERRIDING', - 'PACKAGE', - 'PADDED', - 'PAGESIZE', - 'PARAMETER', - 'PART', - 'PARTITION', - 'PARTITIONED', - 'PARTITIONING', - 'PARTITIONS', - 'PASSWORD', - 'PATH', - 'PERCENT', - 'PIECESIZE', - 'PLAN', - 'POSITION', - 'PRECISION', - 'PREPARE', - 'PREVVAL', - 'PRIMARY', - 'PRIQTY', - 'PRIVILEGES', - 'PROCEDURE', - 'PROGRAM', - 'PSID', - 'PUBLIC', - 'QUERY', - 'QUERYNO', - 'RANGE', - 'RANK', - 'READ', - 'READS', - 'RECOVERY', - 'REFERENCES', - 'REFERENCING', - 'REFRESH', - 'RELEASE', - 'RENAME', - 'REPEAT', - 'RESET', - 'RESIGNAL', - 'RESTART', - 'RESTRICT', - 'RESULT', - 'RESULT_SET_LOCATOR', - 'RETURN', - 'RETURNS', - 'REVOKE', - 'RIGHT', - 'ROLE', - 'ROLLBACK', - 'ROUND_CEILING', - 'ROUND_DOWN', - 'ROUND_FLOOR', - 'ROUND_HALF_DOWN', - 'ROUND_HALF_EVEN', - 'ROUND_HALF_UP', - 'ROUND_UP', - 'ROUTINE', - 'ROW', - 'ROWNUMBER', - 'ROWS', - 'ROWSET', - 'ROW_NUMBER', - 'RRN', - 'RUN', - 'SAVEPOINT', - 'SCHEMA', - 'SCRATCHPAD', - 'SCROLL', - 'SEARCH', - 'SECOND', - 'SECONDS', - 'SECQTY', - 'SECURITY', - 'SELECT', - 'SENSITIVE', - 'SEQUENCE', - 'SESSION', - 'SESSION_USER', - 'SET', - 'SIGNAL', - 'SIMPLE', - 'SNAN', - 'SOME', - 'SOURCE', - 'SPECIFIC', - 'SQL', - 'SQLID', - 'STACKED', - 'STANDARD', - 'START', - 'STARTING', - 'STATEMENT', - 'STATIC', - 'STATMENT', - 'STAY', - 'STOGROUP', - 'STORES', - 'STYLE', - 'SUBSTRING', - 'SUMMARY', - 'SYNONYM', - 'SYSFUN', - 'SYSIBM', - 'SYSPROC', - 'SYSTEM', - 'SYSTEM_USER', - 'TABLE', - 'TABLESPACE', - 'THEN', - 'TIME', - 'TIMESTAMP', - 'TO', - 'TRANSACTION', - 'TRIGGER', - 'TRIM', - 'TRUNCATE', - 'TYPE', - 'UNDO', - 'UNION', - 'UNIQUE', - 'UNTIL', - 'UPDATE', - 'USAGE', - 'USER', - 'USING', - 'VALIDPROC', - 'VALUE', - 'VALUES', - 'VARIABLE', - 'VARIANT', - 'VCAT', - 'VERSION', - 'VIEW', - 'VOLATILE', - 'VOLUMES', - 'WHEN', - 'WHENEVER', - 'WHERE', - 'WHILE', - 'WITH', - 'WITHOUT', - 'WLM', - 'WRITE', - 'XMLELEMENT', - 'XMLEXISTS', - 'XMLNAMESPACES', - 'YEAR', - 'YEARS', - ], -}); + 'ACTIVATE', + 'ADD', + 'AFTER', + 'ALIAS', + 'ALL', + 'ALLOCATE', + 'ALLOW', + 'ALTER', + 'AND', + 'ANY', + 'AS', + 'ASENSITIVE', + 'ASSOCIATE', + 'ASUTIME', + 'AT', + 'ATTRIBUTES', + 'AUDIT', + 'AUTHORIZATION', + 'AUX', + 'AUXILIARY', + 'BEFORE', + 'BEGIN', + 'BETWEEN', + 'BINARY', + 'BUFFERPOOL', + 'BY', + 'CACHE', + 'CALL', + 'CALLED', + 'CAPTURE', + 'CARDINALITY', + 'CASCADED', + 'CASE', + 'CAST', + 'CCSID', + 'CHAR', + 'CHARACTER', + 'CHECK', + 'CLONE', + 'CLOSE', + 'CLUSTER', + 'COLLECTION', + 'COLLID', + 'COLUMN', + 'COMMENT', + 'COMMIT', + 'CONCAT', + 'CONDITION', + 'CONNECT', + 'CONNECTION', + 'CONSTRAINT', + 'CONTAINS', + 'CONTINUE', + 'COUNT', + 'COUNT_BIG', + 'CREATE', + 'CROSS', + 'CURRENT', + 'CURRENT_DATE', + 'CURRENT_LC_CTYPE', + 'CURRENT_PATH', + 'CURRENT_SCHEMA', + 'CURRENT_SERVER', + 'CURRENT_TIME', + 'CURRENT_TIMESTAMP', + 'CURRENT_TIMEZONE', + 'CURRENT_USER', + 'CURSOR', + 'CYCLE', + 'DATA', + 'DATABASE', + 'DATAPARTITIONNAME', + 'DATAPARTITIONNUM', + 'DATE', + 'DAY', + 'DAYS', + 'DB2GENERAL', + 'DB2GENRL', + 'DB2SQL', + 'DBINFO', + 'DBPARTITIONNAME', + 'DBPARTITIONNUM', + 'DEALLOCATE', + 'DECLARE', + 'DEFAULT', + 'DEFAULTS', + 'DEFINITION', + 'DELETE', + 'DENSERANK', + 'DENSE_RANK', + 'DESCRIBE', + 'DESCRIPTOR', + 'DETERMINISTIC', + 'DIAGNOSTICS', + 'DISABLE', + 'DISALLOW', + 'DISCONNECT', + 'DISTINCT', + 'DO', + 'DOCUMENT', + 'DOUBLE', + 'DROP', + 'DSSIZE', + 'DYNAMIC', + 'EACH', + 'EDITPROC', + 'ELSE', + 'ELSEIF', + 'ENABLE', + 'ENCODING', + 'ENCRYPTION', + 'END', + 'END-EXEC', + 'ENDING', + 'ERASE', + 'ESCAPE', + 'EVERY', + 'EXCEPT', + 'EXCEPTION', + 'EXCLUDING', + 'EXCLUSIVE', + 'EXECUTE', + 'EXISTS', + 'EXIT', + 'EXPLAIN', + 'EXTENDED', + 'EXTERNAL', + 'EXTRACT', + 'FENCED', + 'FETCH', + 'FIELDPROC', + 'FILE', + 'FINAL', + 'FIRST1', + 'FOR', + 'FOREIGN', + 'FREE', + 'FROM', + 'FULL', + 'FUNCTION', + 'GENERAL', + 'GENERATED', + 'GET', + 'GLOBAL', + 'GO', + 'GOTO', + 'GRANT', + 'GRAPHIC', + 'GROUP', + 'HANDLER', + 'HASH', + 'HASHED_VALUE', + 'HAVING', + 'HINT', + 'HOLD', + 'HOUR', + 'HOURS', + 'IDENTITY', + 'IF', + 'IMMEDIATE', + 'IMPORT', + 'IN', + 'INCLUDING', + 'INCLUSIVE', + 'INCREMENT', + 'INDEX', + 'INDICATOR', + 'INDICATORS', + 'INF', + 'INFINITY', + 'INHERIT', + 'INNER', + 'INOUT', + 'INSENSITIVE', + 'INSERT', + 'INTEGRITY', + 'INTERSECT', + 'INTO', + 'IS', + 'ISNULL', + 'ISOBID', + 'ISOLATION', + 'ITERATE', + 'JAR', + 'JAVA', + 'JOIN', + 'KEEP', + 'KEY', + 'LABEL', + 'LANGUAGE', + 'LAST3', + 'LATERAL', + 'LC_CTYPE', + 'LEAVE', + 'LEFT', + 'LIKE', + 'LIMIT', + 'LINKTYPE', + 'LOCAL', + 'LOCALDATE', + 'LOCALE', + 'LOCALTIME', + 'LOCALTIMESTAMP', + 'LOCATOR', + 'LOCATORS', + 'LOCK', + 'LOCKMAX', + 'LOCKSIZE', + 'LONG', + 'LOOP', + 'MAINTAINED', + 'MATERIALIZED', + 'MAXVALUE', + 'MICROSECOND', + 'MICROSECONDS', + 'MINUTE', + 'MINUTES', + 'MINVALUE', + 'MODE', + 'MODIFIES', + 'MONTH', + 'MONTHS', + 'NAN', + 'NEW', + 'NEW_TABLE', + 'NEXTVAL', + 'NO', + 'NOCACHE', + 'NOCYCLE', + 'NODENAME', + 'NODENUMBER', + 'NOMAXVALUE', + 'NOMINVALUE', + 'NONE', + 'NOORDER', + 'NORMALIZED', + 'NOT2', + 'NOTNULL', + 'NULL', + 'NULLS', + 'NUMPARTS', + 'OBID', + 'OF', + 'OFF', + 'OFFSET', + 'OLD', + 'OLD_TABLE', + 'ON', + 'OPEN', + 'OPTIMIZATION', + 'OPTIMIZE', + 'OPTION', + 'OR', + 'ORDER', + 'OUT', + 'OUTER', + 'OVER', + 'OVERRIDING', + 'PACKAGE', + 'PADDED', + 'PAGESIZE', + 'PARAMETER', + 'PART', + 'PARTITION', + 'PARTITIONED', + 'PARTITIONING', + 'PARTITIONS', + 'PASSWORD', + 'PATH', + 'PERCENT', + 'PIECESIZE', + 'PLAN', + 'POSITION', + 'PRECISION', + 'PREPARE', + 'PREVVAL', + 'PRIMARY', + 'PRIQTY', + 'PRIVILEGES', + 'PROCEDURE', + 'PROGRAM', + 'PSID', + 'PUBLIC', + 'QUERY', + 'QUERYNO', + 'RANGE', + 'RANK', + 'READ', + 'READS', + 'RECOVERY', + 'REFERENCES', + 'REFERENCING', + 'REFRESH', + 'RELEASE', + 'RENAME', + 'REPEAT', + 'RESET', + 'RESIGNAL', + 'RESTART', + 'RESTRICT', + 'RESULT', + 'RESULT_SET_LOCATOR', + 'RETURN', + 'RETURNS', + 'REVOKE', + 'RIGHT', + 'ROLE', + 'ROLLBACK', + 'ROUND_CEILING', + 'ROUND_DOWN', + 'ROUND_FLOOR', + 'ROUND_HALF_DOWN', + 'ROUND_HALF_EVEN', + 'ROUND_HALF_UP', + 'ROUND_UP', + 'ROUTINE', + 'ROW', + 'ROWNUMBER', + 'ROWS', + 'ROWSET', + 'ROW_NUMBER', + 'RRN', + 'RUN', + 'SAVEPOINT', + 'SCHEMA', + 'SCRATCHPAD', + 'SCROLL', + 'SEARCH', + 'SECOND', + 'SECONDS', + 'SECQTY', + 'SECURITY', + 'SELECT', + 'SENSITIVE', + 'SEQUENCE', + 'SESSION', + 'SESSION_USER', + 'SET', + 'SIGNAL', + 'SIMPLE', + 'SNAN', + 'SOME', + 'SOURCE', + 'SPECIFIC', + 'SQL', + 'SQLID', + 'STACKED', + 'STANDARD', + 'START', + 'STARTING', + 'STATEMENT', + 'STATIC', + 'STATMENT', + 'STAY', + 'STOGROUP', + 'STORES', + 'STYLE', + 'SUBSTRING', + 'SUMMARY', + 'SYNONYM', + 'SYSFUN', + 'SYSIBM', + 'SYSPROC', + 'SYSTEM', + 'SYSTEM_USER', + 'TABLE', + 'TABLESPACE', + 'THEN', + 'TIME', + 'TIMESTAMP', + 'TO', + 'TRANSACTION', + 'TRIGGER', + 'TRIM', + 'TRUNCATE', + 'TYPE', + 'UNDO', + 'UNION', + 'UNIQUE', + 'UNTIL', + 'UPDATE', + 'USAGE', + 'USER', + 'USING', + 'VALIDPROC', + 'VALUE', + 'VALUES', + 'VARIABLE', + 'VARIANT', + 'VCAT', + 'VERSION', + 'VIEW', + 'VOLATILE', + 'VOLUMES', + 'WHEN', + 'WHENEVER', + 'WHERE', + 'WHILE', + 'WITH', + 'WITHOUT', + 'WLM', + 'WRITE', + 'XMLELEMENT', + 'XMLEXISTS', + 'XMLNAMESPACES', + 'YEAR', + 'YEARS', +]; diff --git a/src/languages/db2i/db2i.functions.ts b/src/languages/db2i/db2i.functions.ts index 6c933dcc2e..a3a42d559d 100644 --- a/src/languages/db2i/db2i.functions.ts +++ b/src/languages/db2i/db2i.functions.ts @@ -1,367 +1,362 @@ -import { flatKeywordList } from '../../utils.js'; - -export const functions = flatKeywordList({ +export const functions: string[] = [ // https://www.ibm.com/docs/en/i/7.5?topic=functions-aggregate - aggregate: [ - // TODO: 'ANY', - conflicts with test for ANY predicate in 'operators.ys'!! - 'ARRAY_AGG', - 'AVG', - 'CORR', - 'CORRELATION', - 'COUNT', - 'COUNT_BIG', - 'COVAR_POP', - 'COVARIANCE', - 'COVAR', - 'COVAR_SAMP', - 'COVARIANCE_SAMP', - 'EVERY', - 'GROUPING', - 'JSON_ARRAYAGG', - 'JSON_OBJECTAGG', - 'LISTAGG', - 'MAX', - 'MEDIAN', - 'MIN', - 'PERCENTILE_CONT', - 'PERCENTILE_DISC', - // https://www.ibm.com/docs/en/i/7.5?topic=functions-regression' - 'REGR_AVGX', - 'REGR_AVGY', - 'REGR_COUNT', - 'REGR_INTERCEPT', - 'REGR_R2', - 'REGR_SLOPE', - 'REGR_SXX', - 'REGR_SXY', - 'REGR_SYY', - 'SOME', - 'STDDEV_POP', - 'STDDEV', - 'STDDEV_SAMP', - 'SUM', - 'VAR_POP', - 'VARIANCE', - 'VAR', - 'VAR_SAMP', - 'VARIANCE_SAMP', - 'XMLAGG', - 'XMLGROUP', - ], + // TODO: 'ANY', - conflicts with test for ANY predicate in 'operators.ys'!! + 'ARRAY_AGG', + 'AVG', + 'CORR', + 'CORRELATION', + 'COUNT', + 'COUNT_BIG', + 'COVAR_POP', + 'COVARIANCE', + 'COVAR', + 'COVAR_SAMP', + 'COVARIANCE_SAMP', + 'EVERY', + 'GROUPING', + 'JSON_ARRAYAGG', + 'JSON_OBJECTAGG', + 'LISTAGG', + 'MAX', + 'MEDIAN', + 'MIN', + 'PERCENTILE_CONT', + 'PERCENTILE_DISC', + // https://www.ibm.com/docs/en/i/7.5?topic=functions-regression' + 'REGR_AVGX', + 'REGR_AVGY', + 'REGR_COUNT', + 'REGR_INTERCEPT', + 'REGR_R2', + 'REGR_SLOPE', + 'REGR_SXX', + 'REGR_SXY', + 'REGR_SYY', + 'SOME', + 'STDDEV_POP', + 'STDDEV', + 'STDDEV_SAMP', + 'SUM', + 'VAR_POP', + 'VARIANCE', + 'VAR', + 'VAR_SAMP', + 'VARIANCE_SAMP', + 'XMLAGG', + 'XMLGROUP', + // https://www.ibm.com/docs/en/i/7.5?topic=functions-scalar - scalar: [ - 'ABS', - 'ABSVAL', - 'ACOS', - 'ADD_DAYS', - 'ADD_HOURS', - 'ADD_MINUTES', - 'ADD_MONTHS', - 'ADD_SECONDS', - 'ADD_YEARS', - 'ANTILOG', - 'ARRAY_MAX_CARDINALITY', - 'ARRAY_TRIM', - 'ASCII', - 'ASIN', - 'ATAN', - 'ATAN2', - 'ATANH', - 'BASE64_DECODE', - 'BASE64_ENCODE', - 'BIGINT', - 'BINARY', - 'BIT_LENGTH', - 'BITAND', - 'BITANDNOT', - 'BITNOT', - 'BITOR', - 'BITXOR', - 'BLOB', - 'BOOLEAN', - 'BSON_TO_JSON', - 'CARDINALITY', - 'CEIL', - 'CEILING', - 'CHAR_LENGTH', - 'CHAR', - 'CHARACTER_LENGTH', - 'CHR', - 'CLOB', - 'COALESCE', - 'COMPARE_DECFLOAT', - 'CONCAT', - 'CONTAINS', - 'COS', - 'COSH', - 'COT', - 'CURDATE', - 'CURTIME', - 'DATABASE', - 'DATAPARTITIONNAME', - 'DATAPARTITIONNUM', - 'DATE', - 'DAY', - 'DAYNAME', - 'DAYOFMONTH', - 'DAYOFWEEK_ISO', - 'DAYOFWEEK', - 'DAYOFYEAR', - 'DAYS', - 'DBCLOB', - 'DBPARTITIONNAME', - 'DBPARTITIONNUM', - 'DEC', - 'DECFLOAT_FORMAT', - 'DECFLOAT_SORTKEY', - 'DECFLOAT', - 'DECIMAL', - 'DECRYPT_BINARY', - 'DECRYPT_BIT', - 'DECRYPT_CHAR', - 'DECRYPT_DB', - 'DEGREES', - 'DIFFERENCE', - 'DIGITS', - 'DLCOMMENT', - 'DLLINKTYPE', - 'DLURLCOMPLETE', - 'DLURLPATH', - 'DLURLPATHONLY', - 'DLURLSCHEME', - 'DLURLSERVER', - 'DLVALUE', - 'DOUBLE_PRECISION', - 'DOUBLE', - 'ENCRPYT', - 'ENCRYPT_AES', - 'ENCRYPT_AES256', - 'ENCRYPT_RC2', - 'ENCRYPT_TDES', - 'EXP', - 'EXTRACT', - 'FIRST_DAY', - 'FLOAT', - 'FLOOR', - 'GENERATE_UNIQUE', - 'GET_BLOB_FROM_FILE', - 'GET_CLOB_FROM_FILE', - 'GET_DBCLOB_FROM_FILE', - 'GET_XML_FILE', - 'GETHINT', - 'GRAPHIC', - 'GREATEST', - 'HASH_MD5', - 'HASH_ROW', - 'HASH_SHA1', - 'HASH_SHA256', - 'HASH_SHA512', - 'HASH_VALUES', - 'HASHED_VALUE', - 'HEX', - 'HEXTORAW', - 'HOUR', - 'HTML_ENTITY_DECODE', - 'HTML_ENTITY_ENCODE', - 'HTTP_DELETE_BLOB', - 'HTTP_DELETE', - 'HTTP_GET_BLOB', - 'HTTP_GET', - 'HTTP_PATCH_BLOB', - 'HTTP_PATCH', - 'HTTP_POST_BLOB', - 'HTTP_POST', - 'HTTP_PUT_BLOB', - 'HTTP_PUT', - 'IDENTITY_VAL_LOCAL', - 'IFNULL', - 'INSERT', - 'INSTR', - 'INT', - 'INTEGER', - 'INTERPRET', - 'ISFALSE', - 'ISNOTFALSE', - 'ISNOTTRUE', - 'ISTRUE', - 'JSON_ARRAY', - 'JSON_OBJECT', - 'JSON_QUERY', - 'JSON_TO_BSON', - 'JSON_UPDATE', - 'JSON_VALUE', - 'JULIAN_DAY', - 'LAND', - 'LAST_DAY', - 'LCASE', - 'LEAST', - 'LEFT', - 'LENGTH', - 'LN', - 'LNOT', - 'LOCATE_IN_STRING', - 'LOCATE', - 'LOG10', - 'LOR', - 'LOWER', - 'LPAD', - 'LTRIM', - 'MAX_CARDINALITY', - 'MAX', - 'MICROSECOND', - 'MIDNIGHT_SECONDS', - 'MIN', - 'MINUTE', - 'MOD', - 'MONTH', - 'MONTHNAME', - 'MONTHS_BETWEEN', - 'MQREAD', - 'MQREADCLOB', - 'MQRECEIVE', - 'MQRECEIVECLOB', - 'MQSEND', - 'MULTIPLY_ALT', - 'NEXT_DAY', - 'NORMALIZE_DECFLOAT', - 'NOW', - 'NULLIF', - 'NVL', - 'OCTET_LENGTH', - 'OVERLAY', - 'PI', - 'POSITION', - 'POSSTR', - 'POW', - 'POWER', - 'QUANTIZE', - 'QUARTER', - 'RADIANS', - 'RAISE_ERROR', - 'RANDOM or RAND', - 'REAL', - 'REGEXP_COUNT', - 'REGEXP_INSTR', - 'REGEXP_REPLACE', - 'REGEXP_SUBSTR', - 'REPEAT', - 'REPLACE', - 'RID', - 'RIGHT', - 'ROUND_TIMESTAMP', - 'ROUND', - 'ROWID', - 'RPAD', - 'RRN', - 'RTRIM', - 'SCORE', - 'SECOND', - 'SIGN', - 'SIN', - 'SINH', - 'SMALLINT', - 'SOUNDEX', - 'SPACE', - 'SQRT', - 'STRIP', - 'STRLEFT', - 'STRPOS', - 'STRRIGHT', - 'SUBSTR', - 'SUBSTRING', - 'TABLE_NAME', - 'TABLE_SCHEMA', - 'TAN', - 'TANH', - 'TIME', - 'TIMESTAMP_FORMAT', - 'TIMESTAMP_ISO', - 'TIMESTAMP', - 'TIMESTAMPDIFF_BIG', - 'TIMESTAMPDIFF', - 'TO_CHAR', - 'TO_CLOB', - 'TO_DATE', - 'TO_NUMBER', - 'TO_TIMESTAMP', - 'TOTALORDER', - 'TRANSLATE', - 'TRIM_ARRAY', - 'TRIM', - 'TRUNC_TIMESTAMP', - 'TRUNC', - 'TRUNCATE', - 'UCASE', - 'UPPER', - 'URL_DECODE', - 'URL_ENCODE', - 'VALUE', - 'VARBINARY_FORMAT', - 'VARBINARY', - 'VARCHAR_BIT_FORMAT', - 'VARCHAR_FORMAT_BINARY', - 'VARCHAR_FORMAT', - 'VARCHAR', - 'VARGRAPHIC', - 'VERIFY_GROUP_FOR_USER', - 'WEEK_ISO', - 'WEEK', - 'WRAP', - 'XMLATTRIBUTES', - 'XMLCOMMENT', - 'XMLCONCAT', - 'XMLDOCUMENT', - 'XMLELEMENT', - 'XMLFOREST', - 'XMLNAMESPACES', - 'XMLPARSE', - 'XMLPI', - 'XMLROW', - 'XMLSERIALIZE', - 'XMLTEXT', - 'XMLVALIDATE', - 'XOR', - 'XSLTRANSFORM', - 'YEAR', - 'ZONED', - ], + 'ABS', + 'ABSVAL', + 'ACOS', + 'ADD_DAYS', + 'ADD_HOURS', + 'ADD_MINUTES', + 'ADD_MONTHS', + 'ADD_SECONDS', + 'ADD_YEARS', + 'ANTILOG', + 'ARRAY_MAX_CARDINALITY', + 'ARRAY_TRIM', + 'ASCII', + 'ASIN', + 'ATAN', + 'ATAN2', + 'ATANH', + 'BASE64_DECODE', + 'BASE64_ENCODE', + 'BIGINT', + 'BINARY', + 'BIT_LENGTH', + 'BITAND', + 'BITANDNOT', + 'BITNOT', + 'BITOR', + 'BITXOR', + 'BLOB', + 'BOOLEAN', + 'BSON_TO_JSON', + 'CARDINALITY', + 'CEIL', + 'CEILING', + 'CHAR_LENGTH', + 'CHAR', + 'CHARACTER_LENGTH', + 'CHR', + 'CLOB', + 'COALESCE', + 'COMPARE_DECFLOAT', + 'CONCAT', + 'CONTAINS', + 'COS', + 'COSH', + 'COT', + 'CURDATE', + 'CURTIME', + 'DATABASE', + 'DATAPARTITIONNAME', + 'DATAPARTITIONNUM', + 'DATE', + 'DAY', + 'DAYNAME', + 'DAYOFMONTH', + 'DAYOFWEEK_ISO', + 'DAYOFWEEK', + 'DAYOFYEAR', + 'DAYS', + 'DBCLOB', + 'DBPARTITIONNAME', + 'DBPARTITIONNUM', + 'DEC', + 'DECFLOAT_FORMAT', + 'DECFLOAT_SORTKEY', + 'DECFLOAT', + 'DECIMAL', + 'DECRYPT_BINARY', + 'DECRYPT_BIT', + 'DECRYPT_CHAR', + 'DECRYPT_DB', + 'DEGREES', + 'DIFFERENCE', + 'DIGITS', + 'DLCOMMENT', + 'DLLINKTYPE', + 'DLURLCOMPLETE', + 'DLURLPATH', + 'DLURLPATHONLY', + 'DLURLSCHEME', + 'DLURLSERVER', + 'DLVALUE', + 'DOUBLE_PRECISION', + 'DOUBLE', + 'ENCRPYT', + 'ENCRYPT_AES', + 'ENCRYPT_AES256', + 'ENCRYPT_RC2', + 'ENCRYPT_TDES', + 'EXP', + 'EXTRACT', + 'FIRST_DAY', + 'FLOAT', + 'FLOOR', + 'GENERATE_UNIQUE', + 'GET_BLOB_FROM_FILE', + 'GET_CLOB_FROM_FILE', + 'GET_DBCLOB_FROM_FILE', + 'GET_XML_FILE', + 'GETHINT', + 'GRAPHIC', + 'GREATEST', + 'HASH_MD5', + 'HASH_ROW', + 'HASH_SHA1', + 'HASH_SHA256', + 'HASH_SHA512', + 'HASH_VALUES', + 'HASHED_VALUE', + 'HEX', + 'HEXTORAW', + 'HOUR', + 'HTML_ENTITY_DECODE', + 'HTML_ENTITY_ENCODE', + 'HTTP_DELETE_BLOB', + 'HTTP_DELETE', + 'HTTP_GET_BLOB', + 'HTTP_GET', + 'HTTP_PATCH_BLOB', + 'HTTP_PATCH', + 'HTTP_POST_BLOB', + 'HTTP_POST', + 'HTTP_PUT_BLOB', + 'HTTP_PUT', + 'IDENTITY_VAL_LOCAL', + 'IFNULL', + 'INSERT', + 'INSTR', + 'INT', + 'INTEGER', + 'INTERPRET', + 'ISFALSE', + 'ISNOTFALSE', + 'ISNOTTRUE', + 'ISTRUE', + 'JSON_ARRAY', + 'JSON_OBJECT', + 'JSON_QUERY', + 'JSON_TO_BSON', + 'JSON_UPDATE', + 'JSON_VALUE', + 'JULIAN_DAY', + 'LAND', + 'LAST_DAY', + 'LCASE', + 'LEAST', + 'LEFT', + 'LENGTH', + 'LN', + 'LNOT', + 'LOCATE_IN_STRING', + 'LOCATE', + 'LOG10', + 'LOR', + 'LOWER', + 'LPAD', + 'LTRIM', + 'MAX_CARDINALITY', + 'MAX', + 'MICROSECOND', + 'MIDNIGHT_SECONDS', + 'MIN', + 'MINUTE', + 'MOD', + 'MONTH', + 'MONTHNAME', + 'MONTHS_BETWEEN', + 'MQREAD', + 'MQREADCLOB', + 'MQRECEIVE', + 'MQRECEIVECLOB', + 'MQSEND', + 'MULTIPLY_ALT', + 'NEXT_DAY', + 'NORMALIZE_DECFLOAT', + 'NOW', + 'NULLIF', + 'NVL', + 'OCTET_LENGTH', + 'OVERLAY', + 'PI', + 'POSITION', + 'POSSTR', + 'POW', + 'POWER', + 'QUANTIZE', + 'QUARTER', + 'RADIANS', + 'RAISE_ERROR', + 'RANDOM or RAND', + 'REAL', + 'REGEXP_COUNT', + 'REGEXP_INSTR', + 'REGEXP_REPLACE', + 'REGEXP_SUBSTR', + 'REPEAT', + 'REPLACE', + 'RID', + 'RIGHT', + 'ROUND_TIMESTAMP', + 'ROUND', + 'ROWID', + 'RPAD', + 'RRN', + 'RTRIM', + 'SCORE', + 'SECOND', + 'SIGN', + 'SIN', + 'SINH', + 'SMALLINT', + 'SOUNDEX', + 'SPACE', + 'SQRT', + 'STRIP', + 'STRLEFT', + 'STRPOS', + 'STRRIGHT', + 'SUBSTR', + 'SUBSTRING', + 'TABLE_NAME', + 'TABLE_SCHEMA', + 'TAN', + 'TANH', + 'TIME', + 'TIMESTAMP_FORMAT', + 'TIMESTAMP_ISO', + 'TIMESTAMP', + 'TIMESTAMPDIFF_BIG', + 'TIMESTAMPDIFF', + 'TO_CHAR', + 'TO_CLOB', + 'TO_DATE', + 'TO_NUMBER', + 'TO_TIMESTAMP', + 'TOTALORDER', + 'TRANSLATE', + 'TRIM_ARRAY', + 'TRIM', + 'TRUNC_TIMESTAMP', + 'TRUNC', + 'TRUNCATE', + 'UCASE', + 'UPPER', + 'URL_DECODE', + 'URL_ENCODE', + 'VALUE', + 'VARBINARY_FORMAT', + 'VARBINARY', + 'VARCHAR_BIT_FORMAT', + 'VARCHAR_FORMAT_BINARY', + 'VARCHAR_FORMAT', + 'VARCHAR', + 'VARGRAPHIC', + 'VERIFY_GROUP_FOR_USER', + 'WEEK_ISO', + 'WEEK', + 'WRAP', + 'XMLATTRIBUTES', + 'XMLCOMMENT', + 'XMLCONCAT', + 'XMLDOCUMENT', + 'XMLELEMENT', + 'XMLFOREST', + 'XMLNAMESPACES', + 'XMLPARSE', + 'XMLPI', + 'XMLROW', + 'XMLSERIALIZE', + 'XMLTEXT', + 'XMLVALIDATE', + 'XOR', + 'XSLTRANSFORM', + 'YEAR', + 'ZONED', + // https://www.ibm.com/docs/en/i/7.5?topic=functions-table - table: [ - 'BASE_TABLE', - 'HTTP_DELETE_BLOB_VERBOSE', - 'HTTP_DELETE_VERBOSE', - 'HTTP_GET_BLOB_VERBOSE', - 'HTTP_GET_VERBOSE', - 'HTTP_PATCH_BLOB_VERBOSE', - 'HTTP_PATCH_VERBOSE', - 'HTTP_POST_BLOB_VERBOSE', - 'HTTP_POST_VERBOSE', - 'HTTP_PUT_BLOB_VERBOSE', - 'HTTP_PUT_VERBOSE', - 'JSON_TABLE', - 'MQREADALL', - 'MQREADALLCLOB', - 'MQRECEIVEALL', - 'MQRECEIVEALLCLOB', - 'XMLTABLE', - ], + 'BASE_TABLE', + 'HTTP_DELETE_BLOB_VERBOSE', + 'HTTP_DELETE_VERBOSE', + 'HTTP_GET_BLOB_VERBOSE', + 'HTTP_GET_VERBOSE', + 'HTTP_PATCH_BLOB_VERBOSE', + 'HTTP_PATCH_VERBOSE', + 'HTTP_POST_BLOB_VERBOSE', + 'HTTP_POST_VERBOSE', + 'HTTP_PUT_BLOB_VERBOSE', + 'HTTP_PUT_VERBOSE', + 'JSON_TABLE', + 'MQREADALL', + 'MQREADALLCLOB', + 'MQRECEIVEALL', + 'MQRECEIVEALLCLOB', + 'XMLTABLE', + // https://www.ibm.com/docs/en/db2-for-zos/11?topic=functions-row - row: ['UNPACK'], + 'UNPACK', + // https://www.ibm.com/docs/en/i/7.5?topic=expressions-olap-specifications - olap: [ - 'CUME_DIST', - 'DENSE_RANK', - 'FIRST_VALUE', - 'LAG', - 'LAST_VALUE', - 'LEAD', - 'NTH_VALUE', - 'NTILE', - 'PERCENT_RANK', - 'RANK', - 'RATIO_TO_REPORT', - 'ROW_NUMBER', - ], + 'CUME_DIST', + 'DENSE_RANK', + 'FIRST_VALUE', + 'LAG', + 'LAST_VALUE', + 'LEAD', + 'NTH_VALUE', + 'NTILE', + 'PERCENT_RANK', + 'RANK', + 'RATIO_TO_REPORT', + 'ROW_NUMBER', + // Type casting - cast: ['CAST'], -}); + 'CAST', +]; diff --git a/src/languages/db2i/db2i.keywords.ts b/src/languages/db2i/db2i.keywords.ts index 0d254ddd57..ace8fd82b8 100644 --- a/src/languages/db2i/db2i.keywords.ts +++ b/src/languages/db2i/db2i.keywords.ts @@ -1,514 +1,510 @@ -import { flatKeywordList } from '../../utils.js'; - -export const keywords = flatKeywordList({ +export const keywords: string[] = [ // https://www.ibm.com/docs/en/i/7.5?topic=words-reserved // TODO: This list likely contains all keywords, not only the reserved ones, // try to filter it down to just the reserved keywords. - standard: [ - 'ABSENT', - 'ACCORDING', - 'ACCTNG', - 'ACTION', - 'ACTIVATE', - 'ADD', - 'ALIAS', - 'ALL', - 'ALLOCATE', - 'ALLOW', - 'ALTER', - 'AND', - 'ANY', - 'APPEND', - 'APPLNAME', - 'ARRAY', - 'ARRAY_AGG', - 'ARRAY_TRIM', - 'AS', - 'ASC', - 'ASENSITIVE', - 'ASSOCIATE', - 'ATOMIC', - 'ATTACH', - 'ATTRIBUTES', - 'AUTHORIZATION', - 'AUTONOMOUS', - 'BEFORE', - 'BEGIN', - 'BETWEEN', - 'BINARY', - 'BIND', - 'BIT', - 'BOOLEAN', - 'BSON', - 'BUFFERPOOL', - 'BY', - 'CACHE', - 'CALL', - 'CALLED', - 'CARDINALITY', - 'CASE', - 'CAST', - 'CCSID', - 'CHAR', - 'CHARACTER', - 'CHECK', - 'CL', - 'CLOSE', - 'CLUSTER', - 'COLLECT', - 'COLLECTION', - 'COLUMN', - 'COMMENT', - 'COMMIT', - 'COMPACT', - 'COMPARISONS', - 'COMPRESS', - 'CONCAT', - 'CONCURRENT', - 'CONDITION', - 'CONNECT', - 'CONNECT_BY_ROOT', - 'CONNECTION', - 'CONSTANT', - 'CONSTRAINT', - 'CONTAINS', - 'CONTENT', - 'CONTINUE', - 'COPY', - 'COUNT', - 'COUNT_BIG', - 'CREATE', - 'CREATEIN', - 'CROSS', - 'CUBE', - 'CUME_DIST', - 'CURRENT', - 'CURRENT_DATE', - 'CURRENT_PATH', - 'CURRENT_SCHEMA', - 'CURRENT_SERVER', - 'CURRENT_TIME', - 'CURRENT_TIMESTAMP', - 'CURRENT_TIMEZONE', - 'CURRENT_USER', - 'CURSOR', - 'CYCLE', - 'DATA', - 'DATABASE', - 'DATAPARTITIONNAME', - 'DATAPARTITIONNUM', - 'DATE', - 'DAY', - 'DAYS', - 'DB2GENERAL', - 'DB2GENRL', - 'DB2SQL', - 'DBINFO', - 'DBPARTITIONNAME', - 'DBPARTITIONNUM', - 'DEACTIVATE', - 'DEALLOCATE', - 'DECLARE', - 'DEFAULT', - 'DEFAULTS', - 'DEFER', - 'DEFINE', - 'DEFINITION', - 'DELETE', - 'DELETING', - 'DENSE_RANK', - 'DENSERANK', - 'DESC', - 'DESCRIBE', - 'DESCRIPTOR', - 'DETACH', - 'DETERMINISTIC', - 'DIAGNOSTICS', - 'DISABLE', - 'DISALLOW', - 'DISCONNECT', - 'DISTINCT', - 'DO', - 'DOCUMENT', - 'DOUBLE', - 'DROP', - 'DYNAMIC', - 'EACH', - 'ELSE', - 'ELSEIF', - 'EMPTY', - 'ENABLE', - 'ENCODING', - 'ENCRYPTION', - 'END', - 'END-EXEC', - 'ENDING', - 'ENFORCED', - 'ERROR', - 'ESCAPE', - 'EVERY', - 'EXCEPT', - 'EXCEPTION', - 'EXCLUDING', - 'EXCLUSIVE', - 'EXECUTE', - 'EXISTS', - 'EXIT', - 'EXTEND', - 'EXTERNAL', - 'EXTRACT', - 'FALSE', - 'FENCED', - 'FETCH', - 'FIELDPROC', - 'FILE', - 'FINAL', - 'FIRST_VALUE', - 'FOR', - 'FOREIGN', - 'FORMAT', - 'FREE', - 'FREEPAGE', - 'FROM', - 'FULL', - 'FUNCTION', - 'GBPCACHE', - 'GENERAL', - 'GENERATED', - 'GET', - 'GLOBAL', - 'GO', - 'GOTO', - 'GRANT', - 'GRAPHIC', - 'GROUP', - 'HANDLER', - 'HASH', - 'HASH_ROW', - 'HASHED_VALUE', - 'HAVING', - 'HINT', - 'HOLD', - 'HOUR', - 'HOURS', - // 'ID', Not actually a reserved keyword - 'IDENTITY', - 'IF', - 'IGNORE', - 'IMMEDIATE', - 'IMPLICITLY', - 'IN', - 'INCLUDE', - 'INCLUDING', - 'INCLUSIVE', - 'INCREMENT', - 'INDEX', - 'INDEXBP', - 'INDICATOR', - 'INF', - 'INFINITY', - 'INHERIT', - 'INLINE', - 'INNER', - 'INOUT', - 'INSENSITIVE', - 'INSERT', - 'INSERTING', - 'INTEGRITY', - 'INTERPRET', - 'INTERSECT', - 'INTO', - 'IS', - 'ISNULL', - 'ISOLATION', - 'ITERATE', - 'JAVA', - 'JOIN', - 'JSON', - 'JSON_ARRAY', - 'JSON_ARRAYAGG', - 'JSON_EXISTS', - 'JSON_OBJECT', - 'JSON_OBJECTAGG', - 'JSON_QUERY', - 'JSON_TABLE', - 'JSON_VALUE', - 'KEEP', - 'KEY', - 'KEYS', - 'LABEL', - 'LAG', - 'LANGUAGE', - 'LAST_VALUE', - 'LATERAL', - 'LEAD', - 'LEAVE', - 'LEFT', - 'LEVEL2', - 'LIKE', - 'LIMIT', - 'LINKTYPE', - 'LISTAGG', - 'LOCAL', - 'LOCALDATE', - 'LOCALTIME', - 'LOCALTIMESTAMP', - 'LOCATION', - 'LOCATOR', - 'LOCK', - 'LOCKSIZE', - 'LOG', - 'LOGGED', - 'LONG', - 'LOOP', - 'MAINTAINED', - 'MASK', - 'MATCHED', - 'MATERIALIZED', - 'MAXVALUE', - 'MERGE', - 'MICROSECOND', - 'MICROSECONDS', - 'MINPCTUSED', - 'MINUTE', - 'MINUTES', - 'MINVALUE', - 'MIRROR', - 'MIXED', - 'MODE', - 'MODIFIES', - 'MONTH', - 'MONTHS', - 'NAMESPACE', - 'NAN', - 'NATIONAL', - 'NCHAR', - 'NCLOB', - 'NESTED', - 'NEW', - 'NEW_TABLE', - 'NEXTVAL', - 'NO', - 'NOCACHE', - 'NOCYCLE', - 'NODENAME', - 'NODENUMBER', - 'NOMAXVALUE', - 'NOMINVALUE', - 'NONE', - 'NOORDER', - 'NORMALIZED', - 'NOT', - 'NOTNULL', - 'NTH_VALUE', - 'NTILE', - 'NULL', - 'NULLS', - 'NVARCHAR', - 'OBID', - 'OBJECT', - 'OF', - 'OFF', - 'OFFSET', - 'OLD', - 'OLD_TABLE', - 'OMIT', - 'ON', - 'ONLY', - 'OPEN', - 'OPTIMIZE', - 'OPTION', - 'OR', - 'ORDER', - 'ORDINALITY', - 'ORGANIZE', - 'OUT', - 'OUTER', - 'OVER', - 'OVERLAY', - 'OVERRIDING', - 'PACKAGE', - 'PADDED', - 'PAGE', - 'PAGESIZE', - 'PARAMETER', - 'PART', - 'PARTITION', - 'PARTITIONED', - 'PARTITIONING', - 'PARTITIONS', - 'PASSING', - 'PASSWORD', - 'PATH', - 'PCTFREE', - 'PERCENT_RANK', - 'PERCENTILE_CONT', - 'PERCENTILE_DISC', - 'PERIOD', - 'PERMISSION', - 'PIECESIZE', - 'PIPE', - 'PLAN', - 'POSITION', - 'PREPARE', - 'PREVVAL', - 'PRIMARY', - 'PRIOR', - 'PRIQTY', - 'PRIVILEGES', - 'PROCEDURE', - 'PROGRAM', - 'PROGRAMID', - 'QUERY', - 'RANGE', - 'RANK', - 'RATIO_TO_REPORT', - 'RCDFMT', - 'READ', - 'READS', - 'RECOVERY', - 'REFERENCES', - 'REFERENCING', - 'REFRESH', - 'REGEXP_LIKE', - 'RELEASE', - 'RENAME', - 'REPEAT', - 'RESET', - 'RESIGNAL', - 'RESTART', - 'RESULT', - 'RESULT_SET_LOCATOR', - 'RETURN', - 'RETURNING', - 'RETURNS', - 'REVOKE', - 'RID', - 'RIGHT', - 'ROLLBACK', - 'ROLLUP', - 'ROUTINE', - 'ROW', - 'ROW_NUMBER', - 'ROWNUMBER', - 'ROWS', - 'RRN', - 'RUN', - 'SAVEPOINT', - 'SBCS', - 'SCALAR', - 'SCHEMA', - 'SCRATCHPAD', - 'SCROLL', - 'SEARCH', - 'SECOND', - 'SECONDS', - 'SECQTY', - 'SECURED', - 'SELECT', - 'SENSITIVE', - 'SEQUENCE', - 'SESSION', - 'SESSION_USER', - 'SET', - 'SIGNAL', - 'SIMPLE', - 'SKIP', - 'SNAN', - 'SOME', - 'SOURCE', - 'SPECIFIC', - 'SQL', - 'SQLID', - 'SQLIND_DEFAULT', - 'SQLIND_UNASSIGNED', - 'STACKED', - 'START', - 'STARTING', - 'STATEMENT', - 'STATIC', - 'STOGROUP', - 'SUBSTRING', - 'SUMMARY', - 'SYNONYM', - 'SYSTEM_TIME', - 'SYSTEM_USER', - 'TABLE', - 'TABLESPACE', - 'TABLESPACES', - 'TAG', - 'THEN', - 'THREADSAFE', - 'TIME', - 'TIMESTAMP', - 'TO', - 'TRANSACTION', - 'TRANSFER', - 'TRIGGER', - 'TRIM', - 'TRIM_ARRAY', - 'TRUE', - 'TRUNCATE', - 'TRY_CAST', - 'TYPE', - 'UNDO', - 'UNION', - 'UNIQUE', - 'UNIT', - 'UNKNOWN', - 'UNNEST', - 'UNTIL', - 'UPDATE', - 'UPDATING', - 'URI', - 'USAGE', - 'USE', - 'USER', - 'USERID', - 'USING', - 'VALUE', - 'VALUES', - 'VARIABLE', - 'VARIANT', - 'VCAT', - 'VERSION', - 'VERSIONING', - 'VIEW', - 'VOLATILE', - 'WAIT', - 'WHEN', - 'WHENEVER', - 'WHERE', - 'WHILE', - 'WITH', - 'WITHIN', - 'WITHOUT', - 'WRAPPED', - 'WRAPPER', - 'WRITE', - 'WRKSTNNAME', - 'XMLAGG', - 'XMLATTRIBUTES', - 'XMLCAST', - 'XMLCOMMENT', - 'XMLCONCAT', - 'XMLDOCUMENT', - 'XMLELEMENT', - 'XMLFOREST', - 'XMLGROUP', - 'XMLNAMESPACES', - 'XMLPARSE', - 'XMLPI', - 'XMLROW', - 'XMLSERIALIZE', - 'XMLTABLE', - 'XMLTEXT', - 'XMLVALIDATE', - 'XSLTRANSFORM', - 'XSROBJECT', - 'YEAR', - 'YEARS', - 'YES', - 'ZONE', - ], -}); + 'ABSENT', + 'ACCORDING', + 'ACCTNG', + 'ACTION', + 'ACTIVATE', + 'ADD', + 'ALIAS', + 'ALL', + 'ALLOCATE', + 'ALLOW', + 'ALTER', + 'AND', + 'ANY', + 'APPEND', + 'APPLNAME', + 'ARRAY', + 'ARRAY_AGG', + 'ARRAY_TRIM', + 'AS', + 'ASC', + 'ASENSITIVE', + 'ASSOCIATE', + 'ATOMIC', + 'ATTACH', + 'ATTRIBUTES', + 'AUTHORIZATION', + 'AUTONOMOUS', + 'BEFORE', + 'BEGIN', + 'BETWEEN', + 'BINARY', + 'BIND', + 'BIT', + 'BOOLEAN', + 'BSON', + 'BUFFERPOOL', + 'BY', + 'CACHE', + 'CALL', + 'CALLED', + 'CARDINALITY', + 'CASE', + 'CAST', + 'CCSID', + 'CHAR', + 'CHARACTER', + 'CHECK', + 'CL', + 'CLOSE', + 'CLUSTER', + 'COLLECT', + 'COLLECTION', + 'COLUMN', + 'COMMENT', + 'COMMIT', + 'COMPACT', + 'COMPARISONS', + 'COMPRESS', + 'CONCAT', + 'CONCURRENT', + 'CONDITION', + 'CONNECT', + 'CONNECT_BY_ROOT', + 'CONNECTION', + 'CONSTANT', + 'CONSTRAINT', + 'CONTAINS', + 'CONTENT', + 'CONTINUE', + 'COPY', + 'COUNT', + 'COUNT_BIG', + 'CREATE', + 'CREATEIN', + 'CROSS', + 'CUBE', + 'CUME_DIST', + 'CURRENT', + 'CURRENT_DATE', + 'CURRENT_PATH', + 'CURRENT_SCHEMA', + 'CURRENT_SERVER', + 'CURRENT_TIME', + 'CURRENT_TIMESTAMP', + 'CURRENT_TIMEZONE', + 'CURRENT_USER', + 'CURSOR', + 'CYCLE', + 'DATA', + 'DATABASE', + 'DATAPARTITIONNAME', + 'DATAPARTITIONNUM', + 'DATE', + 'DAY', + 'DAYS', + 'DB2GENERAL', + 'DB2GENRL', + 'DB2SQL', + 'DBINFO', + 'DBPARTITIONNAME', + 'DBPARTITIONNUM', + 'DEACTIVATE', + 'DEALLOCATE', + 'DECLARE', + 'DEFAULT', + 'DEFAULTS', + 'DEFER', + 'DEFINE', + 'DEFINITION', + 'DELETE', + 'DELETING', + 'DENSE_RANK', + 'DENSERANK', + 'DESC', + 'DESCRIBE', + 'DESCRIPTOR', + 'DETACH', + 'DETERMINISTIC', + 'DIAGNOSTICS', + 'DISABLE', + 'DISALLOW', + 'DISCONNECT', + 'DISTINCT', + 'DO', + 'DOCUMENT', + 'DOUBLE', + 'DROP', + 'DYNAMIC', + 'EACH', + 'ELSE', + 'ELSEIF', + 'EMPTY', + 'ENABLE', + 'ENCODING', + 'ENCRYPTION', + 'END', + 'END-EXEC', + 'ENDING', + 'ENFORCED', + 'ERROR', + 'ESCAPE', + 'EVERY', + 'EXCEPT', + 'EXCEPTION', + 'EXCLUDING', + 'EXCLUSIVE', + 'EXECUTE', + 'EXISTS', + 'EXIT', + 'EXTEND', + 'EXTERNAL', + 'EXTRACT', + 'FALSE', + 'FENCED', + 'FETCH', + 'FIELDPROC', + 'FILE', + 'FINAL', + 'FIRST_VALUE', + 'FOR', + 'FOREIGN', + 'FORMAT', + 'FREE', + 'FREEPAGE', + 'FROM', + 'FULL', + 'FUNCTION', + 'GBPCACHE', + 'GENERAL', + 'GENERATED', + 'GET', + 'GLOBAL', + 'GO', + 'GOTO', + 'GRANT', + 'GRAPHIC', + 'GROUP', + 'HANDLER', + 'HASH', + 'HASH_ROW', + 'HASHED_VALUE', + 'HAVING', + 'HINT', + 'HOLD', + 'HOUR', + 'HOURS', + // 'ID', Not actually a reserved keyword + 'IDENTITY', + 'IF', + 'IGNORE', + 'IMMEDIATE', + 'IMPLICITLY', + 'IN', + 'INCLUDE', + 'INCLUDING', + 'INCLUSIVE', + 'INCREMENT', + 'INDEX', + 'INDEXBP', + 'INDICATOR', + 'INF', + 'INFINITY', + 'INHERIT', + 'INLINE', + 'INNER', + 'INOUT', + 'INSENSITIVE', + 'INSERT', + 'INSERTING', + 'INTEGRITY', + 'INTERPRET', + 'INTERSECT', + 'INTO', + 'IS', + 'ISNULL', + 'ISOLATION', + 'ITERATE', + 'JAVA', + 'JOIN', + 'JSON', + 'JSON_ARRAY', + 'JSON_ARRAYAGG', + 'JSON_EXISTS', + 'JSON_OBJECT', + 'JSON_OBJECTAGG', + 'JSON_QUERY', + 'JSON_TABLE', + 'JSON_VALUE', + 'KEEP', + 'KEY', + 'KEYS', + 'LABEL', + 'LAG', + 'LANGUAGE', + 'LAST_VALUE', + 'LATERAL', + 'LEAD', + 'LEAVE', + 'LEFT', + 'LEVEL2', + 'LIKE', + 'LIMIT', + 'LINKTYPE', + 'LISTAGG', + 'LOCAL', + 'LOCALDATE', + 'LOCALTIME', + 'LOCALTIMESTAMP', + 'LOCATION', + 'LOCATOR', + 'LOCK', + 'LOCKSIZE', + 'LOG', + 'LOGGED', + 'LONG', + 'LOOP', + 'MAINTAINED', + 'MASK', + 'MATCHED', + 'MATERIALIZED', + 'MAXVALUE', + 'MERGE', + 'MICROSECOND', + 'MICROSECONDS', + 'MINPCTUSED', + 'MINUTE', + 'MINUTES', + 'MINVALUE', + 'MIRROR', + 'MIXED', + 'MODE', + 'MODIFIES', + 'MONTH', + 'MONTHS', + 'NAMESPACE', + 'NAN', + 'NATIONAL', + 'NCHAR', + 'NCLOB', + 'NESTED', + 'NEW', + 'NEW_TABLE', + 'NEXTVAL', + 'NO', + 'NOCACHE', + 'NOCYCLE', + 'NODENAME', + 'NODENUMBER', + 'NOMAXVALUE', + 'NOMINVALUE', + 'NONE', + 'NOORDER', + 'NORMALIZED', + 'NOT', + 'NOTNULL', + 'NTH_VALUE', + 'NTILE', + 'NULL', + 'NULLS', + 'NVARCHAR', + 'OBID', + 'OBJECT', + 'OF', + 'OFF', + 'OFFSET', + 'OLD', + 'OLD_TABLE', + 'OMIT', + 'ON', + 'ONLY', + 'OPEN', + 'OPTIMIZE', + 'OPTION', + 'OR', + 'ORDER', + 'ORDINALITY', + 'ORGANIZE', + 'OUT', + 'OUTER', + 'OVER', + 'OVERLAY', + 'OVERRIDING', + 'PACKAGE', + 'PADDED', + 'PAGE', + 'PAGESIZE', + 'PARAMETER', + 'PART', + 'PARTITION', + 'PARTITIONED', + 'PARTITIONING', + 'PARTITIONS', + 'PASSING', + 'PASSWORD', + 'PATH', + 'PCTFREE', + 'PERCENT_RANK', + 'PERCENTILE_CONT', + 'PERCENTILE_DISC', + 'PERIOD', + 'PERMISSION', + 'PIECESIZE', + 'PIPE', + 'PLAN', + 'POSITION', + 'PREPARE', + 'PREVVAL', + 'PRIMARY', + 'PRIOR', + 'PRIQTY', + 'PRIVILEGES', + 'PROCEDURE', + 'PROGRAM', + 'PROGRAMID', + 'QUERY', + 'RANGE', + 'RANK', + 'RATIO_TO_REPORT', + 'RCDFMT', + 'READ', + 'READS', + 'RECOVERY', + 'REFERENCES', + 'REFERENCING', + 'REFRESH', + 'REGEXP_LIKE', + 'RELEASE', + 'RENAME', + 'REPEAT', + 'RESET', + 'RESIGNAL', + 'RESTART', + 'RESULT', + 'RESULT_SET_LOCATOR', + 'RETURN', + 'RETURNING', + 'RETURNS', + 'REVOKE', + 'RID', + 'RIGHT', + 'ROLLBACK', + 'ROLLUP', + 'ROUTINE', + 'ROW', + 'ROW_NUMBER', + 'ROWNUMBER', + 'ROWS', + 'RRN', + 'RUN', + 'SAVEPOINT', + 'SBCS', + 'SCALAR', + 'SCHEMA', + 'SCRATCHPAD', + 'SCROLL', + 'SEARCH', + 'SECOND', + 'SECONDS', + 'SECQTY', + 'SECURED', + 'SELECT', + 'SENSITIVE', + 'SEQUENCE', + 'SESSION', + 'SESSION_USER', + 'SET', + 'SIGNAL', + 'SIMPLE', + 'SKIP', + 'SNAN', + 'SOME', + 'SOURCE', + 'SPECIFIC', + 'SQL', + 'SQLID', + 'SQLIND_DEFAULT', + 'SQLIND_UNASSIGNED', + 'STACKED', + 'START', + 'STARTING', + 'STATEMENT', + 'STATIC', + 'STOGROUP', + 'SUBSTRING', + 'SUMMARY', + 'SYNONYM', + 'SYSTEM_TIME', + 'SYSTEM_USER', + 'TABLE', + 'TABLESPACE', + 'TABLESPACES', + 'TAG', + 'THEN', + 'THREADSAFE', + 'TIME', + 'TIMESTAMP', + 'TO', + 'TRANSACTION', + 'TRANSFER', + 'TRIGGER', + 'TRIM', + 'TRIM_ARRAY', + 'TRUE', + 'TRUNCATE', + 'TRY_CAST', + 'TYPE', + 'UNDO', + 'UNION', + 'UNIQUE', + 'UNIT', + 'UNKNOWN', + 'UNNEST', + 'UNTIL', + 'UPDATE', + 'UPDATING', + 'URI', + 'USAGE', + 'USE', + 'USER', + 'USERID', + 'USING', + 'VALUE', + 'VALUES', + 'VARIABLE', + 'VARIANT', + 'VCAT', + 'VERSION', + 'VERSIONING', + 'VIEW', + 'VOLATILE', + 'WAIT', + 'WHEN', + 'WHENEVER', + 'WHERE', + 'WHILE', + 'WITH', + 'WITHIN', + 'WITHOUT', + 'WRAPPED', + 'WRAPPER', + 'WRITE', + 'WRKSTNNAME', + 'XMLAGG', + 'XMLATTRIBUTES', + 'XMLCAST', + 'XMLCOMMENT', + 'XMLCONCAT', + 'XMLDOCUMENT', + 'XMLELEMENT', + 'XMLFOREST', + 'XMLGROUP', + 'XMLNAMESPACES', + 'XMLPARSE', + 'XMLPI', + 'XMLROW', + 'XMLSERIALIZE', + 'XMLTABLE', + 'XMLTEXT', + 'XMLVALIDATE', + 'XSLTRANSFORM', + 'XSROBJECT', + 'YEAR', + 'YEARS', + 'YES', + 'ZONE', +]; diff --git a/src/languages/hive/hive.functions.ts b/src/languages/hive/hive.functions.ts index c67f0a7d46..588e60cd1c 100644 --- a/src/languages/hive/hive.functions.ts +++ b/src/languages/hive/hive.functions.ts @@ -1,204 +1,228 @@ -import { flatKeywordList } from '../../utils.js'; - -export const functions = flatKeywordList({ +export const functions: string[] = [ // https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF - math: [ - 'ABS', - 'ACOS', - 'ASIN', - 'ATAN', - 'BIN', - 'BROUND', - 'CBRT', - 'CEIL', - 'CEILING', - 'CONV', - 'COS', - 'DEGREES', - // 'E', - 'EXP', - 'FACTORIAL', - 'FLOOR', - 'GREATEST', - 'HEX', - 'LEAST', - 'LN', - 'LOG', - 'LOG10', - 'LOG2', - 'NEGATIVE', - 'PI', - 'PMOD', - 'POSITIVE', - 'POW', - 'POWER', - 'RADIANS', - 'RAND', - 'ROUND', - 'SHIFTLEFT', - 'SHIFTRIGHT', - 'SHIFTRIGHTUNSIGNED', - 'SIGN', - 'SIN', - 'SQRT', - 'TAN', - 'UNHEX', - 'WIDTH_BUCKET', - ], - array: ['ARRAY_CONTAINS', 'MAP_KEYS', 'MAP_VALUES', 'SIZE', 'SORT_ARRAY'], - conversion: ['BINARY', 'CAST'], - date: [ - 'ADD_MONTHS', - 'DATE', - 'DATE_ADD', - 'DATE_FORMAT', - 'DATE_SUB', - 'DATEDIFF', - 'DAY', - 'DAYNAME', - 'DAYOFMONTH', - 'DAYOFYEAR', - 'EXTRACT', - 'FROM_UNIXTIME', - 'FROM_UTC_TIMESTAMP', - 'HOUR', - 'LAST_DAY', - 'MINUTE', - 'MONTH', - 'MONTHS_BETWEEN', - 'NEXT_DAY', - 'QUARTER', - 'SECOND', - 'TIMESTAMP', - 'TO_DATE', - 'TO_UTC_TIMESTAMP', - 'TRUNC', - 'UNIX_TIMESTAMP', - 'WEEKOFYEAR', - 'YEAR', - ], - conditional: ['ASSERT_TRUE', 'COALESCE', 'IF', 'ISNOTNULL', 'ISNULL', 'NULLIF', 'NVL'], - string: [ - 'ASCII', - 'BASE64', - 'CHARACTER_LENGTH', - 'CHR', - 'CONCAT', - 'CONCAT_WS', - 'CONTEXT_NGRAMS', - 'DECODE', - 'ELT', - 'ENCODE', - 'FIELD', - 'FIND_IN_SET', - 'FORMAT_NUMBER', - 'GET_JSON_OBJECT', - 'IN_FILE', - 'INITCAP', - 'INSTR', - 'LCASE', - 'LENGTH', - 'LEVENSHTEIN', - 'LOCATE', - 'LOWER', - 'LPAD', - 'LTRIM', - 'NGRAMS', - 'OCTET_LENGTH', - 'PARSE_URL', - 'PRINTF', - 'QUOTE', - 'REGEXP_EXTRACT', - 'REGEXP_REPLACE', - 'REPEAT', - 'REVERSE', - 'RPAD', - 'RTRIM', - 'SENTENCES', - 'SOUNDEX', - 'SPACE', - 'SPLIT', - 'STR_TO_MAP', - 'SUBSTR', - 'SUBSTRING', - 'TRANSLATE', - 'TRIM', - 'UCASE', - 'UNBASE64', - 'UPPER', - ], - masking: [ - 'MASK', - 'MASK_FIRST_N', - 'MASK_HASH', - 'MASK_LAST_N', - 'MASK_SHOW_FIRST_N', - 'MASK_SHOW_LAST_N', - ], - misc: [ - 'AES_DECRYPT', - 'AES_ENCRYPT', - 'CRC32', - 'CURRENT_DATABASE', - 'CURRENT_USER', - 'HASH', - 'JAVA_METHOD', - 'LOGGED_IN_USER', - 'MD5', - 'REFLECT', - 'SHA', - 'SHA1', - 'SHA2', - 'SURROGATE_KEY', - 'VERSION', - ], - aggregate: [ - 'AVG', - 'COLLECT_LIST', - 'COLLECT_SET', - 'CORR', - 'COUNT', - 'COVAR_POP', - 'COVAR_SAMP', - 'HISTOGRAM_NUMERIC', - 'MAX', - 'MIN', - 'NTILE', - 'PERCENTILE', - 'PERCENTILE_APPROX', - 'REGR_AVGX', - 'REGR_AVGY', - 'REGR_COUNT', - 'REGR_INTERCEPT', - 'REGR_R2', - 'REGR_SLOPE', - 'REGR_SXX', - 'REGR_SXY', - 'REGR_SYY', - 'STDDEV_POP', - 'STDDEV_SAMP', - 'SUM', - 'VAR_POP', - 'VAR_SAMP', - 'VARIANCE', - ], - table: ['EXPLODE', 'INLINE', 'JSON_TUPLE', 'PARSE_URL_TUPLE', 'POSEXPLODE', 'STACK'], + // math + 'ABS', + 'ACOS', + 'ASIN', + 'ATAN', + 'BIN', + 'BROUND', + 'CBRT', + 'CEIL', + 'CEILING', + 'CONV', + 'COS', + 'DEGREES', + // 'E', + 'EXP', + 'FACTORIAL', + 'FLOOR', + 'GREATEST', + 'HEX', + 'LEAST', + 'LN', + 'LOG', + 'LOG10', + 'LOG2', + 'NEGATIVE', + 'PI', + 'PMOD', + 'POSITIVE', + 'POW', + 'POWER', + 'RADIANS', + 'RAND', + 'ROUND', + 'SHIFTLEFT', + 'SHIFTRIGHT', + 'SHIFTRIGHTUNSIGNED', + 'SIGN', + 'SIN', + 'SQRT', + 'TAN', + 'UNHEX', + 'WIDTH_BUCKET', + + // array + 'ARRAY_CONTAINS', + 'MAP_KEYS', + 'MAP_VALUES', + 'SIZE', + 'SORT_ARRAY', + + // conversion + 'BINARY', + 'CAST', + + // date + 'ADD_MONTHS', + 'DATE', + 'DATE_ADD', + 'DATE_FORMAT', + 'DATE_SUB', + 'DATEDIFF', + 'DAY', + 'DAYNAME', + 'DAYOFMONTH', + 'DAYOFYEAR', + 'EXTRACT', + 'FROM_UNIXTIME', + 'FROM_UTC_TIMESTAMP', + 'HOUR', + 'LAST_DAY', + 'MINUTE', + 'MONTH', + 'MONTHS_BETWEEN', + 'NEXT_DAY', + 'QUARTER', + 'SECOND', + 'TIMESTAMP', + 'TO_DATE', + 'TO_UTC_TIMESTAMP', + 'TRUNC', + 'UNIX_TIMESTAMP', + 'WEEKOFYEAR', + 'YEAR', + + // conditional + 'ASSERT_TRUE', + 'COALESCE', + 'IF', + 'ISNOTNULL', + 'ISNULL', + 'NULLIF', + 'NVL', + + // string + 'ASCII', + 'BASE64', + 'CHARACTER_LENGTH', + 'CHR', + 'CONCAT', + 'CONCAT_WS', + 'CONTEXT_NGRAMS', + 'DECODE', + 'ELT', + 'ENCODE', + 'FIELD', + 'FIND_IN_SET', + 'FORMAT_NUMBER', + 'GET_JSON_OBJECT', + 'IN_FILE', + 'INITCAP', + 'INSTR', + 'LCASE', + 'LENGTH', + 'LEVENSHTEIN', + 'LOCATE', + 'LOWER', + 'LPAD', + 'LTRIM', + 'NGRAMS', + 'OCTET_LENGTH', + 'PARSE_URL', + 'PRINTF', + 'QUOTE', + 'REGEXP_EXTRACT', + 'REGEXP_REPLACE', + 'REPEAT', + 'REVERSE', + 'RPAD', + 'RTRIM', + 'SENTENCES', + 'SOUNDEX', + 'SPACE', + 'SPLIT', + 'STR_TO_MAP', + 'SUBSTR', + 'SUBSTRING', + 'TRANSLATE', + 'TRIM', + 'UCASE', + 'UNBASE64', + 'UPPER', + + // masking + 'MASK', + 'MASK_FIRST_N', + 'MASK_HASH', + 'MASK_LAST_N', + 'MASK_SHOW_FIRST_N', + 'MASK_SHOW_LAST_N', + + // misc + 'AES_DECRYPT', + 'AES_ENCRYPT', + 'CRC32', + 'CURRENT_DATABASE', + 'CURRENT_USER', + 'HASH', + 'JAVA_METHOD', + 'LOGGED_IN_USER', + 'MD5', + 'REFLECT', + 'SHA', + 'SHA1', + 'SHA2', + 'SURROGATE_KEY', + 'VERSION', + + // aggregate + 'AVG', + 'COLLECT_LIST', + 'COLLECT_SET', + 'CORR', + 'COUNT', + 'COVAR_POP', + 'COVAR_SAMP', + 'HISTOGRAM_NUMERIC', + 'MAX', + 'MIN', + 'NTILE', + 'PERCENTILE', + 'PERCENTILE_APPROX', + 'REGR_AVGX', + 'REGR_AVGY', + 'REGR_COUNT', + 'REGR_INTERCEPT', + 'REGR_R2', + 'REGR_SLOPE', + 'REGR_SXX', + 'REGR_SXY', + 'REGR_SYY', + 'STDDEV_POP', + 'STDDEV_SAMP', + 'SUM', + 'VAR_POP', + 'VAR_SAMP', + 'VARIANCE', + + // table + 'EXPLODE', + 'INLINE', + 'JSON_TUPLE', + 'PARSE_URL_TUPLE', + 'POSEXPLODE', + 'STACK', + // https://cwiki.apache.org/confluence/display/Hive/LanguageManual+WindowingAndAnalytics - window: [ - 'LEAD', - 'LAG', - 'FIRST_VALUE', - 'LAST_VALUE', - 'RANK', - 'ROW_NUMBER', - 'DENSE_RANK', - 'CUME_DIST', - 'PERCENT_RANK', - 'NTILE', - ], + 'LEAD', + 'LAG', + 'FIRST_VALUE', + 'LAST_VALUE', + 'RANK', + 'ROW_NUMBER', + 'DENSE_RANK', + 'CUME_DIST', + 'PERCENT_RANK', + 'NTILE', + // Parameterized data types // https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=82706456 // Though in reality Hive only supports parameters for DECIMAL(), // it doesn't hurt to allow others in here as well. - dataTypes: ['DECIMAL', 'NUMERIC', 'VARCHAR', 'CHAR'], -}); + 'DECIMAL', + 'NUMERIC', + 'VARCHAR', + 'CHAR', +]; diff --git a/src/languages/hive/hive.keywords.ts b/src/languages/hive/hive.keywords.ts index 4bc8e3170c..a747ee7641 100644 --- a/src/languages/hive/hive.keywords.ts +++ b/src/languages/hive/hive.keywords.ts @@ -1,341 +1,337 @@ -import { flatKeywordList } from '../../utils.js'; - -export const keywords = flatKeywordList({ +export const keywords: string[] = [ // https://cwiki.apache.org/confluence/display/hive/languagemanual+ddl // Non-reserved keywords have proscribed meanings in. HiveQL, but can still be used as table or column names - nonReserved: [ - 'ADD', - 'ADMIN', - 'AFTER', - 'ANALYZE', - 'ARCHIVE', - 'ASC', - 'BEFORE', - 'BUCKET', - 'BUCKETS', - 'CASCADE', - 'CHANGE', - 'CLUSTER', - 'CLUSTERED', - 'CLUSTERSTATUS', - 'COLLECTION', - 'COLUMNS', - 'COMMENT', - 'COMPACT', - 'COMPACTIONS', - 'COMPUTE', - 'CONCATENATE', - 'CONTINUE', - 'DATA', - 'DATABASES', - 'DATETIME', - 'DAY', - 'DBPROPERTIES', - 'DEFERRED', - 'DEFINED', - 'DELIMITED', - 'DEPENDENCY', - 'DESC', - 'DIRECTORIES', - 'DIRECTORY', - 'DISABLE', - 'DISTRIBUTE', - 'ELEM_TYPE', - 'ENABLE', - 'ESCAPED', - 'EXCLUSIVE', - 'EXPLAIN', - 'EXPORT', - 'FIELDS', - 'FILE', - 'FILEFORMAT', - 'FIRST', - 'FORMAT', - 'FORMATTED', - 'FUNCTIONS', - 'HOLD_DDLTIME', - 'HOUR', - 'IDXPROPERTIES', - 'IGNORE', - 'INDEX', - 'INDEXES', - 'INPATH', - 'INPUTDRIVER', - 'INPUTFORMAT', - 'ITEMS', - 'JAR', - 'KEYS', - 'KEY_TYPE', - 'LIMIT', - 'LINES', - 'LOAD', - 'LOCATION', - 'LOCK', - 'LOCKS', - 'LOGICAL', - 'LONG', - 'MAPJOIN', - 'MATERIALIZED', - 'METADATA', - 'MINUS', - 'MINUTE', - 'MONTH', - 'MSCK', - 'NOSCAN', - 'NO_DROP', - 'OFFLINE', - 'OPTION', - 'OUTPUTDRIVER', - 'OUTPUTFORMAT', - 'OVERWRITE', - 'OWNER', - 'PARTITIONED', - 'PARTITIONS', - 'PLUS', - 'PRETTY', - 'PRINCIPALS', - 'PROTECTION', - 'PURGE', - 'READ', - 'READONLY', - 'REBUILD', - 'RECORDREADER', - 'RECORDWRITER', - 'RELOAD', - 'RENAME', - 'REPAIR', - 'REPLACE', - 'REPLICATION', - 'RESTRICT', - 'REWRITE', - 'ROLE', - 'ROLES', - 'SCHEMA', - 'SCHEMAS', - 'SECOND', - 'SEMI', - 'SERDE', - 'SERDEPROPERTIES', - 'SERVER', - 'SETS', - 'SHARED', - 'SHOW', - 'SHOW_DATABASE', - 'SKEWED', - 'SORT', - 'SORTED', - 'SSL', - 'STATISTICS', - 'STORED', - 'STREAMTABLE', - 'STRING', - 'STRUCT', - 'TABLES', - 'TBLPROPERTIES', - 'TEMPORARY', - 'TERMINATED', - 'TINYINT', - 'TOUCH', - 'TRANSACTIONS', - 'UNARCHIVE', - 'UNDO', - 'UNIONTYPE', - 'UNLOCK', - 'UNSET', - 'UNSIGNED', - 'URI', - 'USE', - 'UTC', - 'UTCTIMESTAMP', - 'VALUE_TYPE', - 'VIEW', - 'WHILE', - 'YEAR', - 'AUTOCOMMIT', - 'ISOLATION', - 'LEVEL', - 'OFFSET', - 'SNAPSHOT', - 'TRANSACTION', - 'WORK', - 'WRITE', - 'ABORT', - 'KEY', - 'LAST', - 'NORELY', - 'NOVALIDATE', - 'NULLS', - 'RELY', - 'VALIDATE', - 'DETAIL', - 'DOW', - 'EXPRESSION', - 'OPERATOR', - 'QUARTER', - 'SUMMARY', - 'VECTORIZATION', - 'WEEK', - 'YEARS', - 'MONTHS', - 'WEEKS', - 'DAYS', - 'HOURS', - 'MINUTES', - 'SECONDS', - 'TIMESTAMPTZ', - 'ZONE', - ], - reserved: [ - 'ALL', - 'ALTER', - 'AND', - 'ARRAY', - 'AS', - 'AUTHORIZATION', - 'BETWEEN', - 'BIGINT', - 'BINARY', - 'BOOLEAN', - 'BOTH', - 'BY', - 'CASE', - 'CAST', - 'CHAR', - 'COLUMN', - 'CONF', - 'CREATE', - 'CROSS', - 'CUBE', - 'CURRENT', - 'CURRENT_DATE', - 'CURRENT_TIMESTAMP', - 'CURSOR', - 'DATABASE', - 'DATE', - 'DECIMAL', - 'DELETE', - 'DESCRIBE', - 'DISTINCT', - 'DOUBLE', - 'DROP', - 'ELSE', - 'END', - 'EXCHANGE', - 'EXISTS', - 'EXTENDED', - 'EXTERNAL', - 'FALSE', - 'FETCH', - 'FLOAT', - 'FOLLOWING', - 'FOR', - 'FROM', - 'FULL', - 'FUNCTION', - 'GRANT', - 'GROUP', - 'GROUPING', - 'HAVING', - 'IF', - 'IMPORT', - 'IN', - 'INNER', - 'INSERT', - 'INT', - 'INTERSECT', - 'INTERVAL', - 'INTO', - 'IS', - 'JOIN', - 'LATERAL', - 'LEFT', - 'LESS', - 'LIKE', - 'LOCAL', - 'MACRO', - 'MAP', - 'MORE', - 'NONE', - 'NOT', - 'NULL', - 'OF', - 'ON', - 'OR', - 'ORDER', - 'OUT', - 'OUTER', - 'OVER', - 'PARTIALSCAN', - 'PARTITION', - 'PERCENT', - 'PRECEDING', - 'PRESERVE', - 'PROCEDURE', - 'RANGE', - 'READS', - 'REDUCE', - 'REVOKE', - 'RIGHT', - 'ROLLUP', - 'ROW', - 'ROWS', - 'SELECT', - 'SET', - 'SMALLINT', - 'TABLE', - 'TABLESAMPLE', - 'THEN', - 'TIMESTAMP', - 'TO', - 'TRANSFORM', - 'TRIGGER', - 'TRUE', - 'TRUNCATE', - 'UNBOUNDED', - 'UNION', - 'UNIQUEJOIN', - 'UPDATE', - 'USER', - 'USING', - 'UTC_TMESTAMP', - 'VALUES', - 'VARCHAR', - 'WHEN', - 'WHERE', - 'WINDOW', - 'WITH', - 'COMMIT', - 'ONLY', - 'REGEXP', - 'RLIKE', - 'ROLLBACK', - 'START', - 'CACHE', - 'CONSTRAINT', - 'FOREIGN', - 'PRIMARY', - 'REFERENCES', - 'DAYOFWEEK', - 'EXTRACT', - 'FLOOR', - 'INTEGER', - 'PRECISION', - 'VIEWS', - 'TIME', - 'NUMERIC', - 'SYNC', - ], - fileTypes: [ - 'TEXTFILE', - 'SEQUENCEFILE', - 'ORC', - 'CSV', - 'TSV', - 'PARQUET', - 'AVRO', - 'RCFILE', - 'JSONFILE', - 'INPUTFORMAT', - 'OUTPUTFORMAT', - ], -}); + 'ADD', + 'ADMIN', + 'AFTER', + 'ANALYZE', + 'ARCHIVE', + 'ASC', + 'BEFORE', + 'BUCKET', + 'BUCKETS', + 'CASCADE', + 'CHANGE', + 'CLUSTER', + 'CLUSTERED', + 'CLUSTERSTATUS', + 'COLLECTION', + 'COLUMNS', + 'COMMENT', + 'COMPACT', + 'COMPACTIONS', + 'COMPUTE', + 'CONCATENATE', + 'CONTINUE', + 'DATA', + 'DATABASES', + 'DATETIME', + 'DAY', + 'DBPROPERTIES', + 'DEFERRED', + 'DEFINED', + 'DELIMITED', + 'DEPENDENCY', + 'DESC', + 'DIRECTORIES', + 'DIRECTORY', + 'DISABLE', + 'DISTRIBUTE', + 'ELEM_TYPE', + 'ENABLE', + 'ESCAPED', + 'EXCLUSIVE', + 'EXPLAIN', + 'EXPORT', + 'FIELDS', + 'FILE', + 'FILEFORMAT', + 'FIRST', + 'FORMAT', + 'FORMATTED', + 'FUNCTIONS', + 'HOLD_DDLTIME', + 'HOUR', + 'IDXPROPERTIES', + 'IGNORE', + 'INDEX', + 'INDEXES', + 'INPATH', + 'INPUTDRIVER', + 'INPUTFORMAT', + 'ITEMS', + 'JAR', + 'KEYS', + 'KEY_TYPE', + 'LIMIT', + 'LINES', + 'LOAD', + 'LOCATION', + 'LOCK', + 'LOCKS', + 'LOGICAL', + 'LONG', + 'MAPJOIN', + 'MATERIALIZED', + 'METADATA', + 'MINUS', + 'MINUTE', + 'MONTH', + 'MSCK', + 'NOSCAN', + 'NO_DROP', + 'OFFLINE', + 'OPTION', + 'OUTPUTDRIVER', + 'OUTPUTFORMAT', + 'OVERWRITE', + 'OWNER', + 'PARTITIONED', + 'PARTITIONS', + 'PLUS', + 'PRETTY', + 'PRINCIPALS', + 'PROTECTION', + 'PURGE', + 'READ', + 'READONLY', + 'REBUILD', + 'RECORDREADER', + 'RECORDWRITER', + 'RELOAD', + 'RENAME', + 'REPAIR', + 'REPLACE', + 'REPLICATION', + 'RESTRICT', + 'REWRITE', + 'ROLE', + 'ROLES', + 'SCHEMA', + 'SCHEMAS', + 'SECOND', + 'SEMI', + 'SERDE', + 'SERDEPROPERTIES', + 'SERVER', + 'SETS', + 'SHARED', + 'SHOW', + 'SHOW_DATABASE', + 'SKEWED', + 'SORT', + 'SORTED', + 'SSL', + 'STATISTICS', + 'STORED', + 'STREAMTABLE', + 'STRING', + 'STRUCT', + 'TABLES', + 'TBLPROPERTIES', + 'TEMPORARY', + 'TERMINATED', + 'TINYINT', + 'TOUCH', + 'TRANSACTIONS', + 'UNARCHIVE', + 'UNDO', + 'UNIONTYPE', + 'UNLOCK', + 'UNSET', + 'UNSIGNED', + 'URI', + 'USE', + 'UTC', + 'UTCTIMESTAMP', + 'VALUE_TYPE', + 'VIEW', + 'WHILE', + 'YEAR', + 'AUTOCOMMIT', + 'ISOLATION', + 'LEVEL', + 'OFFSET', + 'SNAPSHOT', + 'TRANSACTION', + 'WORK', + 'WRITE', + 'ABORT', + 'KEY', + 'LAST', + 'NORELY', + 'NOVALIDATE', + 'NULLS', + 'RELY', + 'VALIDATE', + 'DETAIL', + 'DOW', + 'EXPRESSION', + 'OPERATOR', + 'QUARTER', + 'SUMMARY', + 'VECTORIZATION', + 'WEEK', + 'YEARS', + 'MONTHS', + 'WEEKS', + 'DAYS', + 'HOURS', + 'MINUTES', + 'SECONDS', + 'TIMESTAMPTZ', + 'ZONE', + + // reserved + 'ALL', + 'ALTER', + 'AND', + 'ARRAY', + 'AS', + 'AUTHORIZATION', + 'BETWEEN', + 'BIGINT', + 'BINARY', + 'BOOLEAN', + 'BOTH', + 'BY', + 'CASE', + 'CAST', + 'CHAR', + 'COLUMN', + 'CONF', + 'CREATE', + 'CROSS', + 'CUBE', + 'CURRENT', + 'CURRENT_DATE', + 'CURRENT_TIMESTAMP', + 'CURSOR', + 'DATABASE', + 'DATE', + 'DECIMAL', + 'DELETE', + 'DESCRIBE', + 'DISTINCT', + 'DOUBLE', + 'DROP', + 'ELSE', + 'END', + 'EXCHANGE', + 'EXISTS', + 'EXTENDED', + 'EXTERNAL', + 'FALSE', + 'FETCH', + 'FLOAT', + 'FOLLOWING', + 'FOR', + 'FROM', + 'FULL', + 'FUNCTION', + 'GRANT', + 'GROUP', + 'GROUPING', + 'HAVING', + 'IF', + 'IMPORT', + 'IN', + 'INNER', + 'INSERT', + 'INT', + 'INTERSECT', + 'INTERVAL', + 'INTO', + 'IS', + 'JOIN', + 'LATERAL', + 'LEFT', + 'LESS', + 'LIKE', + 'LOCAL', + 'MACRO', + 'MAP', + 'MORE', + 'NONE', + 'NOT', + 'NULL', + 'OF', + 'ON', + 'OR', + 'ORDER', + 'OUT', + 'OUTER', + 'OVER', + 'PARTIALSCAN', + 'PARTITION', + 'PERCENT', + 'PRECEDING', + 'PRESERVE', + 'PROCEDURE', + 'RANGE', + 'READS', + 'REDUCE', + 'REVOKE', + 'RIGHT', + 'ROLLUP', + 'ROW', + 'ROWS', + 'SELECT', + 'SET', + 'SMALLINT', + 'TABLE', + 'TABLESAMPLE', + 'THEN', + 'TIMESTAMP', + 'TO', + 'TRANSFORM', + 'TRIGGER', + 'TRUE', + 'TRUNCATE', + 'UNBOUNDED', + 'UNION', + 'UNIQUEJOIN', + 'UPDATE', + 'USER', + 'USING', + 'UTC_TMESTAMP', + 'VALUES', + 'VARCHAR', + 'WHEN', + 'WHERE', + 'WINDOW', + 'WITH', + 'COMMIT', + 'ONLY', + 'REGEXP', + 'RLIKE', + 'ROLLBACK', + 'START', + 'CACHE', + 'CONSTRAINT', + 'FOREIGN', + 'PRIMARY', + 'REFERENCES', + 'DAYOFWEEK', + 'EXTRACT', + 'FLOOR', + 'INTEGER', + 'PRECISION', + 'VIEWS', + 'TIME', + 'NUMERIC', + 'SYNC', + + // fileTypes + 'TEXTFILE', + 'SEQUENCEFILE', + 'ORC', + 'CSV', + 'TSV', + 'PARQUET', + 'AVRO', + 'RCFILE', + 'JSONFILE', + 'INPUTFORMAT', + 'OUTPUTFORMAT', +]; diff --git a/src/languages/mariadb/mariadb.functions.ts b/src/languages/mariadb/mariadb.functions.ts index 3a1f7fd803..e4c6092a34 100644 --- a/src/languages/mariadb/mariadb.functions.ts +++ b/src/languages/mariadb/mariadb.functions.ts @@ -1,275 +1,271 @@ -import { flatKeywordList } from '../../utils.js'; - -export const functions = flatKeywordList({ +export const functions: string[] = [ // https://mariadb.com/kb/en/information-schema-sql_functions-table/ - all: [ - 'ADDDATE', - 'ADD_MONTHS', - 'BIT_AND', - 'BIT_OR', - 'BIT_XOR', - 'CAST', - 'COUNT', - 'CUME_DIST', - 'CURDATE', - 'CURTIME', - 'DATE_ADD', - 'DATE_SUB', - 'DATE_FORMAT', - 'DECODE', - 'DENSE_RANK', - 'EXTRACT', - 'FIRST_VALUE', - 'GROUP_CONCAT', - 'JSON_ARRAYAGG', - 'JSON_OBJECTAGG', - 'LAG', - 'LEAD', - 'MAX', - 'MEDIAN', - 'MID', - 'MIN', - 'NOW', - 'NTH_VALUE', - 'NTILE', - 'POSITION', - 'PERCENT_RANK', - 'PERCENTILE_CONT', - 'PERCENTILE_DISC', - 'RANK', - 'ROW_NUMBER', - 'SESSION_USER', - 'STD', - 'STDDEV', - 'STDDEV_POP', - 'STDDEV_SAMP', - 'SUBDATE', - 'SUBSTR', - 'SUBSTRING', - 'SUM', - 'SYSTEM_USER', - 'TRIM', - 'TRIM_ORACLE', - 'VARIANCE', - 'VAR_POP', - 'VAR_SAMP', - 'ABS', - 'ACOS', - 'ADDTIME', - 'AES_DECRYPT', - 'AES_ENCRYPT', - 'ASIN', - 'ATAN', - 'ATAN2', - 'BENCHMARK', - 'BIN', - 'BINLOG_GTID_POS', - 'BIT_COUNT', - 'BIT_LENGTH', - 'CEIL', - 'CEILING', - 'CHARACTER_LENGTH', - 'CHAR_LENGTH', - 'CHR', - 'COERCIBILITY', - 'COLUMN_CHECK', - 'COLUMN_EXISTS', - 'COLUMN_LIST', - 'COLUMN_JSON', - 'COMPRESS', - 'CONCAT', - 'CONCAT_OPERATOR_ORACLE', - 'CONCAT_WS', - 'CONNECTION_ID', - 'CONV', - 'CONVERT_TZ', - 'COS', - 'COT', - 'CRC32', - 'DATEDIFF', - 'DAYNAME', - 'DAYOFMONTH', - 'DAYOFWEEK', - 'DAYOFYEAR', - 'DEGREES', - 'DECODE_HISTOGRAM', - 'DECODE_ORACLE', - 'DES_DECRYPT', - 'DES_ENCRYPT', - 'ELT', - 'ENCODE', - 'ENCRYPT', - 'EXP', - 'EXPORT_SET', - 'EXTRACTVALUE', - 'FIELD', - 'FIND_IN_SET', - 'FLOOR', - 'FORMAT', - 'FOUND_ROWS', - 'FROM_BASE64', - 'FROM_DAYS', - 'FROM_UNIXTIME', - 'GET_LOCK', - 'GREATEST', - 'HEX', - 'IFNULL', - 'INSTR', - 'ISNULL', - 'IS_FREE_LOCK', - 'IS_USED_LOCK', - 'JSON_ARRAY', - 'JSON_ARRAY_APPEND', - 'JSON_ARRAY_INSERT', - 'JSON_COMPACT', - 'JSON_CONTAINS', - 'JSON_CONTAINS_PATH', - 'JSON_DEPTH', - 'JSON_DETAILED', - 'JSON_EXISTS', - 'JSON_EXTRACT', - 'JSON_INSERT', - 'JSON_KEYS', - 'JSON_LENGTH', - 'JSON_LOOSE', - 'JSON_MERGE', - 'JSON_MERGE_PATCH', - 'JSON_MERGE_PRESERVE', - 'JSON_QUERY', - 'JSON_QUOTE', - 'JSON_OBJECT', - 'JSON_REMOVE', - 'JSON_REPLACE', - 'JSON_SET', - 'JSON_SEARCH', - 'JSON_TYPE', - 'JSON_UNQUOTE', - 'JSON_VALID', - 'JSON_VALUE', - 'LAST_DAY', - 'LAST_INSERT_ID', - 'LCASE', - 'LEAST', - 'LENGTH', - 'LENGTHB', - 'LN', - 'LOAD_FILE', - 'LOCATE', - 'LOG', - 'LOG10', - 'LOG2', - 'LOWER', - 'LPAD', - 'LPAD_ORACLE', - 'LTRIM', - 'LTRIM_ORACLE', - 'MAKEDATE', - 'MAKETIME', - 'MAKE_SET', - 'MASTER_GTID_WAIT', - 'MASTER_POS_WAIT', - 'MD5', - 'MONTHNAME', - 'NAME_CONST', - 'NVL', - 'NVL2', - 'OCT', - 'OCTET_LENGTH', - 'ORD', - 'PERIOD_ADD', - 'PERIOD_DIFF', - 'PI', - 'POW', - 'POWER', - 'QUOTE', - 'REGEXP_INSTR', - 'REGEXP_REPLACE', - 'REGEXP_SUBSTR', - 'RADIANS', - 'RAND', - 'RELEASE_ALL_LOCKS', - 'RELEASE_LOCK', - 'REPLACE_ORACLE', - 'REVERSE', - 'ROUND', - 'RPAD', - 'RPAD_ORACLE', - 'RTRIM', - 'RTRIM_ORACLE', - 'SEC_TO_TIME', - 'SHA', - 'SHA1', - 'SHA2', - 'SIGN', - 'SIN', - 'SLEEP', - 'SOUNDEX', - 'SPACE', - 'SQRT', - 'STRCMP', - 'STR_TO_DATE', - 'SUBSTR_ORACLE', - 'SUBSTRING_INDEX', - 'SUBTIME', - 'SYS_GUID', - 'TAN', - 'TIMEDIFF', - 'TIME_FORMAT', - 'TIME_TO_SEC', - 'TO_BASE64', - 'TO_CHAR', - 'TO_DAYS', - 'TO_SECONDS', - 'UCASE', - 'UNCOMPRESS', - 'UNCOMPRESSED_LENGTH', - 'UNHEX', - 'UNIX_TIMESTAMP', - 'UPDATEXML', - 'UPPER', - 'UUID', - 'UUID_SHORT', - 'VERSION', - 'WEEKDAY', - 'WEEKOFYEAR', - 'WSREP_LAST_WRITTEN_GTID', - 'WSREP_LAST_SEEN_GTID', - 'WSREP_SYNC_WAIT_UPTO_GTID', - 'YEARWEEK', - // CASE expression shorthands - 'COALESCE', - 'NULLIF', - // Data types with parameters - // https://mariadb.com/kb/en/data-types/ - 'TINYINT', - 'SMALLINT', - 'MEDIUMINT', - 'INT', - 'INTEGER', - 'BIGINT', - 'DECIMAL', - 'DEC', - 'NUMERIC', - 'FIXED', - // 'NUMBER', // ?? In oracle mode only - 'FLOAT', - 'DOUBLE', - 'DOUBLE PRECISION', - 'REAL', - 'BIT', - 'BINARY', - 'BLOB', - 'CHAR', - 'NATIONAL CHAR', - 'CHAR BYTE', - 'ENUM', - 'VARBINARY', - 'VARCHAR', - 'NATIONAL VARCHAR', - // 'SET' // handled as special-case in postProcess - 'TIME', - 'DATETIME', - 'TIMESTAMP', - 'YEAR', - ], -}); + 'ADDDATE', + 'ADD_MONTHS', + 'BIT_AND', + 'BIT_OR', + 'BIT_XOR', + 'CAST', + 'COUNT', + 'CUME_DIST', + 'CURDATE', + 'CURTIME', + 'DATE_ADD', + 'DATE_SUB', + 'DATE_FORMAT', + 'DECODE', + 'DENSE_RANK', + 'EXTRACT', + 'FIRST_VALUE', + 'GROUP_CONCAT', + 'JSON_ARRAYAGG', + 'JSON_OBJECTAGG', + 'LAG', + 'LEAD', + 'MAX', + 'MEDIAN', + 'MID', + 'MIN', + 'NOW', + 'NTH_VALUE', + 'NTILE', + 'POSITION', + 'PERCENT_RANK', + 'PERCENTILE_CONT', + 'PERCENTILE_DISC', + 'RANK', + 'ROW_NUMBER', + 'SESSION_USER', + 'STD', + 'STDDEV', + 'STDDEV_POP', + 'STDDEV_SAMP', + 'SUBDATE', + 'SUBSTR', + 'SUBSTRING', + 'SUM', + 'SYSTEM_USER', + 'TRIM', + 'TRIM_ORACLE', + 'VARIANCE', + 'VAR_POP', + 'VAR_SAMP', + 'ABS', + 'ACOS', + 'ADDTIME', + 'AES_DECRYPT', + 'AES_ENCRYPT', + 'ASIN', + 'ATAN', + 'ATAN2', + 'BENCHMARK', + 'BIN', + 'BINLOG_GTID_POS', + 'BIT_COUNT', + 'BIT_LENGTH', + 'CEIL', + 'CEILING', + 'CHARACTER_LENGTH', + 'CHAR_LENGTH', + 'CHR', + 'COERCIBILITY', + 'COLUMN_CHECK', + 'COLUMN_EXISTS', + 'COLUMN_LIST', + 'COLUMN_JSON', + 'COMPRESS', + 'CONCAT', + 'CONCAT_OPERATOR_ORACLE', + 'CONCAT_WS', + 'CONNECTION_ID', + 'CONV', + 'CONVERT_TZ', + 'COS', + 'COT', + 'CRC32', + 'DATEDIFF', + 'DAYNAME', + 'DAYOFMONTH', + 'DAYOFWEEK', + 'DAYOFYEAR', + 'DEGREES', + 'DECODE_HISTOGRAM', + 'DECODE_ORACLE', + 'DES_DECRYPT', + 'DES_ENCRYPT', + 'ELT', + 'ENCODE', + 'ENCRYPT', + 'EXP', + 'EXPORT_SET', + 'EXTRACTVALUE', + 'FIELD', + 'FIND_IN_SET', + 'FLOOR', + 'FORMAT', + 'FOUND_ROWS', + 'FROM_BASE64', + 'FROM_DAYS', + 'FROM_UNIXTIME', + 'GET_LOCK', + 'GREATEST', + 'HEX', + 'IFNULL', + 'INSTR', + 'ISNULL', + 'IS_FREE_LOCK', + 'IS_USED_LOCK', + 'JSON_ARRAY', + 'JSON_ARRAY_APPEND', + 'JSON_ARRAY_INSERT', + 'JSON_COMPACT', + 'JSON_CONTAINS', + 'JSON_CONTAINS_PATH', + 'JSON_DEPTH', + 'JSON_DETAILED', + 'JSON_EXISTS', + 'JSON_EXTRACT', + 'JSON_INSERT', + 'JSON_KEYS', + 'JSON_LENGTH', + 'JSON_LOOSE', + 'JSON_MERGE', + 'JSON_MERGE_PATCH', + 'JSON_MERGE_PRESERVE', + 'JSON_QUERY', + 'JSON_QUOTE', + 'JSON_OBJECT', + 'JSON_REMOVE', + 'JSON_REPLACE', + 'JSON_SET', + 'JSON_SEARCH', + 'JSON_TYPE', + 'JSON_UNQUOTE', + 'JSON_VALID', + 'JSON_VALUE', + 'LAST_DAY', + 'LAST_INSERT_ID', + 'LCASE', + 'LEAST', + 'LENGTH', + 'LENGTHB', + 'LN', + 'LOAD_FILE', + 'LOCATE', + 'LOG', + 'LOG10', + 'LOG2', + 'LOWER', + 'LPAD', + 'LPAD_ORACLE', + 'LTRIM', + 'LTRIM_ORACLE', + 'MAKEDATE', + 'MAKETIME', + 'MAKE_SET', + 'MASTER_GTID_WAIT', + 'MASTER_POS_WAIT', + 'MD5', + 'MONTHNAME', + 'NAME_CONST', + 'NVL', + 'NVL2', + 'OCT', + 'OCTET_LENGTH', + 'ORD', + 'PERIOD_ADD', + 'PERIOD_DIFF', + 'PI', + 'POW', + 'POWER', + 'QUOTE', + 'REGEXP_INSTR', + 'REGEXP_REPLACE', + 'REGEXP_SUBSTR', + 'RADIANS', + 'RAND', + 'RELEASE_ALL_LOCKS', + 'RELEASE_LOCK', + 'REPLACE_ORACLE', + 'REVERSE', + 'ROUND', + 'RPAD', + 'RPAD_ORACLE', + 'RTRIM', + 'RTRIM_ORACLE', + 'SEC_TO_TIME', + 'SHA', + 'SHA1', + 'SHA2', + 'SIGN', + 'SIN', + 'SLEEP', + 'SOUNDEX', + 'SPACE', + 'SQRT', + 'STRCMP', + 'STR_TO_DATE', + 'SUBSTR_ORACLE', + 'SUBSTRING_INDEX', + 'SUBTIME', + 'SYS_GUID', + 'TAN', + 'TIMEDIFF', + 'TIME_FORMAT', + 'TIME_TO_SEC', + 'TO_BASE64', + 'TO_CHAR', + 'TO_DAYS', + 'TO_SECONDS', + 'UCASE', + 'UNCOMPRESS', + 'UNCOMPRESSED_LENGTH', + 'UNHEX', + 'UNIX_TIMESTAMP', + 'UPDATEXML', + 'UPPER', + 'UUID', + 'UUID_SHORT', + 'VERSION', + 'WEEKDAY', + 'WEEKOFYEAR', + 'WSREP_LAST_WRITTEN_GTID', + 'WSREP_LAST_SEEN_GTID', + 'WSREP_SYNC_WAIT_UPTO_GTID', + 'YEARWEEK', + // CASE expression shorthands + 'COALESCE', + 'NULLIF', + // Data types with parameters + // https://mariadb.com/kb/en/data-types/ + 'TINYINT', + 'SMALLINT', + 'MEDIUMINT', + 'INT', + 'INTEGER', + 'BIGINT', + 'DECIMAL', + 'DEC', + 'NUMERIC', + 'FIXED', + // 'NUMBER', // ?? In oracle mode only + 'FLOAT', + 'DOUBLE', + 'DOUBLE PRECISION', + 'REAL', + 'BIT', + 'BINARY', + 'BLOB', + 'CHAR', + 'NATIONAL CHAR', + 'CHAR BYTE', + 'ENUM', + 'VARBINARY', + 'VARCHAR', + 'NATIONAL VARCHAR', + // 'SET' // handled as special-case in postProcess + 'TIME', + 'DATETIME', + 'TIMESTAMP', + 'YEAR', +]; diff --git a/src/languages/mariadb/mariadb.keywords.ts b/src/languages/mariadb/mariadb.keywords.ts index 5bbd1719b7..b8fdfa6846 100644 --- a/src/languages/mariadb/mariadb.keywords.ts +++ b/src/languages/mariadb/mariadb.keywords.ts @@ -1,258 +1,254 @@ -import { flatKeywordList } from '../../utils.js'; - -export const keywords = flatKeywordList({ +export const keywords: string[] = [ // https://mariadb.com/kb/en/reserved-words/ - reserved: [ - 'ACCESSIBLE', - 'ADD', - 'ALL', - 'ALTER', - 'ANALYZE', - 'AND', - 'AS', - 'ASC', - 'ASENSITIVE', - 'BEFORE', - 'BETWEEN', - 'BIGINT', - 'BINARY', - 'BLOB', - 'BOTH', - 'BY', - 'CALL', - 'CASCADE', - 'CASE', - 'CHANGE', - 'CHAR', - 'CHARACTER', - 'CHECK', - 'COLLATE', - 'COLUMN', - 'CONDITION', - 'CONSTRAINT', - 'CONTINUE', - 'CONVERT', - 'CREATE', - 'CROSS', - 'CURRENT_DATE', - 'CURRENT_ROLE', - 'CURRENT_TIME', - 'CURRENT_TIMESTAMP', - 'CURRENT_USER', - 'CURSOR', - 'DATABASE', - 'DATABASES', - 'DAY_HOUR', - 'DAY_MICROSECOND', - 'DAY_MINUTE', - 'DAY_SECOND', - 'DEC', - 'DECIMAL', - 'DECLARE', - 'DEFAULT', - 'DELAYED', - 'DELETE', - 'DELETE_DOMAIN_ID', - 'DESC', - 'DESCRIBE', - 'DETERMINISTIC', - 'DISTINCT', - 'DISTINCTROW', - 'DIV', - 'DO_DOMAIN_IDS', - 'DOUBLE', - 'DROP', - 'DUAL', - 'EACH', - 'ELSE', - 'ELSEIF', - 'ENCLOSED', - 'ESCAPED', - 'EXCEPT', - 'EXISTS', - 'EXIT', - 'EXPLAIN', - 'FALSE', - 'FETCH', - 'FLOAT', - 'FLOAT4', - 'FLOAT8', - 'FOR', - 'FORCE', - 'FOREIGN', - 'FROM', - 'FULLTEXT', - 'GENERAL', - 'GRANT', - 'GROUP', - 'HAVING', - 'HIGH_PRIORITY', - 'HOUR_MICROSECOND', - 'HOUR_MINUTE', - 'HOUR_SECOND', - 'IF', - 'IGNORE', - 'IGNORE_DOMAIN_IDS', - 'IGNORE_SERVER_IDS', - 'IN', - 'INDEX', - 'INFILE', - 'INNER', - 'INOUT', - 'INSENSITIVE', - 'INSERT', - 'INT', - 'INT1', - 'INT2', - 'INT3', - 'INT4', - 'INT8', - 'INTEGER', - 'INTERSECT', - 'INTERVAL', - 'INTO', - 'IS', - 'ITERATE', - 'JOIN', - 'KEY', - 'KEYS', - 'KILL', - 'LEADING', - 'LEAVE', - 'LEFT', - 'LIKE', - 'LIMIT', - 'LINEAR', - 'LINES', - 'LOAD', - 'LOCALTIME', - 'LOCALTIMESTAMP', - 'LOCK', - 'LONG', - 'LONGBLOB', - 'LONGTEXT', - 'LOOP', - 'LOW_PRIORITY', - 'MASTER_HEARTBEAT_PERIOD', - 'MASTER_SSL_VERIFY_SERVER_CERT', - 'MATCH', - 'MAXVALUE', - 'MEDIUMBLOB', - 'MEDIUMINT', - 'MEDIUMTEXT', - 'MIDDLEINT', - 'MINUTE_MICROSECOND', - 'MINUTE_SECOND', - 'MOD', - 'MODIFIES', - 'NATURAL', - 'NOT', - 'NO_WRITE_TO_BINLOG', - 'NULL', - 'NUMERIC', - 'OFFSET', - 'ON', - 'OPTIMIZE', - 'OPTION', - 'OPTIONALLY', - 'OR', - 'ORDER', - 'OUT', - 'OUTER', - 'OUTFILE', - 'OVER', - 'PAGE_CHECKSUM', - 'PARSE_VCOL_EXPR', - 'PARTITION', - 'POSITION', - 'PRECISION', - 'PRIMARY', - 'PROCEDURE', - 'PURGE', - 'RANGE', - 'READ', - 'READS', - 'READ_WRITE', - 'REAL', - 'RECURSIVE', - 'REF_SYSTEM_ID', - 'REFERENCES', - 'REGEXP', - 'RELEASE', - 'RENAME', - 'REPEAT', - 'REPLACE', - 'REQUIRE', - 'RESIGNAL', - 'RESTRICT', - 'RETURN', - 'RETURNING', - 'REVOKE', - 'RIGHT', - 'RLIKE', - 'ROW_NUMBER', - 'ROWS', - 'SCHEMA', - 'SCHEMAS', - 'SECOND_MICROSECOND', - 'SELECT', - 'SENSITIVE', - 'SEPARATOR', - 'SET', - 'SHOW', - 'SIGNAL', - 'SLOW', - 'SMALLINT', - 'SPATIAL', - 'SPECIFIC', - 'SQL', - 'SQLEXCEPTION', - 'SQLSTATE', - 'SQLWARNING', - 'SQL_BIG_RESULT', - 'SQL_CALC_FOUND_ROWS', - 'SQL_SMALL_RESULT', - 'SSL', - 'STARTING', - 'STATS_AUTO_RECALC', - 'STATS_PERSISTENT', - 'STATS_SAMPLE_PAGES', - 'STRAIGHT_JOIN', - 'TABLE', - 'TERMINATED', - 'THEN', - 'TINYBLOB', - 'TINYINT', - 'TINYTEXT', - 'TO', - 'TRAILING', - 'TRIGGER', - 'TRUE', - 'UNDO', - 'UNION', - 'UNIQUE', - 'UNLOCK', - 'UNSIGNED', - 'UPDATE', - 'USAGE', - 'USE', - 'USING', - 'UTC_DATE', - 'UTC_TIME', - 'UTC_TIMESTAMP', - 'VALUES', - 'VARBINARY', - 'VARCHAR', - 'VARCHARACTER', - 'VARYING', - 'WHEN', - 'WHERE', - 'WHILE', - 'WINDOW', - 'WITH', - 'WRITE', - 'XOR', - 'YEAR_MONTH', - 'ZEROFILL', - ], -}); + 'ACCESSIBLE', + 'ADD', + 'ALL', + 'ALTER', + 'ANALYZE', + 'AND', + 'AS', + 'ASC', + 'ASENSITIVE', + 'BEFORE', + 'BETWEEN', + 'BIGINT', + 'BINARY', + 'BLOB', + 'BOTH', + 'BY', + 'CALL', + 'CASCADE', + 'CASE', + 'CHANGE', + 'CHAR', + 'CHARACTER', + 'CHECK', + 'COLLATE', + 'COLUMN', + 'CONDITION', + 'CONSTRAINT', + 'CONTINUE', + 'CONVERT', + 'CREATE', + 'CROSS', + 'CURRENT_DATE', + 'CURRENT_ROLE', + 'CURRENT_TIME', + 'CURRENT_TIMESTAMP', + 'CURRENT_USER', + 'CURSOR', + 'DATABASE', + 'DATABASES', + 'DAY_HOUR', + 'DAY_MICROSECOND', + 'DAY_MINUTE', + 'DAY_SECOND', + 'DEC', + 'DECIMAL', + 'DECLARE', + 'DEFAULT', + 'DELAYED', + 'DELETE', + 'DELETE_DOMAIN_ID', + 'DESC', + 'DESCRIBE', + 'DETERMINISTIC', + 'DISTINCT', + 'DISTINCTROW', + 'DIV', + 'DO_DOMAIN_IDS', + 'DOUBLE', + 'DROP', + 'DUAL', + 'EACH', + 'ELSE', + 'ELSEIF', + 'ENCLOSED', + 'ESCAPED', + 'EXCEPT', + 'EXISTS', + 'EXIT', + 'EXPLAIN', + 'FALSE', + 'FETCH', + 'FLOAT', + 'FLOAT4', + 'FLOAT8', + 'FOR', + 'FORCE', + 'FOREIGN', + 'FROM', + 'FULLTEXT', + 'GENERAL', + 'GRANT', + 'GROUP', + 'HAVING', + 'HIGH_PRIORITY', + 'HOUR_MICROSECOND', + 'HOUR_MINUTE', + 'HOUR_SECOND', + 'IF', + 'IGNORE', + 'IGNORE_DOMAIN_IDS', + 'IGNORE_SERVER_IDS', + 'IN', + 'INDEX', + 'INFILE', + 'INNER', + 'INOUT', + 'INSENSITIVE', + 'INSERT', + 'INT', + 'INT1', + 'INT2', + 'INT3', + 'INT4', + 'INT8', + 'INTEGER', + 'INTERSECT', + 'INTERVAL', + 'INTO', + 'IS', + 'ITERATE', + 'JOIN', + 'KEY', + 'KEYS', + 'KILL', + 'LEADING', + 'LEAVE', + 'LEFT', + 'LIKE', + 'LIMIT', + 'LINEAR', + 'LINES', + 'LOAD', + 'LOCALTIME', + 'LOCALTIMESTAMP', + 'LOCK', + 'LONG', + 'LONGBLOB', + 'LONGTEXT', + 'LOOP', + 'LOW_PRIORITY', + 'MASTER_HEARTBEAT_PERIOD', + 'MASTER_SSL_VERIFY_SERVER_CERT', + 'MATCH', + 'MAXVALUE', + 'MEDIUMBLOB', + 'MEDIUMINT', + 'MEDIUMTEXT', + 'MIDDLEINT', + 'MINUTE_MICROSECOND', + 'MINUTE_SECOND', + 'MOD', + 'MODIFIES', + 'NATURAL', + 'NOT', + 'NO_WRITE_TO_BINLOG', + 'NULL', + 'NUMERIC', + 'OFFSET', + 'ON', + 'OPTIMIZE', + 'OPTION', + 'OPTIONALLY', + 'OR', + 'ORDER', + 'OUT', + 'OUTER', + 'OUTFILE', + 'OVER', + 'PAGE_CHECKSUM', + 'PARSE_VCOL_EXPR', + 'PARTITION', + 'POSITION', + 'PRECISION', + 'PRIMARY', + 'PROCEDURE', + 'PURGE', + 'RANGE', + 'READ', + 'READS', + 'READ_WRITE', + 'REAL', + 'RECURSIVE', + 'REF_SYSTEM_ID', + 'REFERENCES', + 'REGEXP', + 'RELEASE', + 'RENAME', + 'REPEAT', + 'REPLACE', + 'REQUIRE', + 'RESIGNAL', + 'RESTRICT', + 'RETURN', + 'RETURNING', + 'REVOKE', + 'RIGHT', + 'RLIKE', + 'ROW_NUMBER', + 'ROWS', + 'SCHEMA', + 'SCHEMAS', + 'SECOND_MICROSECOND', + 'SELECT', + 'SENSITIVE', + 'SEPARATOR', + 'SET', + 'SHOW', + 'SIGNAL', + 'SLOW', + 'SMALLINT', + 'SPATIAL', + 'SPECIFIC', + 'SQL', + 'SQLEXCEPTION', + 'SQLSTATE', + 'SQLWARNING', + 'SQL_BIG_RESULT', + 'SQL_CALC_FOUND_ROWS', + 'SQL_SMALL_RESULT', + 'SSL', + 'STARTING', + 'STATS_AUTO_RECALC', + 'STATS_PERSISTENT', + 'STATS_SAMPLE_PAGES', + 'STRAIGHT_JOIN', + 'TABLE', + 'TERMINATED', + 'THEN', + 'TINYBLOB', + 'TINYINT', + 'TINYTEXT', + 'TO', + 'TRAILING', + 'TRIGGER', + 'TRUE', + 'UNDO', + 'UNION', + 'UNIQUE', + 'UNLOCK', + 'UNSIGNED', + 'UPDATE', + 'USAGE', + 'USE', + 'USING', + 'UTC_DATE', + 'UTC_TIME', + 'UTC_TIMESTAMP', + 'VALUES', + 'VARBINARY', + 'VARCHAR', + 'VARCHARACTER', + 'VARYING', + 'WHEN', + 'WHERE', + 'WHILE', + 'WINDOW', + 'WITH', + 'WRITE', + 'XOR', + 'YEAR_MONTH', + 'ZEROFILL', +]; diff --git a/src/languages/mysql/mysql.functions.ts b/src/languages/mysql/mysql.functions.ts index 61d57521e1..6464569058 100644 --- a/src/languages/mysql/mysql.functions.ts +++ b/src/languages/mysql/mysql.functions.ts @@ -1,459 +1,455 @@ -import { flatKeywordList } from '../../utils.js'; - -export const functions = flatKeywordList({ +export const functions: string[] = [ // https://dev.mysql.com/doc/refman/8.0/en/built-in-function-reference.html - all: [ - 'ABS', - 'ACOS', - 'ADDDATE', - 'ADDTIME', - 'AES_DECRYPT', - 'AES_ENCRYPT', - // 'AND', - 'ANY_VALUE', - 'ASCII', - 'ASIN', - 'ATAN', - 'ATAN2', - 'AVG', - 'BENCHMARK', - 'BIN', - 'BIN_TO_UUID', - 'BINARY', - 'BIT_AND', - 'BIT_COUNT', - 'BIT_LENGTH', - 'BIT_OR', - 'BIT_XOR', - 'CAN_ACCESS_COLUMN', - 'CAN_ACCESS_DATABASE', - 'CAN_ACCESS_TABLE', - 'CAN_ACCESS_USER', - 'CAN_ACCESS_VIEW', - 'CAST', - 'CEIL', - 'CEILING', - 'CHAR', - 'CHAR_LENGTH', - 'CHARACTER_LENGTH', - 'CHARSET', - 'COALESCE', - 'COERCIBILITY', - 'COLLATION', - 'COMPRESS', - 'CONCAT', - 'CONCAT_WS', - 'CONNECTION_ID', - 'CONV', - 'CONVERT', - 'CONVERT_TZ', - 'COS', - 'COT', - 'COUNT', - 'CRC32', - 'CUME_DIST', - 'CURDATE', - 'CURRENT_DATE', - 'CURRENT_ROLE', - 'CURRENT_TIME', - 'CURRENT_TIMESTAMP', - 'CURRENT_USER', - 'CURTIME', - 'DATABASE', - 'DATE', - 'DATE_ADD', - 'DATE_FORMAT', - 'DATE_SUB', - 'DATEDIFF', - 'DAY', - 'DAYNAME', - 'DAYOFMONTH', - 'DAYOFWEEK', - 'DAYOFYEAR', - 'DEFAULT', - 'DEGREES', - 'DENSE_RANK', - 'DIV', - 'ELT', - 'EXP', - 'EXPORT_SET', - 'EXTRACT', - 'EXTRACTVALUE', - 'FIELD', - 'FIND_IN_SET', - 'FIRST_VALUE', - 'FLOOR', - 'FORMAT', - 'FORMAT_BYTES', - 'FORMAT_PICO_TIME', - 'FOUND_ROWS', - 'FROM_BASE64', - 'FROM_DAYS', - 'FROM_UNIXTIME', - 'GEOMCOLLECTION', - 'GEOMETRYCOLLECTION', - 'GET_DD_COLUMN_PRIVILEGES', - 'GET_DD_CREATE_OPTIONS', - 'GET_DD_INDEX_SUB_PART_LENGTH', - 'GET_FORMAT', - 'GET_LOCK', - 'GREATEST', - 'GROUP_CONCAT', - 'GROUPING', - 'GTID_SUBSET', - 'GTID_SUBTRACT', - 'HEX', - 'HOUR', - 'ICU_VERSION', - 'IF', - 'IFNULL', - // 'IN', - 'INET_ATON', - 'INET_NTOA', - 'INET6_ATON', - 'INET6_NTOA', - 'INSERT', - 'INSTR', - 'INTERNAL_AUTO_INCREMENT', - 'INTERNAL_AVG_ROW_LENGTH', - 'INTERNAL_CHECK_TIME', - 'INTERNAL_CHECKSUM', - 'INTERNAL_DATA_FREE', - 'INTERNAL_DATA_LENGTH', - 'INTERNAL_DD_CHAR_LENGTH', - 'INTERNAL_GET_COMMENT_OR_ERROR', - 'INTERNAL_GET_ENABLED_ROLE_JSON', - 'INTERNAL_GET_HOSTNAME', - 'INTERNAL_GET_USERNAME', - 'INTERNAL_GET_VIEW_WARNING_OR_ERROR', - 'INTERNAL_INDEX_COLUMN_CARDINALITY', - 'INTERNAL_INDEX_LENGTH', - 'INTERNAL_IS_ENABLED_ROLE', - 'INTERNAL_IS_MANDATORY_ROLE', - 'INTERNAL_KEYS_DISABLED', - 'INTERNAL_MAX_DATA_LENGTH', - 'INTERNAL_TABLE_ROWS', - 'INTERNAL_UPDATE_TIME', - 'INTERVAL', - 'IS', - 'IS_FREE_LOCK', - 'IS_IPV4', - 'IS_IPV4_COMPAT', - 'IS_IPV4_MAPPED', - 'IS_IPV6', - 'IS NOT', - 'IS NOT NULL', - 'IS NULL', - 'IS_USED_LOCK', - 'IS_UUID', - 'ISNULL', - 'JSON_ARRAY', - 'JSON_ARRAY_APPEND', - 'JSON_ARRAY_INSERT', - 'JSON_ARRAYAGG', - 'JSON_CONTAINS', - 'JSON_CONTAINS_PATH', - 'JSON_DEPTH', - 'JSON_EXTRACT', - 'JSON_INSERT', - 'JSON_KEYS', - 'JSON_LENGTH', - 'JSON_MERGE', - 'JSON_MERGE_PATCH', - 'JSON_MERGE_PRESERVE', - 'JSON_OBJECT', - 'JSON_OBJECTAGG', - 'JSON_OVERLAPS', - 'JSON_PRETTY', - 'JSON_QUOTE', - 'JSON_REMOVE', - 'JSON_REPLACE', - 'JSON_SCHEMA_VALID', - 'JSON_SCHEMA_VALIDATION_REPORT', - 'JSON_SEARCH', - 'JSON_SET', - 'JSON_STORAGE_FREE', - 'JSON_STORAGE_SIZE', - 'JSON_TABLE', - 'JSON_TYPE', - 'JSON_UNQUOTE', - 'JSON_VALID', - 'JSON_VALUE', - 'LAG', - 'LAST_DAY', - 'LAST_INSERT_ID', - 'LAST_VALUE', - 'LCASE', - 'LEAD', - 'LEAST', - 'LEFT', - 'LENGTH', - 'LIKE', - 'LINESTRING', - 'LN', - 'LOAD_FILE', - 'LOCALTIME', - 'LOCALTIMESTAMP', - 'LOCATE', - 'LOG', - 'LOG10', - 'LOG2', - 'LOWER', - 'LPAD', - 'LTRIM', - 'MAKE_SET', - 'MAKEDATE', - 'MAKETIME', - 'MASTER_POS_WAIT', - 'MATCH', - 'MAX', - 'MBRCONTAINS', - 'MBRCOVEREDBY', - 'MBRCOVERS', - 'MBRDISJOINT', - 'MBREQUALS', - 'MBRINTERSECTS', - 'MBROVERLAPS', - 'MBRTOUCHES', - 'MBRWITHIN', - 'MD5', - 'MEMBER OF', - 'MICROSECOND', - 'MID', - 'MIN', - 'MINUTE', - 'MOD', - 'MONTH', - 'MONTHNAME', - 'MULTILINESTRING', - 'MULTIPOINT', - 'MULTIPOLYGON', - 'NAME_CONST', - 'NOT', - 'NOT IN', - 'NOT LIKE', - 'NOT REGEXP', - 'NOW', - 'NTH_VALUE', - 'NTILE', - 'NULLIF', - 'OCT', - 'OCTET_LENGTH', - // 'OR', - 'ORD', - 'PERCENT_RANK', - 'PERIOD_ADD', - 'PERIOD_DIFF', - 'PI', - 'POINT', - 'POLYGON', - 'POSITION', - 'POW', - 'POWER', - 'PS_CURRENT_THREAD_ID', - 'PS_THREAD_ID', - 'QUARTER', - 'QUOTE', - 'RADIANS', - 'RAND', - 'RANDOM_BYTES', - 'RANK', - 'REGEXP', - 'REGEXP_INSTR', - 'REGEXP_LIKE', - 'REGEXP_REPLACE', - 'REGEXP_SUBSTR', - 'RELEASE_ALL_LOCKS', - 'RELEASE_LOCK', - 'REPEAT', - 'REPLACE', - 'REVERSE', - 'RIGHT', - 'RLIKE', - 'ROLES_GRAPHML', - 'ROUND', - 'ROW_COUNT', - 'ROW_NUMBER', - 'RPAD', - 'RTRIM', - 'SCHEMA', - 'SEC_TO_TIME', - 'SECOND', - 'SESSION_USER', - 'SHA1', - 'SHA2', - 'SIGN', - 'SIN', - 'SLEEP', - 'SOUNDEX', - 'SOUNDS LIKE', - 'SOURCE_POS_WAIT', - 'SPACE', - 'SQRT', - 'ST_AREA', - 'ST_ASBINARY', - 'ST_ASGEOJSON', - 'ST_ASTEXT', - 'ST_BUFFER', - 'ST_BUFFER_STRATEGY', - 'ST_CENTROID', - 'ST_COLLECT', - 'ST_CONTAINS', - 'ST_CONVEXHULL', - 'ST_CROSSES', - 'ST_DIFFERENCE', - 'ST_DIMENSION', - 'ST_DISJOINT', - 'ST_DISTANCE', - 'ST_DISTANCE_SPHERE', - 'ST_ENDPOINT', - 'ST_ENVELOPE', - 'ST_EQUALS', - 'ST_EXTERIORRING', - 'ST_FRECHETDISTANCE', - 'ST_GEOHASH', - 'ST_GEOMCOLLFROMTEXT', - 'ST_GEOMCOLLFROMWKB', - 'ST_GEOMETRYN', - 'ST_GEOMETRYTYPE', - 'ST_GEOMFROMGEOJSON', - 'ST_GEOMFROMTEXT', - 'ST_GEOMFROMWKB', - 'ST_HAUSDORFFDISTANCE', - 'ST_INTERIORRINGN', - 'ST_INTERSECTION', - 'ST_INTERSECTS', - 'ST_ISCLOSED', - 'ST_ISEMPTY', - 'ST_ISSIMPLE', - 'ST_ISVALID', - 'ST_LATFROMGEOHASH', - 'ST_LATITUDE', - 'ST_LENGTH', - 'ST_LINEFROMTEXT', - 'ST_LINEFROMWKB', - 'ST_LINEINTERPOLATEPOINT', - 'ST_LINEINTERPOLATEPOINTS', - 'ST_LONGFROMGEOHASH', - 'ST_LONGITUDE', - 'ST_MAKEENVELOPE', - 'ST_MLINEFROMTEXT', - 'ST_MLINEFROMWKB', - 'ST_MPOINTFROMTEXT', - 'ST_MPOINTFROMWKB', - 'ST_MPOLYFROMTEXT', - 'ST_MPOLYFROMWKB', - 'ST_NUMGEOMETRIES', - 'ST_NUMINTERIORRING', - 'ST_NUMPOINTS', - 'ST_OVERLAPS', - 'ST_POINTATDISTANCE', - 'ST_POINTFROMGEOHASH', - 'ST_POINTFROMTEXT', - 'ST_POINTFROMWKB', - 'ST_POINTN', - 'ST_POLYFROMTEXT', - 'ST_POLYFROMWKB', - 'ST_SIMPLIFY', - 'ST_SRID', - 'ST_STARTPOINT', - 'ST_SWAPXY', - 'ST_SYMDIFFERENCE', - 'ST_TOUCHES', - 'ST_TRANSFORM', - 'ST_UNION', - 'ST_VALIDATE', - 'ST_WITHIN', - 'ST_X', - 'ST_Y', - 'STATEMENT_DIGEST', - 'STATEMENT_DIGEST_TEXT', - 'STD', - 'STDDEV', - 'STDDEV_POP', - 'STDDEV_SAMP', - 'STR_TO_DATE', - 'STRCMP', - 'SUBDATE', - 'SUBSTR', - 'SUBSTRING', - 'SUBSTRING_INDEX', - 'SUBTIME', - 'SUM', - 'SYSDATE', - 'SYSTEM_USER', - 'TAN', - 'TIME', - 'TIME_FORMAT', - 'TIME_TO_SEC', - 'TIMEDIFF', - 'TIMESTAMP', - 'TIMESTAMPADD', - 'TIMESTAMPDIFF', - 'TO_BASE64', - 'TO_DAYS', - 'TO_SECONDS', - 'TRIM', - 'TRUNCATE', - 'UCASE', - 'UNCOMPRESS', - 'UNCOMPRESSED_LENGTH', - 'UNHEX', - 'UNIX_TIMESTAMP', - 'UPDATEXML', - 'UPPER', - // 'USER', - 'UTC_DATE', - 'UTC_TIME', - 'UTC_TIMESTAMP', - 'UUID', - 'UUID_SHORT', - 'UUID_TO_BIN', - 'VALIDATE_PASSWORD_STRENGTH', - 'VALUES', - 'VAR_POP', - 'VAR_SAMP', - 'VARIANCE', - 'VERSION', - 'WAIT_FOR_EXECUTED_GTID_SET', - 'WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS', - 'WEEK', - 'WEEKDAY', - 'WEEKOFYEAR', - 'WEIGHT_STRING', - // 'XOR', - 'YEAR', - 'YEARWEEK', - // Data types with parameters - // https://dev.mysql.com/doc/refman/8.0/en/data-types.html - 'BIT', - 'TINYINT', - 'SMALLINT', - 'MEDIUMINT', - 'INT', - 'INTEGER', - 'BIGINT', - 'DECIMAL', - 'DEC', - 'NUMERIC', - 'FIXED', - 'FLOAT', - 'DOUBLE', - 'DOUBLE PRECISION', - 'REAL', - 'DATETIME', - 'TIMESTAMP', - 'TIME', - 'YEAR', - 'CHAR', - 'NATIONAL CHAR', - 'VARCHAR', - 'NATIONAL VARCHAR', - 'BINARY', - 'VARBINARY', - 'BLOB', - 'TEXT', - 'ENUM', - // 'SET' // handled as special-case in postProcess - ], -}); + 'ABS', + 'ACOS', + 'ADDDATE', + 'ADDTIME', + 'AES_DECRYPT', + 'AES_ENCRYPT', + // 'AND', + 'ANY_VALUE', + 'ASCII', + 'ASIN', + 'ATAN', + 'ATAN2', + 'AVG', + 'BENCHMARK', + 'BIN', + 'BIN_TO_UUID', + 'BINARY', + 'BIT_AND', + 'BIT_COUNT', + 'BIT_LENGTH', + 'BIT_OR', + 'BIT_XOR', + 'CAN_ACCESS_COLUMN', + 'CAN_ACCESS_DATABASE', + 'CAN_ACCESS_TABLE', + 'CAN_ACCESS_USER', + 'CAN_ACCESS_VIEW', + 'CAST', + 'CEIL', + 'CEILING', + 'CHAR', + 'CHAR_LENGTH', + 'CHARACTER_LENGTH', + 'CHARSET', + 'COALESCE', + 'COERCIBILITY', + 'COLLATION', + 'COMPRESS', + 'CONCAT', + 'CONCAT_WS', + 'CONNECTION_ID', + 'CONV', + 'CONVERT', + 'CONVERT_TZ', + 'COS', + 'COT', + 'COUNT', + 'CRC32', + 'CUME_DIST', + 'CURDATE', + 'CURRENT_DATE', + 'CURRENT_ROLE', + 'CURRENT_TIME', + 'CURRENT_TIMESTAMP', + 'CURRENT_USER', + 'CURTIME', + 'DATABASE', + 'DATE', + 'DATE_ADD', + 'DATE_FORMAT', + 'DATE_SUB', + 'DATEDIFF', + 'DAY', + 'DAYNAME', + 'DAYOFMONTH', + 'DAYOFWEEK', + 'DAYOFYEAR', + 'DEFAULT', + 'DEGREES', + 'DENSE_RANK', + 'DIV', + 'ELT', + 'EXP', + 'EXPORT_SET', + 'EXTRACT', + 'EXTRACTVALUE', + 'FIELD', + 'FIND_IN_SET', + 'FIRST_VALUE', + 'FLOOR', + 'FORMAT', + 'FORMAT_BYTES', + 'FORMAT_PICO_TIME', + 'FOUND_ROWS', + 'FROM_BASE64', + 'FROM_DAYS', + 'FROM_UNIXTIME', + 'GEOMCOLLECTION', + 'GEOMETRYCOLLECTION', + 'GET_DD_COLUMN_PRIVILEGES', + 'GET_DD_CREATE_OPTIONS', + 'GET_DD_INDEX_SUB_PART_LENGTH', + 'GET_FORMAT', + 'GET_LOCK', + 'GREATEST', + 'GROUP_CONCAT', + 'GROUPING', + 'GTID_SUBSET', + 'GTID_SUBTRACT', + 'HEX', + 'HOUR', + 'ICU_VERSION', + 'IF', + 'IFNULL', + // 'IN', + 'INET_ATON', + 'INET_NTOA', + 'INET6_ATON', + 'INET6_NTOA', + 'INSERT', + 'INSTR', + 'INTERNAL_AUTO_INCREMENT', + 'INTERNAL_AVG_ROW_LENGTH', + 'INTERNAL_CHECK_TIME', + 'INTERNAL_CHECKSUM', + 'INTERNAL_DATA_FREE', + 'INTERNAL_DATA_LENGTH', + 'INTERNAL_DD_CHAR_LENGTH', + 'INTERNAL_GET_COMMENT_OR_ERROR', + 'INTERNAL_GET_ENABLED_ROLE_JSON', + 'INTERNAL_GET_HOSTNAME', + 'INTERNAL_GET_USERNAME', + 'INTERNAL_GET_VIEW_WARNING_OR_ERROR', + 'INTERNAL_INDEX_COLUMN_CARDINALITY', + 'INTERNAL_INDEX_LENGTH', + 'INTERNAL_IS_ENABLED_ROLE', + 'INTERNAL_IS_MANDATORY_ROLE', + 'INTERNAL_KEYS_DISABLED', + 'INTERNAL_MAX_DATA_LENGTH', + 'INTERNAL_TABLE_ROWS', + 'INTERNAL_UPDATE_TIME', + 'INTERVAL', + 'IS', + 'IS_FREE_LOCK', + 'IS_IPV4', + 'IS_IPV4_COMPAT', + 'IS_IPV4_MAPPED', + 'IS_IPV6', + 'IS NOT', + 'IS NOT NULL', + 'IS NULL', + 'IS_USED_LOCK', + 'IS_UUID', + 'ISNULL', + 'JSON_ARRAY', + 'JSON_ARRAY_APPEND', + 'JSON_ARRAY_INSERT', + 'JSON_ARRAYAGG', + 'JSON_CONTAINS', + 'JSON_CONTAINS_PATH', + 'JSON_DEPTH', + 'JSON_EXTRACT', + 'JSON_INSERT', + 'JSON_KEYS', + 'JSON_LENGTH', + 'JSON_MERGE', + 'JSON_MERGE_PATCH', + 'JSON_MERGE_PRESERVE', + 'JSON_OBJECT', + 'JSON_OBJECTAGG', + 'JSON_OVERLAPS', + 'JSON_PRETTY', + 'JSON_QUOTE', + 'JSON_REMOVE', + 'JSON_REPLACE', + 'JSON_SCHEMA_VALID', + 'JSON_SCHEMA_VALIDATION_REPORT', + 'JSON_SEARCH', + 'JSON_SET', + 'JSON_STORAGE_FREE', + 'JSON_STORAGE_SIZE', + 'JSON_TABLE', + 'JSON_TYPE', + 'JSON_UNQUOTE', + 'JSON_VALID', + 'JSON_VALUE', + 'LAG', + 'LAST_DAY', + 'LAST_INSERT_ID', + 'LAST_VALUE', + 'LCASE', + 'LEAD', + 'LEAST', + 'LEFT', + 'LENGTH', + 'LIKE', + 'LINESTRING', + 'LN', + 'LOAD_FILE', + 'LOCALTIME', + 'LOCALTIMESTAMP', + 'LOCATE', + 'LOG', + 'LOG10', + 'LOG2', + 'LOWER', + 'LPAD', + 'LTRIM', + 'MAKE_SET', + 'MAKEDATE', + 'MAKETIME', + 'MASTER_POS_WAIT', + 'MATCH', + 'MAX', + 'MBRCONTAINS', + 'MBRCOVEREDBY', + 'MBRCOVERS', + 'MBRDISJOINT', + 'MBREQUALS', + 'MBRINTERSECTS', + 'MBROVERLAPS', + 'MBRTOUCHES', + 'MBRWITHIN', + 'MD5', + 'MEMBER OF', + 'MICROSECOND', + 'MID', + 'MIN', + 'MINUTE', + 'MOD', + 'MONTH', + 'MONTHNAME', + 'MULTILINESTRING', + 'MULTIPOINT', + 'MULTIPOLYGON', + 'NAME_CONST', + 'NOT', + 'NOT IN', + 'NOT LIKE', + 'NOT REGEXP', + 'NOW', + 'NTH_VALUE', + 'NTILE', + 'NULLIF', + 'OCT', + 'OCTET_LENGTH', + // 'OR', + 'ORD', + 'PERCENT_RANK', + 'PERIOD_ADD', + 'PERIOD_DIFF', + 'PI', + 'POINT', + 'POLYGON', + 'POSITION', + 'POW', + 'POWER', + 'PS_CURRENT_THREAD_ID', + 'PS_THREAD_ID', + 'QUARTER', + 'QUOTE', + 'RADIANS', + 'RAND', + 'RANDOM_BYTES', + 'RANK', + 'REGEXP', + 'REGEXP_INSTR', + 'REGEXP_LIKE', + 'REGEXP_REPLACE', + 'REGEXP_SUBSTR', + 'RELEASE_ALL_LOCKS', + 'RELEASE_LOCK', + 'REPEAT', + 'REPLACE', + 'REVERSE', + 'RIGHT', + 'RLIKE', + 'ROLES_GRAPHML', + 'ROUND', + 'ROW_COUNT', + 'ROW_NUMBER', + 'RPAD', + 'RTRIM', + 'SCHEMA', + 'SEC_TO_TIME', + 'SECOND', + 'SESSION_USER', + 'SHA1', + 'SHA2', + 'SIGN', + 'SIN', + 'SLEEP', + 'SOUNDEX', + 'SOUNDS LIKE', + 'SOURCE_POS_WAIT', + 'SPACE', + 'SQRT', + 'ST_AREA', + 'ST_ASBINARY', + 'ST_ASGEOJSON', + 'ST_ASTEXT', + 'ST_BUFFER', + 'ST_BUFFER_STRATEGY', + 'ST_CENTROID', + 'ST_COLLECT', + 'ST_CONTAINS', + 'ST_CONVEXHULL', + 'ST_CROSSES', + 'ST_DIFFERENCE', + 'ST_DIMENSION', + 'ST_DISJOINT', + 'ST_DISTANCE', + 'ST_DISTANCE_SPHERE', + 'ST_ENDPOINT', + 'ST_ENVELOPE', + 'ST_EQUALS', + 'ST_EXTERIORRING', + 'ST_FRECHETDISTANCE', + 'ST_GEOHASH', + 'ST_GEOMCOLLFROMTEXT', + 'ST_GEOMCOLLFROMWKB', + 'ST_GEOMETRYN', + 'ST_GEOMETRYTYPE', + 'ST_GEOMFROMGEOJSON', + 'ST_GEOMFROMTEXT', + 'ST_GEOMFROMWKB', + 'ST_HAUSDORFFDISTANCE', + 'ST_INTERIORRINGN', + 'ST_INTERSECTION', + 'ST_INTERSECTS', + 'ST_ISCLOSED', + 'ST_ISEMPTY', + 'ST_ISSIMPLE', + 'ST_ISVALID', + 'ST_LATFROMGEOHASH', + 'ST_LATITUDE', + 'ST_LENGTH', + 'ST_LINEFROMTEXT', + 'ST_LINEFROMWKB', + 'ST_LINEINTERPOLATEPOINT', + 'ST_LINEINTERPOLATEPOINTS', + 'ST_LONGFROMGEOHASH', + 'ST_LONGITUDE', + 'ST_MAKEENVELOPE', + 'ST_MLINEFROMTEXT', + 'ST_MLINEFROMWKB', + 'ST_MPOINTFROMTEXT', + 'ST_MPOINTFROMWKB', + 'ST_MPOLYFROMTEXT', + 'ST_MPOLYFROMWKB', + 'ST_NUMGEOMETRIES', + 'ST_NUMINTERIORRING', + 'ST_NUMPOINTS', + 'ST_OVERLAPS', + 'ST_POINTATDISTANCE', + 'ST_POINTFROMGEOHASH', + 'ST_POINTFROMTEXT', + 'ST_POINTFROMWKB', + 'ST_POINTN', + 'ST_POLYFROMTEXT', + 'ST_POLYFROMWKB', + 'ST_SIMPLIFY', + 'ST_SRID', + 'ST_STARTPOINT', + 'ST_SWAPXY', + 'ST_SYMDIFFERENCE', + 'ST_TOUCHES', + 'ST_TRANSFORM', + 'ST_UNION', + 'ST_VALIDATE', + 'ST_WITHIN', + 'ST_X', + 'ST_Y', + 'STATEMENT_DIGEST', + 'STATEMENT_DIGEST_TEXT', + 'STD', + 'STDDEV', + 'STDDEV_POP', + 'STDDEV_SAMP', + 'STR_TO_DATE', + 'STRCMP', + 'SUBDATE', + 'SUBSTR', + 'SUBSTRING', + 'SUBSTRING_INDEX', + 'SUBTIME', + 'SUM', + 'SYSDATE', + 'SYSTEM_USER', + 'TAN', + 'TIME', + 'TIME_FORMAT', + 'TIME_TO_SEC', + 'TIMEDIFF', + 'TIMESTAMP', + 'TIMESTAMPADD', + 'TIMESTAMPDIFF', + 'TO_BASE64', + 'TO_DAYS', + 'TO_SECONDS', + 'TRIM', + 'TRUNCATE', + 'UCASE', + 'UNCOMPRESS', + 'UNCOMPRESSED_LENGTH', + 'UNHEX', + 'UNIX_TIMESTAMP', + 'UPDATEXML', + 'UPPER', + // 'USER', + 'UTC_DATE', + 'UTC_TIME', + 'UTC_TIMESTAMP', + 'UUID', + 'UUID_SHORT', + 'UUID_TO_BIN', + 'VALIDATE_PASSWORD_STRENGTH', + 'VALUES', + 'VAR_POP', + 'VAR_SAMP', + 'VARIANCE', + 'VERSION', + 'WAIT_FOR_EXECUTED_GTID_SET', + 'WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS', + 'WEEK', + 'WEEKDAY', + 'WEEKOFYEAR', + 'WEIGHT_STRING', + // 'XOR', + 'YEAR', + 'YEARWEEK', + // Data types with parameters + // https://dev.mysql.com/doc/refman/8.0/en/data-types.html + 'BIT', + 'TINYINT', + 'SMALLINT', + 'MEDIUMINT', + 'INT', + 'INTEGER', + 'BIGINT', + 'DECIMAL', + 'DEC', + 'NUMERIC', + 'FIXED', + 'FLOAT', + 'DOUBLE', + 'DOUBLE PRECISION', + 'REAL', + 'DATETIME', + 'TIMESTAMP', + 'TIME', + 'YEAR', + 'CHAR', + 'NATIONAL CHAR', + 'VARCHAR', + 'NATIONAL VARCHAR', + 'BINARY', + 'VARBINARY', + 'BLOB', + 'TEXT', + 'ENUM', + // 'SET' // handled as special-case in postProcess +]; diff --git a/src/languages/mysql/mysql.keywords.ts b/src/languages/mysql/mysql.keywords.ts index 6658f67be7..0bb84f0e05 100644 --- a/src/languages/mysql/mysql.keywords.ts +++ b/src/languages/mysql/mysql.keywords.ts @@ -1,270 +1,266 @@ -import { flatKeywordList } from '../../utils.js'; - -export const keywords = flatKeywordList({ +export const keywords: string[] = [ // https://dev.mysql.com/doc/refman/8.0/en/keywords.html - reserved: [ - 'ACCESSIBLE', // (R) - 'ADD', // (R) - 'ALL', // (R) - 'ALTER', // (R) - 'ANALYZE', // (R) - 'AND', // (R) - 'AS', // (R) - 'ASC', // (R) - 'ASENSITIVE', // (R) - 'BEFORE', // (R) - 'BETWEEN', // (R) - 'BIGINT', // (R) - 'BINARY', // (R) - 'BLOB', // (R) - 'BOTH', // (R) - 'BY', // (R) - 'CALL', // (R) - 'CASCADE', // (R) - 'CASE', // (R) - 'CHANGE', // (R) - 'CHAR', // (R) - 'CHARACTER', // (R) - 'CHECK', // (R) - 'COLLATE', // (R) - 'COLUMN', // (R) - 'CONDITION', // (R) - 'CONSTRAINT', // (R) - 'CONTINUE', // (R) - 'CONVERT', // (R) - 'CREATE', // (R) - 'CROSS', // (R) - 'CUBE', // (R) - 'CUME_DIST', // (R) - 'CURRENT_DATE', // (R) - 'CURRENT_TIME', // (R) - 'CURRENT_TIMESTAMP', // (R) - 'CURRENT_USER', // (R) - 'CURSOR', // (R) - 'DATABASE', // (R) - 'DATABASES', // (R) - 'DAY_HOUR', // (R) - 'DAY_MICROSECOND', // (R) - 'DAY_MINUTE', // (R) - 'DAY_SECOND', // (R) - 'DEC', // (R) - 'DECIMAL', // (R) - 'DECLARE', // (R) - 'DEFAULT', // (R) - 'DELAYED', // (R) - 'DELETE', // (R) - 'DENSE_RANK', // (R) - 'DESC', // (R) - 'DESCRIBE', // (R) - 'DETERMINISTIC', // (R) - 'DISTINCT', // (R) - 'DISTINCTROW', // (R) - 'DIV', // (R) - 'DOUBLE', // (R) - 'DROP', // (R) - 'DUAL', // (R) - 'EACH', // (R) - 'ELSE', // (R) - 'ELSEIF', // (R) - 'EMPTY', // (R) - 'ENCLOSED', // (R) - 'ESCAPED', // (R) - 'EXCEPT', // (R) - 'EXISTS', // (R) - 'EXIT', // (R) - 'EXPLAIN', // (R) - 'FALSE', // (R) - 'FETCH', // (R) - 'FIRST_VALUE', // (R) - 'FLOAT', // (R) - 'FLOAT4', // (R) - 'FLOAT8', // (R) - 'FOR', // (R) - 'FORCE', // (R) - 'FOREIGN', // (R) - 'FROM', // (R) - 'FULLTEXT', // (R) - 'FUNCTION', // (R) - 'GENERATED', // (R) - 'GET', // (R) - 'GRANT', // (R) - 'GROUP', // (R) - 'GROUPING', // (R) - 'GROUPS', // (R) - 'HAVING', // (R) - 'HIGH_PRIORITY', // (R) - 'HOUR_MICROSECOND', // (R) - 'HOUR_MINUTE', // (R) - 'HOUR_SECOND', // (R) - 'IF', // (R) - 'IGNORE', // (R) - 'IN', // (R) - 'INDEX', // (R) - 'INFILE', // (R) - 'INNER', // (R) - 'INOUT', // (R) - 'INSENSITIVE', // (R) - 'INSERT', // (R) - 'IN', // <-- moved over from functions - 'INT', // (R) - 'INT1', // (R) - 'INT2', // (R) - 'INT3', // (R) - 'INT4', // (R) - 'INT8', // (R) - 'INTEGER', // (R) - 'INTERSECT', // (R) - 'INTERVAL', // (R) - 'INTO', // (R) - 'IO_AFTER_GTIDS', // (R) - 'IO_BEFORE_GTIDS', // (R) - 'IS', // (R) - 'ITERATE', // (R) - 'JOIN', // (R) - 'JSON_TABLE', // (R) - 'KEY', // (R) - 'KEYS', // (R) - 'KILL', // (R) - 'LAG', // (R) - 'LAST_VALUE', // (R) - 'LATERAL', // (R) - 'LEAD', // (R) - 'LEADING', // (R) - 'LEAVE', // (R) - 'LEFT', // (R) - 'LIKE', // (R) - 'LIMIT', // (R) - 'LINEAR', // (R) - 'LINES', // (R) - 'LOAD', // (R) - 'LOCALTIME', // (R) - 'LOCALTIMESTAMP', // (R) - 'LOCK', // (R) - 'LONG', // (R) - 'LONGBLOB', // (R) - 'LONGTEXT', // (R) - 'LOOP', // (R) - 'LOW_PRIORITY', // (R) - 'MASTER_BIND', // (R) - 'MASTER_SSL_VERIFY_SERVER_CERT', // (R) - 'MATCH', // (R) - 'MAXVALUE', // (R) - 'MEDIUMBLOB', // (R) - 'MEDIUMINT', // (R) - 'MEDIUMTEXT', // (R) - 'MIDDLEINT', // (R) - 'MINUTE_MICROSECOND', // (R) - 'MINUTE_SECOND', // (R) - 'MOD', // (R) - 'MODIFIES', // (R) - 'NATURAL', // (R) - 'NOT', // (R) - 'NO_WRITE_TO_BINLOG', // (R) - 'NTH_VALUE', // (R) - 'NTILE', // (R) - 'NULL', // (R) - 'NUMERIC', // (R) - 'OF', // (R) - 'ON', // (R) - 'OPTIMIZE', // (R) - 'OPTIMIZER_COSTS', // (R) - 'OPTION', // (R) - 'OPTIONALLY', // (R) - 'OR', // (R) - 'ORDER', // (R) - 'OUT', // (R) - 'OUTER', // (R) - 'OUTFILE', // (R) - 'OVER', // (R) - 'PARTITION', // (R) - 'PERCENT_RANK', // (R) - 'PRECISION', // (R) - 'PRIMARY', // (R) - 'PROCEDURE', // (R) - 'PURGE', // (R) - 'RANGE', // (R) - 'RANK', // (R) - 'READ', // (R) - 'READS', // (R) - 'READ_WRITE', // (R) - 'REAL', // (R) - 'RECURSIVE', // (R) - 'REFERENCES', // (R) - 'REGEXP', // (R) - 'RELEASE', // (R) - 'RENAME', // (R) - 'REPEAT', // (R) - 'REPLACE', // (R) - 'REQUIRE', // (R) - 'RESIGNAL', // (R) - 'RESTRICT', // (R) - 'RETURN', // (R) - 'REVOKE', // (R) - 'RIGHT', // (R) - 'RLIKE', // (R) - 'ROW', // (R) - 'ROWS', // (R) - 'ROW_NUMBER', // (R) - 'SCHEMA', // (R) - 'SCHEMAS', // (R) - 'SECOND_MICROSECOND', // (R) - 'SELECT', // (R) - 'SENSITIVE', // (R) - 'SEPARATOR', // (R) - 'SET', // (R) - 'SHOW', // (R) - 'SIGNAL', // (R) - 'SMALLINT', // (R) - 'SPATIAL', // (R) - 'SPECIFIC', // (R) - 'SQL', // (R) - 'SQLEXCEPTION', // (R) - 'SQLSTATE', // (R) - 'SQLWARNING', // (R) - 'SQL_BIG_RESULT', // (R) - 'SQL_CALC_FOUND_ROWS', // (R) - 'SQL_SMALL_RESULT', // (R) - 'SSL', // (R) - 'STARTING', // (R) - 'STORED', // (R) - 'STRAIGHT_JOIN', // (R) - 'SYSTEM', // (R) - 'TABLE', // (R) - 'TERMINATED', // (R) - 'THEN', // (R) - 'TINYBLOB', // (R) - 'TINYINT', // (R) - 'TINYTEXT', // (R) - 'TO', // (R) - 'TRAILING', // (R) - 'TRIGGER', // (R) - 'TRUE', // (R) - 'UNDO', // (R) - 'UNION', // (R) - 'UNIQUE', // (R) - 'UNLOCK', // (R) - 'UNSIGNED', // (R) - 'UPDATE', // (R) - 'USAGE', // (R) - 'USE', // (R) - 'USING', // (R) - 'UTC_DATE', // (R) - 'UTC_TIME', // (R) - 'UTC_TIMESTAMP', // (R) - 'VALUES', // (R) - 'VARBINARY', // (R) - 'VARCHAR', // (R) - 'VARCHARACTER', // (R) - 'VARYING', // (R) - 'VIRTUAL', // (R) - 'WHEN', // (R) - 'WHERE', // (R) - 'WHILE', // (R) - 'WINDOW', // (R) - 'WITH', // (R) - 'WRITE', // (R) - 'XOR', // (R) - 'YEAR_MONTH', // (R) - 'ZEROFILL', // (R) - ], -}); + 'ACCESSIBLE', // (R) + 'ADD', // (R) + 'ALL', // (R) + 'ALTER', // (R) + 'ANALYZE', // (R) + 'AND', // (R) + 'AS', // (R) + 'ASC', // (R) + 'ASENSITIVE', // (R) + 'BEFORE', // (R) + 'BETWEEN', // (R) + 'BIGINT', // (R) + 'BINARY', // (R) + 'BLOB', // (R) + 'BOTH', // (R) + 'BY', // (R) + 'CALL', // (R) + 'CASCADE', // (R) + 'CASE', // (R) + 'CHANGE', // (R) + 'CHAR', // (R) + 'CHARACTER', // (R) + 'CHECK', // (R) + 'COLLATE', // (R) + 'COLUMN', // (R) + 'CONDITION', // (R) + 'CONSTRAINT', // (R) + 'CONTINUE', // (R) + 'CONVERT', // (R) + 'CREATE', // (R) + 'CROSS', // (R) + 'CUBE', // (R) + 'CUME_DIST', // (R) + 'CURRENT_DATE', // (R) + 'CURRENT_TIME', // (R) + 'CURRENT_TIMESTAMP', // (R) + 'CURRENT_USER', // (R) + 'CURSOR', // (R) + 'DATABASE', // (R) + 'DATABASES', // (R) + 'DAY_HOUR', // (R) + 'DAY_MICROSECOND', // (R) + 'DAY_MINUTE', // (R) + 'DAY_SECOND', // (R) + 'DEC', // (R) + 'DECIMAL', // (R) + 'DECLARE', // (R) + 'DEFAULT', // (R) + 'DELAYED', // (R) + 'DELETE', // (R) + 'DENSE_RANK', // (R) + 'DESC', // (R) + 'DESCRIBE', // (R) + 'DETERMINISTIC', // (R) + 'DISTINCT', // (R) + 'DISTINCTROW', // (R) + 'DIV', // (R) + 'DOUBLE', // (R) + 'DROP', // (R) + 'DUAL', // (R) + 'EACH', // (R) + 'ELSE', // (R) + 'ELSEIF', // (R) + 'EMPTY', // (R) + 'ENCLOSED', // (R) + 'ESCAPED', // (R) + 'EXCEPT', // (R) + 'EXISTS', // (R) + 'EXIT', // (R) + 'EXPLAIN', // (R) + 'FALSE', // (R) + 'FETCH', // (R) + 'FIRST_VALUE', // (R) + 'FLOAT', // (R) + 'FLOAT4', // (R) + 'FLOAT8', // (R) + 'FOR', // (R) + 'FORCE', // (R) + 'FOREIGN', // (R) + 'FROM', // (R) + 'FULLTEXT', // (R) + 'FUNCTION', // (R) + 'GENERATED', // (R) + 'GET', // (R) + 'GRANT', // (R) + 'GROUP', // (R) + 'GROUPING', // (R) + 'GROUPS', // (R) + 'HAVING', // (R) + 'HIGH_PRIORITY', // (R) + 'HOUR_MICROSECOND', // (R) + 'HOUR_MINUTE', // (R) + 'HOUR_SECOND', // (R) + 'IF', // (R) + 'IGNORE', // (R) + 'IN', // (R) + 'INDEX', // (R) + 'INFILE', // (R) + 'INNER', // (R) + 'INOUT', // (R) + 'INSENSITIVE', // (R) + 'INSERT', // (R) + 'IN', // <-- moved over from functions + 'INT', // (R) + 'INT1', // (R) + 'INT2', // (R) + 'INT3', // (R) + 'INT4', // (R) + 'INT8', // (R) + 'INTEGER', // (R) + 'INTERSECT', // (R) + 'INTERVAL', // (R) + 'INTO', // (R) + 'IO_AFTER_GTIDS', // (R) + 'IO_BEFORE_GTIDS', // (R) + 'IS', // (R) + 'ITERATE', // (R) + 'JOIN', // (R) + 'JSON_TABLE', // (R) + 'KEY', // (R) + 'KEYS', // (R) + 'KILL', // (R) + 'LAG', // (R) + 'LAST_VALUE', // (R) + 'LATERAL', // (R) + 'LEAD', // (R) + 'LEADING', // (R) + 'LEAVE', // (R) + 'LEFT', // (R) + 'LIKE', // (R) + 'LIMIT', // (R) + 'LINEAR', // (R) + 'LINES', // (R) + 'LOAD', // (R) + 'LOCALTIME', // (R) + 'LOCALTIMESTAMP', // (R) + 'LOCK', // (R) + 'LONG', // (R) + 'LONGBLOB', // (R) + 'LONGTEXT', // (R) + 'LOOP', // (R) + 'LOW_PRIORITY', // (R) + 'MASTER_BIND', // (R) + 'MASTER_SSL_VERIFY_SERVER_CERT', // (R) + 'MATCH', // (R) + 'MAXVALUE', // (R) + 'MEDIUMBLOB', // (R) + 'MEDIUMINT', // (R) + 'MEDIUMTEXT', // (R) + 'MIDDLEINT', // (R) + 'MINUTE_MICROSECOND', // (R) + 'MINUTE_SECOND', // (R) + 'MOD', // (R) + 'MODIFIES', // (R) + 'NATURAL', // (R) + 'NOT', // (R) + 'NO_WRITE_TO_BINLOG', // (R) + 'NTH_VALUE', // (R) + 'NTILE', // (R) + 'NULL', // (R) + 'NUMERIC', // (R) + 'OF', // (R) + 'ON', // (R) + 'OPTIMIZE', // (R) + 'OPTIMIZER_COSTS', // (R) + 'OPTION', // (R) + 'OPTIONALLY', // (R) + 'OR', // (R) + 'ORDER', // (R) + 'OUT', // (R) + 'OUTER', // (R) + 'OUTFILE', // (R) + 'OVER', // (R) + 'PARTITION', // (R) + 'PERCENT_RANK', // (R) + 'PRECISION', // (R) + 'PRIMARY', // (R) + 'PROCEDURE', // (R) + 'PURGE', // (R) + 'RANGE', // (R) + 'RANK', // (R) + 'READ', // (R) + 'READS', // (R) + 'READ_WRITE', // (R) + 'REAL', // (R) + 'RECURSIVE', // (R) + 'REFERENCES', // (R) + 'REGEXP', // (R) + 'RELEASE', // (R) + 'RENAME', // (R) + 'REPEAT', // (R) + 'REPLACE', // (R) + 'REQUIRE', // (R) + 'RESIGNAL', // (R) + 'RESTRICT', // (R) + 'RETURN', // (R) + 'REVOKE', // (R) + 'RIGHT', // (R) + 'RLIKE', // (R) + 'ROW', // (R) + 'ROWS', // (R) + 'ROW_NUMBER', // (R) + 'SCHEMA', // (R) + 'SCHEMAS', // (R) + 'SECOND_MICROSECOND', // (R) + 'SELECT', // (R) + 'SENSITIVE', // (R) + 'SEPARATOR', // (R) + 'SET', // (R) + 'SHOW', // (R) + 'SIGNAL', // (R) + 'SMALLINT', // (R) + 'SPATIAL', // (R) + 'SPECIFIC', // (R) + 'SQL', // (R) + 'SQLEXCEPTION', // (R) + 'SQLSTATE', // (R) + 'SQLWARNING', // (R) + 'SQL_BIG_RESULT', // (R) + 'SQL_CALC_FOUND_ROWS', // (R) + 'SQL_SMALL_RESULT', // (R) + 'SSL', // (R) + 'STARTING', // (R) + 'STORED', // (R) + 'STRAIGHT_JOIN', // (R) + 'SYSTEM', // (R) + 'TABLE', // (R) + 'TERMINATED', // (R) + 'THEN', // (R) + 'TINYBLOB', // (R) + 'TINYINT', // (R) + 'TINYTEXT', // (R) + 'TO', // (R) + 'TRAILING', // (R) + 'TRIGGER', // (R) + 'TRUE', // (R) + 'UNDO', // (R) + 'UNION', // (R) + 'UNIQUE', // (R) + 'UNLOCK', // (R) + 'UNSIGNED', // (R) + 'UPDATE', // (R) + 'USAGE', // (R) + 'USE', // (R) + 'USING', // (R) + 'UTC_DATE', // (R) + 'UTC_TIME', // (R) + 'UTC_TIMESTAMP', // (R) + 'VALUES', // (R) + 'VARBINARY', // (R) + 'VARCHAR', // (R) + 'VARCHARACTER', // (R) + 'VARYING', // (R) + 'VIRTUAL', // (R) + 'WHEN', // (R) + 'WHERE', // (R) + 'WHILE', // (R) + 'WINDOW', // (R) + 'WITH', // (R) + 'WRITE', // (R) + 'XOR', // (R) + 'YEAR_MONTH', // (R) + 'ZEROFILL', // (R) +]; diff --git a/src/languages/n1ql/n1ql.functions.ts b/src/languages/n1ql/n1ql.functions.ts index 80e85d732a..366f698266 100644 --- a/src/languages/n1ql/n1ql.functions.ts +++ b/src/languages/n1ql/n1ql.functions.ts @@ -1,235 +1,231 @@ -import { flatKeywordList } from '../../utils.js'; - -export const functions = flatKeywordList({ +export const functions: string[] = [ // https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/functions.html - all: [ - 'ABORT', - 'ABS', - 'ACOS', - 'ADVISOR', - 'ARRAY_AGG', - 'ARRAY_AGG', - 'ARRAY_APPEND', - 'ARRAY_AVG', - 'ARRAY_BINARY_SEARCH', - 'ARRAY_CONCAT', - 'ARRAY_CONTAINS', - 'ARRAY_COUNT', - 'ARRAY_DISTINCT', - 'ARRAY_EXCEPT', - 'ARRAY_FLATTEN', - 'ARRAY_IFNULL', - 'ARRAY_INSERT', - 'ARRAY_INTERSECT', - 'ARRAY_LENGTH', - 'ARRAY_MAX', - 'ARRAY_MIN', - 'ARRAY_MOVE', - 'ARRAY_POSITION', - 'ARRAY_PREPEND', - 'ARRAY_PUT', - 'ARRAY_RANGE', - 'ARRAY_REMOVE', - 'ARRAY_REPEAT', - 'ARRAY_REPLACE', - 'ARRAY_REVERSE', - 'ARRAY_SORT', - 'ARRAY_STAR', - 'ARRAY_SUM', - 'ARRAY_SYMDIFF', - 'ARRAY_SYMDIFF1', - 'ARRAY_SYMDIFFN', - 'ARRAY_UNION', - 'ASIN', - 'ATAN', - 'ATAN2', - 'AVG', - 'BASE64', - 'BASE64_DECODE', - 'BASE64_ENCODE', - 'BITAND ', - 'BITCLEAR ', - 'BITNOT ', - 'BITOR ', - 'BITSET ', - 'BITSHIFT ', - 'BITTEST ', - 'BITXOR ', - 'CEIL', - 'CLOCK_LOCAL', - 'CLOCK_MILLIS', - 'CLOCK_STR', - 'CLOCK_TZ', - 'CLOCK_UTC', - 'COALESCE', - 'CONCAT', - 'CONCAT2', - 'CONTAINS', - 'CONTAINS_TOKEN', - 'CONTAINS_TOKEN_LIKE', - 'CONTAINS_TOKEN_REGEXP', - 'COS', - 'COUNT', - 'COUNT', - 'COUNTN', - 'CUME_DIST', - 'CURL', - 'DATE_ADD_MILLIS', - 'DATE_ADD_STR', - 'DATE_DIFF_MILLIS', - 'DATE_DIFF_STR', - 'DATE_FORMAT_STR', - 'DATE_PART_MILLIS', - 'DATE_PART_STR', - 'DATE_RANGE_MILLIS', - 'DATE_RANGE_STR', - 'DATE_TRUNC_MILLIS', - 'DATE_TRUNC_STR', - 'DECODE', - 'DECODE_JSON', - 'DEGREES', - 'DENSE_RANK', - 'DURATION_TO_STR', - // 'E', - 'ENCODED_SIZE', - 'ENCODE_JSON', - 'EXP', - 'FIRST_VALUE', - 'FLOOR', - 'GREATEST', - 'HAS_TOKEN', - 'IFINF', - 'IFMISSING', - 'IFMISSINGORNULL', - 'IFNAN', - 'IFNANORINF', - 'IFNULL', - 'INITCAP', - 'ISARRAY', - 'ISATOM', - 'ISBITSET', - 'ISBOOLEAN', - 'ISNUMBER', - 'ISOBJECT', - 'ISSTRING', - 'LAG', - 'LAST_VALUE', - 'LEAD', - 'LEAST', - 'LENGTH', - 'LN', - 'LOG', - 'LOWER', - 'LTRIM', - 'MAX', - 'MEAN', - 'MEDIAN', - 'META', - 'MILLIS', - 'MILLIS_TO_LOCAL', - 'MILLIS_TO_STR', - 'MILLIS_TO_TZ', - 'MILLIS_TO_UTC', - 'MILLIS_TO_ZONE_NAME', - 'MIN', - 'MISSINGIF', - 'NANIF', - 'NEGINFIF', - 'NOW_LOCAL', - 'NOW_MILLIS', - 'NOW_STR', - 'NOW_TZ', - 'NOW_UTC', - 'NTH_VALUE', - 'NTILE', - 'NULLIF', - 'NVL', - 'NVL2', - 'OBJECT_ADD', - 'OBJECT_CONCAT', - 'OBJECT_INNER_PAIRS', - 'OBJECT_INNER_VALUES', - 'OBJECT_LENGTH', - 'OBJECT_NAMES', - 'OBJECT_PAIRS', - 'OBJECT_PUT', - 'OBJECT_REMOVE', - 'OBJECT_RENAME', - 'OBJECT_REPLACE', - 'OBJECT_UNWRAP', - 'OBJECT_VALUES', - 'PAIRS', - 'PERCENT_RANK', - 'PI', - 'POLY_LENGTH', - 'POSINFIF', - 'POSITION', - 'POWER', - 'RADIANS', - 'RANDOM', - 'RANK', - 'RATIO_TO_REPORT', - 'REGEXP_CONTAINS', - 'REGEXP_LIKE', - 'REGEXP_MATCHES', - 'REGEXP_POSITION', - 'REGEXP_REPLACE', - 'REGEXP_SPLIT', - 'REGEX_CONTAINS', - 'REGEX_LIKE', - 'REGEX_MATCHES', - 'REGEX_POSITION', - 'REGEX_REPLACE', - 'REGEX_SPLIT', - 'REPEAT', - 'REPLACE', - 'REVERSE', - 'ROUND', - 'ROW_NUMBER', - 'RTRIM', - 'SEARCH', - 'SEARCH_META', - 'SEARCH_SCORE', - 'SIGN', - 'SIN', - 'SPLIT', - 'SQRT', - 'STDDEV', - 'STDDEV_POP', - 'STDDEV_SAMP', - 'STR_TO_DURATION', - 'STR_TO_MILLIS', - 'STR_TO_TZ', - 'STR_TO_UTC', - 'STR_TO_ZONE_NAME', - 'SUBSTR', - 'SUFFIXES', - 'SUM', - 'TAN', - 'TITLE', - 'TOARRAY', - 'TOATOM', - 'TOBOOLEAN', - 'TOKENS', - 'TOKENS', - 'TONUMBER', - 'TOOBJECT', - 'TOSTRING', - 'TRIM', - 'TRUNC', - // 'TYPE', // disabled - 'UPPER', - 'UUID', - 'VARIANCE', - 'VARIANCE_POP', - 'VARIANCE_SAMP', - 'VAR_POP', - 'VAR_SAMP', - 'WEEKDAY_MILLIS', - 'WEEKDAY_STR', - // type casting - // not implemented in N1QL, but added here now for the sake of tests - // https://docs.couchbase.com/server/current/analytics/3_query.html#Vs_SQL-92 - 'CAST', - ], -}); + 'ABORT', + 'ABS', + 'ACOS', + 'ADVISOR', + 'ARRAY_AGG', + 'ARRAY_AGG', + 'ARRAY_APPEND', + 'ARRAY_AVG', + 'ARRAY_BINARY_SEARCH', + 'ARRAY_CONCAT', + 'ARRAY_CONTAINS', + 'ARRAY_COUNT', + 'ARRAY_DISTINCT', + 'ARRAY_EXCEPT', + 'ARRAY_FLATTEN', + 'ARRAY_IFNULL', + 'ARRAY_INSERT', + 'ARRAY_INTERSECT', + 'ARRAY_LENGTH', + 'ARRAY_MAX', + 'ARRAY_MIN', + 'ARRAY_MOVE', + 'ARRAY_POSITION', + 'ARRAY_PREPEND', + 'ARRAY_PUT', + 'ARRAY_RANGE', + 'ARRAY_REMOVE', + 'ARRAY_REPEAT', + 'ARRAY_REPLACE', + 'ARRAY_REVERSE', + 'ARRAY_SORT', + 'ARRAY_STAR', + 'ARRAY_SUM', + 'ARRAY_SYMDIFF', + 'ARRAY_SYMDIFF1', + 'ARRAY_SYMDIFFN', + 'ARRAY_UNION', + 'ASIN', + 'ATAN', + 'ATAN2', + 'AVG', + 'BASE64', + 'BASE64_DECODE', + 'BASE64_ENCODE', + 'BITAND ', + 'BITCLEAR ', + 'BITNOT ', + 'BITOR ', + 'BITSET ', + 'BITSHIFT ', + 'BITTEST ', + 'BITXOR ', + 'CEIL', + 'CLOCK_LOCAL', + 'CLOCK_MILLIS', + 'CLOCK_STR', + 'CLOCK_TZ', + 'CLOCK_UTC', + 'COALESCE', + 'CONCAT', + 'CONCAT2', + 'CONTAINS', + 'CONTAINS_TOKEN', + 'CONTAINS_TOKEN_LIKE', + 'CONTAINS_TOKEN_REGEXP', + 'COS', + 'COUNT', + 'COUNT', + 'COUNTN', + 'CUME_DIST', + 'CURL', + 'DATE_ADD_MILLIS', + 'DATE_ADD_STR', + 'DATE_DIFF_MILLIS', + 'DATE_DIFF_STR', + 'DATE_FORMAT_STR', + 'DATE_PART_MILLIS', + 'DATE_PART_STR', + 'DATE_RANGE_MILLIS', + 'DATE_RANGE_STR', + 'DATE_TRUNC_MILLIS', + 'DATE_TRUNC_STR', + 'DECODE', + 'DECODE_JSON', + 'DEGREES', + 'DENSE_RANK', + 'DURATION_TO_STR', + // 'E', + 'ENCODED_SIZE', + 'ENCODE_JSON', + 'EXP', + 'FIRST_VALUE', + 'FLOOR', + 'GREATEST', + 'HAS_TOKEN', + 'IFINF', + 'IFMISSING', + 'IFMISSINGORNULL', + 'IFNAN', + 'IFNANORINF', + 'IFNULL', + 'INITCAP', + 'ISARRAY', + 'ISATOM', + 'ISBITSET', + 'ISBOOLEAN', + 'ISNUMBER', + 'ISOBJECT', + 'ISSTRING', + 'LAG', + 'LAST_VALUE', + 'LEAD', + 'LEAST', + 'LENGTH', + 'LN', + 'LOG', + 'LOWER', + 'LTRIM', + 'MAX', + 'MEAN', + 'MEDIAN', + 'META', + 'MILLIS', + 'MILLIS_TO_LOCAL', + 'MILLIS_TO_STR', + 'MILLIS_TO_TZ', + 'MILLIS_TO_UTC', + 'MILLIS_TO_ZONE_NAME', + 'MIN', + 'MISSINGIF', + 'NANIF', + 'NEGINFIF', + 'NOW_LOCAL', + 'NOW_MILLIS', + 'NOW_STR', + 'NOW_TZ', + 'NOW_UTC', + 'NTH_VALUE', + 'NTILE', + 'NULLIF', + 'NVL', + 'NVL2', + 'OBJECT_ADD', + 'OBJECT_CONCAT', + 'OBJECT_INNER_PAIRS', + 'OBJECT_INNER_VALUES', + 'OBJECT_LENGTH', + 'OBJECT_NAMES', + 'OBJECT_PAIRS', + 'OBJECT_PUT', + 'OBJECT_REMOVE', + 'OBJECT_RENAME', + 'OBJECT_REPLACE', + 'OBJECT_UNWRAP', + 'OBJECT_VALUES', + 'PAIRS', + 'PERCENT_RANK', + 'PI', + 'POLY_LENGTH', + 'POSINFIF', + 'POSITION', + 'POWER', + 'RADIANS', + 'RANDOM', + 'RANK', + 'RATIO_TO_REPORT', + 'REGEXP_CONTAINS', + 'REGEXP_LIKE', + 'REGEXP_MATCHES', + 'REGEXP_POSITION', + 'REGEXP_REPLACE', + 'REGEXP_SPLIT', + 'REGEX_CONTAINS', + 'REGEX_LIKE', + 'REGEX_MATCHES', + 'REGEX_POSITION', + 'REGEX_REPLACE', + 'REGEX_SPLIT', + 'REPEAT', + 'REPLACE', + 'REVERSE', + 'ROUND', + 'ROW_NUMBER', + 'RTRIM', + 'SEARCH', + 'SEARCH_META', + 'SEARCH_SCORE', + 'SIGN', + 'SIN', + 'SPLIT', + 'SQRT', + 'STDDEV', + 'STDDEV_POP', + 'STDDEV_SAMP', + 'STR_TO_DURATION', + 'STR_TO_MILLIS', + 'STR_TO_TZ', + 'STR_TO_UTC', + 'STR_TO_ZONE_NAME', + 'SUBSTR', + 'SUFFIXES', + 'SUM', + 'TAN', + 'TITLE', + 'TOARRAY', + 'TOATOM', + 'TOBOOLEAN', + 'TOKENS', + 'TOKENS', + 'TONUMBER', + 'TOOBJECT', + 'TOSTRING', + 'TRIM', + 'TRUNC', + // 'TYPE', // disabled + 'UPPER', + 'UUID', + 'VARIANCE', + 'VARIANCE_POP', + 'VARIANCE_SAMP', + 'VAR_POP', + 'VAR_SAMP', + 'WEEKDAY_MILLIS', + 'WEEKDAY_STR', + // type casting + // not implemented in N1QL, but added here now for the sake of tests + // https://docs.couchbase.com/server/current/analytics/3_query.html#Vs_SQL-92 + 'CAST', +]; diff --git a/src/languages/n1ql/n1ql.keywords.ts b/src/languages/n1ql/n1ql.keywords.ts index 31ae3111be..825739a7a4 100644 --- a/src/languages/n1ql/n1ql.keywords.ts +++ b/src/languages/n1ql/n1ql.keywords.ts @@ -1,211 +1,207 @@ -import { flatKeywordList } from '../../utils.js'; - -export const keywords = flatKeywordList({ +export const keywords: string[] = [ // https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/reservedwords.html - all: [ - 'ADVISE', - 'ALL', - 'ALTER', - 'ANALYZE', - 'AND', - 'ANY', - 'ARRAY', - 'AS', - 'ASC', - 'AT', - 'BEGIN', - 'BETWEEN', - 'BINARY', - 'BOOLEAN', - 'BREAK', - 'BUCKET', - 'BUILD', - 'BY', - 'CALL', - 'CASE', - 'CAST', - 'CLUSTER', - 'COLLATE', - 'COLLECTION', - 'COMMIT', - 'COMMITTED', - 'CONNECT', - 'CONTINUE', - 'CORRELATED', - 'COVER', - 'CREATE', - 'CURRENT', - 'DATABASE', - 'DATASET', - 'DATASTORE', - 'DECLARE', - 'DECREMENT', - 'DELETE', - 'DERIVED', - 'DESC', - 'DESCRIBE', - 'DISTINCT', - 'DO', - 'DROP', - 'EACH', - 'ELEMENT', - 'ELSE', - 'END', - 'EVERY', - 'EXCEPT', - 'EXCLUDE', - 'EXECUTE', - 'EXISTS', - 'EXPLAIN', - 'FALSE', - 'FETCH', - 'FILTER', - 'FIRST', - 'FLATTEN', - 'FLUSH', - 'FOLLOWING', - 'FOR', - 'FORCE', - 'FROM', - 'FTS', - 'FUNCTION', - 'GOLANG', - 'GRANT', - 'GROUP', - 'GROUPS', - 'GSI', - 'HASH', - 'HAVING', - 'IF', - 'ISOLATION', - 'IGNORE', - 'ILIKE', - 'IN', - 'INCLUDE', - 'INCREMENT', - 'INDEX', - 'INFER', - 'INLINE', - 'INNER', - 'INSERT', - 'INTERSECT', - 'INTO', - 'IS', - 'JAVASCRIPT', - 'JOIN', - 'KEY', - 'KEYS', - 'KEYSPACE', - 'KNOWN', - 'LANGUAGE', - 'LAST', - 'LEFT', - 'LET', - 'LETTING', - 'LEVEL', - 'LIKE', - 'LIMIT', - 'LSM', - 'MAP', - 'MAPPING', - 'MATCHED', - 'MATERIALIZED', - 'MERGE', - 'MINUS', - 'MISSING', - 'NAMESPACE', - 'NEST', - 'NL', - 'NO', - 'NOT', - 'NTH_VALUE', - 'NULL', - 'NULLS', - 'NUMBER', - 'OBJECT', - 'OFFSET', - 'ON', - 'OPTION', - 'OPTIONS', - 'OR', - 'ORDER', - 'OTHERS', - 'OUTER', - 'OVER', - 'PARSE', - 'PARTITION', - 'PASSWORD', - 'PATH', - 'POOL', - 'PRECEDING', - 'PREPARE', - 'PRIMARY', - 'PRIVATE', - 'PRIVILEGE', - 'PROBE', - 'PROCEDURE', - 'PUBLIC', - 'RANGE', - 'RAW', - 'REALM', - 'REDUCE', - 'RENAME', - 'RESPECT', - 'RETURN', - 'RETURNING', - 'REVOKE', - 'RIGHT', - 'ROLE', - 'ROLLBACK', - 'ROW', - 'ROWS', - 'SATISFIES', - 'SAVEPOINT', - 'SCHEMA', - 'SCOPE', - 'SELECT', - 'SELF', - 'SEMI', - 'SET', - 'SHOW', - 'SOME', - 'START', - 'STATISTICS', - 'STRING', - 'SYSTEM', - 'THEN', - 'TIES', - 'TO', - 'TRAN', - 'TRANSACTION', - 'TRIGGER', - 'TRUE', - 'TRUNCATE', - 'UNBOUNDED', - 'UNDER', - 'UNION', - 'UNIQUE', - 'UNKNOWN', - 'UNNEST', - 'UNSET', - 'UPDATE', - 'UPSERT', - 'USE', - 'USER', - 'USING', - 'VALIDATE', - 'VALUE', - 'VALUED', - 'VALUES', - 'VIA', - 'VIEW', - 'WHEN', - 'WHERE', - 'WHILE', - 'WINDOW', - 'WITH', - 'WITHIN', - 'WORK', - 'XOR', - ], -}); + 'ADVISE', + 'ALL', + 'ALTER', + 'ANALYZE', + 'AND', + 'ANY', + 'ARRAY', + 'AS', + 'ASC', + 'AT', + 'BEGIN', + 'BETWEEN', + 'BINARY', + 'BOOLEAN', + 'BREAK', + 'BUCKET', + 'BUILD', + 'BY', + 'CALL', + 'CASE', + 'CAST', + 'CLUSTER', + 'COLLATE', + 'COLLECTION', + 'COMMIT', + 'COMMITTED', + 'CONNECT', + 'CONTINUE', + 'CORRELATED', + 'COVER', + 'CREATE', + 'CURRENT', + 'DATABASE', + 'DATASET', + 'DATASTORE', + 'DECLARE', + 'DECREMENT', + 'DELETE', + 'DERIVED', + 'DESC', + 'DESCRIBE', + 'DISTINCT', + 'DO', + 'DROP', + 'EACH', + 'ELEMENT', + 'ELSE', + 'END', + 'EVERY', + 'EXCEPT', + 'EXCLUDE', + 'EXECUTE', + 'EXISTS', + 'EXPLAIN', + 'FALSE', + 'FETCH', + 'FILTER', + 'FIRST', + 'FLATTEN', + 'FLUSH', + 'FOLLOWING', + 'FOR', + 'FORCE', + 'FROM', + 'FTS', + 'FUNCTION', + 'GOLANG', + 'GRANT', + 'GROUP', + 'GROUPS', + 'GSI', + 'HASH', + 'HAVING', + 'IF', + 'ISOLATION', + 'IGNORE', + 'ILIKE', + 'IN', + 'INCLUDE', + 'INCREMENT', + 'INDEX', + 'INFER', + 'INLINE', + 'INNER', + 'INSERT', + 'INTERSECT', + 'INTO', + 'IS', + 'JAVASCRIPT', + 'JOIN', + 'KEY', + 'KEYS', + 'KEYSPACE', + 'KNOWN', + 'LANGUAGE', + 'LAST', + 'LEFT', + 'LET', + 'LETTING', + 'LEVEL', + 'LIKE', + 'LIMIT', + 'LSM', + 'MAP', + 'MAPPING', + 'MATCHED', + 'MATERIALIZED', + 'MERGE', + 'MINUS', + 'MISSING', + 'NAMESPACE', + 'NEST', + 'NL', + 'NO', + 'NOT', + 'NTH_VALUE', + 'NULL', + 'NULLS', + 'NUMBER', + 'OBJECT', + 'OFFSET', + 'ON', + 'OPTION', + 'OPTIONS', + 'OR', + 'ORDER', + 'OTHERS', + 'OUTER', + 'OVER', + 'PARSE', + 'PARTITION', + 'PASSWORD', + 'PATH', + 'POOL', + 'PRECEDING', + 'PREPARE', + 'PRIMARY', + 'PRIVATE', + 'PRIVILEGE', + 'PROBE', + 'PROCEDURE', + 'PUBLIC', + 'RANGE', + 'RAW', + 'REALM', + 'REDUCE', + 'RENAME', + 'RESPECT', + 'RETURN', + 'RETURNING', + 'REVOKE', + 'RIGHT', + 'ROLE', + 'ROLLBACK', + 'ROW', + 'ROWS', + 'SATISFIES', + 'SAVEPOINT', + 'SCHEMA', + 'SCOPE', + 'SELECT', + 'SELF', + 'SEMI', + 'SET', + 'SHOW', + 'SOME', + 'START', + 'STATISTICS', + 'STRING', + 'SYSTEM', + 'THEN', + 'TIES', + 'TO', + 'TRAN', + 'TRANSACTION', + 'TRIGGER', + 'TRUE', + 'TRUNCATE', + 'UNBOUNDED', + 'UNDER', + 'UNION', + 'UNIQUE', + 'UNKNOWN', + 'UNNEST', + 'UNSET', + 'UPDATE', + 'UPSERT', + 'USE', + 'USER', + 'USING', + 'VALIDATE', + 'VALUE', + 'VALUED', + 'VALUES', + 'VIA', + 'VIEW', + 'WHEN', + 'WHERE', + 'WHILE', + 'WINDOW', + 'WITH', + 'WITHIN', + 'WORK', + 'XOR', +]; diff --git a/src/languages/plsql/plsql.functions.ts b/src/languages/plsql/plsql.functions.ts index 6284040abb..d3858dabcf 100644 --- a/src/languages/plsql/plsql.functions.ts +++ b/src/languages/plsql/plsql.functions.ts @@ -1,264 +1,313 @@ -import { flatKeywordList } from '../../utils.js'; - -export const functions = flatKeywordList({ +export const functions: string[] = [ // https://docs.oracle.com/cd/B19306_01/server.102/b14200/functions001.htm - numeric: [ - 'ABS', - 'ACOS', - 'ASIN', - 'ATAN', - 'ATAN2', - 'BITAND', - 'CEIL', - 'COS', - 'COSH', - 'EXP', - 'FLOOR', - 'LN', - 'LOG', - 'MOD', - 'NANVL', - 'POWER', - 'REMAINDER', - 'ROUND', - 'SIGN', - 'SIN', - 'SINH', - 'SQRT', - 'TAN', - 'TANH', - 'TRUNC', - 'WIDTH_BUCKET', - ], - character: [ - 'CHR', - 'CONCAT', - 'INITCAP', - 'LOWER', - 'LPAD', - 'LTRIM', - 'NLS_INITCAP', - 'NLS_LOWER', - 'NLSSORT', - 'NLS_UPPER', - 'REGEXP_REPLACE', - 'REGEXP_SUBSTR', - 'REPLACE', - 'RPAD', - 'RTRIM', - 'SOUNDEX', - 'SUBSTR', - 'TRANSLATE', - 'TREAT', - 'TRIM', - 'UPPER', + // numeric + 'ABS', + 'ACOS', + 'ASIN', + 'ATAN', + 'ATAN2', + 'BITAND', + 'CEIL', + 'COS', + 'COSH', + 'EXP', + 'FLOOR', + 'LN', + 'LOG', + 'MOD', + 'NANVL', + 'POWER', + 'REMAINDER', + 'ROUND', + 'SIGN', + 'SIN', + 'SINH', + 'SQRT', + 'TAN', + 'TANH', + 'TRUNC', + 'WIDTH_BUCKET', + + // character + 'CHR', + 'CONCAT', + 'INITCAP', + 'LOWER', + 'LPAD', + 'LTRIM', + 'NLS_INITCAP', + 'NLS_LOWER', + 'NLSSORT', + 'NLS_UPPER', + 'REGEXP_REPLACE', + 'REGEXP_SUBSTR', + 'REPLACE', + 'RPAD', + 'RTRIM', + 'SOUNDEX', + 'SUBSTR', + 'TRANSLATE', + 'TREAT', + 'TRIM', + 'UPPER', + + 'NLS_CHARSET_DECL_LEN', + 'NLS_CHARSET_ID', + 'NLS_CHARSET_NAME', + + 'ASCII', + 'INSTR', + 'LENGTH', + 'REGEXP_INSTR', + + // datetime + 'ADD_MONTHS', + 'CURRENT_DATE', + 'CURRENT_TIMESTAMP', + 'DBTIMEZONE', + 'EXTRACT', + 'FROM_TZ', + 'LAST_DAY', + 'LOCALTIMESTAMP', + 'MONTHS_BETWEEN', + 'NEW_TIME', + 'NEXT_DAY', + 'NUMTODSINTERVAL', + 'NUMTOYMINTERVAL', + 'ROUND', + 'SESSIONTIMEZONE', + 'SYS_EXTRACT_UTC', + 'SYSDATE', + 'SYSTIMESTAMP', + 'TO_CHAR', + 'TO_TIMESTAMP', + 'TO_TIMESTAMP_TZ', + 'TO_DSINTERVAL', + 'TO_YMINTERVAL', + 'TRUNC', + 'TZ_OFFSET', + + // comparison + 'GREATEST', + 'LEAST', + + // conversion + 'ASCIISTR', + 'BIN_TO_NUM', + 'CAST', + 'CHARTOROWID', + 'COMPOSE', + 'CONVERT', + 'DECOMPOSE', + 'HEXTORAW', + 'NUMTODSINTERVAL', + 'NUMTOYMINTERVAL', + 'RAWTOHEX', + 'RAWTONHEX', + 'ROWIDTOCHAR', + 'ROWIDTONCHAR', + 'SCN_TO_TIMESTAMP', + 'TIMESTAMP_TO_SCN', + 'TO_BINARY_DOUBLE', + 'TO_BINARY_FLOAT', + 'TO_CHAR', + 'TO_CLOB', + 'TO_DATE', + 'TO_DSINTERVAL', + 'TO_LOB', + 'TO_MULTI_BYTE', + 'TO_NCHAR', + 'TO_NCLOB', + 'TO_NUMBER', + 'TO_DSINTERVAL', + 'TO_SINGLE_BYTE', + 'TO_TIMESTAMP', + 'TO_TIMESTAMP_TZ', + 'TO_YMINTERVAL', + 'TO_YMINTERVAL', + 'TRANSLATE', + 'UNISTR', + + // largeObject + 'BFILENAME', + 'EMPTY_BLOB,', + 'EMPTY_CLOB', + + // collection + 'CARDINALITY', + 'COLLECT', + 'POWERMULTISET', + 'POWERMULTISET_BY_CARDINALITY', + 'SET', - 'NLS_CHARSET_DECL_LEN', - 'NLS_CHARSET_ID', - 'NLS_CHARSET_NAME', + // hierarchical + 'SYS_CONNECT_BY_PATH', + + // dataMining + 'CLUSTER_ID', + 'CLUSTER_PROBABILITY', + 'CLUSTER_SET', + 'FEATURE_ID', + 'FEATURE_SET', + 'FEATURE_VALUE', + 'PREDICTION', + 'PREDICTION_COST', + 'PREDICTION_DETAILS', + 'PREDICTION_PROBABILITY', + 'PREDICTION_SET', + + // xml + 'APPENDCHILDXML', + 'DELETEXML', + 'DEPTH', + 'EXTRACT', + 'EXISTSNODE', + 'EXTRACTVALUE', + 'INSERTCHILDXML', + 'INSERTXMLBEFORE', + 'PATH', + 'SYS_DBURIGEN', + 'SYS_XMLAGG', + 'SYS_XMLGEN', + 'UPDATEXML', + 'XMLAGG', + 'XMLCDATA', + 'XMLCOLATTVAL', + 'XMLCOMMENT', + 'XMLCONCAT', + 'XMLFOREST', + 'XMLPARSE', + 'XMLPI', + 'XMLQUERY', + 'XMLROOT', + 'XMLSEQUENCE', + 'XMLSERIALIZE', + 'XMLTABLE', + 'XMLTRANSFORM', + + // encoding + 'DECODE', + 'DUMP', + 'ORA_HASH', + 'VSIZE', + + // nullRelated + 'COALESCE', + 'LNNVL', + 'NULLIF', + 'NVL', + 'NVL2', + + // env + 'SYS_CONTEXT', + 'SYS_GUID', + 'SYS_TYPEID', + 'UID', + 'USER', + 'USERENV', + + // aggregate + 'AVG', + 'COLLECT', + 'CORR', + 'CORR_S', + 'CORR_K', + 'COUNT', + 'COVAR_POP', + 'COVAR_SAMP', + 'CUME_DIST', + 'DENSE_RANK', + 'FIRST', + 'GROUP_ID', + 'GROUPING', + 'GROUPING_ID', + 'LAST', + 'MAX', + 'MEDIAN', + 'MIN', + 'PERCENTILE_CONT', + 'PERCENTILE_DISC', + 'PERCENT_RANK', + 'RANK', + 'REGR_SLOPE', + 'REGR_INTERCEPT', + 'REGR_COUNT', + 'REGR_R2', + 'REGR_AVGX', + 'REGR_AVGY', + 'REGR_SXX', + 'REGR_SYY', + 'REGR_SXY', + 'STATS_BINOMIAL_TEST', + 'STATS_CROSSTAB', + 'STATS_F_TEST', + 'STATS_KS_TEST', + 'STATS_MODE', + 'STATS_MW_TEST', + 'STATS_ONE_WAY_ANOVA', + 'STATS_T_TEST_ONE', + 'STATS_T_TEST_PAIRED', + 'STATS_T_TEST_INDEP', + 'STATS_T_TEST_INDEPU', + 'STATS_WSR_TEST', + 'STDDEV', + 'STDDEV_POP', + 'STDDEV_SAMP', + 'SUM', + 'VAR_POP', + 'VAR_SAMP', + 'VARIANCE', - 'ASCII', - 'INSTR', - 'LENGTH', - 'REGEXP_INSTR', - ], - datetime: [ - 'ADD_MONTHS', - 'CURRENT_DATE', - 'CURRENT_TIMESTAMP', - 'DBTIMEZONE', - 'EXTRACT', - 'FROM_TZ', - 'LAST_DAY', - 'LOCALTIMESTAMP', - 'MONTHS_BETWEEN', - 'NEW_TIME', - 'NEXT_DAY', - 'NUMTODSINTERVAL', - 'NUMTOYMINTERVAL', - 'ROUND', - 'SESSIONTIMEZONE', - 'SYS_EXTRACT_UTC', - 'SYSDATE', - 'SYSTIMESTAMP', - 'TO_CHAR', - 'TO_TIMESTAMP', - 'TO_TIMESTAMP_TZ', - 'TO_DSINTERVAL', - 'TO_YMINTERVAL', - 'TRUNC', - 'TZ_OFFSET', - ], - comparison: ['GREATEST', 'LEAST'], - conversion: [ - 'ASCIISTR', - 'BIN_TO_NUM', - 'CAST', - 'CHARTOROWID', - 'COMPOSE', - 'CONVERT', - 'DECOMPOSE', - 'HEXTORAW', - 'NUMTODSINTERVAL', - 'NUMTOYMINTERVAL', - 'RAWTOHEX', - 'RAWTONHEX', - 'ROWIDTOCHAR', - 'ROWIDTONCHAR', - 'SCN_TO_TIMESTAMP', - 'TIMESTAMP_TO_SCN', - 'TO_BINARY_DOUBLE', - 'TO_BINARY_FLOAT', - 'TO_CHAR', - 'TO_CLOB', - 'TO_DATE', - 'TO_DSINTERVAL', - 'TO_LOB', - 'TO_MULTI_BYTE', - 'TO_NCHAR', - 'TO_NCLOB', - 'TO_NUMBER', - 'TO_DSINTERVAL', - 'TO_SINGLE_BYTE', - 'TO_TIMESTAMP', - 'TO_TIMESTAMP_TZ', - 'TO_YMINTERVAL', - 'TO_YMINTERVAL', - 'TRANSLATE', - 'UNISTR', - ], - largeObject: ['BFILENAME', 'EMPTY_BLOB,', 'EMPTY_CLOB'], - collection: ['CARDINALITY', 'COLLECT', 'POWERMULTISET', 'POWERMULTISET_BY_CARDINALITY', 'SET'], - hierarchical: ['SYS_CONNECT_BY_PATH'], - dataMining: [ - 'CLUSTER_ID', - 'CLUSTER_PROBABILITY', - 'CLUSTER_SET', - 'FEATURE_ID', - 'FEATURE_SET', - 'FEATURE_VALUE', - 'PREDICTION', - 'PREDICTION_COST', - 'PREDICTION_DETAILS', - 'PREDICTION_PROBABILITY', - 'PREDICTION_SET', - ], - xml: [ - 'APPENDCHILDXML', - 'DELETEXML', - 'DEPTH', - 'EXTRACT', - 'EXISTSNODE', - 'EXTRACTVALUE', - 'INSERTCHILDXML', - 'INSERTXMLBEFORE', - 'PATH', - 'SYS_DBURIGEN', - 'SYS_XMLAGG', - 'SYS_XMLGEN', - 'UPDATEXML', - 'XMLAGG', - 'XMLCDATA', - 'XMLCOLATTVAL', - 'XMLCOMMENT', - 'XMLCONCAT', - 'XMLFOREST', - 'XMLPARSE', - 'XMLPI', - 'XMLQUERY', - 'XMLROOT', - 'XMLSEQUENCE', - 'XMLSERIALIZE', - 'XMLTABLE', - 'XMLTRANSFORM', - ], - encoding: ['DECODE', 'DUMP', 'ORA_HASH', 'VSIZE'], - nullRelated: ['COALESCE', 'LNNVL', 'NULLIF', 'NVL', 'NVL2'], - env: ['SYS_CONTEXT', 'SYS_GUID', 'SYS_TYPEID', 'UID', 'USER', 'USERENV'], - aggregate: [ - 'AVG', - 'COLLECT', - 'CORR', - 'CORR_S', - 'CORR_K', - 'COUNT', - 'COVAR_POP', - 'COVAR_SAMP', - 'CUME_DIST', - 'DENSE_RANK', - 'FIRST', - 'GROUP_ID', - 'GROUPING', - 'GROUPING_ID', - 'LAST', - 'MAX', - 'MEDIAN', - 'MIN', - 'PERCENTILE_CONT', - 'PERCENTILE_DISC', - 'PERCENT_RANK', - 'RANK', - 'REGR_SLOPE', - 'REGR_INTERCEPT', - 'REGR_COUNT', - 'REGR_R2', - 'REGR_AVGX', - 'REGR_AVGY', - 'REGR_SXX', - 'REGR_SYY', - 'REGR_SXY', - 'STATS_BINOMIAL_TEST', - 'STATS_CROSSTAB', - 'STATS_F_TEST', - 'STATS_KS_TEST', - 'STATS_MODE', - 'STATS_MW_TEST', - 'STATS_ONE_WAY_ANOVA', - 'STATS_T_TEST_ONE', - 'STATS_T_TEST_PAIRED', - 'STATS_T_TEST_INDEP', - 'STATS_T_TEST_INDEPU', - 'STATS_WSR_TEST', - 'STDDEV', - 'STDDEV_POP', - 'STDDEV_SAMP', - 'SUM', - 'VAR_POP', - 'VAR_SAMP', - 'VARIANCE', - ], // Windowing functions (minus the ones already listed in aggregates) - window: ['FIRST_VALUE', 'LAG', 'LAST_VALUE', 'LEAD', 'NTILE', 'RATIO_TO_REPORT', 'ROW_NUMBER'], - objectReference: ['DEREF', 'MAKE_REF', 'REF', 'REFTOHEX', 'VALUE'], - model: ['CV', 'ITERATION_NUMBER', 'PRESENTNNV', 'PRESENTV', 'PREVIOUS'], + // window + 'FIRST_VALUE', + 'LAG', + 'LAST_VALUE', + 'LEAD', + 'NTILE', + 'RATIO_TO_REPORT', + 'ROW_NUMBER', + + // objectReference + 'DEREF', + 'MAKE_REF', + 'REF', + 'REFTOHEX', + 'VALUE', + + // model + 'CV', + 'ITERATION_NUMBER', + 'PRESENTNNV', + 'PRESENTV', + 'PREVIOUS', + // Parameterized data types // https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/Data-Types.html - dataTypes: [ - // Oracle builtin data types - 'VARCHAR2', - 'NVARCHAR2', - 'NUMBER', - 'FLOAT', - 'TIMESTAMP', - 'INTERVAL YEAR', - 'INTERVAL DAY', - 'RAW', - 'UROWID', - 'NCHAR', - // ANSI Data Types - 'CHARACTER', - 'CHAR', - 'CHARACTER VARYING', - 'CHAR VARYING', - 'NATIONAL CHARACTER', - 'NATIONAL CHAR', - 'NATIONAL CHARACTER VARYING', - 'NATIONAL CHAR VARYING', - 'NCHAR VARYING', - 'NUMERIC', - 'DECIMAL', - 'FLOAT', - // SQL/DS and DB2 Data Types - 'VARCHAR', - ], -}); + // Oracle builtin data types + 'VARCHAR2', + 'NVARCHAR2', + 'NUMBER', + 'FLOAT', + 'TIMESTAMP', + 'INTERVAL YEAR', + 'INTERVAL DAY', + 'RAW', + 'UROWID', + 'NCHAR', + // ANSI Data Types + 'CHARACTER', + 'CHAR', + 'CHARACTER VARYING', + 'CHAR VARYING', + 'NATIONAL CHARACTER', + 'NATIONAL CHAR', + 'NATIONAL CHARACTER VARYING', + 'NATIONAL CHAR VARYING', + 'NCHAR VARYING', + 'NUMERIC', + 'DECIMAL', + 'FLOAT', + // SQL/DS and DB2 Data Types + 'VARCHAR', +]; diff --git a/src/languages/plsql/plsql.keywords.ts b/src/languages/plsql/plsql.keywords.ts index feac7cb7a5..88dec949ea 100644 --- a/src/languages/plsql/plsql.keywords.ts +++ b/src/languages/plsql/plsql.keywords.ts @@ -1,331 +1,327 @@ -import { flatKeywordList } from '../../utils.js'; - -export const keywords = flatKeywordList({ +export const keywords: string[] = [ // https://docs.oracle.com/cd/B19306_01/appdev.102/b14261/reservewords.htm - all: [ - // 'A', - 'ADD', - 'AGENT', - 'AGGREGATE', - 'ALL', - 'ALTER', - 'AND', - 'ANY', - 'ARRAY', - 'ARROW', - 'AS', - 'ASC', - 'AT', - 'ATTRIBUTE', - 'AUTHID', - 'AVG', - 'BEGIN', - 'BETWEEN', - 'BFILE_BASE', - 'BINARY', - 'BLOB_BASE', - 'BLOCK', - 'BODY', - 'BOTH', - 'BOUND', - 'BULK', - 'BY', - 'BYTE', - // 'C', - 'CALL', - 'CALLING', - 'CASCADE', - 'CASE', - 'CHAR', - 'CHAR_BASE', - 'CHARACTER', - 'CHARSET', - 'CHARSETFORM', - 'CHARSETID', - 'CHECK', - 'CLOB_BASE', - 'CLOSE', - 'CLUSTER', - 'CLUSTERS', - 'COLAUTH', - 'COLLECT', - 'COLUMNS', - 'COMMENT', - 'COMMIT', - 'COMMITTED', - 'COMPILED', - 'COMPRESS', - 'CONNECT', - 'CONSTANT', - 'CONSTRUCTOR', - 'CONTEXT', - 'CONVERT', - 'COUNT', - 'CRASH', - 'CREATE', - 'CURRENT', - 'CURSOR', - 'CUSTOMDATUM', - 'DANGLING', - 'DATA', - 'DATE', - 'DATE_BASE', - 'DAY', - 'DECIMAL', - 'DECLARE', - 'DEFAULT', - 'DEFINE', - 'DELETE', - 'DESC', - 'DETERMINISTIC', - 'DISTINCT', - 'DOUBLE', - 'DROP', - 'DURATION', - 'ELEMENT', - 'ELSE', - 'ELSIF', - 'EMPTY', - 'END', - 'ESCAPE', - 'EXCEPT', - 'EXCEPTION', - 'EXCEPTIONS', - 'EXCLUSIVE', - 'EXECUTE', - 'EXISTS', - 'EXIT', - 'EXTERNAL', - 'FETCH', - 'FINAL', - 'FIXED', - 'FLOAT', - 'FOR', - 'FORALL', - 'FORCE', - 'FORM', - 'FROM', - 'FUNCTION', - 'GENERAL', - 'GOTO', - 'GRANT', - 'GROUP', - 'HASH', - 'HAVING', - 'HEAP', - 'HIDDEN', - 'HOUR', - 'IDENTIFIED', - 'IF', - 'IMMEDIATE', - 'IN', - 'INCLUDING', - 'INDEX', - 'INDEXES', - 'INDICATOR', - 'INDICES', - 'INFINITE', - 'INSERT', - 'INSTANTIABLE', - 'INT', - 'INTERFACE', - 'INTERSECT', - 'INTERVAL', - 'INTO', - 'INVALIDATE', - 'IS', - 'ISOLATION', - 'JAVA', - 'LANGUAGE', - 'LARGE', - 'LEADING', - 'LENGTH', - 'LEVEL', - 'LIBRARY', - 'LIKE', - 'LIKE2', - 'LIKE4', - 'LIKEC', - 'LIMIT', - 'LIMITED', - 'LOCAL', - 'LOCK', - 'LONG', - 'LOOP', - 'MAP', - 'MAX', - 'MAXLEN', - 'MEMBER', - 'MERGE', - 'MIN', - 'MINUS', - 'MINUTE', - 'MOD', - 'MODE', - 'MODIFY', - 'MONTH', - 'MULTISET', - 'NAME', - 'NAN', - 'NATIONAL', - 'NATIVE', - 'NCHAR', - 'NEW', - 'NOCOMPRESS', - 'NOCOPY', - 'NOT', - 'NOWAIT', - 'NULL', - 'NUMBER_BASE', - 'OBJECT', - 'OCICOLL', - 'OCIDATE', - 'OCIDATETIME', - 'OCIDURATION', - 'OCIINTERVAL', - 'OCILOBLOCATOR', - 'OCINUMBER', - 'OCIRAW', - 'OCIREF', - 'OCIREFCURSOR', - 'OCIROWID', - 'OCISTRING', - 'OCITYPE', - 'OF', - 'ON', - 'ONLY', - 'OPAQUE', - 'OPEN', - 'OPERATOR', - 'OPTION', - 'OR', - 'ORACLE', - 'ORADATA', - 'ORDER', - 'OVERLAPS', - 'ORGANIZATION', - 'ORLANY', - 'ORLVARY', - 'OTHERS', - 'OUT', - 'OVERRIDING', - 'PACKAGE', - 'PARALLEL_ENABLE', - 'PARAMETER', - 'PARAMETERS', - 'PARTITION', - 'PASCAL', - 'PIPE', - 'PIPELINED', - 'PRAGMA', - 'PRECISION', - 'PRIOR', - 'PRIVATE', - 'PROCEDURE', - 'PUBLIC', - 'RAISE', - 'RANGE', - 'RAW', - 'READ', - 'RECORD', - 'REF', - 'REFERENCE', - 'REM', - 'REMAINDER', - 'RENAME', - 'RESOURCE', - 'RESULT', - 'RETURN', - 'RETURNING', - 'REVERSE', - 'REVOKE', - 'ROLLBACK', - 'ROW', - 'SAMPLE', - 'SAVE', - 'SAVEPOINT', - 'SB1', - 'SB2', - 'SB4', - 'SECOND', - 'SEGMENT', - 'SELECT', - 'SELF', - 'SEPARATE', - 'SEQUENCE', - 'SERIALIZABLE', - 'SET', - 'SHARE', - 'SHORT', - 'SIZE', - 'SIZE_T', - 'SOME', - 'SPARSE', - 'SQL', - 'SQLCODE', - 'SQLDATA', - 'SQLNAME', - 'SQLSTATE', - 'STANDARD', - 'START', - 'STATIC', - 'STDDEV', - 'STORED', - 'STRING', - 'STRUCT', - 'STYLE', - 'SUBMULTISET', - 'SUBPARTITION', - 'SUBSTITUTABLE', - 'SUBTYPE', - 'SUM', - 'SYNONYM', - 'TABAUTH', - 'TABLE', - 'TDO', - 'THE', - 'THEN', - 'TIME', - 'TIMESTAMP', - 'TIMEZONE_ABBR', - 'TIMEZONE_HOUR', - 'TIMEZONE_MINUTE', - 'TIMEZONE_REGION', - 'TO', - 'TRAILING', - 'TRANSAC', - 'TRANSACTIONAL', - 'TRUSTED', - 'TYPE', - 'UB1', - 'UB2', - 'UB4', - 'UNDER', - 'UNION', - 'UNIQUE', - 'UNSIGNED', - 'UNTRUSTED', - 'UPDATE', - 'USE', - 'USING', - 'VALIST', - 'VALUE', - 'VALUES', - 'VARIABLE', - 'VARIANCE', - 'VARRAY', - 'VARYING', - 'VIEW', - 'VIEWS', - 'VOID', - 'WHEN', - 'WHERE', - 'WHILE', - 'WITH', - 'WORK', - 'WRAPPED', - 'WRITE', - 'YEAR', - 'ZONE', - ], -}); + // 'A', + 'ADD', + 'AGENT', + 'AGGREGATE', + 'ALL', + 'ALTER', + 'AND', + 'ANY', + 'ARRAY', + 'ARROW', + 'AS', + 'ASC', + 'AT', + 'ATTRIBUTE', + 'AUTHID', + 'AVG', + 'BEGIN', + 'BETWEEN', + 'BFILE_BASE', + 'BINARY', + 'BLOB_BASE', + 'BLOCK', + 'BODY', + 'BOTH', + 'BOUND', + 'BULK', + 'BY', + 'BYTE', + // 'C', + 'CALL', + 'CALLING', + 'CASCADE', + 'CASE', + 'CHAR', + 'CHAR_BASE', + 'CHARACTER', + 'CHARSET', + 'CHARSETFORM', + 'CHARSETID', + 'CHECK', + 'CLOB_BASE', + 'CLOSE', + 'CLUSTER', + 'CLUSTERS', + 'COLAUTH', + 'COLLECT', + 'COLUMNS', + 'COMMENT', + 'COMMIT', + 'COMMITTED', + 'COMPILED', + 'COMPRESS', + 'CONNECT', + 'CONSTANT', + 'CONSTRUCTOR', + 'CONTEXT', + 'CONVERT', + 'COUNT', + 'CRASH', + 'CREATE', + 'CURRENT', + 'CURSOR', + 'CUSTOMDATUM', + 'DANGLING', + 'DATA', + 'DATE', + 'DATE_BASE', + 'DAY', + 'DECIMAL', + 'DECLARE', + 'DEFAULT', + 'DEFINE', + 'DELETE', + 'DESC', + 'DETERMINISTIC', + 'DISTINCT', + 'DOUBLE', + 'DROP', + 'DURATION', + 'ELEMENT', + 'ELSE', + 'ELSIF', + 'EMPTY', + 'END', + 'ESCAPE', + 'EXCEPT', + 'EXCEPTION', + 'EXCEPTIONS', + 'EXCLUSIVE', + 'EXECUTE', + 'EXISTS', + 'EXIT', + 'EXTERNAL', + 'FETCH', + 'FINAL', + 'FIXED', + 'FLOAT', + 'FOR', + 'FORALL', + 'FORCE', + 'FORM', + 'FROM', + 'FUNCTION', + 'GENERAL', + 'GOTO', + 'GRANT', + 'GROUP', + 'HASH', + 'HAVING', + 'HEAP', + 'HIDDEN', + 'HOUR', + 'IDENTIFIED', + 'IF', + 'IMMEDIATE', + 'IN', + 'INCLUDING', + 'INDEX', + 'INDEXES', + 'INDICATOR', + 'INDICES', + 'INFINITE', + 'INSERT', + 'INSTANTIABLE', + 'INT', + 'INTERFACE', + 'INTERSECT', + 'INTERVAL', + 'INTO', + 'INVALIDATE', + 'IS', + 'ISOLATION', + 'JAVA', + 'LANGUAGE', + 'LARGE', + 'LEADING', + 'LENGTH', + 'LEVEL', + 'LIBRARY', + 'LIKE', + 'LIKE2', + 'LIKE4', + 'LIKEC', + 'LIMIT', + 'LIMITED', + 'LOCAL', + 'LOCK', + 'LONG', + 'LOOP', + 'MAP', + 'MAX', + 'MAXLEN', + 'MEMBER', + 'MERGE', + 'MIN', + 'MINUS', + 'MINUTE', + 'MOD', + 'MODE', + 'MODIFY', + 'MONTH', + 'MULTISET', + 'NAME', + 'NAN', + 'NATIONAL', + 'NATIVE', + 'NCHAR', + 'NEW', + 'NOCOMPRESS', + 'NOCOPY', + 'NOT', + 'NOWAIT', + 'NULL', + 'NUMBER_BASE', + 'OBJECT', + 'OCICOLL', + 'OCIDATE', + 'OCIDATETIME', + 'OCIDURATION', + 'OCIINTERVAL', + 'OCILOBLOCATOR', + 'OCINUMBER', + 'OCIRAW', + 'OCIREF', + 'OCIREFCURSOR', + 'OCIROWID', + 'OCISTRING', + 'OCITYPE', + 'OF', + 'ON', + 'ONLY', + 'OPAQUE', + 'OPEN', + 'OPERATOR', + 'OPTION', + 'OR', + 'ORACLE', + 'ORADATA', + 'ORDER', + 'OVERLAPS', + 'ORGANIZATION', + 'ORLANY', + 'ORLVARY', + 'OTHERS', + 'OUT', + 'OVERRIDING', + 'PACKAGE', + 'PARALLEL_ENABLE', + 'PARAMETER', + 'PARAMETERS', + 'PARTITION', + 'PASCAL', + 'PIPE', + 'PIPELINED', + 'PRAGMA', + 'PRECISION', + 'PRIOR', + 'PRIVATE', + 'PROCEDURE', + 'PUBLIC', + 'RAISE', + 'RANGE', + 'RAW', + 'READ', + 'RECORD', + 'REF', + 'REFERENCE', + 'REM', + 'REMAINDER', + 'RENAME', + 'RESOURCE', + 'RESULT', + 'RETURN', + 'RETURNING', + 'REVERSE', + 'REVOKE', + 'ROLLBACK', + 'ROW', + 'SAMPLE', + 'SAVE', + 'SAVEPOINT', + 'SB1', + 'SB2', + 'SB4', + 'SECOND', + 'SEGMENT', + 'SELECT', + 'SELF', + 'SEPARATE', + 'SEQUENCE', + 'SERIALIZABLE', + 'SET', + 'SHARE', + 'SHORT', + 'SIZE', + 'SIZE_T', + 'SOME', + 'SPARSE', + 'SQL', + 'SQLCODE', + 'SQLDATA', + 'SQLNAME', + 'SQLSTATE', + 'STANDARD', + 'START', + 'STATIC', + 'STDDEV', + 'STORED', + 'STRING', + 'STRUCT', + 'STYLE', + 'SUBMULTISET', + 'SUBPARTITION', + 'SUBSTITUTABLE', + 'SUBTYPE', + 'SUM', + 'SYNONYM', + 'TABAUTH', + 'TABLE', + 'TDO', + 'THE', + 'THEN', + 'TIME', + 'TIMESTAMP', + 'TIMEZONE_ABBR', + 'TIMEZONE_HOUR', + 'TIMEZONE_MINUTE', + 'TIMEZONE_REGION', + 'TO', + 'TRAILING', + 'TRANSAC', + 'TRANSACTIONAL', + 'TRUSTED', + 'TYPE', + 'UB1', + 'UB2', + 'UB4', + 'UNDER', + 'UNION', + 'UNIQUE', + 'UNSIGNED', + 'UNTRUSTED', + 'UPDATE', + 'USE', + 'USING', + 'VALIST', + 'VALUE', + 'VALUES', + 'VARIABLE', + 'VARIANCE', + 'VARRAY', + 'VARYING', + 'VIEW', + 'VIEWS', + 'VOID', + 'WHEN', + 'WHERE', + 'WHILE', + 'WITH', + 'WORK', + 'WRAPPED', + 'WRITE', + 'YEAR', + 'ZONE', +]; diff --git a/src/languages/postgresql/postgresql.functions.ts b/src/languages/postgresql/postgresql.functions.ts index 81e3f09470..b3f256a94e 100644 --- a/src/languages/postgresql/postgresql.functions.ts +++ b/src/languages/postgresql/postgresql.functions.ts @@ -1,732 +1,725 @@ -import { flatKeywordList } from '../../utils.js'; - -export const functions = flatKeywordList({ +export const functions: string[] = [ // https://www.postgresql.org/docs/14/functions.html // // https://www.postgresql.org/docs/14/functions-math.html - math: [ - 'ABS', - 'ACOS', - 'ACOSD', - 'ACOSH', - 'ASIN', - 'ASIND', - 'ASINH', - 'ATAN', - 'ATAN2', - 'ATAN2D', - 'ATAND', - 'ATANH', - 'CBRT', - 'CEIL', - 'CEILING', - 'COS', - 'COSD', - 'COSH', - 'COT', - 'COTD', - 'DEGREES', - 'DIV', - 'EXP', - 'FACTORIAL', - 'FLOOR', - 'GCD', - 'LCM', - 'LN', - 'LOG', - 'LOG10', - 'MIN_SCALE', - 'MOD', - 'PI', - 'POWER', - 'RADIANS', - 'RANDOM', - 'ROUND', - 'SCALE', - 'SETSEED', - 'SIGN', - 'SIN', - 'SIND', - 'SINH', - 'SQRT', - 'TAN', - 'TAND', - 'TANH', - 'TRIM_SCALE', - 'TRUNC', - 'WIDTH_BUCKET', - ], + 'ABS', + 'ACOS', + 'ACOSD', + 'ACOSH', + 'ASIN', + 'ASIND', + 'ASINH', + 'ATAN', + 'ATAN2', + 'ATAN2D', + 'ATAND', + 'ATANH', + 'CBRT', + 'CEIL', + 'CEILING', + 'COS', + 'COSD', + 'COSH', + 'COT', + 'COTD', + 'DEGREES', + 'DIV', + 'EXP', + 'FACTORIAL', + 'FLOOR', + 'GCD', + 'LCM', + 'LN', + 'LOG', + 'LOG10', + 'MIN_SCALE', + 'MOD', + 'PI', + 'POWER', + 'RADIANS', + 'RANDOM', + 'ROUND', + 'SCALE', + 'SETSEED', + 'SIGN', + 'SIN', + 'SIND', + 'SINH', + 'SQRT', + 'TAN', + 'TAND', + 'TANH', + 'TRIM_SCALE', + 'TRUNC', + 'WIDTH_BUCKET', + // https://www.postgresql.org/docs/14/functions-string.html - string: [ - 'ABS', - 'ASCII', - 'BIT_LENGTH', - 'BTRIM', - 'CHARACTER_LENGTH', - 'CHAR_LENGTH', - 'CHR', - 'CONCAT', - 'CONCAT_WS', - 'FORMAT', - 'INITCAP', - 'LEFT', - 'LENGTH', - 'LOWER', - 'LPAD', - 'LTRIM', - 'MD5', - 'NORMALIZE', - 'OCTET_LENGTH', - 'OVERLAY', - 'PARSE_IDENT', - 'PG_CLIENT_ENCODING', - 'POSITION', - 'QUOTE_IDENT', - 'QUOTE_LITERAL', - 'QUOTE_NULLABLE', - 'REGEXP_MATCH', - 'REGEXP_MATCHES', - 'REGEXP_REPLACE', - 'REGEXP_SPLIT_TO_ARRAY', - 'REGEXP_SPLIT_TO_TABLE', - 'REPEAT', - 'REPLACE', - 'REVERSE', - 'RIGHT', - 'RPAD', - 'RTRIM', - 'SPLIT_PART', - 'SPRINTF', - 'STARTS_WITH', - 'STRING_AGG', - 'STRING_TO_ARRAY', - 'STRING_TO_TABLE', - 'STRPOS', - 'SUBSTR', - 'SUBSTRING', - 'TO_ASCII', - 'TO_HEX', - 'TRANSLATE', - 'TRIM', - 'UNISTR', - 'UPPER', - ], + 'ABS', + 'ASCII', + 'BIT_LENGTH', + 'BTRIM', + 'CHARACTER_LENGTH', + 'CHAR_LENGTH', + 'CHR', + 'CONCAT', + 'CONCAT_WS', + 'FORMAT', + 'INITCAP', + 'LEFT', + 'LENGTH', + 'LOWER', + 'LPAD', + 'LTRIM', + 'MD5', + 'NORMALIZE', + 'OCTET_LENGTH', + 'OVERLAY', + 'PARSE_IDENT', + 'PG_CLIENT_ENCODING', + 'POSITION', + 'QUOTE_IDENT', + 'QUOTE_LITERAL', + 'QUOTE_NULLABLE', + 'REGEXP_MATCH', + 'REGEXP_MATCHES', + 'REGEXP_REPLACE', + 'REGEXP_SPLIT_TO_ARRAY', + 'REGEXP_SPLIT_TO_TABLE', + 'REPEAT', + 'REPLACE', + 'REVERSE', + 'RIGHT', + 'RPAD', + 'RTRIM', + 'SPLIT_PART', + 'SPRINTF', + 'STARTS_WITH', + 'STRING_AGG', + 'STRING_TO_ARRAY', + 'STRING_TO_TABLE', + 'STRPOS', + 'SUBSTR', + 'SUBSTRING', + 'TO_ASCII', + 'TO_HEX', + 'TRANSLATE', + 'TRIM', + 'UNISTR', + 'UPPER', + // https://www.postgresql.org/docs/14/functions-binarystring.html - binary: [ - 'BIT_COUNT', - 'BIT_LENGTH', - 'BTRIM', - 'CONVERT', - 'CONVERT_FROM', - 'CONVERT_TO', - 'DECODE', - 'ENCODE', - 'GET_BIT', - 'GET_BYTE', - 'LENGTH', - 'LTRIM', - 'MD5', - 'OCTET_LENGTH', - 'OVERLAY', - 'POSITION', - 'RTRIM', - 'SET_BIT', - 'SET_BYTE', - 'SHA224', - 'SHA256', - 'SHA384', - 'SHA512', - 'STRING_AGG', - 'SUBSTR', - 'SUBSTRING', - 'TRIM', - ], + 'BIT_COUNT', + 'BIT_LENGTH', + 'BTRIM', + 'CONVERT', + 'CONVERT_FROM', + 'CONVERT_TO', + 'DECODE', + 'ENCODE', + 'GET_BIT', + 'GET_BYTE', + 'LENGTH', + 'LTRIM', + 'MD5', + 'OCTET_LENGTH', + 'OVERLAY', + 'POSITION', + 'RTRIM', + 'SET_BIT', + 'SET_BYTE', + 'SHA224', + 'SHA256', + 'SHA384', + 'SHA512', + 'STRING_AGG', + 'SUBSTR', + 'SUBSTRING', + 'TRIM', + // https://www.postgresql.org/docs/14/functions-bitstring.html - bitstring: [ - 'BIT_COUNT', - 'BIT_LENGTH', - 'GET_BIT', - 'LENGTH', - 'OCTET_LENGTH', - 'OVERLAY', - 'POSITION', - 'SET_BIT', - 'SUBSTRING', - ], + 'BIT_COUNT', + 'BIT_LENGTH', + 'GET_BIT', + 'LENGTH', + 'OCTET_LENGTH', + 'OVERLAY', + 'POSITION', + 'SET_BIT', + 'SUBSTRING', + // https://www.postgresql.org/docs/14/functions-matching.html - pattern: [ - 'REGEXP_MATCH', - 'REGEXP_MATCHES', - 'REGEXP_REPLACE', - 'REGEXP_SPLIT_TO_ARRAY', - 'REGEXP_SPLIT_TO_TABLE', - ], + 'REGEXP_MATCH', + 'REGEXP_MATCHES', + 'REGEXP_REPLACE', + 'REGEXP_SPLIT_TO_ARRAY', + 'REGEXP_SPLIT_TO_TABLE', + // https://www.postgresql.org/docs/14/functions-formatting.html - datatype: ['TO_CHAR', 'TO_DATE', 'TO_NUMBER', 'TO_TIMESTAMP'], + 'TO_CHAR', + 'TO_DATE', + 'TO_NUMBER', + 'TO_TIMESTAMP', + // https://www.postgresql.org/docs/14/functions-datetime.html - datetime: [ - // 'AGE', - 'CLOCK_TIMESTAMP', - 'CURRENT_DATE', - 'CURRENT_TIME', - 'CURRENT_TIMESTAMP', - 'DATE_BIN', - 'DATE_PART', - 'DATE_TRUNC', - 'EXTRACT', - 'ISFINITE', - 'JUSTIFY_DAYS', - 'JUSTIFY_HOURS', - 'JUSTIFY_INTERVAL', - 'LOCALTIME', - 'LOCALTIMESTAMP', - 'MAKE_DATE', - 'MAKE_INTERVAL', - 'MAKE_TIME', - 'MAKE_TIMESTAMP', - 'MAKE_TIMESTAMPTZ', - 'NOW', - 'PG_SLEEP', - 'PG_SLEEP_FOR', - 'PG_SLEEP_UNTIL', - 'STATEMENT_TIMESTAMP', - 'TIMEOFDAY', - 'TO_TIMESTAMP', - 'TRANSACTION_TIMESTAMP', - ], + // 'AGE', + 'CLOCK_TIMESTAMP', + 'CURRENT_DATE', + 'CURRENT_TIME', + 'CURRENT_TIMESTAMP', + 'DATE_BIN', + 'DATE_PART', + 'DATE_TRUNC', + 'EXTRACT', + 'ISFINITE', + 'JUSTIFY_DAYS', + 'JUSTIFY_HOURS', + 'JUSTIFY_INTERVAL', + 'LOCALTIME', + 'LOCALTIMESTAMP', + 'MAKE_DATE', + 'MAKE_INTERVAL', + 'MAKE_TIME', + 'MAKE_TIMESTAMP', + 'MAKE_TIMESTAMPTZ', + 'NOW', + 'PG_SLEEP', + 'PG_SLEEP_FOR', + 'PG_SLEEP_UNTIL', + 'STATEMENT_TIMESTAMP', + 'TIMEOFDAY', + 'TO_TIMESTAMP', + 'TRANSACTION_TIMESTAMP', + // https://www.postgresql.org/docs/14/functions-enum.html - enum: ['ENUM_FIRST', 'ENUM_LAST', 'ENUM_RANGE'], + 'ENUM_FIRST', + 'ENUM_LAST', + 'ENUM_RANGE', + // https://www.postgresql.org/docs/14/functions-geometry.html - geometry: [ - 'AREA', - 'BOUND_BOX', - 'BOX', - 'CENTER', - 'CIRCLE', - 'DIAGONAL', - 'DIAMETER', - 'HEIGHT', - 'ISCLOSED', - 'ISOPEN', - 'LENGTH', - 'LINE', - 'LSEG', - 'NPOINTS', - 'PATH', - 'PCLOSE', - 'POINT', - 'POLYGON', - 'POPEN', - 'RADIUS', - 'SLOPE', - 'WIDTH', - ], + 'AREA', + 'BOUND_BOX', + 'BOX', + 'CENTER', + 'CIRCLE', + 'DIAGONAL', + 'DIAMETER', + 'HEIGHT', + 'ISCLOSED', + 'ISOPEN', + 'LENGTH', + 'LINE', + 'LSEG', + 'NPOINTS', + 'PATH', + 'PCLOSE', + 'POINT', + 'POLYGON', + 'POPEN', + 'RADIUS', + 'SLOPE', + 'WIDTH', + // https://www.postgresql.org/docs/14/functions-net.html - network: [ - 'ABBREV', - 'BROADCAST', - 'FAMILY', - 'HOST', - 'HOSTMASK', - 'INET_MERGE', - 'INET_SAME_FAMILY', - 'MACADDR8_SET7BIT', - 'MASKLEN', - 'NETMASK', - 'NETWORK', - 'SET_MASKLEN', - 'TEXT', - 'TRUNC', - ], + 'ABBREV', + 'BROADCAST', + 'FAMILY', + 'HOST', + 'HOSTMASK', + 'INET_MERGE', + 'INET_SAME_FAMILY', + 'MACADDR8_SET7BIT', + 'MASKLEN', + 'NETMASK', + 'NETWORK', + 'SET_MASKLEN', + 'TEXT', + 'TRUNC', + // https://www.postgresql.org/docs/14/functions-textsearch.html - textsearch: [ - 'ARRAY_TO_TSVECTOR', - 'GET_CURRENT_TS_CONFIG', - 'JSONB_TO_TSVECTOR', - 'JSON_TO_TSVECTOR', - 'LENGTH', - 'NUMNODE', - 'PHRASETO_TSQUERY', - 'PLAINTO_TSQUERY', - 'QUERYTREE', - 'SETWEIGHT', - 'STRIP', - 'TO_TSQUERY', - 'TO_TSVECTOR', - 'TSQUERY_PHRASE', - 'TSVECTOR_TO_ARRAY', - 'TS_DEBUG', - 'TS_DELETE', - 'TS_FILTER', - 'TS_HEADLINE', - 'TS_LEXIZE', - 'TS_PARSE', - 'TS_RANK', - 'TS_RANK_CD', - 'TS_REWRITE', - 'TS_STAT', - 'TS_TOKEN_TYPE', - 'WEBSEARCH_TO_TSQUERY', - ], + 'ARRAY_TO_TSVECTOR', + 'GET_CURRENT_TS_CONFIG', + 'JSONB_TO_TSVECTOR', + 'JSON_TO_TSVECTOR', + 'LENGTH', + 'NUMNODE', + 'PHRASETO_TSQUERY', + 'PLAINTO_TSQUERY', + 'QUERYTREE', + 'SETWEIGHT', + 'STRIP', + 'TO_TSQUERY', + 'TO_TSVECTOR', + 'TSQUERY_PHRASE', + 'TSVECTOR_TO_ARRAY', + 'TS_DEBUG', + 'TS_DELETE', + 'TS_FILTER', + 'TS_HEADLINE', + 'TS_LEXIZE', + 'TS_PARSE', + 'TS_RANK', + 'TS_RANK_CD', + 'TS_REWRITE', + 'TS_STAT', + 'TS_TOKEN_TYPE', + 'WEBSEARCH_TO_TSQUERY', + // https://www.postgresql.org/docs/14/functions-uuid.html - uuid: ['UUID'], + 'UUID', + // https://www.postgresql.org/docs/14/functions-xml.html - xml: [ - 'CURSOR_TO_XML', - 'CURSOR_TO_XMLSCHEMA', - 'DATABASE_TO_XML', - 'DATABASE_TO_XMLSCHEMA', - 'DATABASE_TO_XML_AND_XMLSCHEMA', - 'NEXTVAL', - 'QUERY_TO_XML', - 'QUERY_TO_XMLSCHEMA', - 'QUERY_TO_XML_AND_XMLSCHEMA', - 'SCHEMA_TO_XML', - 'SCHEMA_TO_XMLSCHEMA', - 'SCHEMA_TO_XML_AND_XMLSCHEMA', - 'STRING', - 'TABLE_TO_XML', - 'TABLE_TO_XMLSCHEMA', - 'TABLE_TO_XML_AND_XMLSCHEMA', - 'XMLAGG', - 'XMLCOMMENT', - 'XMLCONCAT', - 'XMLELEMENT', - 'XMLEXISTS', - 'XMLFOREST', - 'XMLPARSE', - 'XMLPI', - 'XMLROOT', - 'XMLSERIALIZE', - 'XMLTABLE', - 'XML_IS_WELL_FORMED', - 'XML_IS_WELL_FORMED_CONTENT', - 'XML_IS_WELL_FORMED_DOCUMENT', - 'XPATH', - 'XPATH_EXISTS', - ], + 'CURSOR_TO_XML', + 'CURSOR_TO_XMLSCHEMA', + 'DATABASE_TO_XML', + 'DATABASE_TO_XMLSCHEMA', + 'DATABASE_TO_XML_AND_XMLSCHEMA', + 'NEXTVAL', + 'QUERY_TO_XML', + 'QUERY_TO_XMLSCHEMA', + 'QUERY_TO_XML_AND_XMLSCHEMA', + 'SCHEMA_TO_XML', + 'SCHEMA_TO_XMLSCHEMA', + 'SCHEMA_TO_XML_AND_XMLSCHEMA', + 'STRING', + 'TABLE_TO_XML', + 'TABLE_TO_XMLSCHEMA', + 'TABLE_TO_XML_AND_XMLSCHEMA', + 'XMLAGG', + 'XMLCOMMENT', + 'XMLCONCAT', + 'XMLELEMENT', + 'XMLEXISTS', + 'XMLFOREST', + 'XMLPARSE', + 'XMLPI', + 'XMLROOT', + 'XMLSERIALIZE', + 'XMLTABLE', + 'XML_IS_WELL_FORMED', + 'XML_IS_WELL_FORMED_CONTENT', + 'XML_IS_WELL_FORMED_DOCUMENT', + 'XPATH', + 'XPATH_EXISTS', + // https://www.postgresql.org/docs/14/functions-json.html - json: [ - 'ARRAY_TO_JSON', - 'JSONB_AGG', - 'JSONB_ARRAY_ELEMENTS', - 'JSONB_ARRAY_ELEMENTS_TEXT', - 'JSONB_ARRAY_LENGTH', - 'JSONB_BUILD_ARRAY', - 'JSONB_BUILD_OBJECT', - 'JSONB_EACH', - 'JSONB_EACH_TEXT', - 'JSONB_EXTRACT_PATH', - 'JSONB_EXTRACT_PATH_TEXT', - 'JSONB_INSERT', - 'JSONB_OBJECT', - 'JSONB_OBJECT_AGG', - 'JSONB_OBJECT_KEYS', - 'JSONB_PATH_EXISTS', - 'JSONB_PATH_EXISTS_TZ', - 'JSONB_PATH_MATCH', - 'JSONB_PATH_MATCH_TZ', - 'JSONB_PATH_QUERY', - 'JSONB_PATH_QUERY_ARRAY', - 'JSONB_PATH_QUERY_ARRAY_TZ', - 'JSONB_PATH_QUERY_FIRST', - 'JSONB_PATH_QUERY_FIRST_TZ', - 'JSONB_PATH_QUERY_TZ', - 'JSONB_POPULATE_RECORD', - 'JSONB_POPULATE_RECORDSET', - 'JSONB_PRETTY', - 'JSONB_SET', - 'JSONB_SET_LAX', - 'JSONB_STRIP_NULLS', - 'JSONB_TO_RECORD', - 'JSONB_TO_RECORDSET', - 'JSONB_TYPEOF', - 'JSON_AGG', - 'JSON_ARRAY_ELEMENTS', - 'JSON_ARRAY_ELEMENTS_TEXT', - 'JSON_ARRAY_LENGTH', - 'JSON_BUILD_ARRAY', - 'JSON_BUILD_OBJECT', - 'JSON_EACH', - 'JSON_EACH_TEXT', - 'JSON_EXTRACT_PATH', - 'JSON_EXTRACT_PATH_TEXT', - 'JSON_OBJECT', - 'JSON_OBJECT_AGG', - 'JSON_OBJECT_KEYS', - 'JSON_POPULATE_RECORD', - 'JSON_POPULATE_RECORDSET', - 'JSON_STRIP_NULLS', - 'JSON_TO_RECORD', - 'JSON_TO_RECORDSET', - 'JSON_TYPEOF', - 'ROW_TO_JSON', - 'TO_JSON', - 'TO_JSONB', - 'TO_TIMESTAMP', - ], + 'ARRAY_TO_JSON', + 'JSONB_AGG', + 'JSONB_ARRAY_ELEMENTS', + 'JSONB_ARRAY_ELEMENTS_TEXT', + 'JSONB_ARRAY_LENGTH', + 'JSONB_BUILD_ARRAY', + 'JSONB_BUILD_OBJECT', + 'JSONB_EACH', + 'JSONB_EACH_TEXT', + 'JSONB_EXTRACT_PATH', + 'JSONB_EXTRACT_PATH_TEXT', + 'JSONB_INSERT', + 'JSONB_OBJECT', + 'JSONB_OBJECT_AGG', + 'JSONB_OBJECT_KEYS', + 'JSONB_PATH_EXISTS', + 'JSONB_PATH_EXISTS_TZ', + 'JSONB_PATH_MATCH', + 'JSONB_PATH_MATCH_TZ', + 'JSONB_PATH_QUERY', + 'JSONB_PATH_QUERY_ARRAY', + 'JSONB_PATH_QUERY_ARRAY_TZ', + 'JSONB_PATH_QUERY_FIRST', + 'JSONB_PATH_QUERY_FIRST_TZ', + 'JSONB_PATH_QUERY_TZ', + 'JSONB_POPULATE_RECORD', + 'JSONB_POPULATE_RECORDSET', + 'JSONB_PRETTY', + 'JSONB_SET', + 'JSONB_SET_LAX', + 'JSONB_STRIP_NULLS', + 'JSONB_TO_RECORD', + 'JSONB_TO_RECORDSET', + 'JSONB_TYPEOF', + 'JSON_AGG', + 'JSON_ARRAY_ELEMENTS', + 'JSON_ARRAY_ELEMENTS_TEXT', + 'JSON_ARRAY_LENGTH', + 'JSON_BUILD_ARRAY', + 'JSON_BUILD_OBJECT', + 'JSON_EACH', + 'JSON_EACH_TEXT', + 'JSON_EXTRACT_PATH', + 'JSON_EXTRACT_PATH_TEXT', + 'JSON_OBJECT', + 'JSON_OBJECT_AGG', + 'JSON_OBJECT_KEYS', + 'JSON_POPULATE_RECORD', + 'JSON_POPULATE_RECORDSET', + 'JSON_STRIP_NULLS', + 'JSON_TO_RECORD', + 'JSON_TO_RECORDSET', + 'JSON_TYPEOF', + 'ROW_TO_JSON', + 'TO_JSON', + 'TO_JSONB', + 'TO_TIMESTAMP', + // https://www.postgresql.org/docs/14/functions-sequence.html - sequence: ['CURRVAL', 'LASTVAL', 'NEXTVAL', 'SETVAL'], + 'CURRVAL', + 'LASTVAL', + 'NEXTVAL', + 'SETVAL', + // https://www.postgresql.org/docs/14/functions-conditional.html - conditional: [ - // 'CASE', - 'COALESCE', - 'GREATEST', - 'LEAST', - 'NULLIF', - ], + // 'CASE', + 'COALESCE', + 'GREATEST', + 'LEAST', + 'NULLIF', + // https://www.postgresql.org/docs/14/functions-array.html - array: [ - 'ARRAY_AGG', - 'ARRAY_APPEND', - 'ARRAY_CAT', - 'ARRAY_DIMS', - 'ARRAY_FILL', - 'ARRAY_LENGTH', - 'ARRAY_LOWER', - 'ARRAY_NDIMS', - 'ARRAY_POSITION', - 'ARRAY_POSITIONS', - 'ARRAY_PREPEND', - 'ARRAY_REMOVE', - 'ARRAY_REPLACE', - 'ARRAY_TO_STRING', - 'ARRAY_UPPER', - 'CARDINALITY', - 'STRING_TO_ARRAY', - 'TRIM_ARRAY', - 'UNNEST', - ], + 'ARRAY_AGG', + 'ARRAY_APPEND', + 'ARRAY_CAT', + 'ARRAY_DIMS', + 'ARRAY_FILL', + 'ARRAY_LENGTH', + 'ARRAY_LOWER', + 'ARRAY_NDIMS', + 'ARRAY_POSITION', + 'ARRAY_POSITIONS', + 'ARRAY_PREPEND', + 'ARRAY_REMOVE', + 'ARRAY_REPLACE', + 'ARRAY_TO_STRING', + 'ARRAY_UPPER', + 'CARDINALITY', + 'STRING_TO_ARRAY', + 'TRIM_ARRAY', + 'UNNEST', + // https://www.postgresql.org/docs/14/functions-range.html - range: [ - 'ISEMPTY', - 'LOWER', - 'LOWER_INC', - 'LOWER_INF', - 'MULTIRANGE', - 'RANGE_MERGE', - 'UPPER', - 'UPPER_INC', - 'UPPER_INF', - ], + 'ISEMPTY', + 'LOWER', + 'LOWER_INC', + 'LOWER_INF', + 'MULTIRANGE', + 'RANGE_MERGE', + 'UPPER', + 'UPPER_INC', + 'UPPER_INF', + // https://www.postgresql.org/docs/14/functions-aggregate.html - aggregate: [ - // 'ANY', - 'ARRAY_AGG', - 'AVG', - 'BIT_AND', - 'BIT_OR', - 'BIT_XOR', - 'BOOL_AND', - 'BOOL_OR', - 'COALESCE', - 'CORR', - 'COUNT', - 'COVAR_POP', - 'COVAR_SAMP', - 'CUME_DIST', - 'DENSE_RANK', - 'EVERY', - 'GROUPING', - 'JSONB_AGG', - 'JSONB_OBJECT_AGG', - 'JSON_AGG', - 'JSON_OBJECT_AGG', - 'MAX', - 'MIN', - 'MODE', - 'PERCENTILE_CONT', - 'PERCENTILE_DISC', - 'PERCENT_RANK', - 'RANGE_AGG', - 'RANGE_INTERSECT_AGG', - 'RANK', - 'REGR_AVGX', - 'REGR_AVGY', - 'REGR_COUNT', - 'REGR_INTERCEPT', - 'REGR_R2', - 'REGR_SLOPE', - 'REGR_SXX', - 'REGR_SXY', - 'REGR_SYY', - // 'SOME', - 'STDDEV', - 'STDDEV_POP', - 'STDDEV_SAMP', - 'STRING_AGG', - 'SUM', - 'TO_JSON', - 'TO_JSONB', - 'VARIANCE', - 'VAR_POP', - 'VAR_SAMP', - 'XMLAGG', - ], + // 'ANY', + 'ARRAY_AGG', + 'AVG', + 'BIT_AND', + 'BIT_OR', + 'BIT_XOR', + 'BOOL_AND', + 'BOOL_OR', + 'COALESCE', + 'CORR', + 'COUNT', + 'COVAR_POP', + 'COVAR_SAMP', + 'CUME_DIST', + 'DENSE_RANK', + 'EVERY', + 'GROUPING', + 'JSONB_AGG', + 'JSONB_OBJECT_AGG', + 'JSON_AGG', + 'JSON_OBJECT_AGG', + 'MAX', + 'MIN', + 'MODE', + 'PERCENTILE_CONT', + 'PERCENTILE_DISC', + 'PERCENT_RANK', + 'RANGE_AGG', + 'RANGE_INTERSECT_AGG', + 'RANK', + 'REGR_AVGX', + 'REGR_AVGY', + 'REGR_COUNT', + 'REGR_INTERCEPT', + 'REGR_R2', + 'REGR_SLOPE', + 'REGR_SXX', + 'REGR_SXY', + 'REGR_SYY', + // 'SOME', + 'STDDEV', + 'STDDEV_POP', + 'STDDEV_SAMP', + 'STRING_AGG', + 'SUM', + 'TO_JSON', + 'TO_JSONB', + 'VARIANCE', + 'VAR_POP', + 'VAR_SAMP', + 'XMLAGG', + // https://www.postgresql.org/docs/14/functions-window.html - window: [ - 'CUME_DIST', - 'DENSE_RANK', - 'FIRST_VALUE', - 'LAG', - 'LAST_VALUE', - 'LEAD', - 'NTH_VALUE', - 'NTILE', - 'PERCENT_RANK', - 'RANK', - 'ROW_NUMBER', - ], + 'CUME_DIST', + 'DENSE_RANK', + 'FIRST_VALUE', + 'LAG', + 'LAST_VALUE', + 'LEAD', + 'NTH_VALUE', + 'NTILE', + 'PERCENT_RANK', + 'RANK', + 'ROW_NUMBER', + // https://www.postgresql.org/docs/14/functions-srf.html - set: ['GENERATE_SERIES', 'GENERATE_SUBSCRIPTS'], + 'GENERATE_SERIES', + 'GENERATE_SUBSCRIPTS', + // https://www.postgresql.org/docs/14/functions-info.html - sysInfo: [ - 'ACLDEFAULT', - 'ACLEXPLODE', - 'COL_DESCRIPTION', - 'CURRENT_CATALOG', - 'CURRENT_DATABASE', - 'CURRENT_QUERY', - 'CURRENT_ROLE', - 'CURRENT_SCHEMA', - 'CURRENT_SCHEMAS', - 'CURRENT_USER', - 'FORMAT_TYPE', - 'HAS_ANY_COLUMN_PRIVILEGE', - 'HAS_COLUMN_PRIVILEGE', - 'HAS_DATABASE_PRIVILEGE', - 'HAS_FOREIGN_DATA_WRAPPER_PRIVILEGE', - 'HAS_FUNCTION_PRIVILEGE', - 'HAS_LANGUAGE_PRIVILEGE', - 'HAS_SCHEMA_PRIVILEGE', - 'HAS_SEQUENCE_PRIVILEGE', - 'HAS_SERVER_PRIVILEGE', - 'HAS_TABLESPACE_PRIVILEGE', - 'HAS_TABLE_PRIVILEGE', - 'HAS_TYPE_PRIVILEGE', - 'INET_CLIENT_ADDR', - 'INET_CLIENT_PORT', - 'INET_SERVER_ADDR', - 'INET_SERVER_PORT', - 'MAKEACLITEM', - 'OBJ_DESCRIPTION', - 'PG_BACKEND_PID', - 'PG_BLOCKING_PIDS', - 'PG_COLLATION_IS_VISIBLE', - 'PG_CONF_LOAD_TIME', - 'PG_CONTROL_CHECKPOINT', - 'PG_CONTROL_INIT', - 'PG_CONTROL_SYSTEM', - 'PG_CONVERSION_IS_VISIBLE', - 'PG_CURRENT_LOGFILE', - 'PG_CURRENT_SNAPSHOT', - 'PG_CURRENT_XACT_ID', - 'PG_CURRENT_XACT_ID_IF_ASSIGNED', - 'PG_DESCRIBE_OBJECT', - 'PG_FUNCTION_IS_VISIBLE', - 'PG_GET_CATALOG_FOREIGN_KEYS', - 'PG_GET_CONSTRAINTDEF', - 'PG_GET_EXPR', - 'PG_GET_FUNCTIONDEF', - 'PG_GET_FUNCTION_ARGUMENTS', - 'PG_GET_FUNCTION_IDENTITY_ARGUMENTS', - 'PG_GET_FUNCTION_RESULT', - 'PG_GET_INDEXDEF', - 'PG_GET_KEYWORDS', - 'PG_GET_OBJECT_ADDRESS', - 'PG_GET_OWNED_SEQUENCE', - 'PG_GET_RULEDEF', - 'PG_GET_SERIAL_SEQUENCE', - 'PG_GET_STATISTICSOBJDEF', - 'PG_GET_TRIGGERDEF', - 'PG_GET_USERBYID', - 'PG_GET_VIEWDEF', - 'PG_HAS_ROLE', - 'PG_IDENTIFY_OBJECT', - 'PG_IDENTIFY_OBJECT_AS_ADDRESS', - 'PG_INDEXAM_HAS_PROPERTY', - 'PG_INDEX_COLUMN_HAS_PROPERTY', - 'PG_INDEX_HAS_PROPERTY', - 'PG_IS_OTHER_TEMP_SCHEMA', - 'PG_JIT_AVAILABLE', - 'PG_LAST_COMMITTED_XACT', - 'PG_LISTENING_CHANNELS', - 'PG_MY_TEMP_SCHEMA', - 'PG_NOTIFICATION_QUEUE_USAGE', - 'PG_OPCLASS_IS_VISIBLE', - 'PG_OPERATOR_IS_VISIBLE', - 'PG_OPFAMILY_IS_VISIBLE', - 'PG_OPTIONS_TO_TABLE', - 'PG_POSTMASTER_START_TIME', - 'PG_SAFE_SNAPSHOT_BLOCKING_PIDS', - 'PG_SNAPSHOT_XIP', - 'PG_SNAPSHOT_XMAX', - 'PG_SNAPSHOT_XMIN', - 'PG_STATISTICS_OBJ_IS_VISIBLE', - 'PG_TABLESPACE_DATABASES', - 'PG_TABLESPACE_LOCATION', - 'PG_TABLE_IS_VISIBLE', - 'PG_TRIGGER_DEPTH', - 'PG_TS_CONFIG_IS_VISIBLE', - 'PG_TS_DICT_IS_VISIBLE', - 'PG_TS_PARSER_IS_VISIBLE', - 'PG_TS_TEMPLATE_IS_VISIBLE', - 'PG_TYPEOF', - 'PG_TYPE_IS_VISIBLE', - 'PG_VISIBLE_IN_SNAPSHOT', - 'PG_XACT_COMMIT_TIMESTAMP', - 'PG_XACT_COMMIT_TIMESTAMP_ORIGIN', - 'PG_XACT_STATUS', - 'PQSERVERVERSION', - 'ROW_SECURITY_ACTIVE', - 'SESSION_USER', - 'SHOBJ_DESCRIPTION', - 'TO_REGCLASS', - 'TO_REGCOLLATION', - 'TO_REGNAMESPACE', - 'TO_REGOPER', - 'TO_REGOPERATOR', - 'TO_REGPROC', - 'TO_REGPROCEDURE', - 'TO_REGROLE', - 'TO_REGTYPE', - 'TXID_CURRENT', - 'TXID_CURRENT_IF_ASSIGNED', - 'TXID_CURRENT_SNAPSHOT', - 'TXID_SNAPSHOT_XIP', - 'TXID_SNAPSHOT_XMAX', - 'TXID_SNAPSHOT_XMIN', - 'TXID_STATUS', - 'TXID_VISIBLE_IN_SNAPSHOT', - 'USER', - 'VERSION', - ], + 'ACLDEFAULT', + 'ACLEXPLODE', + 'COL_DESCRIPTION', + 'CURRENT_CATALOG', + 'CURRENT_DATABASE', + 'CURRENT_QUERY', + 'CURRENT_ROLE', + 'CURRENT_SCHEMA', + 'CURRENT_SCHEMAS', + 'CURRENT_USER', + 'FORMAT_TYPE', + 'HAS_ANY_COLUMN_PRIVILEGE', + 'HAS_COLUMN_PRIVILEGE', + 'HAS_DATABASE_PRIVILEGE', + 'HAS_FOREIGN_DATA_WRAPPER_PRIVILEGE', + 'HAS_FUNCTION_PRIVILEGE', + 'HAS_LANGUAGE_PRIVILEGE', + 'HAS_SCHEMA_PRIVILEGE', + 'HAS_SEQUENCE_PRIVILEGE', + 'HAS_SERVER_PRIVILEGE', + 'HAS_TABLESPACE_PRIVILEGE', + 'HAS_TABLE_PRIVILEGE', + 'HAS_TYPE_PRIVILEGE', + 'INET_CLIENT_ADDR', + 'INET_CLIENT_PORT', + 'INET_SERVER_ADDR', + 'INET_SERVER_PORT', + 'MAKEACLITEM', + 'OBJ_DESCRIPTION', + 'PG_BACKEND_PID', + 'PG_BLOCKING_PIDS', + 'PG_COLLATION_IS_VISIBLE', + 'PG_CONF_LOAD_TIME', + 'PG_CONTROL_CHECKPOINT', + 'PG_CONTROL_INIT', + 'PG_CONTROL_SYSTEM', + 'PG_CONVERSION_IS_VISIBLE', + 'PG_CURRENT_LOGFILE', + 'PG_CURRENT_SNAPSHOT', + 'PG_CURRENT_XACT_ID', + 'PG_CURRENT_XACT_ID_IF_ASSIGNED', + 'PG_DESCRIBE_OBJECT', + 'PG_FUNCTION_IS_VISIBLE', + 'PG_GET_CATALOG_FOREIGN_KEYS', + 'PG_GET_CONSTRAINTDEF', + 'PG_GET_EXPR', + 'PG_GET_FUNCTIONDEF', + 'PG_GET_FUNCTION_ARGUMENTS', + 'PG_GET_FUNCTION_IDENTITY_ARGUMENTS', + 'PG_GET_FUNCTION_RESULT', + 'PG_GET_INDEXDEF', + 'PG_GET_KEYWORDS', + 'PG_GET_OBJECT_ADDRESS', + 'PG_GET_OWNED_SEQUENCE', + 'PG_GET_RULEDEF', + 'PG_GET_SERIAL_SEQUENCE', + 'PG_GET_STATISTICSOBJDEF', + 'PG_GET_TRIGGERDEF', + 'PG_GET_USERBYID', + 'PG_GET_VIEWDEF', + 'PG_HAS_ROLE', + 'PG_IDENTIFY_OBJECT', + 'PG_IDENTIFY_OBJECT_AS_ADDRESS', + 'PG_INDEXAM_HAS_PROPERTY', + 'PG_INDEX_COLUMN_HAS_PROPERTY', + 'PG_INDEX_HAS_PROPERTY', + 'PG_IS_OTHER_TEMP_SCHEMA', + 'PG_JIT_AVAILABLE', + 'PG_LAST_COMMITTED_XACT', + 'PG_LISTENING_CHANNELS', + 'PG_MY_TEMP_SCHEMA', + 'PG_NOTIFICATION_QUEUE_USAGE', + 'PG_OPCLASS_IS_VISIBLE', + 'PG_OPERATOR_IS_VISIBLE', + 'PG_OPFAMILY_IS_VISIBLE', + 'PG_OPTIONS_TO_TABLE', + 'PG_POSTMASTER_START_TIME', + 'PG_SAFE_SNAPSHOT_BLOCKING_PIDS', + 'PG_SNAPSHOT_XIP', + 'PG_SNAPSHOT_XMAX', + 'PG_SNAPSHOT_XMIN', + 'PG_STATISTICS_OBJ_IS_VISIBLE', + 'PG_TABLESPACE_DATABASES', + 'PG_TABLESPACE_LOCATION', + 'PG_TABLE_IS_VISIBLE', + 'PG_TRIGGER_DEPTH', + 'PG_TS_CONFIG_IS_VISIBLE', + 'PG_TS_DICT_IS_VISIBLE', + 'PG_TS_PARSER_IS_VISIBLE', + 'PG_TS_TEMPLATE_IS_VISIBLE', + 'PG_TYPEOF', + 'PG_TYPE_IS_VISIBLE', + 'PG_VISIBLE_IN_SNAPSHOT', + 'PG_XACT_COMMIT_TIMESTAMP', + 'PG_XACT_COMMIT_TIMESTAMP_ORIGIN', + 'PG_XACT_STATUS', + 'PQSERVERVERSION', + 'ROW_SECURITY_ACTIVE', + 'SESSION_USER', + 'SHOBJ_DESCRIPTION', + 'TO_REGCLASS', + 'TO_REGCOLLATION', + 'TO_REGNAMESPACE', + 'TO_REGOPER', + 'TO_REGOPERATOR', + 'TO_REGPROC', + 'TO_REGPROCEDURE', + 'TO_REGROLE', + 'TO_REGTYPE', + 'TXID_CURRENT', + 'TXID_CURRENT_IF_ASSIGNED', + 'TXID_CURRENT_SNAPSHOT', + 'TXID_SNAPSHOT_XIP', + 'TXID_SNAPSHOT_XMAX', + 'TXID_SNAPSHOT_XMIN', + 'TXID_STATUS', + 'TXID_VISIBLE_IN_SNAPSHOT', + 'USER', + 'VERSION', + // https://www.postgresql.org/docs/14/functions-admin.html - sysAdmin: [ - 'BRIN_DESUMMARIZE_RANGE', - 'BRIN_SUMMARIZE_NEW_VALUES', - 'BRIN_SUMMARIZE_RANGE', - 'CONVERT_FROM', - 'CURRENT_SETTING', - 'GIN_CLEAN_PENDING_LIST', - 'PG_ADVISORY_LOCK', - 'PG_ADVISORY_LOCK_SHARED', - 'PG_ADVISORY_UNLOCK', - 'PG_ADVISORY_UNLOCK_ALL', - 'PG_ADVISORY_UNLOCK_SHARED', - 'PG_ADVISORY_XACT_LOCK', - 'PG_ADVISORY_XACT_LOCK_SHARED', - 'PG_BACKUP_START_TIME', - 'PG_CANCEL_BACKEND', - 'PG_COLLATION_ACTUAL_VERSION', - 'PG_COLUMN_COMPRESSION', - 'PG_COLUMN_SIZE', - 'PG_COPY_LOGICAL_REPLICATION_SLOT', - 'PG_COPY_PHYSICAL_REPLICATION_SLOT', - 'PG_CREATE_LOGICAL_REPLICATION_SLOT', - 'PG_CREATE_PHYSICAL_REPLICATION_SLOT', - 'PG_CREATE_RESTORE_POINT', - 'PG_CURRENT_WAL_FLUSH_LSN', - 'PG_CURRENT_WAL_INSERT_LSN', - 'PG_CURRENT_WAL_LSN', - 'PG_DATABASE_SIZE', - 'PG_DROP_REPLICATION_SLOT', - 'PG_EXPORT_SNAPSHOT', - 'PG_FILENODE_RELATION', - 'PG_GET_WAL_REPLAY_PAUSE_STATE', - 'PG_IMPORT_SYSTEM_COLLATIONS', - 'PG_INDEXES_SIZE', - 'PG_IS_IN_BACKUP', - 'PG_IS_IN_RECOVERY', - 'PG_IS_WAL_REPLAY_PAUSED', - 'PG_LAST_WAL_RECEIVE_LSN', - 'PG_LAST_WAL_REPLAY_LSN', - 'PG_LAST_XACT_REPLAY_TIMESTAMP', - 'PG_LOGICAL_EMIT_MESSAGE', - 'PG_LOGICAL_SLOT_GET_BINARY_CHANGES', - 'PG_LOGICAL_SLOT_GET_CHANGES', - 'PG_LOGICAL_SLOT_PEEK_BINARY_CHANGES', - 'PG_LOGICAL_SLOT_PEEK_CHANGES', - 'PG_LOG_BACKEND_MEMORY_CONTEXTS', - 'PG_LS_ARCHIVE_STATUSDIR', - 'PG_LS_DIR', - 'PG_LS_LOGDIR', - 'PG_LS_TMPDIR', - 'PG_LS_WALDIR', - 'PG_PARTITION_ANCESTORS', - 'PG_PARTITION_ROOT', - 'PG_PARTITION_TREE', - 'PG_PROMOTE', - 'PG_READ_BINARY_FILE', - 'PG_READ_FILE', - 'PG_RELATION_FILENODE', - 'PG_RELATION_FILEPATH', - 'PG_RELATION_SIZE', - 'PG_RELOAD_CONF', - 'PG_REPLICATION_ORIGIN_ADVANCE', - 'PG_REPLICATION_ORIGIN_CREATE', - 'PG_REPLICATION_ORIGIN_DROP', - 'PG_REPLICATION_ORIGIN_OID', - 'PG_REPLICATION_ORIGIN_PROGRESS', - 'PG_REPLICATION_ORIGIN_SESSION_IS_SETUP', - 'PG_REPLICATION_ORIGIN_SESSION_PROGRESS', - 'PG_REPLICATION_ORIGIN_SESSION_RESET', - 'PG_REPLICATION_ORIGIN_SESSION_SETUP', - 'PG_REPLICATION_ORIGIN_XACT_RESET', - 'PG_REPLICATION_ORIGIN_XACT_SETUP', - 'PG_REPLICATION_SLOT_ADVANCE', - 'PG_ROTATE_LOGFILE', - 'PG_SIZE_BYTES', - 'PG_SIZE_PRETTY', - 'PG_START_BACKUP', - 'PG_STAT_FILE', - 'PG_STOP_BACKUP', - 'PG_SWITCH_WAL', - 'PG_TABLESPACE_SIZE', - 'PG_TABLE_SIZE', - 'PG_TERMINATE_BACKEND', - 'PG_TOTAL_RELATION_SIZE', - 'PG_TRY_ADVISORY_LOCK', - 'PG_TRY_ADVISORY_LOCK_SHARED', - 'PG_TRY_ADVISORY_XACT_LOCK', - 'PG_TRY_ADVISORY_XACT_LOCK_SHARED', - 'PG_WALFILE_NAME', - 'PG_WALFILE_NAME_OFFSET', - 'PG_WAL_LSN_DIFF', - 'PG_WAL_REPLAY_PAUSE', - 'PG_WAL_REPLAY_RESUME', - 'SET_CONFIG', - ], + 'BRIN_DESUMMARIZE_RANGE', + 'BRIN_SUMMARIZE_NEW_VALUES', + 'BRIN_SUMMARIZE_RANGE', + 'CONVERT_FROM', + 'CURRENT_SETTING', + 'GIN_CLEAN_PENDING_LIST', + 'PG_ADVISORY_LOCK', + 'PG_ADVISORY_LOCK_SHARED', + 'PG_ADVISORY_UNLOCK', + 'PG_ADVISORY_UNLOCK_ALL', + 'PG_ADVISORY_UNLOCK_SHARED', + 'PG_ADVISORY_XACT_LOCK', + 'PG_ADVISORY_XACT_LOCK_SHARED', + 'PG_BACKUP_START_TIME', + 'PG_CANCEL_BACKEND', + 'PG_COLLATION_ACTUAL_VERSION', + 'PG_COLUMN_COMPRESSION', + 'PG_COLUMN_SIZE', + 'PG_COPY_LOGICAL_REPLICATION_SLOT', + 'PG_COPY_PHYSICAL_REPLICATION_SLOT', + 'PG_CREATE_LOGICAL_REPLICATION_SLOT', + 'PG_CREATE_PHYSICAL_REPLICATION_SLOT', + 'PG_CREATE_RESTORE_POINT', + 'PG_CURRENT_WAL_FLUSH_LSN', + 'PG_CURRENT_WAL_INSERT_LSN', + 'PG_CURRENT_WAL_LSN', + 'PG_DATABASE_SIZE', + 'PG_DROP_REPLICATION_SLOT', + 'PG_EXPORT_SNAPSHOT', + 'PG_FILENODE_RELATION', + 'PG_GET_WAL_REPLAY_PAUSE_STATE', + 'PG_IMPORT_SYSTEM_COLLATIONS', + 'PG_INDEXES_SIZE', + 'PG_IS_IN_BACKUP', + 'PG_IS_IN_RECOVERY', + 'PG_IS_WAL_REPLAY_PAUSED', + 'PG_LAST_WAL_RECEIVE_LSN', + 'PG_LAST_WAL_REPLAY_LSN', + 'PG_LAST_XACT_REPLAY_TIMESTAMP', + 'PG_LOGICAL_EMIT_MESSAGE', + 'PG_LOGICAL_SLOT_GET_BINARY_CHANGES', + 'PG_LOGICAL_SLOT_GET_CHANGES', + 'PG_LOGICAL_SLOT_PEEK_BINARY_CHANGES', + 'PG_LOGICAL_SLOT_PEEK_CHANGES', + 'PG_LOG_BACKEND_MEMORY_CONTEXTS', + 'PG_LS_ARCHIVE_STATUSDIR', + 'PG_LS_DIR', + 'PG_LS_LOGDIR', + 'PG_LS_TMPDIR', + 'PG_LS_WALDIR', + 'PG_PARTITION_ANCESTORS', + 'PG_PARTITION_ROOT', + 'PG_PARTITION_TREE', + 'PG_PROMOTE', + 'PG_READ_BINARY_FILE', + 'PG_READ_FILE', + 'PG_RELATION_FILENODE', + 'PG_RELATION_FILEPATH', + 'PG_RELATION_SIZE', + 'PG_RELOAD_CONF', + 'PG_REPLICATION_ORIGIN_ADVANCE', + 'PG_REPLICATION_ORIGIN_CREATE', + 'PG_REPLICATION_ORIGIN_DROP', + 'PG_REPLICATION_ORIGIN_OID', + 'PG_REPLICATION_ORIGIN_PROGRESS', + 'PG_REPLICATION_ORIGIN_SESSION_IS_SETUP', + 'PG_REPLICATION_ORIGIN_SESSION_PROGRESS', + 'PG_REPLICATION_ORIGIN_SESSION_RESET', + 'PG_REPLICATION_ORIGIN_SESSION_SETUP', + 'PG_REPLICATION_ORIGIN_XACT_RESET', + 'PG_REPLICATION_ORIGIN_XACT_SETUP', + 'PG_REPLICATION_SLOT_ADVANCE', + 'PG_ROTATE_LOGFILE', + 'PG_SIZE_BYTES', + 'PG_SIZE_PRETTY', + 'PG_START_BACKUP', + 'PG_STAT_FILE', + 'PG_STOP_BACKUP', + 'PG_SWITCH_WAL', + 'PG_TABLESPACE_SIZE', + 'PG_TABLE_SIZE', + 'PG_TERMINATE_BACKEND', + 'PG_TOTAL_RELATION_SIZE', + 'PG_TRY_ADVISORY_LOCK', + 'PG_TRY_ADVISORY_LOCK_SHARED', + 'PG_TRY_ADVISORY_XACT_LOCK', + 'PG_TRY_ADVISORY_XACT_LOCK_SHARED', + 'PG_WALFILE_NAME', + 'PG_WALFILE_NAME_OFFSET', + 'PG_WAL_LSN_DIFF', + 'PG_WAL_REPLAY_PAUSE', + 'PG_WAL_REPLAY_RESUME', + 'SET_CONFIG', + // https://www.postgresql.org/docs/14/functions-trigger.html - trigger: [ - 'SUPPRESS_REDUNDANT_UPDATES_TRIGGER', - 'TSVECTOR_UPDATE_TRIGGER', - 'TSVECTOR_UPDATE_TRIGGER_COLUMN', - ], + 'SUPPRESS_REDUNDANT_UPDATES_TRIGGER', + 'TSVECTOR_UPDATE_TRIGGER', + 'TSVECTOR_UPDATE_TRIGGER_COLUMN', + // https://www.postgresql.org/docs/14/functions-event-triggers.html - eventTrigger: [ - 'PG_EVENT_TRIGGER_DDL_COMMANDS', - 'PG_EVENT_TRIGGER_DROPPED_OBJECTS', - 'PG_EVENT_TRIGGER_TABLE_REWRITE_OID', - 'PG_EVENT_TRIGGER_TABLE_REWRITE_REASON', - 'PG_GET_OBJECT_ADDRESS', - ], + 'PG_EVENT_TRIGGER_DDL_COMMANDS', + 'PG_EVENT_TRIGGER_DROPPED_OBJECTS', + 'PG_EVENT_TRIGGER_TABLE_REWRITE_OID', + 'PG_EVENT_TRIGGER_TABLE_REWRITE_REASON', + 'PG_GET_OBJECT_ADDRESS', + // https://www.postgresql.org/docs/14/functions-statistics.html - stats: ['PG_MCV_LIST_ITEMS'], - cast: ['CAST'], + 'PG_MCV_LIST_ITEMS', + + // cast + 'CAST', + // Parameterized data types // https://www.postgresql.org/docs/current/datatype.html - dataTypes: [ - 'BIT', - 'BIT VARYING', - 'CHARACTER', - 'CHARACTER VARYING', - 'VARCHAR', - 'CHAR', - 'DECIMAL', - 'NUMERIC', - 'TIME', - 'TIMESTAMP', - 'ENUM', - ], -}); + 'BIT', + 'BIT VARYING', + 'CHARACTER', + 'CHARACTER VARYING', + 'VARCHAR', + 'CHAR', + 'DECIMAL', + 'NUMERIC', + 'TIME', + 'TIMESTAMP', + 'ENUM', +]; diff --git a/src/languages/postgresql/postgresql.keywords.ts b/src/languages/postgresql/postgresql.keywords.ts index 743d3dae5a..988ede0df7 100644 --- a/src/languages/postgresql/postgresql.keywords.ts +++ b/src/languages/postgresql/postgresql.keywords.ts @@ -1,464 +1,460 @@ -import { flatKeywordList } from '../../utils.js'; - -export const keywords = flatKeywordList({ +export const keywords: string[] = [ // https://www.postgresql.org/docs/14/sql-keywords-appendix.html - all: [ - 'ABORT', - 'ABSOLUTE', - 'ACCESS', - 'ACTION', - 'ADD', - 'ADMIN', - 'AFTER', - 'AGGREGATE', - 'ALL', // reserved - 'ALSO', - 'ALTER', - 'ALWAYS', - 'ANALYSE', // reserved - 'ANALYZE', // reserved - 'AND', // reserved - 'ANY', // reserved - 'ARRAY', // reserved, requires AS - 'AS', // reserved, requires AS - 'ASC', // reserved - 'ASENSITIVE', - 'ASSERTION', - 'ASSIGNMENT', - 'ASYMMETRIC', // reserved - 'AT', - 'ATOMIC', - 'ATTACH', - 'ATTRIBUTE', - 'AUTHORIZATION', // reserved (can be function or type) - 'BACKWARD', - 'BEFORE', - 'BEGIN', - 'BETWEEN', // (cannot be function or type) - 'BIGINT', // (cannot be function or type) - 'BINARY', // reserved (can be function or type) - 'BIT', // (cannot be function or type) - 'BOOLEAN', // (cannot be function or type) - 'BOTH', // reserved - 'BREADTH', - 'BY', - 'CACHE', - 'CALL', - 'CALLED', - 'CASCADE', - 'CASCADED', - 'CASE', // reserved - 'CAST', // reserved - 'CATALOG', - 'CHAIN', - 'CHAR', // (cannot be function or type), requires AS - 'CHARACTER', // (cannot be function or type), requires AS - 'CHARACTERISTICS', - 'CHECK', // reserved - 'CHECKPOINT', - 'CLASS', - 'CLOSE', - 'CLUSTER', - 'COALESCE', // (cannot be function or type) - 'COLLATE', // reserved - 'COLLATION', // reserved (can be function or type) - 'COLUMN', // reserved - 'COLUMNS', - 'COMMENT', - 'COMMENTS', - 'COMMIT', - 'COMMITTED', - 'COMPRESSION', - 'CONCURRENTLY', // reserved (can be function or type) - 'CONFIGURATION', - 'CONFLICT', - 'CONNECTION', - 'CONSTRAINT', // reserved - 'CONSTRAINTS', - 'CONTENT', - 'CONTINUE', - 'CONVERSION', - 'COPY', - 'COST', - 'CREATE', // reserved, requires AS - 'CROSS', // reserved (can be function or type) - 'CSV', - 'CUBE', - 'CURRENT', - 'CURRENT_CATALOG', // reserved - 'CURRENT_DATE', // reserved - 'CURRENT_ROLE', // reserved - 'CURRENT_SCHEMA', // reserved (can be function or type) - 'CURRENT_TIME', // reserved - 'CURRENT_TIMESTAMP', // reserved - 'CURRENT_USER', // reserved - 'CURSOR', - 'CYCLE', - 'DATA', - 'DATABASE', - 'DAY', // requires AS - 'DEALLOCATE', - 'DEC', // (cannot be function or type) - 'DECIMAL', // (cannot be function or type) - 'DECLARE', - 'DEFAULT', // reserved - 'DEFAULTS', - 'DEFERRABLE', // reserved - 'DEFERRED', - 'DEFINER', - 'DELETE', - 'DELIMITER', - 'DELIMITERS', - 'DEPENDS', - 'DEPTH', - 'DESC', // reserved - 'DETACH', - 'DICTIONARY', - 'DISABLE', - 'DISCARD', - 'DISTINCT', // reserved - 'DO', // reserved - 'DOCUMENT', - 'DOMAIN', - 'DOUBLE', - 'DROP', - 'EACH', - 'ELSE', // reserved - 'ENABLE', - 'ENCODING', - 'ENCRYPTED', - 'END', // reserved - 'ENUM', - 'ESCAPE', - 'EVENT', - 'EXCEPT', // reserved, requires AS - 'EXCLUDE', - 'EXCLUDING', - 'EXCLUSIVE', - 'EXECUTE', - 'EXISTS', // (cannot be function or type) - 'EXPLAIN', - 'EXPRESSION', - 'EXTENSION', - 'EXTERNAL', - 'EXTRACT', // (cannot be function or type) - 'FALSE', // reserved - 'FAMILY', - 'FETCH', // reserved, requires AS - 'FILTER', // requires AS - 'FINALIZE', - 'FIRST', - 'FLOAT', // (cannot be function or type) - 'FOLLOWING', - 'FOR', // reserved, requires AS - 'FORCE', - 'FOREIGN', // reserved - 'FORWARD', - 'FREEZE', // reserved (can be function or type) - 'FROM', // reserved, requires AS - 'FULL', // reserved (can be function or type) - 'FUNCTION', - 'FUNCTIONS', - 'GENERATED', - 'GLOBAL', - 'GRANT', // reserved, requires AS - 'GRANTED', - 'GREATEST', // (cannot be function or type) - 'GROUP', // reserved, requires AS - 'GROUPING', // (cannot be function or type) - 'GROUPS', - 'HANDLER', - 'HAVING', // reserved, requires AS - 'HEADER', - 'HOLD', - 'HOUR', // requires AS - 'IDENTITY', - 'IF', - 'ILIKE', // reserved (can be function or type) - 'IMMEDIATE', - 'IMMUTABLE', - 'IMPLICIT', - 'IMPORT', - 'IN', // reserved - 'INCLUDE', - 'INCLUDING', - 'INCREMENT', - 'INDEX', - 'INDEXES', - 'INHERIT', - 'INHERITS', - 'INITIALLY', // reserved - 'INLINE', - 'INNER', // reserved (can be function or type) - 'INOUT', // (cannot be function or type) - 'INPUT', - 'INSENSITIVE', - 'INSERT', - 'INSTEAD', - 'INT', // (cannot be function or type) - 'INTEGER', // (cannot be function or type) - 'INTERSECT', // reserved, requires AS - 'INTERVAL', // (cannot be function or type) - 'INTO', // reserved, requires AS - 'INVOKER', - 'IS', // reserved (can be function or type) - 'ISNULL', // reserved (can be function or type), requires AS - 'ISOLATION', - 'JOIN', // reserved (can be function or type) - 'KEY', - 'LABEL', - 'LANGUAGE', - 'LARGE', - 'LAST', - 'LATERAL', // reserved - 'LEADING', // reserved - 'LEAKPROOF', - 'LEAST', // (cannot be function or type) - 'LEFT', // reserved (can be function or type) - 'LEVEL', - 'LIKE', // reserved (can be function or type) - 'LIMIT', // reserved, requires AS - 'LISTEN', - 'LOAD', - 'LOCAL', - 'LOCALTIME', // reserved - 'LOCALTIMESTAMP', // reserved - 'LOCATION', - 'LOCK', - 'LOCKED', - 'LOGGED', - 'MAPPING', - 'MATCH', - 'MATERIALIZED', - 'MAXVALUE', - 'METHOD', - 'MINUTE', // requires AS - 'MINVALUE', - 'MODE', - 'MONTH', // requires AS - 'MOVE', - 'NAME', - 'NAMES', - 'NATIONAL', // (cannot be function or type) - 'NATURAL', // reserved (can be function or type) - 'NCHAR', // (cannot be function or type) - 'NEW', - 'NEXT', - 'NFC', - 'NFD', - 'NFKC', - 'NFKD', - 'NO', - 'NONE', // (cannot be function or type) - 'NORMALIZE', // (cannot be function or type) - 'NORMALIZED', - 'NOT', // reserved - 'NOTHING', - 'NOTIFY', - 'NOTNULL', // reserved (can be function or type), requires AS - 'NOWAIT', - 'NULL', // reserved - 'NULLIF', // (cannot be function or type) - 'NULLS', - 'NUMERIC', // (cannot be function or type) - 'OBJECT', - 'OF', - 'OFF', - 'OFFSET', // reserved, requires AS - 'OIDS', - 'OLD', - 'ON', // reserved, requires AS - 'ONLY', // reserved - 'OPERATOR', - 'OPTION', - 'OPTIONS', - 'OR', // reserved - 'ORDER', // reserved, requires AS - 'ORDINALITY', - 'OTHERS', - 'OUT', // (cannot be function or type) - 'OUTER', // reserved (can be function or type) - 'OVER', // requires AS - 'OVERLAPS', // reserved (can be function or type), requires AS - 'OVERLAY', // (cannot be function or type) - 'OVERRIDING', - 'OWNED', - 'OWNER', - 'PARALLEL', - 'PARSER', - 'PARTIAL', - 'PARTITION', - 'PASSING', - 'PASSWORD', - 'PLACING', // reserved - 'PLANS', - 'POLICY', - 'POSITION', // (cannot be function or type) - 'PRECEDING', - 'PRECISION', // (cannot be function or type), requires AS - 'PREPARE', - 'PREPARED', - 'PRESERVE', - 'PRIMARY', // reserved - 'PRIOR', - 'PRIVILEGES', - 'PROCEDURAL', - 'PROCEDURE', - 'PROCEDURES', - 'PROGRAM', - 'PUBLICATION', - 'QUOTE', - 'RANGE', - 'READ', - 'REAL', // (cannot be function or type) - 'REASSIGN', - 'RECHECK', - 'RECURSIVE', - 'REF', - 'REFERENCES', // reserved - 'REFERENCING', - 'REFRESH', - 'REINDEX', - 'RELATIVE', - 'RELEASE', - 'RENAME', - 'REPEATABLE', - 'REPLACE', - 'REPLICA', - 'RESET', - 'RESTART', - 'RESTRICT', - 'RETURN', - 'RETURNING', // reserved, requires AS - 'RETURNS', - 'REVOKE', - 'RIGHT', // reserved (can be function or type) - 'ROLE', - 'ROLLBACK', - 'ROLLUP', - 'ROUTINE', - 'ROUTINES', - 'ROW', // (cannot be function or type) - 'ROWS', - 'RULE', - 'SAVEPOINT', - 'SCHEMA', - 'SCHEMAS', - 'SCROLL', - 'SEARCH', - 'SECOND', // requires AS - 'SECURITY', - 'SELECT', // reserved - 'SEQUENCE', - 'SEQUENCES', - 'SERIALIZABLE', - 'SERVER', - 'SESSION', - 'SESSION_USER', // reserved - 'SET', - 'SETOF', // (cannot be function or type) - 'SETS', - 'SHARE', - 'SHOW', - 'SIMILAR', // reserved (can be function or type) - 'SIMPLE', - 'SKIP', - 'SMALLINT', // (cannot be function or type) - 'SNAPSHOT', - 'SOME', // reserved - 'SQL', - 'STABLE', - 'STANDALONE', - 'START', - 'STATEMENT', - 'STATISTICS', - 'STDIN', - 'STDOUT', - 'STORAGE', - 'STORED', - 'STRICT', - 'STRIP', - 'SUBSCRIPTION', - 'SUBSTRING', // (cannot be function or type) - 'SUPPORT', - 'SYMMETRIC', // reserved - 'SYSID', - 'SYSTEM', - 'TABLE', // reserved - 'TABLES', - 'TABLESAMPLE', // reserved (can be function or type) - 'TABLESPACE', - 'TEMP', - 'TEMPLATE', - 'TEMPORARY', - 'TEXT', - 'THEN', // reserved - 'TIES', - 'TIME', // (cannot be function or type) - 'TIMESTAMP', // (cannot be function or type) - 'TO', // reserved, requires AS - 'TRAILING', // reserved - 'TRANSACTION', - 'TRANSFORM', - 'TREAT', // (cannot be function or type) - 'TRIGGER', - 'TRIM', // (cannot be function or type) - 'TRUE', // reserved - 'TRUNCATE', - 'TRUSTED', - 'TYPE', - 'TYPES', - 'UESCAPE', - 'UNBOUNDED', - 'UNCOMMITTED', - 'UNENCRYPTED', - 'UNION', // reserved, requires AS - 'UNIQUE', // reserved - 'UNKNOWN', - 'UNLISTEN', - 'UNLOGGED', - 'UNTIL', - 'UPDATE', - 'USER', // reserved - 'USING', // reserved - 'VACUUM', - 'VALID', - 'VALIDATE', - 'VALIDATOR', - 'VALUE', - 'VALUES', // (cannot be function or type) - 'VARCHAR', // (cannot be function or type) - 'VARIADIC', // reserved - 'VARYING', // requires AS - 'VERBOSE', // reserved (can be function or type) - 'VERSION', - 'VIEW', - 'VIEWS', - 'VOLATILE', - 'WHEN', // reserved - 'WHERE', // reserved, requires AS - 'WHITESPACE', - 'WINDOW', // reserved, requires AS - 'WITH', // reserved, requires AS - 'WITHIN', // requires AS - 'WITHOUT', // requires AS - 'WORK', - 'WRAPPER', - 'WRITE', - 'XML', - 'XMLATTRIBUTES', // (cannot be function or type) - 'XMLCONCAT', // (cannot be function or type) - 'XMLELEMENT', // (cannot be function or type) - 'XMLEXISTS', // (cannot be function or type) - 'XMLFOREST', // (cannot be function or type) - 'XMLNAMESPACES', // (cannot be function or type) - 'XMLPARSE', // (cannot be function or type) - 'XMLPI', // (cannot be function or type) - 'XMLROOT', // (cannot be function or type) - 'XMLSERIALIZE', // (cannot be function or type) - 'XMLTABLE', // (cannot be function or type) - 'YEAR', // requires AS - 'YES', - 'ZONE', - ], -}); + 'ABORT', + 'ABSOLUTE', + 'ACCESS', + 'ACTION', + 'ADD', + 'ADMIN', + 'AFTER', + 'AGGREGATE', + 'ALL', // reserved + 'ALSO', + 'ALTER', + 'ALWAYS', + 'ANALYSE', // reserved + 'ANALYZE', // reserved + 'AND', // reserved + 'ANY', // reserved + 'ARRAY', // reserved, requires AS + 'AS', // reserved, requires AS + 'ASC', // reserved + 'ASENSITIVE', + 'ASSERTION', + 'ASSIGNMENT', + 'ASYMMETRIC', // reserved + 'AT', + 'ATOMIC', + 'ATTACH', + 'ATTRIBUTE', + 'AUTHORIZATION', // reserved (can be function or type) + 'BACKWARD', + 'BEFORE', + 'BEGIN', + 'BETWEEN', // (cannot be function or type) + 'BIGINT', // (cannot be function or type) + 'BINARY', // reserved (can be function or type) + 'BIT', // (cannot be function or type) + 'BOOLEAN', // (cannot be function or type) + 'BOTH', // reserved + 'BREADTH', + 'BY', + 'CACHE', + 'CALL', + 'CALLED', + 'CASCADE', + 'CASCADED', + 'CASE', // reserved + 'CAST', // reserved + 'CATALOG', + 'CHAIN', + 'CHAR', // (cannot be function or type), requires AS + 'CHARACTER', // (cannot be function or type), requires AS + 'CHARACTERISTICS', + 'CHECK', // reserved + 'CHECKPOINT', + 'CLASS', + 'CLOSE', + 'CLUSTER', + 'COALESCE', // (cannot be function or type) + 'COLLATE', // reserved + 'COLLATION', // reserved (can be function or type) + 'COLUMN', // reserved + 'COLUMNS', + 'COMMENT', + 'COMMENTS', + 'COMMIT', + 'COMMITTED', + 'COMPRESSION', + 'CONCURRENTLY', // reserved (can be function or type) + 'CONFIGURATION', + 'CONFLICT', + 'CONNECTION', + 'CONSTRAINT', // reserved + 'CONSTRAINTS', + 'CONTENT', + 'CONTINUE', + 'CONVERSION', + 'COPY', + 'COST', + 'CREATE', // reserved, requires AS + 'CROSS', // reserved (can be function or type) + 'CSV', + 'CUBE', + 'CURRENT', + 'CURRENT_CATALOG', // reserved + 'CURRENT_DATE', // reserved + 'CURRENT_ROLE', // reserved + 'CURRENT_SCHEMA', // reserved (can be function or type) + 'CURRENT_TIME', // reserved + 'CURRENT_TIMESTAMP', // reserved + 'CURRENT_USER', // reserved + 'CURSOR', + 'CYCLE', + 'DATA', + 'DATABASE', + 'DAY', // requires AS + 'DEALLOCATE', + 'DEC', // (cannot be function or type) + 'DECIMAL', // (cannot be function or type) + 'DECLARE', + 'DEFAULT', // reserved + 'DEFAULTS', + 'DEFERRABLE', // reserved + 'DEFERRED', + 'DEFINER', + 'DELETE', + 'DELIMITER', + 'DELIMITERS', + 'DEPENDS', + 'DEPTH', + 'DESC', // reserved + 'DETACH', + 'DICTIONARY', + 'DISABLE', + 'DISCARD', + 'DISTINCT', // reserved + 'DO', // reserved + 'DOCUMENT', + 'DOMAIN', + 'DOUBLE', + 'DROP', + 'EACH', + 'ELSE', // reserved + 'ENABLE', + 'ENCODING', + 'ENCRYPTED', + 'END', // reserved + 'ENUM', + 'ESCAPE', + 'EVENT', + 'EXCEPT', // reserved, requires AS + 'EXCLUDE', + 'EXCLUDING', + 'EXCLUSIVE', + 'EXECUTE', + 'EXISTS', // (cannot be function or type) + 'EXPLAIN', + 'EXPRESSION', + 'EXTENSION', + 'EXTERNAL', + 'EXTRACT', // (cannot be function or type) + 'FALSE', // reserved + 'FAMILY', + 'FETCH', // reserved, requires AS + 'FILTER', // requires AS + 'FINALIZE', + 'FIRST', + 'FLOAT', // (cannot be function or type) + 'FOLLOWING', + 'FOR', // reserved, requires AS + 'FORCE', + 'FOREIGN', // reserved + 'FORWARD', + 'FREEZE', // reserved (can be function or type) + 'FROM', // reserved, requires AS + 'FULL', // reserved (can be function or type) + 'FUNCTION', + 'FUNCTIONS', + 'GENERATED', + 'GLOBAL', + 'GRANT', // reserved, requires AS + 'GRANTED', + 'GREATEST', // (cannot be function or type) + 'GROUP', // reserved, requires AS + 'GROUPING', // (cannot be function or type) + 'GROUPS', + 'HANDLER', + 'HAVING', // reserved, requires AS + 'HEADER', + 'HOLD', + 'HOUR', // requires AS + 'IDENTITY', + 'IF', + 'ILIKE', // reserved (can be function or type) + 'IMMEDIATE', + 'IMMUTABLE', + 'IMPLICIT', + 'IMPORT', + 'IN', // reserved + 'INCLUDE', + 'INCLUDING', + 'INCREMENT', + 'INDEX', + 'INDEXES', + 'INHERIT', + 'INHERITS', + 'INITIALLY', // reserved + 'INLINE', + 'INNER', // reserved (can be function or type) + 'INOUT', // (cannot be function or type) + 'INPUT', + 'INSENSITIVE', + 'INSERT', + 'INSTEAD', + 'INT', // (cannot be function or type) + 'INTEGER', // (cannot be function or type) + 'INTERSECT', // reserved, requires AS + 'INTERVAL', // (cannot be function or type) + 'INTO', // reserved, requires AS + 'INVOKER', + 'IS', // reserved (can be function or type) + 'ISNULL', // reserved (can be function or type), requires AS + 'ISOLATION', + 'JOIN', // reserved (can be function or type) + 'KEY', + 'LABEL', + 'LANGUAGE', + 'LARGE', + 'LAST', + 'LATERAL', // reserved + 'LEADING', // reserved + 'LEAKPROOF', + 'LEAST', // (cannot be function or type) + 'LEFT', // reserved (can be function or type) + 'LEVEL', + 'LIKE', // reserved (can be function or type) + 'LIMIT', // reserved, requires AS + 'LISTEN', + 'LOAD', + 'LOCAL', + 'LOCALTIME', // reserved + 'LOCALTIMESTAMP', // reserved + 'LOCATION', + 'LOCK', + 'LOCKED', + 'LOGGED', + 'MAPPING', + 'MATCH', + 'MATERIALIZED', + 'MAXVALUE', + 'METHOD', + 'MINUTE', // requires AS + 'MINVALUE', + 'MODE', + 'MONTH', // requires AS + 'MOVE', + 'NAME', + 'NAMES', + 'NATIONAL', // (cannot be function or type) + 'NATURAL', // reserved (can be function or type) + 'NCHAR', // (cannot be function or type) + 'NEW', + 'NEXT', + 'NFC', + 'NFD', + 'NFKC', + 'NFKD', + 'NO', + 'NONE', // (cannot be function or type) + 'NORMALIZE', // (cannot be function or type) + 'NORMALIZED', + 'NOT', // reserved + 'NOTHING', + 'NOTIFY', + 'NOTNULL', // reserved (can be function or type), requires AS + 'NOWAIT', + 'NULL', // reserved + 'NULLIF', // (cannot be function or type) + 'NULLS', + 'NUMERIC', // (cannot be function or type) + 'OBJECT', + 'OF', + 'OFF', + 'OFFSET', // reserved, requires AS + 'OIDS', + 'OLD', + 'ON', // reserved, requires AS + 'ONLY', // reserved + 'OPERATOR', + 'OPTION', + 'OPTIONS', + 'OR', // reserved + 'ORDER', // reserved, requires AS + 'ORDINALITY', + 'OTHERS', + 'OUT', // (cannot be function or type) + 'OUTER', // reserved (can be function or type) + 'OVER', // requires AS + 'OVERLAPS', // reserved (can be function or type), requires AS + 'OVERLAY', // (cannot be function or type) + 'OVERRIDING', + 'OWNED', + 'OWNER', + 'PARALLEL', + 'PARSER', + 'PARTIAL', + 'PARTITION', + 'PASSING', + 'PASSWORD', + 'PLACING', // reserved + 'PLANS', + 'POLICY', + 'POSITION', // (cannot be function or type) + 'PRECEDING', + 'PRECISION', // (cannot be function or type), requires AS + 'PREPARE', + 'PREPARED', + 'PRESERVE', + 'PRIMARY', // reserved + 'PRIOR', + 'PRIVILEGES', + 'PROCEDURAL', + 'PROCEDURE', + 'PROCEDURES', + 'PROGRAM', + 'PUBLICATION', + 'QUOTE', + 'RANGE', + 'READ', + 'REAL', // (cannot be function or type) + 'REASSIGN', + 'RECHECK', + 'RECURSIVE', + 'REF', + 'REFERENCES', // reserved + 'REFERENCING', + 'REFRESH', + 'REINDEX', + 'RELATIVE', + 'RELEASE', + 'RENAME', + 'REPEATABLE', + 'REPLACE', + 'REPLICA', + 'RESET', + 'RESTART', + 'RESTRICT', + 'RETURN', + 'RETURNING', // reserved, requires AS + 'RETURNS', + 'REVOKE', + 'RIGHT', // reserved (can be function or type) + 'ROLE', + 'ROLLBACK', + 'ROLLUP', + 'ROUTINE', + 'ROUTINES', + 'ROW', // (cannot be function or type) + 'ROWS', + 'RULE', + 'SAVEPOINT', + 'SCHEMA', + 'SCHEMAS', + 'SCROLL', + 'SEARCH', + 'SECOND', // requires AS + 'SECURITY', + 'SELECT', // reserved + 'SEQUENCE', + 'SEQUENCES', + 'SERIALIZABLE', + 'SERVER', + 'SESSION', + 'SESSION_USER', // reserved + 'SET', + 'SETOF', // (cannot be function or type) + 'SETS', + 'SHARE', + 'SHOW', + 'SIMILAR', // reserved (can be function or type) + 'SIMPLE', + 'SKIP', + 'SMALLINT', // (cannot be function or type) + 'SNAPSHOT', + 'SOME', // reserved + 'SQL', + 'STABLE', + 'STANDALONE', + 'START', + 'STATEMENT', + 'STATISTICS', + 'STDIN', + 'STDOUT', + 'STORAGE', + 'STORED', + 'STRICT', + 'STRIP', + 'SUBSCRIPTION', + 'SUBSTRING', // (cannot be function or type) + 'SUPPORT', + 'SYMMETRIC', // reserved + 'SYSID', + 'SYSTEM', + 'TABLE', // reserved + 'TABLES', + 'TABLESAMPLE', // reserved (can be function or type) + 'TABLESPACE', + 'TEMP', + 'TEMPLATE', + 'TEMPORARY', + 'TEXT', + 'THEN', // reserved + 'TIES', + 'TIME', // (cannot be function or type) + 'TIMESTAMP', // (cannot be function or type) + 'TO', // reserved, requires AS + 'TRAILING', // reserved + 'TRANSACTION', + 'TRANSFORM', + 'TREAT', // (cannot be function or type) + 'TRIGGER', + 'TRIM', // (cannot be function or type) + 'TRUE', // reserved + 'TRUNCATE', + 'TRUSTED', + 'TYPE', + 'TYPES', + 'UESCAPE', + 'UNBOUNDED', + 'UNCOMMITTED', + 'UNENCRYPTED', + 'UNION', // reserved, requires AS + 'UNIQUE', // reserved + 'UNKNOWN', + 'UNLISTEN', + 'UNLOGGED', + 'UNTIL', + 'UPDATE', + 'USER', // reserved + 'USING', // reserved + 'VACUUM', + 'VALID', + 'VALIDATE', + 'VALIDATOR', + 'VALUE', + 'VALUES', // (cannot be function or type) + 'VARCHAR', // (cannot be function or type) + 'VARIADIC', // reserved + 'VARYING', // requires AS + 'VERBOSE', // reserved (can be function or type) + 'VERSION', + 'VIEW', + 'VIEWS', + 'VOLATILE', + 'WHEN', // reserved + 'WHERE', // reserved, requires AS + 'WHITESPACE', + 'WINDOW', // reserved, requires AS + 'WITH', // reserved, requires AS + 'WITHIN', // requires AS + 'WITHOUT', // requires AS + 'WORK', + 'WRAPPER', + 'WRITE', + 'XML', + 'XMLATTRIBUTES', // (cannot be function or type) + 'XMLCONCAT', // (cannot be function or type) + 'XMLELEMENT', // (cannot be function or type) + 'XMLEXISTS', // (cannot be function or type) + 'XMLFOREST', // (cannot be function or type) + 'XMLNAMESPACES', // (cannot be function or type) + 'XMLPARSE', // (cannot be function or type) + 'XMLPI', // (cannot be function or type) + 'XMLROOT', // (cannot be function or type) + 'XMLSERIALIZE', // (cannot be function or type) + 'XMLTABLE', // (cannot be function or type) + 'YEAR', // requires AS + 'YES', + 'ZONE', +]; diff --git a/src/languages/redshift/redshift.functions.ts b/src/languages/redshift/redshift.functions.ts index 46dbdab7f5..5c65e1fb7b 100644 --- a/src/languages/redshift/redshift.functions.ts +++ b/src/languages/redshift/redshift.functions.ts @@ -1,366 +1,374 @@ -import { flatKeywordList } from '../../utils.js'; - -export const functions = flatKeywordList({ +export const functions: string[] = [ // https://docs.aws.amazon.com/redshift/latest/dg/c_Aggregate_Functions.html - aggregate: [ - 'ANY_VALUE', - 'APPROXIMATE PERCENTILE_DISC', - 'AVG', - 'COUNT', - 'LISTAGG', - 'MAX', - 'MEDIAN', - 'MIN', - 'PERCENTILE_CONT', - 'STDDEV_SAMP', - 'STDDEV_POP', - 'SUM', - 'VAR_SAMP', - 'VAR_POP', - ], + 'ANY_VALUE', + 'APPROXIMATE PERCENTILE_DISC', + 'AVG', + 'COUNT', + 'LISTAGG', + 'MAX', + 'MEDIAN', + 'MIN', + 'PERCENTILE_CONT', + 'STDDEV_SAMP', + 'STDDEV_POP', + 'SUM', + 'VAR_SAMP', + 'VAR_POP', + // https://docs.aws.amazon.com/redshift/latest/dg/c_Array_Functions.html - array: [ - 'array', - 'array_concat', - 'array_flatten', - 'get_array_length', - 'split_to_array', - 'subarray', - ], + 'array', + 'array_concat', + 'array_flatten', + 'get_array_length', + 'split_to_array', + 'subarray', + // https://docs.aws.amazon.com/redshift/latest/dg/c_bitwise_aggregate_functions.html - bitwise: ['BIT_AND', 'BIT_OR', 'BOOL_AND', 'BOOL_OR'], + 'BIT_AND', + 'BIT_OR', + 'BOOL_AND', + 'BOOL_OR', + // https://docs.aws.amazon.com/redshift/latest/dg/c_conditional_expressions.html - conditional: ['COALESCE', 'DECODE', 'GREATEST', 'LEAST', 'NVL', 'NVL2', 'NULLIF'], + 'COALESCE', + 'DECODE', + 'GREATEST', + 'LEAST', + 'NVL', + 'NVL2', + 'NULLIF', + // https://docs.aws.amazon.com/redshift/latest/dg/Date_functions_header.html - dateTime: [ - 'ADD_MONTHS', - 'AT TIME ZONE', - 'CONVERT_TIMEZONE', - 'CURRENT_DATE', - 'CURRENT_TIME', - 'CURRENT_TIMESTAMP', - 'DATE_CMP', - 'DATE_CMP_TIMESTAMP', - 'DATE_CMP_TIMESTAMPTZ', - 'DATE_PART_YEAR', - 'DATEADD', - 'DATEDIFF', - 'DATE_PART', - 'DATE_TRUNC', - 'EXTRACT', - 'GETDATE', - 'INTERVAL_CMP', - 'LAST_DAY', - 'MONTHS_BETWEEN', - 'NEXT_DAY', - 'SYSDATE', - 'TIMEOFDAY', - 'TIMESTAMP_CMP', - 'TIMESTAMP_CMP_DATE', - 'TIMESTAMP_CMP_TIMESTAMPTZ', - 'TIMESTAMPTZ_CMP', - 'TIMESTAMPTZ_CMP_DATE', - 'TIMESTAMPTZ_CMP_TIMESTAMP', - 'TIMEZONE', - 'TO_TIMESTAMP', - 'TRUNC', - ], + 'ADD_MONTHS', + 'AT TIME ZONE', + 'CONVERT_TIMEZONE', + 'CURRENT_DATE', + 'CURRENT_TIME', + 'CURRENT_TIMESTAMP', + 'DATE_CMP', + 'DATE_CMP_TIMESTAMP', + 'DATE_CMP_TIMESTAMPTZ', + 'DATE_PART_YEAR', + 'DATEADD', + 'DATEDIFF', + 'DATE_PART', + 'DATE_TRUNC', + 'EXTRACT', + 'GETDATE', + 'INTERVAL_CMP', + 'LAST_DAY', + 'MONTHS_BETWEEN', + 'NEXT_DAY', + 'SYSDATE', + 'TIMEOFDAY', + 'TIMESTAMP_CMP', + 'TIMESTAMP_CMP_DATE', + 'TIMESTAMP_CMP_TIMESTAMPTZ', + 'TIMESTAMPTZ_CMP', + 'TIMESTAMPTZ_CMP_DATE', + 'TIMESTAMPTZ_CMP_TIMESTAMP', + 'TIMEZONE', + 'TO_TIMESTAMP', + 'TRUNC', + // https://docs.aws.amazon.com/redshift/latest/dg/geospatial-functions.html - spatial: [ - 'AddBBox', - 'DropBBox', - 'GeometryType', - 'ST_AddPoint', - 'ST_Angle', - 'ST_Area', - 'ST_AsBinary', - 'ST_AsEWKB', - 'ST_AsEWKT', - 'ST_AsGeoJSON', - 'ST_AsText', - 'ST_Azimuth', - 'ST_Boundary', - 'ST_Collect', - 'ST_Contains', - 'ST_ContainsProperly', - 'ST_ConvexHull', - 'ST_CoveredBy', - 'ST_Covers', - 'ST_Crosses', - 'ST_Dimension', - 'ST_Disjoint', - 'ST_Distance', - 'ST_DistanceSphere', - 'ST_DWithin', - 'ST_EndPoint', - 'ST_Envelope', - 'ST_Equals', - 'ST_ExteriorRing', - 'ST_Force2D', - 'ST_Force3D', - 'ST_Force3DM', - 'ST_Force3DZ', - 'ST_Force4D', - 'ST_GeometryN', - 'ST_GeometryType', - 'ST_GeomFromEWKB', - 'ST_GeomFromEWKT', - 'ST_GeomFromText', - 'ST_GeomFromWKB', - 'ST_InteriorRingN', - 'ST_Intersects', - 'ST_IsPolygonCCW', - 'ST_IsPolygonCW', - 'ST_IsClosed', - 'ST_IsCollection', - 'ST_IsEmpty', - 'ST_IsSimple', - 'ST_IsValid', - 'ST_Length', - 'ST_LengthSphere', - 'ST_Length2D', - 'ST_LineFromMultiPoint', - 'ST_LineInterpolatePoint', - 'ST_M', - 'ST_MakeEnvelope', - 'ST_MakeLine', - 'ST_MakePoint', - 'ST_MakePolygon', - 'ST_MemSize', - 'ST_MMax', - 'ST_MMin', - 'ST_Multi', - 'ST_NDims', - 'ST_NPoints', - 'ST_NRings', - 'ST_NumGeometries', - 'ST_NumInteriorRings', - 'ST_NumPoints', - 'ST_Perimeter', - 'ST_Perimeter2D', - 'ST_Point', - 'ST_PointN', - 'ST_Points', - 'ST_Polygon', - 'ST_RemovePoint', - 'ST_Reverse', - 'ST_SetPoint', - 'ST_SetSRID', - 'ST_Simplify', - 'ST_SRID', - 'ST_StartPoint', - 'ST_Touches', - 'ST_Within', - 'ST_X', - 'ST_XMax', - 'ST_XMin', - 'ST_Y', - 'ST_YMax', - 'ST_YMin', - 'ST_Z', - 'ST_ZMax', - 'ST_ZMin', - 'SupportsBBox', - ], + 'AddBBox', + 'DropBBox', + 'GeometryType', + 'ST_AddPoint', + 'ST_Angle', + 'ST_Area', + 'ST_AsBinary', + 'ST_AsEWKB', + 'ST_AsEWKT', + 'ST_AsGeoJSON', + 'ST_AsText', + 'ST_Azimuth', + 'ST_Boundary', + 'ST_Collect', + 'ST_Contains', + 'ST_ContainsProperly', + 'ST_ConvexHull', + 'ST_CoveredBy', + 'ST_Covers', + 'ST_Crosses', + 'ST_Dimension', + 'ST_Disjoint', + 'ST_Distance', + 'ST_DistanceSphere', + 'ST_DWithin', + 'ST_EndPoint', + 'ST_Envelope', + 'ST_Equals', + 'ST_ExteriorRing', + 'ST_Force2D', + 'ST_Force3D', + 'ST_Force3DM', + 'ST_Force3DZ', + 'ST_Force4D', + 'ST_GeometryN', + 'ST_GeometryType', + 'ST_GeomFromEWKB', + 'ST_GeomFromEWKT', + 'ST_GeomFromText', + 'ST_GeomFromWKB', + 'ST_InteriorRingN', + 'ST_Intersects', + 'ST_IsPolygonCCW', + 'ST_IsPolygonCW', + 'ST_IsClosed', + 'ST_IsCollection', + 'ST_IsEmpty', + 'ST_IsSimple', + 'ST_IsValid', + 'ST_Length', + 'ST_LengthSphere', + 'ST_Length2D', + 'ST_LineFromMultiPoint', + 'ST_LineInterpolatePoint', + 'ST_M', + 'ST_MakeEnvelope', + 'ST_MakeLine', + 'ST_MakePoint', + 'ST_MakePolygon', + 'ST_MemSize', + 'ST_MMax', + 'ST_MMin', + 'ST_Multi', + 'ST_NDims', + 'ST_NPoints', + 'ST_NRings', + 'ST_NumGeometries', + 'ST_NumInteriorRings', + 'ST_NumPoints', + 'ST_Perimeter', + 'ST_Perimeter2D', + 'ST_Point', + 'ST_PointN', + 'ST_Points', + 'ST_Polygon', + 'ST_RemovePoint', + 'ST_Reverse', + 'ST_SetPoint', + 'ST_SetSRID', + 'ST_Simplify', + 'ST_SRID', + 'ST_StartPoint', + 'ST_Touches', + 'ST_Within', + 'ST_X', + 'ST_XMax', + 'ST_XMin', + 'ST_Y', + 'ST_YMax', + 'ST_YMin', + 'ST_Z', + 'ST_ZMax', + 'ST_ZMin', + 'SupportsBBox', + // https://docs.aws.amazon.com/redshift/latest/dg/hash-functions.html - hash: ['CHECKSUM', 'FUNC_SHA1', 'FNV_HASH', 'MD5', 'SHA', 'SHA1', 'SHA2'], + 'CHECKSUM', + 'FUNC_SHA1', + 'FNV_HASH', + 'MD5', + 'SHA', + 'SHA1', + 'SHA2', + // https://docs.aws.amazon.com/redshift/latest/dg/hyperloglog-functions.html - hyperLogLog: ['HLL', 'HLL_CREATE_SKETCH', 'HLL_CARDINALITY', 'HLL_COMBINE'], + 'HLL', + 'HLL_CREATE_SKETCH', + 'HLL_CARDINALITY', + 'HLL_COMBINE', + // https://docs.aws.amazon.com/redshift/latest/dg/json-functions.html - json: [ - 'IS_VALID_JSON', - 'IS_VALID_JSON_ARRAY', - 'JSON_ARRAY_LENGTH', - 'JSON_EXTRACT_ARRAY_ELEMENT_TEXT', - 'JSON_EXTRACT_PATH_TEXT', - 'JSON_PARSE', - 'JSON_SERIALIZE', - ], + 'IS_VALID_JSON', + 'IS_VALID_JSON_ARRAY', + 'JSON_ARRAY_LENGTH', + 'JSON_EXTRACT_ARRAY_ELEMENT_TEXT', + 'JSON_EXTRACT_PATH_TEXT', + 'JSON_PARSE', + 'JSON_SERIALIZE', + // https://docs.aws.amazon.com/redshift/latest/dg/Math_functions.html - math: [ - 'ABS', - 'ACOS', - 'ASIN', - 'ATAN', - 'ATAN2', - 'CBRT', - 'CEILING', - 'CEIL', - 'COS', - 'COT', - 'DEGREES', - 'DEXP', - 'DLOG1', - 'DLOG10', - 'EXP', - 'FLOOR', - 'LN', - 'LOG', - 'MOD', - 'PI', - 'POWER', - 'RADIANS', - 'RANDOM', - 'ROUND', - 'SIN', - 'SIGN', - 'SQRT', - 'TAN', - 'TO_HEX', - 'TRUNC', - ], + 'ABS', + 'ACOS', + 'ASIN', + 'ATAN', + 'ATAN2', + 'CBRT', + 'CEILING', + 'CEIL', + 'COS', + 'COT', + 'DEGREES', + 'DEXP', + 'DLOG1', + 'DLOG10', + 'EXP', + 'FLOOR', + 'LN', + 'LOG', + 'MOD', + 'PI', + 'POWER', + 'RADIANS', + 'RANDOM', + 'ROUND', + 'SIN', + 'SIGN', + 'SQRT', + 'TAN', + 'TO_HEX', + 'TRUNC', + // https://docs.aws.amazon.com/redshift/latest/dg/ml-function.html - machineLearning: ['EXPLAIN_MODEL'], + 'EXPLAIN_MODEL', + // https://docs.aws.amazon.com/redshift/latest/dg/String_functions_header.html - string: [ - 'ASCII', - 'BPCHARCMP', - 'BTRIM', - 'BTTEXT_PATTERN_CMP', - 'CHAR_LENGTH', - 'CHARACTER_LENGTH', - 'CHARINDEX', - 'CHR', - 'COLLATE', - 'CONCAT', - 'CRC32', - 'DIFFERENCE', - 'INITCAP', - 'LEFT', - 'RIGHT', - 'LEN', - 'LENGTH', - 'LOWER', - 'LPAD', - 'RPAD', - 'LTRIM', - 'OCTETINDEX', - 'OCTET_LENGTH', - 'POSITION', - 'QUOTE_IDENT', - 'QUOTE_LITERAL', - 'REGEXP_COUNT', - 'REGEXP_INSTR', - 'REGEXP_REPLACE', - 'REGEXP_SUBSTR', - 'REPEAT', - 'REPLACE', - 'REPLICATE', - 'REVERSE', - 'RTRIM', - 'SOUNDEX', - 'SPLIT_PART', - 'STRPOS', - 'STRTOL', - 'SUBSTRING', - 'TEXTLEN', - 'TRANSLATE', - 'TRIM', - 'UPPER', - ], + 'ASCII', + 'BPCHARCMP', + 'BTRIM', + 'BTTEXT_PATTERN_CMP', + 'CHAR_LENGTH', + 'CHARACTER_LENGTH', + 'CHARINDEX', + 'CHR', + 'COLLATE', + 'CONCAT', + 'CRC32', + 'DIFFERENCE', + 'INITCAP', + 'LEFT', + 'RIGHT', + 'LEN', + 'LENGTH', + 'LOWER', + 'LPAD', + 'RPAD', + 'LTRIM', + 'OCTETINDEX', + 'OCTET_LENGTH', + 'POSITION', + 'QUOTE_IDENT', + 'QUOTE_LITERAL', + 'REGEXP_COUNT', + 'REGEXP_INSTR', + 'REGEXP_REPLACE', + 'REGEXP_SUBSTR', + 'REPEAT', + 'REPLACE', + 'REPLICATE', + 'REVERSE', + 'RTRIM', + 'SOUNDEX', + 'SPLIT_PART', + 'STRPOS', + 'STRTOL', + 'SUBSTRING', + 'TEXTLEN', + 'TRANSLATE', + 'TRIM', + 'UPPER', + // https://docs.aws.amazon.com/redshift/latest/dg/c_Type_Info_Functions.html - superType: [ - 'decimal_precision', - 'decimal_scale', - 'is_array', - 'is_bigint', - 'is_boolean', - 'is_char', - 'is_decimal', - 'is_float', - 'is_integer', - 'is_object', - 'is_scalar', - 'is_smallint', - 'is_varchar', - 'json_typeof', - ], + 'decimal_precision', + 'decimal_scale', + 'is_array', + 'is_bigint', + 'is_boolean', + 'is_char', + 'is_decimal', + 'is_float', + 'is_integer', + 'is_object', + 'is_scalar', + 'is_smallint', + 'is_varchar', + 'json_typeof', + // https://docs.aws.amazon.com/redshift/latest/dg/c_Window_functions.html - window: [ - 'AVG', - 'COUNT', - 'CUME_DIST', - 'DENSE_RANK', - 'FIRST_VALUE', - 'LAST_VALUE', - 'LAG', - 'LEAD', - 'LISTAGG', - 'MAX', - 'MEDIAN', - 'MIN', - 'NTH_VALUE', - 'NTILE', - 'PERCENT_RANK', - 'PERCENTILE_CONT', - 'PERCENTILE_DISC', - 'RANK', - 'RATIO_TO_REPORT', - 'ROW_NUMBER', - 'STDDEV_SAMP', - 'STDDEV_POP', - 'SUM', - 'VAR_SAMP', - 'VAR_POP', - ], + 'AVG', + 'COUNT', + 'CUME_DIST', + 'DENSE_RANK', + 'FIRST_VALUE', + 'LAST_VALUE', + 'LAG', + 'LEAD', + 'LISTAGG', + 'MAX', + 'MEDIAN', + 'MIN', + 'NTH_VALUE', + 'NTILE', + 'PERCENT_RANK', + 'PERCENTILE_CONT', + 'PERCENTILE_DISC', + 'RANK', + 'RATIO_TO_REPORT', + 'ROW_NUMBER', + 'STDDEV_SAMP', + 'STDDEV_POP', + 'SUM', + 'VAR_SAMP', + 'VAR_POP', + // https://docs.aws.amazon.com/redshift/latest/dg/r_Data_type_formatting.html - dataType: [ - 'CAST', - 'CONVERT', - 'TO_CHAR', - 'TO_DATE', - 'TO_NUMBER', - 'TEXT_TO_INT_ALT', - 'TEXT_TO_NUMERIC_ALT', - ], + 'CAST', + 'CONVERT', + 'TO_CHAR', + 'TO_DATE', + 'TO_NUMBER', + 'TEXT_TO_INT_ALT', + 'TEXT_TO_NUMERIC_ALT', + // https://docs.aws.amazon.com/redshift/latest/dg/r_System_administration_functions.html - sysAdmin: [ - 'CHANGE_QUERY_PRIORITY', - 'CHANGE_SESSION_PRIORITY', - 'CHANGE_USER_PRIORITY', - 'CURRENT_SETTING', - 'PG_CANCEL_BACKEND', - 'PG_TERMINATE_BACKEND', - 'REBOOT_CLUSTER', - 'SET_CONFIG', - ], + 'CHANGE_QUERY_PRIORITY', + 'CHANGE_SESSION_PRIORITY', + 'CHANGE_USER_PRIORITY', + 'CURRENT_SETTING', + 'PG_CANCEL_BACKEND', + 'PG_TERMINATE_BACKEND', + 'REBOOT_CLUSTER', + 'SET_CONFIG', + // https://docs.aws.amazon.com/redshift/latest/dg/r_System_information_functions.html - sysInfo: [ - 'CURRENT_AWS_ACCOUNT', - 'CURRENT_DATABASE', - 'CURRENT_NAMESPACE', - 'CURRENT_SCHEMA', - 'CURRENT_SCHEMAS', - 'CURRENT_USER', - 'CURRENT_USER_ID', - 'HAS_ASSUMEROLE_PRIVILEGE', - 'HAS_DATABASE_PRIVILEGE', - 'HAS_SCHEMA_PRIVILEGE', - 'HAS_TABLE_PRIVILEGE', - 'PG_BACKEND_PID', - 'PG_GET_COLS', - 'PG_GET_GRANTEE_BY_IAM_ROLE', - 'PG_GET_IAM_ROLE_BY_USER', - 'PG_GET_LATE_BINDING_VIEW_COLS', - 'PG_LAST_COPY_COUNT', - 'PG_LAST_COPY_ID', - 'PG_LAST_UNLOAD_ID', - 'PG_LAST_QUERY_ID', - 'PG_LAST_UNLOAD_COUNT', - 'SESSION_USER', - 'SLICE_NUM', - 'USER', - 'VERSION', - ], - dataTypes: [ - 'DECIMAL', - 'NUMERIC', - 'CHAR', - 'CHARACTER', - 'VARCHAR', - 'CHARACTER VARYING', - 'NCHAR', - 'NVARCHAR', - 'VARBYTE', - ], -}); + 'CURRENT_AWS_ACCOUNT', + 'CURRENT_DATABASE', + 'CURRENT_NAMESPACE', + 'CURRENT_SCHEMA', + 'CURRENT_SCHEMAS', + 'CURRENT_USER', + 'CURRENT_USER_ID', + 'HAS_ASSUMEROLE_PRIVILEGE', + 'HAS_DATABASE_PRIVILEGE', + 'HAS_SCHEMA_PRIVILEGE', + 'HAS_TABLE_PRIVILEGE', + 'PG_BACKEND_PID', + 'PG_GET_COLS', + 'PG_GET_GRANTEE_BY_IAM_ROLE', + 'PG_GET_IAM_ROLE_BY_USER', + 'PG_GET_LATE_BINDING_VIEW_COLS', + 'PG_LAST_COPY_COUNT', + 'PG_LAST_COPY_ID', + 'PG_LAST_UNLOAD_ID', + 'PG_LAST_QUERY_ID', + 'PG_LAST_UNLOAD_COUNT', + 'SESSION_USER', + 'SLICE_NUM', + 'USER', + 'VERSION', + + // dataTypes + 'DECIMAL', + 'NUMERIC', + 'CHAR', + 'CHARACTER', + 'VARCHAR', + 'CHARACTER VARYING', + 'NCHAR', + 'NVARCHAR', + 'VARBYTE', +]; diff --git a/src/languages/redshift/redshift.keywords.ts b/src/languages/redshift/redshift.keywords.ts index 15eee26439..c8e5f8068a 100644 --- a/src/languages/redshift/redshift.keywords.ts +++ b/src/languages/redshift/redshift.keywords.ts @@ -1,189 +1,195 @@ -import { flatKeywordList } from '../../utils.js'; - -export const keywords = flatKeywordList({ +export const keywords: string[] = [ // https://docs.aws.amazon.com/redshift/latest/dg/r_pg_keywords.html - standard: [ - 'AES128', - 'AES256', - 'ALL', - 'ALLOWOVERWRITE', - 'ANY', - 'ARRAY', - 'AS', - 'ASC', - 'AUTHORIZATION', - 'BACKUP', - 'BETWEEN', - 'BINARY', - 'BOTH', - 'CHECK', - 'COLUMN', - 'CONSTRAINT', - 'CREATE', - 'CROSS', - 'DEFAULT', - 'DEFERRABLE', - 'DEFLATE', - 'DEFRAG', - 'DESC', - 'DISABLE', - 'DISTINCT', - 'DO', - 'ENABLE', - 'ENCODE', - 'ENCRYPT', - 'ENCRYPTION', - 'EXPLICIT', - 'FALSE', - 'FOR', - 'FOREIGN', - 'FREEZE', - 'FROM', - 'FULL', - 'GLOBALDICT256', - 'GLOBALDICT64K', - 'GROUP', - 'IDENTITY', - 'IGNORE', - 'ILIKE', - 'IN', - 'INITIALLY', - 'INNER', - 'INTO', - 'IS', - 'ISNULL', - 'LANGUAGE', - 'LEADING', - 'LIKE', - 'LIMIT', - 'LOCALTIME', - 'LOCALTIMESTAMP', - 'LUN', - 'LUNS', - 'MINUS', - 'NATURAL', - 'NEW', - 'NOT', - 'NOTNULL', - 'NULL', - 'NULLS', - 'OFF', - 'OFFLINE', - 'OFFSET', - 'OID', - 'OLD', - 'ON', - 'ONLY', - 'OPEN', - 'ORDER', - 'OUTER', - 'OVERLAPS', - 'PARALLEL', - 'PARTITION', - 'PERCENT', - 'PERMISSIONS', - 'PLACING', - 'PRIMARY', - 'RECOVER', - 'REFERENCES', - 'REJECTLOG', - 'RESORT', - 'RESPECT', - 'RESTORE', - 'SIMILAR', - 'SNAPSHOT', - 'SOME', - 'SYSTEM', - 'TABLE', - 'TAG', - 'TDES', - 'THEN', - 'TIMESTAMP', - 'TO', - 'TOP', - 'TRAILING', - 'TRUE', - 'UNIQUE', - 'USING', - 'VERBOSE', - 'WALLET', - 'WITHOUT', - ], + 'AES128', + 'AES256', + 'ALL', + 'ALLOWOVERWRITE', + 'ANY', + 'ARRAY', + 'AS', + 'ASC', + 'AUTHORIZATION', + 'BACKUP', + 'BETWEEN', + 'BINARY', + 'BOTH', + 'CHECK', + 'COLUMN', + 'CONSTRAINT', + 'CREATE', + 'CROSS', + 'DEFAULT', + 'DEFERRABLE', + 'DEFLATE', + 'DEFRAG', + 'DESC', + 'DISABLE', + 'DISTINCT', + 'DO', + 'ENABLE', + 'ENCODE', + 'ENCRYPT', + 'ENCRYPTION', + 'EXPLICIT', + 'FALSE', + 'FOR', + 'FOREIGN', + 'FREEZE', + 'FROM', + 'FULL', + 'GLOBALDICT256', + 'GLOBALDICT64K', + 'GROUP', + 'IDENTITY', + 'IGNORE', + 'ILIKE', + 'IN', + 'INITIALLY', + 'INNER', + 'INTO', + 'IS', + 'ISNULL', + 'LANGUAGE', + 'LEADING', + 'LIKE', + 'LIMIT', + 'LOCALTIME', + 'LOCALTIMESTAMP', + 'LUN', + 'LUNS', + 'MINUS', + 'NATURAL', + 'NEW', + 'NOT', + 'NOTNULL', + 'NULL', + 'NULLS', + 'OFF', + 'OFFLINE', + 'OFFSET', + 'OID', + 'OLD', + 'ON', + 'ONLY', + 'OPEN', + 'ORDER', + 'OUTER', + 'OVERLAPS', + 'PARALLEL', + 'PARTITION', + 'PERCENT', + 'PERMISSIONS', + 'PLACING', + 'PRIMARY', + 'RECOVER', + 'REFERENCES', + 'REJECTLOG', + 'RESORT', + 'RESPECT', + 'RESTORE', + 'SIMILAR', + 'SNAPSHOT', + 'SOME', + 'SYSTEM', + 'TABLE', + 'TAG', + 'TDES', + 'THEN', + 'TIMESTAMP', + 'TO', + 'TOP', + 'TRAILING', + 'TRUE', + 'UNIQUE', + 'USING', + 'VERBOSE', + 'WALLET', + 'WITHOUT', + // https://docs.aws.amazon.com/redshift/latest/dg/copy-parameters-data-conversion.html - dataConversionParams: [ - 'ACCEPTANYDATE', - 'ACCEPTINVCHARS', - 'BLANKSASNULL', - 'DATEFORMAT', - 'EMPTYASNULL', - 'ENCODING', - 'ESCAPE', - 'EXPLICIT_IDS', - 'FILLRECORD', - 'IGNOREBLANKLINES', - 'IGNOREHEADER', - 'REMOVEQUOTES', - 'ROUNDEC', - 'TIMEFORMAT', - 'TRIMBLANKS', - 'TRUNCATECOLUMNS', - ], + 'ACCEPTANYDATE', + 'ACCEPTINVCHARS', + 'BLANKSASNULL', + 'DATEFORMAT', + 'EMPTYASNULL', + 'ENCODING', + 'ESCAPE', + 'EXPLICIT_IDS', + 'FILLRECORD', + 'IGNOREBLANKLINES', + 'IGNOREHEADER', + 'REMOVEQUOTES', + 'ROUNDEC', + 'TIMEFORMAT', + 'TRIMBLANKS', + 'TRUNCATECOLUMNS', + // https://docs.aws.amazon.com/redshift/latest/dg/copy-parameters-data-load.html - dataLoadParams: ['COMPROWS', 'COMPUPDATE', 'MAXERROR', 'NOLOAD', 'STATUPDATE'], + 'COMPROWS', + 'COMPUPDATE', + 'MAXERROR', + 'NOLOAD', + 'STATUPDATE', + // https://docs.aws.amazon.com/redshift/latest/dg/copy-parameters-data-format.html - dataFormatParams: [ - 'FORMAT', - 'CSV', - 'DELIMITER', - 'FIXEDWIDTH', - 'SHAPEFILE', - 'AVRO', - 'JSON', - 'PARQUET', - 'ORC', - ], + 'FORMAT', + 'CSV', + 'DELIMITER', + 'FIXEDWIDTH', + 'SHAPEFILE', + 'AVRO', + 'JSON', + 'PARQUET', + 'ORC', + // https://docs.aws.amazon.com/redshift/latest/dg/copy-parameters-authorization.html - copyAuthParams: [ - 'ACCESS_KEY_ID', - 'CREDENTIALS', - 'ENCRYPTED', - 'IAM_ROLE', - 'MASTER_SYMMETRIC_KEY', - 'SECRET_ACCESS_KEY', - 'SESSION_TOKEN', - ], + 'ACCESS_KEY_ID', + 'CREDENTIALS', + 'ENCRYPTED', + 'IAM_ROLE', + 'MASTER_SYMMETRIC_KEY', + 'SECRET_ACCESS_KEY', + 'SESSION_TOKEN', + // https://docs.aws.amazon.com/redshift/latest/dg/copy-parameters-file-compression.html - copyCompressionParams: ['BZIP2', 'GZIP', 'LZOP', 'ZSTD'], + 'BZIP2', + 'GZIP', + 'LZOP', + 'ZSTD', + // https://docs.aws.amazon.com/redshift/latest/dg/r_COPY-alphabetical-parm-list.html - copyMiscParams: ['MANIFEST', 'READRATIO', 'REGION', 'SSH'], + 'MANIFEST', + 'READRATIO', + 'REGION', + 'SSH', + // https://docs.aws.amazon.com/redshift/latest/dg/c_Compression_encodings.html - compressionEncodings: [ - 'RAW', - 'AZ64', - 'BYTEDICT', - 'DELTA', - 'DELTA32K', - 'LZO', - 'MOSTLY8', - 'MOSTLY16', - 'MOSTLY32', - 'RUNLENGTH', - 'TEXT255', - 'TEXT32K', - ], - misc: [ - // CREATE EXTERNAL SCHEMA (https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_EXTERNAL_SCHEMA.html) - 'CATALOG_ROLE', - 'SECRET_ARN', - 'EXTERNAL', - // https://docs.aws.amazon.com/redshift/latest/dg/c_choosing_dist_sort.html - 'AUTO', - 'EVEN', - 'KEY', - 'PREDICATE', // ANALYZE | ANALYSE (https://docs.aws.amazon.com/redshift/latest/dg/r_ANALYZE.html) - // unknown - 'COMPRESSION', - ], + 'RAW', + 'AZ64', + 'BYTEDICT', + 'DELTA', + 'DELTA32K', + 'LZO', + 'MOSTLY8', + 'MOSTLY16', + 'MOSTLY32', + 'RUNLENGTH', + 'TEXT255', + 'TEXT32K', + + // misc + // CREATE EXTERNAL SCHEMA (https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_EXTERNAL_SCHEMA.html) + 'CATALOG_ROLE', + 'SECRET_ARN', + 'EXTERNAL', + // https://docs.aws.amazon.com/redshift/latest/dg/c_choosing_dist_sort.html + 'AUTO', + 'EVEN', + 'KEY', + 'PREDICATE', // ANALYZE | ANALYSE (https://docs.aws.amazon.com/redshift/latest/dg/r_ANALYZE.html) + // unknown + 'COMPRESSION', + /** * Other keywords not included: * STL: https://docs.aws.amazon.com/redshift/latest/dg/c_intro_STL_tables.html @@ -191,6 +197,8 @@ export const keywords = flatKeywordList({ * SVL: https://docs.aws.amazon.com/redshift/latest/dg/svl_views.html * SVV: https://docs.aws.amazon.com/redshift/latest/dg/svv_views.html */ + // https://docs.aws.amazon.com/redshift/latest/dg/r_Character_types.html#r_Character_types-text-and-bpchar-types - dataTypes: ['BPCHAR', 'TEXT'], -}); + 'BPCHAR', + 'TEXT', +]; diff --git a/src/languages/singlestoredb/singlestoredb.functions.ts b/src/languages/singlestoredb/singlestoredb.functions.ts index 3c7b92b0a5..1ecd4e167b 100644 --- a/src/languages/singlestoredb/singlestoredb.functions.ts +++ b/src/languages/singlestoredb/singlestoredb.functions.ts @@ -1,6 +1,4 @@ -import { flatKeywordList } from '../../utils.js'; - -export const functions = flatKeywordList({ +export const functions: string[] = [ // https://docs.singlestore.com/managed-service/en/reference/sql-reference/vector-functions/vector-functions.html // https://docs.singlestore.com/managed-service/en/reference/sql-reference/window-functions/window-functions.html // https://docs.singlestore.com/managed-service/en/reference/sql-reference/string-functions/string-functions.html @@ -16,300 +14,298 @@ export const functions = flatKeywordList({ // https://docs.singlestore.com/managed-service/en/reference/sql-reference/distinct-count-estimation-functions.html // https://docs.singlestore.com/managed-service/en/reference/sql-reference/full-text-search-functions/full-text-search-functions.html // https://docs.singlestore.com/managed-service/en/reference/sql-reference/regular-expression-functions.html - all: [ - 'ABS', - 'ACOS', - 'ADDDATE', - 'ADDTIME', - 'AES_DECRYPT', - 'AES_ENCRYPT', - 'ANY_VALUE', - 'APPROX_COUNT_DISTINCT', - 'APPROX_COUNT_DISTINCT_ACCUMULATE', - 'APPROX_COUNT_DISTINCT_COMBINE', - 'APPROX_COUNT_DISTINCT_ESTIMATE', - 'APPROX_GEOGRAPHY_INTERSECTS', - 'APPROX_PERCENTILE', - 'ASCII', - 'ASIN', - 'ATAN', - 'ATAN2', - 'AVG', - 'BIN', - 'BINARY', - 'BIT_AND', - 'BIT_COUNT', - 'BIT_OR', - 'BIT_XOR', - 'CAST', - 'CEIL', - 'CEILING', - 'CHAR', - 'CHARACTER_LENGTH', - 'CHAR_LENGTH', - 'CHARSET', - 'COALESCE', - 'COERCIBILITY', - 'COLLATION', - 'COLLECT', - 'CONCAT', - 'CONCAT_WS', - 'CONNECTION_ID', - 'CONV', - 'CONVERT', - 'CONVERT_TZ', - 'COS', - 'COT', - 'COUNT', - 'CUME_DIST', - 'CURDATE', - 'CURRENT_DATE', - 'CURRENT_ROLE', - 'CURRENT_TIME', - 'CURRENT_TIMESTAMP', - 'CURRENT_USER', - 'CURTIME', - 'DATABASE', - 'DATE', - 'DATE_ADD', - 'DATEDIFF', - 'DATE_FORMAT', - 'DATE_SUB', - 'DATE_TRUNC', - 'DAY', - 'DAYNAME', - 'DAYOFMONTH', - 'DAYOFWEEK', - 'DAYOFYEAR', - 'DECODE', - 'DEFAULT', - 'DEGREES', - 'DENSE_RANK', - 'DIV', - 'DOT_PRODUCT', - 'ELT', - 'EUCLIDEAN_DISTANCE', - 'EXP', - 'EXTRACT', - 'FIELD', - 'FIRST', - 'FIRST_VALUE', - 'FLOOR', - 'FORMAT', - 'FOUND_ROWS', - 'FROM_BASE64', - 'FROM_DAYS', - 'FROM_UNIXTIME', - 'GEOGRAPHY_AREA', - 'GEOGRAPHY_CONTAINS', - 'GEOGRAPHY_DISTANCE', - 'GEOGRAPHY_INTERSECTS', - 'GEOGRAPHY_LATITUDE', - 'GEOGRAPHY_LENGTH', - 'GEOGRAPHY_LONGITUDE', - 'GEOGRAPHY_POINT', - 'GEOGRAPHY_WITHIN_DISTANCE', - 'GEOMETRY_AREA', - 'GEOMETRY_CONTAINS', - 'GEOMETRY_DISTANCE', - 'GEOMETRY_FILTER', - 'GEOMETRY_INTERSECTS', - 'GEOMETRY_LENGTH', - 'GEOMETRY_POINT', - 'GEOMETRY_WITHIN_DISTANCE', - 'GEOMETRY_X', - 'GEOMETRY_Y', - 'GREATEST', - 'GROUPING', - 'GROUP_CONCAT', - 'HEX', - 'HIGHLIGHT', - 'HOUR', - 'ICU_VERSION', - 'IF', - 'IFNULL', - 'INET_ATON', - 'INET_NTOA', - 'INET6_ATON', - 'INET6_NTOA', - 'INITCAP', - 'INSERT', - 'INSTR', - 'INTERVAL', - 'IS', - 'IS NULL', - 'JSON_AGG', - 'JSON_ARRAY_CONTAINS_DOUBLE', - 'JSON_ARRAY_CONTAINS_JSON', - 'JSON_ARRAY_CONTAINS_STRING', - 'JSON_ARRAY_PUSH_DOUBLE', - 'JSON_ARRAY_PUSH_JSON', - 'JSON_ARRAY_PUSH_STRING', - 'JSON_DELETE_KEY', - 'JSON_EXTRACT_DOUBLE', - 'JSON_EXTRACT_JSON', - 'JSON_EXTRACT_STRING', - 'JSON_EXTRACT_BIGINT', - 'JSON_GET_TYPE', - 'JSON_LENGTH', - 'JSON_SET_DOUBLE', - 'JSON_SET_JSON', - 'JSON_SET_STRING', - 'JSON_SPLICE_DOUBLE', - 'JSON_SPLICE_JSON', - 'JSON_SPLICE_STRING', - 'LAG', - 'LAST_DAY', - 'LAST_VALUE', - 'LCASE', - 'LEAD', - 'LEAST', - 'LEFT', - 'LENGTH', - 'LIKE', - 'LN', - 'LOCALTIME', - 'LOCALTIMESTAMP', - 'LOCATE', - 'LOG', - 'LOG10', - 'LOG2', - 'LPAD', - 'LTRIM', - 'MATCH', - 'MAX', - 'MD5', - 'MEDIAN', - 'MICROSECOND', - 'MIN', - 'MINUTE', - 'MOD', - 'MONTH', - 'MONTHNAME', - 'MONTHS_BETWEEN', - 'NOT', - 'NOW', - 'NTH_VALUE', - 'NTILE', - 'NULLIF', - 'OCTET_LENGTH', - 'PERCENT_RANK', - 'PERCENTILE_CONT', - 'PERCENTILE_DISC', - 'PI', - 'PIVOT', - 'POSITION', - 'POW', - 'POWER', - 'QUARTER', - 'QUOTE', - 'RADIANS', - 'RAND', - 'RANK', - 'REGEXP', - 'REPEAT', - 'REPLACE', - 'REVERSE', - 'RIGHT', - 'RLIKE', - 'ROUND', - 'ROW_COUNT', - 'ROW_NUMBER', - 'RPAD', - 'RTRIM', - 'SCALAR', - 'SCHEMA', - 'SEC_TO_TIME', - 'SHA1', - 'SHA2', - 'SIGMOID', - 'SIGN', - 'SIN', - 'SLEEP', - 'SPLIT', - 'SOUNDEX', - 'SOUNDS LIKE', - 'SOURCE_POS_WAIT', - 'SPACE', - 'SQRT', - 'STDDEV', - 'STDDEV_POP', - 'STDDEV_SAMP', - 'STR_TO_DATE', - 'SUBDATE', - 'SUBSTR', - 'SUBSTRING', - 'SUBSTRING_INDEX', - 'SUM', - 'SYS_GUID', - 'TAN', - 'TIME', - 'TIMEDIFF', - 'TIME_BUCKET', - 'TIME_FORMAT', - 'TIMESTAMP', - 'TIMESTAMPADD', - 'TIMESTAMPDIFF', - 'TIME_TO_SEC', - 'TO_BASE64', - 'TO_CHAR', - 'TO_DAYS', - 'TO_JSON', - 'TO_NUMBER', - 'TO_SECONDS', - 'TO_TIMESTAMP', - 'TRIM', - 'TRUNC', - 'TRUNCATE', - 'UCASE', - 'UNHEX', - 'UNIX_TIMESTAMP', - 'UPDATEXML', - 'UPPER', - // 'USER', - 'UTC_DATE', - 'UTC_TIME', - 'UTC_TIMESTAMP', - 'UUID', - 'VALUES', - 'VARIANCE', - 'VAR_POP', - 'VAR_SAMP', - 'VECTOR_SUB', - 'VERSION', - 'WEEK', - 'WEEKDAY', - 'WEEKOFYEAR', - 'YEAR', - // Data types with parameters - // https://docs.singlestore.com/managed-service/en/reference/sql-reference/data-types.html - 'BIT', - 'TINYINT', - 'SMALLINT', - 'MEDIUMINT', - 'INT', - 'INTEGER', - 'BIGINT', - 'DECIMAL', - 'DEC', - 'NUMERIC', - 'FIXED', - 'FLOAT', - 'DOUBLE', - 'DOUBLE PRECISION', - 'REAL', - 'DATETIME', - 'TIMESTAMP', - 'TIME', - 'YEAR', - 'CHAR', - 'NATIONAL CHAR', - 'VARCHAR', - 'NATIONAL VARCHAR', - 'BINARY', - 'VARBINARY', - 'BLOB', - 'TEXT', - 'ENUM', - ], -}); + 'ABS', + 'ACOS', + 'ADDDATE', + 'ADDTIME', + 'AES_DECRYPT', + 'AES_ENCRYPT', + 'ANY_VALUE', + 'APPROX_COUNT_DISTINCT', + 'APPROX_COUNT_DISTINCT_ACCUMULATE', + 'APPROX_COUNT_DISTINCT_COMBINE', + 'APPROX_COUNT_DISTINCT_ESTIMATE', + 'APPROX_GEOGRAPHY_INTERSECTS', + 'APPROX_PERCENTILE', + 'ASCII', + 'ASIN', + 'ATAN', + 'ATAN2', + 'AVG', + 'BIN', + 'BINARY', + 'BIT_AND', + 'BIT_COUNT', + 'BIT_OR', + 'BIT_XOR', + 'CAST', + 'CEIL', + 'CEILING', + 'CHAR', + 'CHARACTER_LENGTH', + 'CHAR_LENGTH', + 'CHARSET', + 'COALESCE', + 'COERCIBILITY', + 'COLLATION', + 'COLLECT', + 'CONCAT', + 'CONCAT_WS', + 'CONNECTION_ID', + 'CONV', + 'CONVERT', + 'CONVERT_TZ', + 'COS', + 'COT', + 'COUNT', + 'CUME_DIST', + 'CURDATE', + 'CURRENT_DATE', + 'CURRENT_ROLE', + 'CURRENT_TIME', + 'CURRENT_TIMESTAMP', + 'CURRENT_USER', + 'CURTIME', + 'DATABASE', + 'DATE', + 'DATE_ADD', + 'DATEDIFF', + 'DATE_FORMAT', + 'DATE_SUB', + 'DATE_TRUNC', + 'DAY', + 'DAYNAME', + 'DAYOFMONTH', + 'DAYOFWEEK', + 'DAYOFYEAR', + 'DECODE', + 'DEFAULT', + 'DEGREES', + 'DENSE_RANK', + 'DIV', + 'DOT_PRODUCT', + 'ELT', + 'EUCLIDEAN_DISTANCE', + 'EXP', + 'EXTRACT', + 'FIELD', + 'FIRST', + 'FIRST_VALUE', + 'FLOOR', + 'FORMAT', + 'FOUND_ROWS', + 'FROM_BASE64', + 'FROM_DAYS', + 'FROM_UNIXTIME', + 'GEOGRAPHY_AREA', + 'GEOGRAPHY_CONTAINS', + 'GEOGRAPHY_DISTANCE', + 'GEOGRAPHY_INTERSECTS', + 'GEOGRAPHY_LATITUDE', + 'GEOGRAPHY_LENGTH', + 'GEOGRAPHY_LONGITUDE', + 'GEOGRAPHY_POINT', + 'GEOGRAPHY_WITHIN_DISTANCE', + 'GEOMETRY_AREA', + 'GEOMETRY_CONTAINS', + 'GEOMETRY_DISTANCE', + 'GEOMETRY_FILTER', + 'GEOMETRY_INTERSECTS', + 'GEOMETRY_LENGTH', + 'GEOMETRY_POINT', + 'GEOMETRY_WITHIN_DISTANCE', + 'GEOMETRY_X', + 'GEOMETRY_Y', + 'GREATEST', + 'GROUPING', + 'GROUP_CONCAT', + 'HEX', + 'HIGHLIGHT', + 'HOUR', + 'ICU_VERSION', + 'IF', + 'IFNULL', + 'INET_ATON', + 'INET_NTOA', + 'INET6_ATON', + 'INET6_NTOA', + 'INITCAP', + 'INSERT', + 'INSTR', + 'INTERVAL', + 'IS', + 'IS NULL', + 'JSON_AGG', + 'JSON_ARRAY_CONTAINS_DOUBLE', + 'JSON_ARRAY_CONTAINS_JSON', + 'JSON_ARRAY_CONTAINS_STRING', + 'JSON_ARRAY_PUSH_DOUBLE', + 'JSON_ARRAY_PUSH_JSON', + 'JSON_ARRAY_PUSH_STRING', + 'JSON_DELETE_KEY', + 'JSON_EXTRACT_DOUBLE', + 'JSON_EXTRACT_JSON', + 'JSON_EXTRACT_STRING', + 'JSON_EXTRACT_BIGINT', + 'JSON_GET_TYPE', + 'JSON_LENGTH', + 'JSON_SET_DOUBLE', + 'JSON_SET_JSON', + 'JSON_SET_STRING', + 'JSON_SPLICE_DOUBLE', + 'JSON_SPLICE_JSON', + 'JSON_SPLICE_STRING', + 'LAG', + 'LAST_DAY', + 'LAST_VALUE', + 'LCASE', + 'LEAD', + 'LEAST', + 'LEFT', + 'LENGTH', + 'LIKE', + 'LN', + 'LOCALTIME', + 'LOCALTIMESTAMP', + 'LOCATE', + 'LOG', + 'LOG10', + 'LOG2', + 'LPAD', + 'LTRIM', + 'MATCH', + 'MAX', + 'MD5', + 'MEDIAN', + 'MICROSECOND', + 'MIN', + 'MINUTE', + 'MOD', + 'MONTH', + 'MONTHNAME', + 'MONTHS_BETWEEN', + 'NOT', + 'NOW', + 'NTH_VALUE', + 'NTILE', + 'NULLIF', + 'OCTET_LENGTH', + 'PERCENT_RANK', + 'PERCENTILE_CONT', + 'PERCENTILE_DISC', + 'PI', + 'PIVOT', + 'POSITION', + 'POW', + 'POWER', + 'QUARTER', + 'QUOTE', + 'RADIANS', + 'RAND', + 'RANK', + 'REGEXP', + 'REPEAT', + 'REPLACE', + 'REVERSE', + 'RIGHT', + 'RLIKE', + 'ROUND', + 'ROW_COUNT', + 'ROW_NUMBER', + 'RPAD', + 'RTRIM', + 'SCALAR', + 'SCHEMA', + 'SEC_TO_TIME', + 'SHA1', + 'SHA2', + 'SIGMOID', + 'SIGN', + 'SIN', + 'SLEEP', + 'SPLIT', + 'SOUNDEX', + 'SOUNDS LIKE', + 'SOURCE_POS_WAIT', + 'SPACE', + 'SQRT', + 'STDDEV', + 'STDDEV_POP', + 'STDDEV_SAMP', + 'STR_TO_DATE', + 'SUBDATE', + 'SUBSTR', + 'SUBSTRING', + 'SUBSTRING_INDEX', + 'SUM', + 'SYS_GUID', + 'TAN', + 'TIME', + 'TIMEDIFF', + 'TIME_BUCKET', + 'TIME_FORMAT', + 'TIMESTAMP', + 'TIMESTAMPADD', + 'TIMESTAMPDIFF', + 'TIME_TO_SEC', + 'TO_BASE64', + 'TO_CHAR', + 'TO_DAYS', + 'TO_JSON', + 'TO_NUMBER', + 'TO_SECONDS', + 'TO_TIMESTAMP', + 'TRIM', + 'TRUNC', + 'TRUNCATE', + 'UCASE', + 'UNHEX', + 'UNIX_TIMESTAMP', + 'UPDATEXML', + 'UPPER', + // 'USER', + 'UTC_DATE', + 'UTC_TIME', + 'UTC_TIMESTAMP', + 'UUID', + 'VALUES', + 'VARIANCE', + 'VAR_POP', + 'VAR_SAMP', + 'VECTOR_SUB', + 'VERSION', + 'WEEK', + 'WEEKDAY', + 'WEEKOFYEAR', + 'YEAR', + // Data types with parameters + // https://docs.singlestore.com/managed-service/en/reference/sql-reference/data-types.html + 'BIT', + 'TINYINT', + 'SMALLINT', + 'MEDIUMINT', + 'INT', + 'INTEGER', + 'BIGINT', + 'DECIMAL', + 'DEC', + 'NUMERIC', + 'FIXED', + 'FLOAT', + 'DOUBLE', + 'DOUBLE PRECISION', + 'REAL', + 'DATETIME', + 'TIMESTAMP', + 'TIME', + 'YEAR', + 'CHAR', + 'NATIONAL CHAR', + 'VARCHAR', + 'NATIONAL VARCHAR', + 'BINARY', + 'VARBINARY', + 'BLOB', + 'TEXT', + 'ENUM', +]; diff --git a/src/languages/singlestoredb/singlestoredb.keywords.ts b/src/languages/singlestoredb/singlestoredb.keywords.ts index c09d475b94..4ce008c189 100644 --- a/src/languages/singlestoredb/singlestoredb.keywords.ts +++ b/src/languages/singlestoredb/singlestoredb.keywords.ts @@ -1,255 +1,251 @@ -import { flatKeywordList } from '../../utils.js'; - -export const keywords = flatKeywordList({ +export const keywords: string[] = [ // List of all keywords taken from: // https://docs.singlestore.com/managed-service/en/reference/sql-reference/restricted-keywords/list-of-restricted-keywords.html // Then filtered down to reserved keywords by running // > SELECT * AS ; // for each keyword in that list and observing which of these produce an error. - reserved: [ - 'ADD', - 'ALL', - 'ALTER', - 'ANALYZE', - 'AND', - 'AS', - 'ASC', - 'ASENSITIVE', - 'BEFORE', - 'BETWEEN', - 'BIGINT', - 'BINARY', - '_BINARY', - 'BLOB', - 'BOTH', - 'BY', - 'CALL', - 'CASCADE', - 'CASE', - 'CHANGE', - 'CHAR', - 'CHARACTER', - 'CHECK', - 'COLLATE', - 'COLUMN', - 'CONDITION', - 'CONSTRAINT', - 'CONTINUE', - 'CONVERT', - 'CREATE', - 'CROSS', - 'CURRENT_DATE', - 'CURRENT_TIME', - 'CURRENT_TIMESTAMP', - 'CURRENT_USER', - 'CURSOR', - 'DATABASE', - 'DATABASES', - 'DAY_HOUR', - 'DAY_MICROSECOND', - 'DAY_MINUTE', - 'DAY_SECOND', - 'DEC', - 'DECIMAL', - 'DECLARE', - 'DEFAULT', - 'DELAYED', - 'DELETE', - 'DESC', - 'DESCRIBE', - 'DETERMINISTIC', - 'DISTINCT', - 'DISTINCTROW', - 'DIV', - 'DOUBLE', - 'DROP', - 'DUAL', - 'EACH', - 'ELSE', - 'ELSEIF', - 'ENCLOSED', - 'ESCAPED', - 'EXCEPT', - 'EXISTS', - 'EXIT', - 'EXPLAIN', - 'EXTRA_JOIN', - 'FALSE', - 'FETCH', - 'FLOAT', - 'FLOAT4', - 'FLOAT8', - 'FOR', - 'FORCE', - 'FORCE_COMPILED_MODE', - 'FORCE_INTERPRETER_MODE', - 'FOREIGN', - 'FROM', - 'FULL', - 'FULLTEXT', - 'GRANT', - 'GROUP', - 'HAVING', - 'HEARTBEAT_NO_LOGGING', - 'HIGH_PRIORITY', - 'HOUR_MICROSECOND', - 'HOUR_MINUTE', - 'HOUR_SECOND', - 'IF', - 'IGNORE', - 'IN', - 'INDEX', - 'INFILE', - 'INNER', - 'INOUT', - 'INSENSITIVE', - 'INSERT', - 'IN', - 'INT', - 'INT1', - 'INT2', - 'INT3', - 'INT4', - 'INT8', - 'INTEGER', - '_INTERNAL_DYNAMIC_TYPECAST', - 'INTERSECT', - 'INTERVAL', - 'INTO', - 'ITERATE', - 'JOIN', - 'KEY', - 'KEYS', - 'KILL', - 'LEADING', - 'LEAVE', - 'LEFT', - 'LIKE', - 'LIMIT', - 'LINES', - 'LOAD', - 'LOCALTIME', - 'LOCALTIMESTAMP', - 'LOCK', - 'LONG', - 'LONGBLOB', - 'LONGTEXT', - 'LOOP', - 'LOW_PRIORITY', - 'MATCH', - 'MAXVALUE', - 'MEDIUMBLOB', - 'MEDIUMINT', - 'MEDIUMTEXT', - 'MIDDLEINT', - 'MINUS', - 'MINUTE_MICROSECOND', - 'MINUTE_SECOND', - 'MOD', - 'MODIFIES', - 'NATURAL', - 'NO_QUERY_REWRITE', - 'NOT', - 'NO_WRITE_TO_BINLOG', - 'NO_QUERY_REWRITE', - 'NULL', - 'NUMERIC', - 'ON', - 'OPTIMIZE', - 'OPTION', - 'OPTIONALLY', - 'OR', - 'ORDER', - 'OUT', - 'OUTER', - 'OUTFILE', - 'OVER', - 'PRECISION', - 'PRIMARY', - 'PROCEDURE', - 'PURGE', - 'RANGE', - 'READ', - 'READS', - 'REAL', - 'REFERENCES', - 'REGEXP', - 'RELEASE', - 'RENAME', - 'REPEAT', - 'REPLACE', - 'REQUIRE', - 'RESTRICT', - 'RETURN', - 'REVOKE', - 'RIGHT', - 'RIGHT_ANTI_JOIN', - 'RIGHT_SEMI_JOIN', - 'RIGHT_STRAIGHT_JOIN', - 'RLIKE', - 'SCHEMA', - 'SCHEMAS', - 'SECOND_MICROSECOND', - 'SELECT', - 'SEMI_JOIN', - 'SENSITIVE', - 'SEPARATOR', - 'SET', - 'SHOW', - 'SIGNAL', - 'SMALLINT', - 'SPATIAL', - 'SPECIFIC', - 'SQL', - 'SQL_BIG_RESULT', - 'SQL_BUFFER_RESULT', - 'SQL_CACHE', - 'SQL_CALC_FOUND_ROWS', - 'SQLEXCEPTION', - 'SQL_NO_CACHE', - 'SQL_NO_LOGGING', - 'SQL_SMALL_RESULT', - 'SQLSTATE', - 'SQLWARNING', - 'STRAIGHT_JOIN', - 'TABLE', - 'TERMINATED', - 'THEN', - 'TINYBLOB', - 'TINYINT', - 'TINYTEXT', - 'TO', - 'TRAILING', - 'TRIGGER', - 'TRUE', - 'UNBOUNDED', - 'UNDO', - 'UNION', - 'UNIQUE', - 'UNLOCK', - 'UNSIGNED', - 'UPDATE', - 'USAGE', - 'USE', - 'USING', - 'UTC_DATE', - 'UTC_TIME', - 'UTC_TIMESTAMP', - '_UTF8', - 'VALUES', - 'VARBINARY', - 'VARCHAR', - 'VARCHARACTER', - 'VARYING', - 'WHEN', - 'WHERE', - 'WHILE', - 'WINDOW', - 'WITH', - 'WITHIN', - 'WRITE', - 'XOR', - 'YEAR_MONTH', - 'ZEROFILL', - ], -}); + 'ADD', + 'ALL', + 'ALTER', + 'ANALYZE', + 'AND', + 'AS', + 'ASC', + 'ASENSITIVE', + 'BEFORE', + 'BETWEEN', + 'BIGINT', + 'BINARY', + '_BINARY', + 'BLOB', + 'BOTH', + 'BY', + 'CALL', + 'CASCADE', + 'CASE', + 'CHANGE', + 'CHAR', + 'CHARACTER', + 'CHECK', + 'COLLATE', + 'COLUMN', + 'CONDITION', + 'CONSTRAINT', + 'CONTINUE', + 'CONVERT', + 'CREATE', + 'CROSS', + 'CURRENT_DATE', + 'CURRENT_TIME', + 'CURRENT_TIMESTAMP', + 'CURRENT_USER', + 'CURSOR', + 'DATABASE', + 'DATABASES', + 'DAY_HOUR', + 'DAY_MICROSECOND', + 'DAY_MINUTE', + 'DAY_SECOND', + 'DEC', + 'DECIMAL', + 'DECLARE', + 'DEFAULT', + 'DELAYED', + 'DELETE', + 'DESC', + 'DESCRIBE', + 'DETERMINISTIC', + 'DISTINCT', + 'DISTINCTROW', + 'DIV', + 'DOUBLE', + 'DROP', + 'DUAL', + 'EACH', + 'ELSE', + 'ELSEIF', + 'ENCLOSED', + 'ESCAPED', + 'EXCEPT', + 'EXISTS', + 'EXIT', + 'EXPLAIN', + 'EXTRA_JOIN', + 'FALSE', + 'FETCH', + 'FLOAT', + 'FLOAT4', + 'FLOAT8', + 'FOR', + 'FORCE', + 'FORCE_COMPILED_MODE', + 'FORCE_INTERPRETER_MODE', + 'FOREIGN', + 'FROM', + 'FULL', + 'FULLTEXT', + 'GRANT', + 'GROUP', + 'HAVING', + 'HEARTBEAT_NO_LOGGING', + 'HIGH_PRIORITY', + 'HOUR_MICROSECOND', + 'HOUR_MINUTE', + 'HOUR_SECOND', + 'IF', + 'IGNORE', + 'IN', + 'INDEX', + 'INFILE', + 'INNER', + 'INOUT', + 'INSENSITIVE', + 'INSERT', + 'IN', + 'INT', + 'INT1', + 'INT2', + 'INT3', + 'INT4', + 'INT8', + 'INTEGER', + '_INTERNAL_DYNAMIC_TYPECAST', + 'INTERSECT', + 'INTERVAL', + 'INTO', + 'ITERATE', + 'JOIN', + 'KEY', + 'KEYS', + 'KILL', + 'LEADING', + 'LEAVE', + 'LEFT', + 'LIKE', + 'LIMIT', + 'LINES', + 'LOAD', + 'LOCALTIME', + 'LOCALTIMESTAMP', + 'LOCK', + 'LONG', + 'LONGBLOB', + 'LONGTEXT', + 'LOOP', + 'LOW_PRIORITY', + 'MATCH', + 'MAXVALUE', + 'MEDIUMBLOB', + 'MEDIUMINT', + 'MEDIUMTEXT', + 'MIDDLEINT', + 'MINUS', + 'MINUTE_MICROSECOND', + 'MINUTE_SECOND', + 'MOD', + 'MODIFIES', + 'NATURAL', + 'NO_QUERY_REWRITE', + 'NOT', + 'NO_WRITE_TO_BINLOG', + 'NO_QUERY_REWRITE', + 'NULL', + 'NUMERIC', + 'ON', + 'OPTIMIZE', + 'OPTION', + 'OPTIONALLY', + 'OR', + 'ORDER', + 'OUT', + 'OUTER', + 'OUTFILE', + 'OVER', + 'PRECISION', + 'PRIMARY', + 'PROCEDURE', + 'PURGE', + 'RANGE', + 'READ', + 'READS', + 'REAL', + 'REFERENCES', + 'REGEXP', + 'RELEASE', + 'RENAME', + 'REPEAT', + 'REPLACE', + 'REQUIRE', + 'RESTRICT', + 'RETURN', + 'REVOKE', + 'RIGHT', + 'RIGHT_ANTI_JOIN', + 'RIGHT_SEMI_JOIN', + 'RIGHT_STRAIGHT_JOIN', + 'RLIKE', + 'SCHEMA', + 'SCHEMAS', + 'SECOND_MICROSECOND', + 'SELECT', + 'SEMI_JOIN', + 'SENSITIVE', + 'SEPARATOR', + 'SET', + 'SHOW', + 'SIGNAL', + 'SMALLINT', + 'SPATIAL', + 'SPECIFIC', + 'SQL', + 'SQL_BIG_RESULT', + 'SQL_BUFFER_RESULT', + 'SQL_CACHE', + 'SQL_CALC_FOUND_ROWS', + 'SQLEXCEPTION', + 'SQL_NO_CACHE', + 'SQL_NO_LOGGING', + 'SQL_SMALL_RESULT', + 'SQLSTATE', + 'SQLWARNING', + 'STRAIGHT_JOIN', + 'TABLE', + 'TERMINATED', + 'THEN', + 'TINYBLOB', + 'TINYINT', + 'TINYTEXT', + 'TO', + 'TRAILING', + 'TRIGGER', + 'TRUE', + 'UNBOUNDED', + 'UNDO', + 'UNION', + 'UNIQUE', + 'UNLOCK', + 'UNSIGNED', + 'UPDATE', + 'USAGE', + 'USE', + 'USING', + 'UTC_DATE', + 'UTC_TIME', + 'UTC_TIMESTAMP', + '_UTF8', + 'VALUES', + 'VARBINARY', + 'VARCHAR', + 'VARCHARACTER', + 'VARYING', + 'WHEN', + 'WHERE', + 'WHILE', + 'WINDOW', + 'WITH', + 'WITHIN', + 'WRITE', + 'XOR', + 'YEAR_MONTH', + 'ZEROFILL', +]; diff --git a/src/languages/snowflake/snowflake.functions.ts b/src/languages/snowflake/snowflake.functions.ts index d81de487b0..55eeecee6f 100644 --- a/src/languages/snowflake/snowflake.functions.ts +++ b/src/languages/snowflake/snowflake.functions.ts @@ -1,6 +1,4 @@ -import { flatKeywordList } from '../../utils.js'; - -export const functions = flatKeywordList({ +export const functions: string[] = [ // https://docs.snowflake.com/en/sql-reference-functions.html // // https://docs.snowflake.com/en/sql-reference/functions-all.html @@ -18,593 +16,591 @@ export const functions = flatKeywordList({ // .map(x => x.replace('— Deprecated', '')) // Step 3 // .filter(x => !x.endsWith('')) // Step 4 // .filter(x => !x.includes('[')) // Step 5 - all: [ - 'ABS', - 'ACOS', - 'ACOSH', - 'ADD_MONTHS', - 'ALL_USER_NAMES', - 'ANY_VALUE', - 'APPROX_COUNT_DISTINCT', - 'APPROX_PERCENTILE', - 'APPROX_PERCENTILE_ACCUMULATE', - 'APPROX_PERCENTILE_COMBINE', - 'APPROX_PERCENTILE_ESTIMATE', - 'APPROX_TOP_K', - 'APPROX_TOP_K_ACCUMULATE', - 'APPROX_TOP_K_COMBINE', - 'APPROX_TOP_K_ESTIMATE', - 'APPROXIMATE_JACCARD_INDEX', - 'APPROXIMATE_SIMILARITY', - 'ARRAY_AGG', - 'ARRAY_APPEND', - 'ARRAY_CAT', - 'ARRAY_COMPACT', - 'ARRAY_CONSTRUCT', - 'ARRAY_CONSTRUCT_COMPACT', - 'ARRAY_CONTAINS', - 'ARRAY_INSERT', - 'ARRAY_INTERSECTION', - 'ARRAY_POSITION', - 'ARRAY_PREPEND', - 'ARRAY_SIZE', - 'ARRAY_SLICE', - 'ARRAY_TO_STRING', - 'ARRAY_UNION_AGG', - 'ARRAY_UNIQUE_AGG', - 'ARRAYS_OVERLAP', - 'AS_ARRAY', - 'AS_BINARY', - 'AS_BOOLEAN', - 'AS_CHAR', - 'AS_VARCHAR', - 'AS_DATE', - 'AS_DECIMAL', - 'AS_NUMBER', - 'AS_DOUBLE', - 'AS_REAL', - 'AS_INTEGER', - 'AS_OBJECT', - 'AS_TIME', - 'AS_TIMESTAMP_LTZ', - 'AS_TIMESTAMP_NTZ', - 'AS_TIMESTAMP_TZ', - 'ASCII', - 'ASIN', - 'ASINH', - 'ATAN', - 'ATAN2', - 'ATANH', - 'AUTO_REFRESH_REGISTRATION_HISTORY', - 'AUTOMATIC_CLUSTERING_HISTORY', - 'AVG', - 'BASE64_DECODE_BINARY', - 'BASE64_DECODE_STRING', - 'BASE64_ENCODE', - 'BIT_LENGTH', - 'BITAND', - 'BITAND_AGG', - 'BITMAP_BIT_POSITION', - 'BITMAP_BUCKET_NUMBER', - 'BITMAP_CONSTRUCT_AGG', - 'BITMAP_COUNT', - 'BITMAP_OR_AGG', - 'BITNOT', - 'BITOR', - 'BITOR_AGG', - 'BITSHIFTLEFT', - 'BITSHIFTRIGHT', - 'BITXOR', - 'BITXOR_AGG', - 'BOOLAND', - 'BOOLAND_AGG', - 'BOOLNOT', - 'BOOLOR', - 'BOOLOR_AGG', - 'BOOLXOR', - 'BOOLXOR_AGG', - 'BUILD_SCOPED_FILE_URL', - 'BUILD_STAGE_FILE_URL', - 'CASE', - 'CAST', - 'CBRT', - 'CEIL', - 'CHARINDEX', - 'CHECK_JSON', - 'CHECK_XML', - 'CHR', - 'CHAR', - 'COALESCE', - 'COLLATE', - 'COLLATION', - 'COMPLETE_TASK_GRAPHS', - 'COMPRESS', - 'CONCAT', - 'CONCAT_WS', - 'CONDITIONAL_CHANGE_EVENT', - 'CONDITIONAL_TRUE_EVENT', - 'CONTAINS', - 'CONVERT_TIMEZONE', - 'COPY_HISTORY', - 'CORR', - 'COS', - 'COSH', - 'COT', - 'COUNT', - 'COUNT_IF', - 'COVAR_POP', - 'COVAR_SAMP', - 'CUME_DIST', - 'CURRENT_ACCOUNT', - 'CURRENT_AVAILABLE_ROLES', - 'CURRENT_CLIENT', - 'CURRENT_DATABASE', - 'CURRENT_DATE', - 'CURRENT_IP_ADDRESS', - 'CURRENT_REGION', - 'CURRENT_ROLE', - 'CURRENT_SCHEMA', - 'CURRENT_SCHEMAS', - 'CURRENT_SECONDARY_ROLES', - 'CURRENT_SESSION', - 'CURRENT_STATEMENT', - 'CURRENT_TASK_GRAPHS', - 'CURRENT_TIME', - 'CURRENT_TIMESTAMP', - 'CURRENT_TRANSACTION', - 'CURRENT_USER', - 'CURRENT_VERSION', - 'CURRENT_WAREHOUSE', - 'DATA_TRANSFER_HISTORY', - 'DATABASE_REFRESH_HISTORY', - 'DATABASE_REFRESH_PROGRESS', - 'DATABASE_REFRESH_PROGRESS_BY_JOB', - 'DATABASE_STORAGE_USAGE_HISTORY', - 'DATE_FROM_PARTS', - 'DATE_PART', - 'DATE_TRUNC', - 'DATEADD', - 'DATEDIFF', - 'DAYNAME', - 'DECODE', - 'DECOMPRESS_BINARY', - 'DECOMPRESS_STRING', - 'DECRYPT', - 'DECRYPT_RAW', - 'DEGREES', - 'DENSE_RANK', - 'DIV0', - 'EDITDISTANCE', - 'ENCRYPT', - 'ENCRYPT_RAW', - 'ENDSWITH', - 'EQUAL_NULL', - 'EXP', - 'EXPLAIN_JSON', - 'EXTERNAL_FUNCTIONS_HISTORY', - 'EXTERNAL_TABLE_FILES', - 'EXTERNAL_TABLE_FILE_REGISTRATION_HISTORY', - 'EXTRACT', - 'EXTRACT_SEMANTIC_CATEGORIES', - 'FACTORIAL', - 'FIRST_VALUE', - 'FLATTEN', - 'FLOOR', - 'GENERATE_COLUMN_DESCRIPTION', - 'GENERATOR', - 'GET', - 'GET_ABSOLUTE_PATH', - 'GET_DDL', - 'GET_IGNORE_CASE', - 'GET_OBJECT_REFERENCES', - 'GET_PATH', - 'GET_PRESIGNED_URL', - 'GET_RELATIVE_PATH', - 'GET_STAGE_LOCATION', - 'GETBIT', - 'GREATEST', - 'GROUPING', - 'GROUPING_ID', - 'HASH', - 'HASH_AGG', - 'HAVERSINE', - 'HEX_DECODE_BINARY', - 'HEX_DECODE_STRING', - 'HEX_ENCODE', - 'HLL', - 'HLL_ACCUMULATE', - 'HLL_COMBINE', - 'HLL_ESTIMATE', - 'HLL_EXPORT', - 'HLL_IMPORT', - 'HOUR', - 'MINUTE', - 'SECOND', - 'IFF', - 'IFNULL', - 'ILIKE', - 'ILIKE ANY', - 'INFER_SCHEMA', - 'INITCAP', - 'INSERT', - 'INVOKER_ROLE', - 'INVOKER_SHARE', - 'IS_ARRAY', - 'IS_BINARY', - 'IS_BOOLEAN', - 'IS_CHAR', - 'IS_VARCHAR', - 'IS_DATE', - 'IS_DATE_VALUE', - 'IS_DECIMAL', - 'IS_DOUBLE', - 'IS_REAL', - 'IS_GRANTED_TO_INVOKER_ROLE', - 'IS_INTEGER', - 'IS_NULL_VALUE', - 'IS_OBJECT', - 'IS_ROLE_IN_SESSION', - 'IS_TIME', - 'IS_TIMESTAMP_LTZ', - 'IS_TIMESTAMP_NTZ', - 'IS_TIMESTAMP_TZ', - 'JAROWINKLER_SIMILARITY', - 'JSON_EXTRACT_PATH_TEXT', - 'KURTOSIS', - 'LAG', - 'LAST_DAY', - 'LAST_QUERY_ID', - 'LAST_TRANSACTION', - 'LAST_VALUE', - 'LEAD', - 'LEAST', - 'LEFT', - 'LENGTH', - 'LEN', - 'LIKE', - 'LIKE ALL', - 'LIKE ANY', - 'LISTAGG', - 'LN', - 'LOCALTIME', - 'LOCALTIMESTAMP', - 'LOG', - 'LOGIN_HISTORY', - 'LOGIN_HISTORY_BY_USER', - 'LOWER', - 'LPAD', - 'LTRIM', - 'MATERIALIZED_VIEW_REFRESH_HISTORY', - 'MD5', - 'MD5_HEX', - 'MD5_BINARY', - 'MD5_NUMBER — Obsoleted', - 'MD5_NUMBER_LOWER64', - 'MD5_NUMBER_UPPER64', - 'MEDIAN', - 'MIN', - 'MAX', - 'MINHASH', - 'MINHASH_COMBINE', - 'MOD', - 'MODE', - 'MONTHNAME', - 'MONTHS_BETWEEN', - 'NEXT_DAY', - 'NORMAL', - 'NTH_VALUE', - 'NTILE', - 'NULLIF', - 'NULLIFZERO', - 'NVL', - 'NVL2', - 'OBJECT_AGG', - 'OBJECT_CONSTRUCT', - 'OBJECT_CONSTRUCT_KEEP_NULL', - 'OBJECT_DELETE', - 'OBJECT_INSERT', - 'OBJECT_KEYS', - 'OBJECT_PICK', - 'OCTET_LENGTH', - 'PARSE_IP', - 'PARSE_JSON', - 'PARSE_URL', - 'PARSE_XML', - 'PERCENT_RANK', - 'PERCENTILE_CONT', - 'PERCENTILE_DISC', - 'PI', - 'PIPE_USAGE_HISTORY', - 'POLICY_CONTEXT', - 'POLICY_REFERENCES', - 'POSITION', - 'POW', - 'POWER', - 'PREVIOUS_DAY', - 'QUERY_ACCELERATION_HISTORY', - 'QUERY_HISTORY', - 'QUERY_HISTORY_BY_SESSION', - 'QUERY_HISTORY_BY_USER', - 'QUERY_HISTORY_BY_WAREHOUSE', - 'RADIANS', - 'RANDOM', - 'RANDSTR', - 'RANK', - 'RATIO_TO_REPORT', - 'REGEXP', - 'REGEXP_COUNT', - 'REGEXP_INSTR', - 'REGEXP_LIKE', - 'REGEXP_REPLACE', - 'REGEXP_SUBSTR', - 'REGEXP_SUBSTR_ALL', - 'REGR_AVGX', - 'REGR_AVGY', - 'REGR_COUNT', - 'REGR_INTERCEPT', - 'REGR_R2', - 'REGR_SLOPE', - 'REGR_SXX', - 'REGR_SXY', - 'REGR_SYY', - 'REGR_VALX', - 'REGR_VALY', - 'REPEAT', - 'REPLACE', - 'REPLICATION_GROUP_REFRESH_HISTORY', - 'REPLICATION_GROUP_REFRESH_PROGRESS', - 'REPLICATION_GROUP_REFRESH_PROGRESS_BY_JOB', - 'REPLICATION_GROUP_USAGE_HISTORY', - 'REPLICATION_USAGE_HISTORY', - 'REST_EVENT_HISTORY', - 'RESULT_SCAN', - 'REVERSE', - 'RIGHT', - 'RLIKE', - 'ROUND', - 'ROW_NUMBER', - 'RPAD', - 'RTRIM', - 'RTRIMMED_LENGTH', - 'SEARCH_OPTIMIZATION_HISTORY', - 'SEQ1', - 'SEQ2', - 'SEQ4', - 'SEQ8', - 'SERVERLESS_TASK_HISTORY', - 'SHA1', - 'SHA1_HEX', - 'SHA1_BINARY', - 'SHA2', - 'SHA2_HEX', - 'SHA2_BINARY', - 'SIGN', - 'SIN', - 'SINH', - 'SKEW', - 'SOUNDEX', - 'SPACE', - 'SPLIT', - 'SPLIT_PART', - 'SPLIT_TO_TABLE', - 'SQRT', - 'SQUARE', - 'ST_AREA', - 'ST_ASEWKB', - 'ST_ASEWKT', - 'ST_ASGEOJSON', - 'ST_ASWKB', - 'ST_ASBINARY', - 'ST_ASWKT', - 'ST_ASTEXT', - 'ST_AZIMUTH', - 'ST_CENTROID', - 'ST_COLLECT', - 'ST_CONTAINS', - 'ST_COVEREDBY', - 'ST_COVERS', - 'ST_DIFFERENCE', - 'ST_DIMENSION', - 'ST_DISJOINT', - 'ST_DISTANCE', - 'ST_DWITHIN', - 'ST_ENDPOINT', - 'ST_ENVELOPE', - 'ST_GEOGFROMGEOHASH', - 'ST_GEOGPOINTFROMGEOHASH', - 'ST_GEOGRAPHYFROMWKB', - 'ST_GEOGRAPHYFROMWKT', - 'ST_GEOHASH', - 'ST_GEOMETRYFROMWKB', - 'ST_GEOMETRYFROMWKT', - 'ST_HAUSDORFFDISTANCE', - 'ST_INTERSECTION', - 'ST_INTERSECTS', - 'ST_LENGTH', - 'ST_MAKEGEOMPOINT', - 'ST_GEOM_POINT', - 'ST_MAKELINE', - 'ST_MAKEPOINT', - 'ST_POINT', - 'ST_MAKEPOLYGON', - 'ST_POLYGON', - 'ST_NPOINTS', - 'ST_NUMPOINTS', - 'ST_PERIMETER', - 'ST_POINTN', - 'ST_SETSRID', - 'ST_SIMPLIFY', - 'ST_SRID', - 'ST_STARTPOINT', - 'ST_SYMDIFFERENCE', - 'ST_UNION', - 'ST_WITHIN', - 'ST_X', - 'ST_XMAX', - 'ST_XMIN', - 'ST_Y', - 'ST_YMAX', - 'ST_YMIN', - 'STAGE_DIRECTORY_FILE_REGISTRATION_HISTORY', - 'STAGE_STORAGE_USAGE_HISTORY', - 'STARTSWITH', - 'STDDEV', - 'STDDEV_POP', - 'STDDEV_SAMP', - 'STRIP_NULL_VALUE', - 'STRTOK', - 'STRTOK_SPLIT_TO_TABLE', - 'STRTOK_TO_ARRAY', - 'SUBSTR', - 'SUBSTRING', - 'SUM', - 'SYSDATE', - 'SYSTEM$ABORT_SESSION', - 'SYSTEM$ABORT_TRANSACTION', - 'SYSTEM$AUTHORIZE_PRIVATELINK', - 'SYSTEM$AUTHORIZE_STAGE_PRIVATELINK_ACCESS', - 'SYSTEM$BEHAVIOR_CHANGE_BUNDLE_STATUS', - 'SYSTEM$CANCEL_ALL_QUERIES', - 'SYSTEM$CANCEL_QUERY', - 'SYSTEM$CLUSTERING_DEPTH', - 'SYSTEM$CLUSTERING_INFORMATION', - 'SYSTEM$CLUSTERING_RATIO ', - 'SYSTEM$CURRENT_USER_TASK_NAME', - 'SYSTEM$DATABASE_REFRESH_HISTORY ', - 'SYSTEM$DATABASE_REFRESH_PROGRESS', - 'SYSTEM$DATABASE_REFRESH_PROGRESS_BY_JOB ', - 'SYSTEM$DISABLE_BEHAVIOR_CHANGE_BUNDLE', - 'SYSTEM$DISABLE_DATABASE_REPLICATION', - 'SYSTEM$ENABLE_BEHAVIOR_CHANGE_BUNDLE', - 'SYSTEM$ESTIMATE_QUERY_ACCELERATION', - 'SYSTEM$ESTIMATE_SEARCH_OPTIMIZATION_COSTS', - 'SYSTEM$EXPLAIN_JSON_TO_TEXT', - 'SYSTEM$EXPLAIN_PLAN_JSON', - 'SYSTEM$EXTERNAL_TABLE_PIPE_STATUS', - 'SYSTEM$GENERATE_SAML_CSR', - 'SYSTEM$GENERATE_SCIM_ACCESS_TOKEN', - 'SYSTEM$GET_AWS_SNS_IAM_POLICY', - 'SYSTEM$GET_PREDECESSOR_RETURN_VALUE', - 'SYSTEM$GET_PRIVATELINK', - 'SYSTEM$GET_PRIVATELINK_AUTHORIZED_ENDPOINTS', - 'SYSTEM$GET_PRIVATELINK_CONFIG', - 'SYSTEM$GET_SNOWFLAKE_PLATFORM_INFO', - 'SYSTEM$GET_TAG', - 'SYSTEM$GET_TAG_ALLOWED_VALUES', - 'SYSTEM$GET_TAG_ON_CURRENT_COLUMN', - 'SYSTEM$GET_TAG_ON_CURRENT_TABLE', - 'SYSTEM$GLOBAL_ACCOUNT_SET_PARAMETER', - 'SYSTEM$LAST_CHANGE_COMMIT_TIME', - 'SYSTEM$LINK_ACCOUNT_OBJECTS_BY_NAME', - 'SYSTEM$MIGRATE_SAML_IDP_REGISTRATION', - 'SYSTEM$PIPE_FORCE_RESUME', - 'SYSTEM$PIPE_STATUS', - 'SYSTEM$REVOKE_PRIVATELINK', - 'SYSTEM$REVOKE_STAGE_PRIVATELINK_ACCESS', - 'SYSTEM$SET_RETURN_VALUE', - 'SYSTEM$SHOW_OAUTH_CLIENT_SECRETS', - 'SYSTEM$STREAM_GET_TABLE_TIMESTAMP', - 'SYSTEM$STREAM_HAS_DATA', - 'SYSTEM$TASK_DEPENDENTS_ENABLE', - 'SYSTEM$TYPEOF', - 'SYSTEM$USER_TASK_CANCEL_ONGOING_EXECUTIONS', - 'SYSTEM$VERIFY_EXTERNAL_OAUTH_TOKEN', - 'SYSTEM$WAIT', - 'SYSTEM$WHITELIST', - 'SYSTEM$WHITELIST_PRIVATELINK', - 'TAG_REFERENCES', - 'TAG_REFERENCES_ALL_COLUMNS', - 'TAG_REFERENCES_WITH_LINEAGE', - 'TAN', - 'TANH', - 'TASK_DEPENDENTS', - 'TASK_HISTORY', - 'TIME_FROM_PARTS', - 'TIME_SLICE', - 'TIMEADD', - 'TIMEDIFF', - 'TIMESTAMP_FROM_PARTS', - 'TIMESTAMPADD', - 'TIMESTAMPDIFF', - 'TO_ARRAY', - 'TO_BINARY', - 'TO_BOOLEAN', - 'TO_CHAR', - 'TO_VARCHAR', - 'TO_DATE', - 'DATE', - 'TO_DECIMAL', - 'TO_NUMBER', - 'TO_NUMERIC', - 'TO_DOUBLE', - 'TO_GEOGRAPHY', - 'TO_GEOMETRY', - 'TO_JSON', - 'TO_OBJECT', - 'TO_TIME', - 'TIME', - 'TO_TIMESTAMP', - 'TO_TIMESTAMP_LTZ', - 'TO_TIMESTAMP_NTZ', - 'TO_TIMESTAMP_TZ', - 'TO_VARIANT', - 'TO_XML', - 'TRANSLATE', - 'TRIM', - 'TRUNCATE', - 'TRUNC', - 'TRUNC', - 'TRY_BASE64_DECODE_BINARY', - 'TRY_BASE64_DECODE_STRING', - 'TRY_CAST', - 'TRY_HEX_DECODE_BINARY', - 'TRY_HEX_DECODE_STRING', - 'TRY_PARSE_JSON', - 'TRY_TO_BINARY', - 'TRY_TO_BOOLEAN', - 'TRY_TO_DATE', - 'TRY_TO_DECIMAL', - 'TRY_TO_NUMBER', - 'TRY_TO_NUMERIC', - 'TRY_TO_DOUBLE', - 'TRY_TO_GEOGRAPHY', - 'TRY_TO_GEOMETRY', - 'TRY_TO_TIME', - 'TRY_TO_TIMESTAMP', - 'TRY_TO_TIMESTAMP_LTZ', - 'TRY_TO_TIMESTAMP_NTZ', - 'TRY_TO_TIMESTAMP_TZ', - 'TYPEOF', - 'UNICODE', - 'UNIFORM', - 'UPPER', - 'UUID_STRING', - 'VALIDATE', - 'VALIDATE_PIPE_LOAD', - 'VAR_POP', - 'VAR_SAMP', - 'VARIANCE', - 'VARIANCE_SAMP', - 'VARIANCE_POP', - 'WAREHOUSE_LOAD_HISTORY', - 'WAREHOUSE_METERING_HISTORY', - 'WIDTH_BUCKET', - 'XMLGET', - 'YEAR', - 'YEAROFWEEK', - 'YEAROFWEEKISO', - 'DAY', - 'DAYOFMONTH', - 'DAYOFWEEK', - 'DAYOFWEEKISO', - 'DAYOFYEAR', - 'WEEK', - 'WEEK', - 'WEEKOFYEAR', - 'WEEKISO', - 'MONTH', - 'QUARTER', - 'ZEROIFNULL', - 'ZIPF', - ], -}); + 'ABS', + 'ACOS', + 'ACOSH', + 'ADD_MONTHS', + 'ALL_USER_NAMES', + 'ANY_VALUE', + 'APPROX_COUNT_DISTINCT', + 'APPROX_PERCENTILE', + 'APPROX_PERCENTILE_ACCUMULATE', + 'APPROX_PERCENTILE_COMBINE', + 'APPROX_PERCENTILE_ESTIMATE', + 'APPROX_TOP_K', + 'APPROX_TOP_K_ACCUMULATE', + 'APPROX_TOP_K_COMBINE', + 'APPROX_TOP_K_ESTIMATE', + 'APPROXIMATE_JACCARD_INDEX', + 'APPROXIMATE_SIMILARITY', + 'ARRAY_AGG', + 'ARRAY_APPEND', + 'ARRAY_CAT', + 'ARRAY_COMPACT', + 'ARRAY_CONSTRUCT', + 'ARRAY_CONSTRUCT_COMPACT', + 'ARRAY_CONTAINS', + 'ARRAY_INSERT', + 'ARRAY_INTERSECTION', + 'ARRAY_POSITION', + 'ARRAY_PREPEND', + 'ARRAY_SIZE', + 'ARRAY_SLICE', + 'ARRAY_TO_STRING', + 'ARRAY_UNION_AGG', + 'ARRAY_UNIQUE_AGG', + 'ARRAYS_OVERLAP', + 'AS_ARRAY', + 'AS_BINARY', + 'AS_BOOLEAN', + 'AS_CHAR', + 'AS_VARCHAR', + 'AS_DATE', + 'AS_DECIMAL', + 'AS_NUMBER', + 'AS_DOUBLE', + 'AS_REAL', + 'AS_INTEGER', + 'AS_OBJECT', + 'AS_TIME', + 'AS_TIMESTAMP_LTZ', + 'AS_TIMESTAMP_NTZ', + 'AS_TIMESTAMP_TZ', + 'ASCII', + 'ASIN', + 'ASINH', + 'ATAN', + 'ATAN2', + 'ATANH', + 'AUTO_REFRESH_REGISTRATION_HISTORY', + 'AUTOMATIC_CLUSTERING_HISTORY', + 'AVG', + 'BASE64_DECODE_BINARY', + 'BASE64_DECODE_STRING', + 'BASE64_ENCODE', + 'BIT_LENGTH', + 'BITAND', + 'BITAND_AGG', + 'BITMAP_BIT_POSITION', + 'BITMAP_BUCKET_NUMBER', + 'BITMAP_CONSTRUCT_AGG', + 'BITMAP_COUNT', + 'BITMAP_OR_AGG', + 'BITNOT', + 'BITOR', + 'BITOR_AGG', + 'BITSHIFTLEFT', + 'BITSHIFTRIGHT', + 'BITXOR', + 'BITXOR_AGG', + 'BOOLAND', + 'BOOLAND_AGG', + 'BOOLNOT', + 'BOOLOR', + 'BOOLOR_AGG', + 'BOOLXOR', + 'BOOLXOR_AGG', + 'BUILD_SCOPED_FILE_URL', + 'BUILD_STAGE_FILE_URL', + 'CASE', + 'CAST', + 'CBRT', + 'CEIL', + 'CHARINDEX', + 'CHECK_JSON', + 'CHECK_XML', + 'CHR', + 'CHAR', + 'COALESCE', + 'COLLATE', + 'COLLATION', + 'COMPLETE_TASK_GRAPHS', + 'COMPRESS', + 'CONCAT', + 'CONCAT_WS', + 'CONDITIONAL_CHANGE_EVENT', + 'CONDITIONAL_TRUE_EVENT', + 'CONTAINS', + 'CONVERT_TIMEZONE', + 'COPY_HISTORY', + 'CORR', + 'COS', + 'COSH', + 'COT', + 'COUNT', + 'COUNT_IF', + 'COVAR_POP', + 'COVAR_SAMP', + 'CUME_DIST', + 'CURRENT_ACCOUNT', + 'CURRENT_AVAILABLE_ROLES', + 'CURRENT_CLIENT', + 'CURRENT_DATABASE', + 'CURRENT_DATE', + 'CURRENT_IP_ADDRESS', + 'CURRENT_REGION', + 'CURRENT_ROLE', + 'CURRENT_SCHEMA', + 'CURRENT_SCHEMAS', + 'CURRENT_SECONDARY_ROLES', + 'CURRENT_SESSION', + 'CURRENT_STATEMENT', + 'CURRENT_TASK_GRAPHS', + 'CURRENT_TIME', + 'CURRENT_TIMESTAMP', + 'CURRENT_TRANSACTION', + 'CURRENT_USER', + 'CURRENT_VERSION', + 'CURRENT_WAREHOUSE', + 'DATA_TRANSFER_HISTORY', + 'DATABASE_REFRESH_HISTORY', + 'DATABASE_REFRESH_PROGRESS', + 'DATABASE_REFRESH_PROGRESS_BY_JOB', + 'DATABASE_STORAGE_USAGE_HISTORY', + 'DATE_FROM_PARTS', + 'DATE_PART', + 'DATE_TRUNC', + 'DATEADD', + 'DATEDIFF', + 'DAYNAME', + 'DECODE', + 'DECOMPRESS_BINARY', + 'DECOMPRESS_STRING', + 'DECRYPT', + 'DECRYPT_RAW', + 'DEGREES', + 'DENSE_RANK', + 'DIV0', + 'EDITDISTANCE', + 'ENCRYPT', + 'ENCRYPT_RAW', + 'ENDSWITH', + 'EQUAL_NULL', + 'EXP', + 'EXPLAIN_JSON', + 'EXTERNAL_FUNCTIONS_HISTORY', + 'EXTERNAL_TABLE_FILES', + 'EXTERNAL_TABLE_FILE_REGISTRATION_HISTORY', + 'EXTRACT', + 'EXTRACT_SEMANTIC_CATEGORIES', + 'FACTORIAL', + 'FIRST_VALUE', + 'FLATTEN', + 'FLOOR', + 'GENERATE_COLUMN_DESCRIPTION', + 'GENERATOR', + 'GET', + 'GET_ABSOLUTE_PATH', + 'GET_DDL', + 'GET_IGNORE_CASE', + 'GET_OBJECT_REFERENCES', + 'GET_PATH', + 'GET_PRESIGNED_URL', + 'GET_RELATIVE_PATH', + 'GET_STAGE_LOCATION', + 'GETBIT', + 'GREATEST', + 'GROUPING', + 'GROUPING_ID', + 'HASH', + 'HASH_AGG', + 'HAVERSINE', + 'HEX_DECODE_BINARY', + 'HEX_DECODE_STRING', + 'HEX_ENCODE', + 'HLL', + 'HLL_ACCUMULATE', + 'HLL_COMBINE', + 'HLL_ESTIMATE', + 'HLL_EXPORT', + 'HLL_IMPORT', + 'HOUR', + 'MINUTE', + 'SECOND', + 'IFF', + 'IFNULL', + 'ILIKE', + 'ILIKE ANY', + 'INFER_SCHEMA', + 'INITCAP', + 'INSERT', + 'INVOKER_ROLE', + 'INVOKER_SHARE', + 'IS_ARRAY', + 'IS_BINARY', + 'IS_BOOLEAN', + 'IS_CHAR', + 'IS_VARCHAR', + 'IS_DATE', + 'IS_DATE_VALUE', + 'IS_DECIMAL', + 'IS_DOUBLE', + 'IS_REAL', + 'IS_GRANTED_TO_INVOKER_ROLE', + 'IS_INTEGER', + 'IS_NULL_VALUE', + 'IS_OBJECT', + 'IS_ROLE_IN_SESSION', + 'IS_TIME', + 'IS_TIMESTAMP_LTZ', + 'IS_TIMESTAMP_NTZ', + 'IS_TIMESTAMP_TZ', + 'JAROWINKLER_SIMILARITY', + 'JSON_EXTRACT_PATH_TEXT', + 'KURTOSIS', + 'LAG', + 'LAST_DAY', + 'LAST_QUERY_ID', + 'LAST_TRANSACTION', + 'LAST_VALUE', + 'LEAD', + 'LEAST', + 'LEFT', + 'LENGTH', + 'LEN', + 'LIKE', + 'LIKE ALL', + 'LIKE ANY', + 'LISTAGG', + 'LN', + 'LOCALTIME', + 'LOCALTIMESTAMP', + 'LOG', + 'LOGIN_HISTORY', + 'LOGIN_HISTORY_BY_USER', + 'LOWER', + 'LPAD', + 'LTRIM', + 'MATERIALIZED_VIEW_REFRESH_HISTORY', + 'MD5', + 'MD5_HEX', + 'MD5_BINARY', + 'MD5_NUMBER — Obsoleted', + 'MD5_NUMBER_LOWER64', + 'MD5_NUMBER_UPPER64', + 'MEDIAN', + 'MIN', + 'MAX', + 'MINHASH', + 'MINHASH_COMBINE', + 'MOD', + 'MODE', + 'MONTHNAME', + 'MONTHS_BETWEEN', + 'NEXT_DAY', + 'NORMAL', + 'NTH_VALUE', + 'NTILE', + 'NULLIF', + 'NULLIFZERO', + 'NVL', + 'NVL2', + 'OBJECT_AGG', + 'OBJECT_CONSTRUCT', + 'OBJECT_CONSTRUCT_KEEP_NULL', + 'OBJECT_DELETE', + 'OBJECT_INSERT', + 'OBJECT_KEYS', + 'OBJECT_PICK', + 'OCTET_LENGTH', + 'PARSE_IP', + 'PARSE_JSON', + 'PARSE_URL', + 'PARSE_XML', + 'PERCENT_RANK', + 'PERCENTILE_CONT', + 'PERCENTILE_DISC', + 'PI', + 'PIPE_USAGE_HISTORY', + 'POLICY_CONTEXT', + 'POLICY_REFERENCES', + 'POSITION', + 'POW', + 'POWER', + 'PREVIOUS_DAY', + 'QUERY_ACCELERATION_HISTORY', + 'QUERY_HISTORY', + 'QUERY_HISTORY_BY_SESSION', + 'QUERY_HISTORY_BY_USER', + 'QUERY_HISTORY_BY_WAREHOUSE', + 'RADIANS', + 'RANDOM', + 'RANDSTR', + 'RANK', + 'RATIO_TO_REPORT', + 'REGEXP', + 'REGEXP_COUNT', + 'REGEXP_INSTR', + 'REGEXP_LIKE', + 'REGEXP_REPLACE', + 'REGEXP_SUBSTR', + 'REGEXP_SUBSTR_ALL', + 'REGR_AVGX', + 'REGR_AVGY', + 'REGR_COUNT', + 'REGR_INTERCEPT', + 'REGR_R2', + 'REGR_SLOPE', + 'REGR_SXX', + 'REGR_SXY', + 'REGR_SYY', + 'REGR_VALX', + 'REGR_VALY', + 'REPEAT', + 'REPLACE', + 'REPLICATION_GROUP_REFRESH_HISTORY', + 'REPLICATION_GROUP_REFRESH_PROGRESS', + 'REPLICATION_GROUP_REFRESH_PROGRESS_BY_JOB', + 'REPLICATION_GROUP_USAGE_HISTORY', + 'REPLICATION_USAGE_HISTORY', + 'REST_EVENT_HISTORY', + 'RESULT_SCAN', + 'REVERSE', + 'RIGHT', + 'RLIKE', + 'ROUND', + 'ROW_NUMBER', + 'RPAD', + 'RTRIM', + 'RTRIMMED_LENGTH', + 'SEARCH_OPTIMIZATION_HISTORY', + 'SEQ1', + 'SEQ2', + 'SEQ4', + 'SEQ8', + 'SERVERLESS_TASK_HISTORY', + 'SHA1', + 'SHA1_HEX', + 'SHA1_BINARY', + 'SHA2', + 'SHA2_HEX', + 'SHA2_BINARY', + 'SIGN', + 'SIN', + 'SINH', + 'SKEW', + 'SOUNDEX', + 'SPACE', + 'SPLIT', + 'SPLIT_PART', + 'SPLIT_TO_TABLE', + 'SQRT', + 'SQUARE', + 'ST_AREA', + 'ST_ASEWKB', + 'ST_ASEWKT', + 'ST_ASGEOJSON', + 'ST_ASWKB', + 'ST_ASBINARY', + 'ST_ASWKT', + 'ST_ASTEXT', + 'ST_AZIMUTH', + 'ST_CENTROID', + 'ST_COLLECT', + 'ST_CONTAINS', + 'ST_COVEREDBY', + 'ST_COVERS', + 'ST_DIFFERENCE', + 'ST_DIMENSION', + 'ST_DISJOINT', + 'ST_DISTANCE', + 'ST_DWITHIN', + 'ST_ENDPOINT', + 'ST_ENVELOPE', + 'ST_GEOGFROMGEOHASH', + 'ST_GEOGPOINTFROMGEOHASH', + 'ST_GEOGRAPHYFROMWKB', + 'ST_GEOGRAPHYFROMWKT', + 'ST_GEOHASH', + 'ST_GEOMETRYFROMWKB', + 'ST_GEOMETRYFROMWKT', + 'ST_HAUSDORFFDISTANCE', + 'ST_INTERSECTION', + 'ST_INTERSECTS', + 'ST_LENGTH', + 'ST_MAKEGEOMPOINT', + 'ST_GEOM_POINT', + 'ST_MAKELINE', + 'ST_MAKEPOINT', + 'ST_POINT', + 'ST_MAKEPOLYGON', + 'ST_POLYGON', + 'ST_NPOINTS', + 'ST_NUMPOINTS', + 'ST_PERIMETER', + 'ST_POINTN', + 'ST_SETSRID', + 'ST_SIMPLIFY', + 'ST_SRID', + 'ST_STARTPOINT', + 'ST_SYMDIFFERENCE', + 'ST_UNION', + 'ST_WITHIN', + 'ST_X', + 'ST_XMAX', + 'ST_XMIN', + 'ST_Y', + 'ST_YMAX', + 'ST_YMIN', + 'STAGE_DIRECTORY_FILE_REGISTRATION_HISTORY', + 'STAGE_STORAGE_USAGE_HISTORY', + 'STARTSWITH', + 'STDDEV', + 'STDDEV_POP', + 'STDDEV_SAMP', + 'STRIP_NULL_VALUE', + 'STRTOK', + 'STRTOK_SPLIT_TO_TABLE', + 'STRTOK_TO_ARRAY', + 'SUBSTR', + 'SUBSTRING', + 'SUM', + 'SYSDATE', + 'SYSTEM$ABORT_SESSION', + 'SYSTEM$ABORT_TRANSACTION', + 'SYSTEM$AUTHORIZE_PRIVATELINK', + 'SYSTEM$AUTHORIZE_STAGE_PRIVATELINK_ACCESS', + 'SYSTEM$BEHAVIOR_CHANGE_BUNDLE_STATUS', + 'SYSTEM$CANCEL_ALL_QUERIES', + 'SYSTEM$CANCEL_QUERY', + 'SYSTEM$CLUSTERING_DEPTH', + 'SYSTEM$CLUSTERING_INFORMATION', + 'SYSTEM$CLUSTERING_RATIO ', + 'SYSTEM$CURRENT_USER_TASK_NAME', + 'SYSTEM$DATABASE_REFRESH_HISTORY ', + 'SYSTEM$DATABASE_REFRESH_PROGRESS', + 'SYSTEM$DATABASE_REFRESH_PROGRESS_BY_JOB ', + 'SYSTEM$DISABLE_BEHAVIOR_CHANGE_BUNDLE', + 'SYSTEM$DISABLE_DATABASE_REPLICATION', + 'SYSTEM$ENABLE_BEHAVIOR_CHANGE_BUNDLE', + 'SYSTEM$ESTIMATE_QUERY_ACCELERATION', + 'SYSTEM$ESTIMATE_SEARCH_OPTIMIZATION_COSTS', + 'SYSTEM$EXPLAIN_JSON_TO_TEXT', + 'SYSTEM$EXPLAIN_PLAN_JSON', + 'SYSTEM$EXTERNAL_TABLE_PIPE_STATUS', + 'SYSTEM$GENERATE_SAML_CSR', + 'SYSTEM$GENERATE_SCIM_ACCESS_TOKEN', + 'SYSTEM$GET_AWS_SNS_IAM_POLICY', + 'SYSTEM$GET_PREDECESSOR_RETURN_VALUE', + 'SYSTEM$GET_PRIVATELINK', + 'SYSTEM$GET_PRIVATELINK_AUTHORIZED_ENDPOINTS', + 'SYSTEM$GET_PRIVATELINK_CONFIG', + 'SYSTEM$GET_SNOWFLAKE_PLATFORM_INFO', + 'SYSTEM$GET_TAG', + 'SYSTEM$GET_TAG_ALLOWED_VALUES', + 'SYSTEM$GET_TAG_ON_CURRENT_COLUMN', + 'SYSTEM$GET_TAG_ON_CURRENT_TABLE', + 'SYSTEM$GLOBAL_ACCOUNT_SET_PARAMETER', + 'SYSTEM$LAST_CHANGE_COMMIT_TIME', + 'SYSTEM$LINK_ACCOUNT_OBJECTS_BY_NAME', + 'SYSTEM$MIGRATE_SAML_IDP_REGISTRATION', + 'SYSTEM$PIPE_FORCE_RESUME', + 'SYSTEM$PIPE_STATUS', + 'SYSTEM$REVOKE_PRIVATELINK', + 'SYSTEM$REVOKE_STAGE_PRIVATELINK_ACCESS', + 'SYSTEM$SET_RETURN_VALUE', + 'SYSTEM$SHOW_OAUTH_CLIENT_SECRETS', + 'SYSTEM$STREAM_GET_TABLE_TIMESTAMP', + 'SYSTEM$STREAM_HAS_DATA', + 'SYSTEM$TASK_DEPENDENTS_ENABLE', + 'SYSTEM$TYPEOF', + 'SYSTEM$USER_TASK_CANCEL_ONGOING_EXECUTIONS', + 'SYSTEM$VERIFY_EXTERNAL_OAUTH_TOKEN', + 'SYSTEM$WAIT', + 'SYSTEM$WHITELIST', + 'SYSTEM$WHITELIST_PRIVATELINK', + 'TAG_REFERENCES', + 'TAG_REFERENCES_ALL_COLUMNS', + 'TAG_REFERENCES_WITH_LINEAGE', + 'TAN', + 'TANH', + 'TASK_DEPENDENTS', + 'TASK_HISTORY', + 'TIME_FROM_PARTS', + 'TIME_SLICE', + 'TIMEADD', + 'TIMEDIFF', + 'TIMESTAMP_FROM_PARTS', + 'TIMESTAMPADD', + 'TIMESTAMPDIFF', + 'TO_ARRAY', + 'TO_BINARY', + 'TO_BOOLEAN', + 'TO_CHAR', + 'TO_VARCHAR', + 'TO_DATE', + 'DATE', + 'TO_DECIMAL', + 'TO_NUMBER', + 'TO_NUMERIC', + 'TO_DOUBLE', + 'TO_GEOGRAPHY', + 'TO_GEOMETRY', + 'TO_JSON', + 'TO_OBJECT', + 'TO_TIME', + 'TIME', + 'TO_TIMESTAMP', + 'TO_TIMESTAMP_LTZ', + 'TO_TIMESTAMP_NTZ', + 'TO_TIMESTAMP_TZ', + 'TO_VARIANT', + 'TO_XML', + 'TRANSLATE', + 'TRIM', + 'TRUNCATE', + 'TRUNC', + 'TRUNC', + 'TRY_BASE64_DECODE_BINARY', + 'TRY_BASE64_DECODE_STRING', + 'TRY_CAST', + 'TRY_HEX_DECODE_BINARY', + 'TRY_HEX_DECODE_STRING', + 'TRY_PARSE_JSON', + 'TRY_TO_BINARY', + 'TRY_TO_BOOLEAN', + 'TRY_TO_DATE', + 'TRY_TO_DECIMAL', + 'TRY_TO_NUMBER', + 'TRY_TO_NUMERIC', + 'TRY_TO_DOUBLE', + 'TRY_TO_GEOGRAPHY', + 'TRY_TO_GEOMETRY', + 'TRY_TO_TIME', + 'TRY_TO_TIMESTAMP', + 'TRY_TO_TIMESTAMP_LTZ', + 'TRY_TO_TIMESTAMP_NTZ', + 'TRY_TO_TIMESTAMP_TZ', + 'TYPEOF', + 'UNICODE', + 'UNIFORM', + 'UPPER', + 'UUID_STRING', + 'VALIDATE', + 'VALIDATE_PIPE_LOAD', + 'VAR_POP', + 'VAR_SAMP', + 'VARIANCE', + 'VARIANCE_SAMP', + 'VARIANCE_POP', + 'WAREHOUSE_LOAD_HISTORY', + 'WAREHOUSE_METERING_HISTORY', + 'WIDTH_BUCKET', + 'XMLGET', + 'YEAR', + 'YEAROFWEEK', + 'YEAROFWEEKISO', + 'DAY', + 'DAYOFMONTH', + 'DAYOFWEEK', + 'DAYOFWEEKISO', + 'DAYOFYEAR', + 'WEEK', + 'WEEK', + 'WEEKOFYEAR', + 'WEEKISO', + 'MONTH', + 'QUARTER', + 'ZEROIFNULL', + 'ZIPF', +]; diff --git a/src/languages/snowflake/snowflake.keywords.ts b/src/languages/snowflake/snowflake.keywords.ts index fe3a82b5ee..fe204c8f2f 100644 --- a/src/languages/snowflake/snowflake.keywords.ts +++ b/src/languages/snowflake/snowflake.keywords.ts @@ -1,140 +1,137 @@ -import { flatKeywordList } from '../../utils.js'; - -export const keywords = flatKeywordList({ +export const keywords: string[] = [ // https://docs.snowflake.com/en/sql-reference/reserved-keywords.html // // run in console on this page: $x('//tbody/tr/*[1]/p/text()').map(x => x.nodeValue) - all: [ - 'ACCOUNT', - 'ALL', - 'ALTER', - 'AND', - 'ANY', - 'AS', - 'BETWEEN', - 'BY', - 'CASE', - 'CAST', - 'CHECK', - 'COLUMN', - 'CONNECT', - 'CONNECTION', - 'CONSTRAINT', - 'CREATE', - 'CROSS', - 'CURRENT', - 'CURRENT_DATE', - 'CURRENT_TIME', - 'CURRENT_TIMESTAMP', - 'CURRENT_USER', - 'DATABASE', - 'DELETE', - 'DISTINCT', - 'DROP', - 'ELSE', - 'EXISTS', - 'FALSE', - 'FOLLOWING', - 'FOR', - 'FROM', - 'FULL', - 'GRANT', - 'GROUP', - 'GSCLUSTER', - 'HAVING', - 'ILIKE', - 'IN', - 'INCREMENT', - 'INNER', - 'INSERT', - 'INTERSECT', - 'INTO', - 'IS', - 'ISSUE', - 'JOIN', - 'LATERAL', - 'LEFT', - 'LIKE', - 'LOCALTIME', - 'LOCALTIMESTAMP', - 'MINUS', - 'NATURAL', - 'NOT', - 'NULL', - 'OF', - 'ON', - 'OR', - 'ORDER', - 'ORGANIZATION', - 'QUALIFY', - 'REGEXP', - 'REVOKE', - 'RIGHT', - 'RLIKE', - 'ROW', - 'ROWS', - 'SAMPLE', - 'SCHEMA', - 'SELECT', - 'SET', - 'SOME', - 'START', - 'TABLE', - 'TABLESAMPLE', - 'THEN', - 'TO', - 'TRIGGER', - 'TRUE', - 'TRY_CAST', - 'UNION', - 'UNIQUE', - 'UPDATE', - 'USING', - 'VALUES', - 'VIEW', - 'WHEN', - 'WHENEVER', - 'WHERE', - 'WITH', - ], + 'ACCOUNT', + 'ALL', + 'ALTER', + 'AND', + 'ANY', + 'AS', + 'BETWEEN', + 'BY', + 'CASE', + 'CAST', + 'CHECK', + 'COLUMN', + 'CONNECT', + 'CONNECTION', + 'CONSTRAINT', + 'CREATE', + 'CROSS', + 'CURRENT', + 'CURRENT_DATE', + 'CURRENT_TIME', + 'CURRENT_TIMESTAMP', + 'CURRENT_USER', + 'DATABASE', + 'DELETE', + 'DISTINCT', + 'DROP', + 'ELSE', + 'EXISTS', + 'FALSE', + 'FOLLOWING', + 'FOR', + 'FROM', + 'FULL', + 'GRANT', + 'GROUP', + 'GSCLUSTER', + 'HAVING', + 'ILIKE', + 'IN', + 'INCREMENT', + 'INNER', + 'INSERT', + 'INTERSECT', + 'INTO', + 'IS', + 'ISSUE', + 'JOIN', + 'LATERAL', + 'LEFT', + 'LIKE', + 'LOCALTIME', + 'LOCALTIMESTAMP', + 'MINUS', + 'NATURAL', + 'NOT', + 'NULL', + 'OF', + 'ON', + 'OR', + 'ORDER', + 'ORGANIZATION', + 'QUALIFY', + 'REGEXP', + 'REVOKE', + 'RIGHT', + 'RLIKE', + 'ROW', + 'ROWS', + 'SAMPLE', + 'SCHEMA', + 'SELECT', + 'SET', + 'SOME', + 'START', + 'TABLE', + 'TABLESAMPLE', + 'THEN', + 'TO', + 'TRIGGER', + 'TRUE', + 'TRY_CAST', + 'UNION', + 'UNIQUE', + 'UPDATE', + 'USING', + 'VALUES', + 'VIEW', + 'WHEN', + 'WHENEVER', + 'WHERE', + 'WITH', + // These are definitely keywords, but haven't found a definite list in the docs - additional: ['COMMENT'], - datatypes: [ - 'NUMBER', - 'DECIMAL', - 'NUMERIC', - 'INT', - 'INTEGER', - 'BIGINT', - 'SMALLINT', - 'TINYINT', - 'BYTEINT', - 'FLOAT', - 'FLOAT4', - 'FLOAT8', - 'DOUBLE', - 'DOUBLE PRECISION', - 'REAL', - 'VARCHAR', - 'CHAR', - 'CHARACTER', - 'STRING', - 'TEXT', - 'BINARY', - 'VARBINARY', - 'BOOLEAN', - 'DATE', - 'DATETIME', - 'TIME', - 'TIMESTAMP', - 'TIMESTAMP_LTZ', - 'TIMESTAMP_NTZ', - 'TIMESTAMP', - 'TIMESTAMP_TZ', - 'VARIANT', - 'OBJECT', - 'ARRAY', - 'GEOGRAPHY', - 'GEOMETRY', - ], -}); + 'COMMENT', + + // datatypes + 'NUMBER', + 'DECIMAL', + 'NUMERIC', + 'INT', + 'INTEGER', + 'BIGINT', + 'SMALLINT', + 'TINYINT', + 'BYTEINT', + 'FLOAT', + 'FLOAT4', + 'FLOAT8', + 'DOUBLE', + 'DOUBLE PRECISION', + 'REAL', + 'VARCHAR', + 'CHAR', + 'CHARACTER', + 'STRING', + 'TEXT', + 'BINARY', + 'VARBINARY', + 'BOOLEAN', + 'DATE', + 'DATETIME', + 'TIME', + 'TIMESTAMP', + 'TIMESTAMP_LTZ', + 'TIMESTAMP_NTZ', + 'TIMESTAMP', + 'TIMESTAMP_TZ', + 'VARIANT', + 'OBJECT', + 'ARRAY', + 'GEOGRAPHY', + 'GEOMETRY', +]; diff --git a/src/languages/spark/spark.functions.ts b/src/languages/spark/spark.functions.ts index e0cb52800c..78e6dbb78f 100644 --- a/src/languages/spark/spark.functions.ts +++ b/src/languages/spark/spark.functions.ts @@ -1,358 +1,351 @@ -import { flatKeywordList } from '../../utils.js'; - -export const functions = flatKeywordList({ +export const functions: string[] = [ // http://spark.apache.org/docs/latest/sql-ref-functions.html // // http://spark.apache.org/docs/latest/sql-ref-functions-builtin.html#aggregate-functions - aggregate: [ - // 'ANY', - 'APPROX_COUNT_DISTINCT', - 'APPROX_PERCENTILE', - 'AVG', - 'BIT_AND', - 'BIT_OR', - 'BIT_XOR', - 'BOOL_AND', - 'BOOL_OR', - 'COLLECT_LIST', - 'COLLECT_SET', - 'CORR', - 'COUNT', - 'COUNT', - 'COUNT', - 'COUNT_IF', - 'COUNT_MIN_SKETCH', - 'COVAR_POP', - 'COVAR_SAMP', - 'EVERY', - 'FIRST', - 'FIRST_VALUE', - 'GROUPING', - 'GROUPING_ID', - 'KURTOSIS', - 'LAST', - 'LAST_VALUE', - 'MAX', - 'MAX_BY', - 'MEAN', - 'MIN', - 'MIN_BY', - 'PERCENTILE', - 'PERCENTILE', - 'PERCENTILE_APPROX', - 'SKEWNESS', - // 'SOME', - 'STD', - 'STDDEV', - 'STDDEV_POP', - 'STDDEV_SAMP', - 'SUM', - 'VAR_POP', - 'VAR_SAMP', - 'VARIANCE', - ], + // 'ANY', + 'APPROX_COUNT_DISTINCT', + 'APPROX_PERCENTILE', + 'AVG', + 'BIT_AND', + 'BIT_OR', + 'BIT_XOR', + 'BOOL_AND', + 'BOOL_OR', + 'COLLECT_LIST', + 'COLLECT_SET', + 'CORR', + 'COUNT', + 'COUNT', + 'COUNT', + 'COUNT_IF', + 'COUNT_MIN_SKETCH', + 'COVAR_POP', + 'COVAR_SAMP', + 'EVERY', + 'FIRST', + 'FIRST_VALUE', + 'GROUPING', + 'GROUPING_ID', + 'KURTOSIS', + 'LAST', + 'LAST_VALUE', + 'MAX', + 'MAX_BY', + 'MEAN', + 'MIN', + 'MIN_BY', + 'PERCENTILE', + 'PERCENTILE', + 'PERCENTILE_APPROX', + 'SKEWNESS', + // 'SOME', + 'STD', + 'STDDEV', + 'STDDEV_POP', + 'STDDEV_SAMP', + 'SUM', + 'VAR_POP', + 'VAR_SAMP', + 'VARIANCE', + // http://spark.apache.org/docs/latest/sql-ref-functions-builtin.html#window-functions - window: [ - 'CUME_DIST', - 'DENSE_RANK', - 'LAG', - 'LEAD', - 'NTH_VALUE', - 'NTILE', - 'PERCENT_RANK', - 'RANK', - 'ROW_NUMBER', - ], + 'CUME_DIST', + 'DENSE_RANK', + 'LAG', + 'LEAD', + 'NTH_VALUE', + 'NTILE', + 'PERCENT_RANK', + 'RANK', + 'ROW_NUMBER', + // http://spark.apache.org/docs/latest/sql-ref-functions-builtin.html#array-functions - array: [ - 'ARRAY', - 'ARRAY_CONTAINS', - 'ARRAY_DISTINCT', - 'ARRAY_EXCEPT', - 'ARRAY_INTERSECT', - 'ARRAY_JOIN', - 'ARRAY_MAX', - 'ARRAY_MIN', - 'ARRAY_POSITION', - 'ARRAY_REMOVE', - 'ARRAY_REPEAT', - 'ARRAY_UNION', - 'ARRAYS_OVERLAP', - 'ARRAYS_ZIP', - 'FLATTEN', - 'SEQUENCE', - 'SHUFFLE', - 'SLICE', - 'SORT_ARRAY', - ], + 'ARRAY', + 'ARRAY_CONTAINS', + 'ARRAY_DISTINCT', + 'ARRAY_EXCEPT', + 'ARRAY_INTERSECT', + 'ARRAY_JOIN', + 'ARRAY_MAX', + 'ARRAY_MIN', + 'ARRAY_POSITION', + 'ARRAY_REMOVE', + 'ARRAY_REPEAT', + 'ARRAY_UNION', + 'ARRAYS_OVERLAP', + 'ARRAYS_ZIP', + 'FLATTEN', + 'SEQUENCE', + 'SHUFFLE', + 'SLICE', + 'SORT_ARRAY', + // http://spark.apache.org/docs/latest/sql-ref-functions-builtin.html#map-functions - map: [ - 'ELEMENT_AT', - 'ELEMENT_AT', - 'MAP', - 'MAP_CONCAT', - 'MAP_ENTRIES', - 'MAP_FROM_ARRAYS', - 'MAP_FROM_ENTRIES', - 'MAP_KEYS', - 'MAP_VALUES', - 'STR_TO_MAP', - ], + 'ELEMENT_AT', + 'ELEMENT_AT', + 'MAP', + 'MAP_CONCAT', + 'MAP_ENTRIES', + 'MAP_FROM_ARRAYS', + 'MAP_FROM_ENTRIES', + 'MAP_KEYS', + 'MAP_VALUES', + 'STR_TO_MAP', + // http://spark.apache.org/docs/latest/sql-ref-functions-builtin.html#date-and-timestamp-functions - datetime: [ - 'ADD_MONTHS', - 'CURRENT_DATE', - 'CURRENT_DATE', - 'CURRENT_TIMESTAMP', - 'CURRENT_TIMESTAMP', - 'CURRENT_TIMEZONE', - 'DATE_ADD', - 'DATE_FORMAT', - 'DATE_FROM_UNIX_DATE', - 'DATE_PART', - 'DATE_SUB', - 'DATE_TRUNC', - 'DATEDIFF', - 'DAY', - 'DAYOFMONTH', - 'DAYOFWEEK', - 'DAYOFYEAR', - 'EXTRACT', - 'FROM_UNIXTIME', - 'FROM_UTC_TIMESTAMP', - 'HOUR', - 'LAST_DAY', - 'MAKE_DATE', - 'MAKE_DT_INTERVAL', - 'MAKE_INTERVAL', - 'MAKE_TIMESTAMP', - 'MAKE_YM_INTERVAL', - 'MINUTE', - 'MONTH', - 'MONTHS_BETWEEN', - 'NEXT_DAY', - 'NOW', - 'QUARTER', - 'SECOND', - 'SESSION_WINDOW', - 'TIMESTAMP_MICROS', - 'TIMESTAMP_MILLIS', - 'TIMESTAMP_SECONDS', - 'TO_DATE', - 'TO_TIMESTAMP', - 'TO_UNIX_TIMESTAMP', - 'TO_UTC_TIMESTAMP', - 'TRUNC', - 'UNIX_DATE', - 'UNIX_MICROS', - 'UNIX_MILLIS', - 'UNIX_SECONDS', - 'UNIX_TIMESTAMP', - 'WEEKDAY', - 'WEEKOFYEAR', - 'WINDOW', - 'YEAR', - ], + 'ADD_MONTHS', + 'CURRENT_DATE', + 'CURRENT_DATE', + 'CURRENT_TIMESTAMP', + 'CURRENT_TIMESTAMP', + 'CURRENT_TIMEZONE', + 'DATE_ADD', + 'DATE_FORMAT', + 'DATE_FROM_UNIX_DATE', + 'DATE_PART', + 'DATE_SUB', + 'DATE_TRUNC', + 'DATEDIFF', + 'DAY', + 'DAYOFMONTH', + 'DAYOFWEEK', + 'DAYOFYEAR', + 'EXTRACT', + 'FROM_UNIXTIME', + 'FROM_UTC_TIMESTAMP', + 'HOUR', + 'LAST_DAY', + 'MAKE_DATE', + 'MAKE_DT_INTERVAL', + 'MAKE_INTERVAL', + 'MAKE_TIMESTAMP', + 'MAKE_YM_INTERVAL', + 'MINUTE', + 'MONTH', + 'MONTHS_BETWEEN', + 'NEXT_DAY', + 'NOW', + 'QUARTER', + 'SECOND', + 'SESSION_WINDOW', + 'TIMESTAMP_MICROS', + 'TIMESTAMP_MILLIS', + 'TIMESTAMP_SECONDS', + 'TO_DATE', + 'TO_TIMESTAMP', + 'TO_UNIX_TIMESTAMP', + 'TO_UTC_TIMESTAMP', + 'TRUNC', + 'UNIX_DATE', + 'UNIX_MICROS', + 'UNIX_MILLIS', + 'UNIX_SECONDS', + 'UNIX_TIMESTAMP', + 'WEEKDAY', + 'WEEKOFYEAR', + 'WINDOW', + 'YEAR', + // http://spark.apache.org/docs/latest/sql-ref-functions-builtin.html#json-functions - json: [ - 'FROM_JSON', - 'GET_JSON_OBJECT', - 'JSON_ARRAY_LENGTH', - 'JSON_OBJECT_KEYS', - 'JSON_TUPLE', - 'SCHEMA_OF_JSON', - 'TO_JSON', - ], + 'FROM_JSON', + 'GET_JSON_OBJECT', + 'JSON_ARRAY_LENGTH', + 'JSON_OBJECT_KEYS', + 'JSON_TUPLE', + 'SCHEMA_OF_JSON', + 'TO_JSON', + // http://spark.apache.org/docs/latest/api/sql/index.html - misc: [ - 'ABS', - 'ACOS', - 'ACOSH', - 'AGGREGATE', - 'ARRAY_SORT', - 'ASCII', - 'ASIN', - 'ASINH', - 'ASSERT_TRUE', - 'ATAN', - 'ATAN2', - 'ATANH', - 'BASE64', - 'BIGINT', - 'BIN', - 'BINARY', - 'BIT_COUNT', - 'BIT_GET', - 'BIT_LENGTH', - 'BOOLEAN', - 'BROUND', - 'BTRIM', - 'CARDINALITY', - 'CBRT', - 'CEIL', - 'CEILING', - 'CHAR', - 'CHAR_LENGTH', - 'CHARACTER_LENGTH', - 'CHR', - 'CONCAT', - 'CONCAT_WS', - 'CONV', - 'COS', - 'COSH', - 'COT', - 'CRC32', - 'CURRENT_CATALOG', - 'CURRENT_DATABASE', - 'CURRENT_USER', - 'DATE', - 'DECIMAL', - 'DEGREES', - 'DOUBLE', - // 'E', - 'ELT', - 'EXP', - 'EXPM1', - 'FACTORIAL', - 'FIND_IN_SET', - 'FLOAT', - 'FLOOR', - 'FORALL', - 'FORMAT_NUMBER', - 'FORMAT_STRING', - 'FROM_CSV', - 'GETBIT', - 'HASH', - 'HEX', - 'HYPOT', - 'INITCAP', - 'INLINE', - 'INLINE_OUTER', - 'INPUT_FILE_BLOCK_LENGTH', - 'INPUT_FILE_BLOCK_START', - 'INPUT_FILE_NAME', - 'INSTR', - 'INT', - 'ISNAN', - 'ISNOTNULL', - 'ISNULL', - 'JAVA_METHOD', - 'LCASE', - 'LEFT', - 'LENGTH', - 'LEVENSHTEIN', - 'LN', - 'LOCATE', - 'LOG', - 'LOG10', - 'LOG1P', - 'LOG2', - 'LOWER', - 'LPAD', - 'LTRIM', - 'MAP_FILTER', - 'MAP_ZIP_WITH', - 'MD5', - 'MOD', - 'MONOTONICALLY_INCREASING_ID', - 'NAMED_STRUCT', - 'NANVL', - 'NEGATIVE', - 'NVL', - 'NVL2', - 'OCTET_LENGTH', - 'OVERLAY', - 'PARSE_URL', - 'PI', - 'PMOD', - 'POSEXPLODE', - 'POSEXPLODE_OUTER', - 'POSITION', - 'POSITIVE', - 'POW', - 'POWER', - 'PRINTF', - 'RADIANS', - 'RAISE_ERROR', - 'RAND', - 'RANDN', - 'RANDOM', - 'REFLECT', - 'REGEXP_EXTRACT', - 'REGEXP_EXTRACT_ALL', - 'REGEXP_LIKE', - 'REGEXP_REPLACE', - 'REPEAT', - 'REPLACE', - 'REVERSE', - 'RIGHT', - 'RINT', - 'ROUND', - 'RPAD', - 'RTRIM', - 'SCHEMA_OF_CSV', - 'SENTENCES', - 'SHA', - 'SHA1', - 'SHA2', - 'SHIFTLEFT', - 'SHIFTRIGHT', - 'SHIFTRIGHTUNSIGNED', - 'SIGN', - 'SIGNUM', - 'SIN', - 'SINH', - 'SMALLINT', - 'SOUNDEX', - 'SPACE', - 'SPARK_PARTITION_ID', - 'SPLIT', - 'SQRT', - 'STACK', - 'SUBSTR', - 'SUBSTRING', - 'SUBSTRING_INDEX', - 'TAN', - 'TANH', - 'TIMESTAMP', - 'TINYINT', - 'TO_CSV', - 'TRANSFORM_KEYS', - 'TRANSFORM_VALUES', - 'TRANSLATE', - 'TRIM', - 'TRY_ADD', - 'TRY_DIVIDE', - 'TYPEOF', - 'UCASE', - 'UNBASE64', - 'UNHEX', - 'UPPER', - 'UUID', - 'VERSION', - 'WIDTH_BUCKET', - 'XPATH', - 'XPATH_BOOLEAN', - 'XPATH_DOUBLE', - 'XPATH_FLOAT', - 'XPATH_INT', - 'XPATH_LONG', - 'XPATH_NUMBER', - 'XPATH_SHORT', - 'XPATH_STRING', - 'XXHASH64', - 'ZIP_WITH', - ], - cast: ['CAST'], + 'ABS', + 'ACOS', + 'ACOSH', + 'AGGREGATE', + 'ARRAY_SORT', + 'ASCII', + 'ASIN', + 'ASINH', + 'ASSERT_TRUE', + 'ATAN', + 'ATAN2', + 'ATANH', + 'BASE64', + 'BIGINT', + 'BIN', + 'BINARY', + 'BIT_COUNT', + 'BIT_GET', + 'BIT_LENGTH', + 'BOOLEAN', + 'BROUND', + 'BTRIM', + 'CARDINALITY', + 'CBRT', + 'CEIL', + 'CEILING', + 'CHAR', + 'CHAR_LENGTH', + 'CHARACTER_LENGTH', + 'CHR', + 'CONCAT', + 'CONCAT_WS', + 'CONV', + 'COS', + 'COSH', + 'COT', + 'CRC32', + 'CURRENT_CATALOG', + 'CURRENT_DATABASE', + 'CURRENT_USER', + 'DATE', + 'DECIMAL', + 'DEGREES', + 'DOUBLE', + // 'E', + 'ELT', + 'EXP', + 'EXPM1', + 'FACTORIAL', + 'FIND_IN_SET', + 'FLOAT', + 'FLOOR', + 'FORALL', + 'FORMAT_NUMBER', + 'FORMAT_STRING', + 'FROM_CSV', + 'GETBIT', + 'HASH', + 'HEX', + 'HYPOT', + 'INITCAP', + 'INLINE', + 'INLINE_OUTER', + 'INPUT_FILE_BLOCK_LENGTH', + 'INPUT_FILE_BLOCK_START', + 'INPUT_FILE_NAME', + 'INSTR', + 'INT', + 'ISNAN', + 'ISNOTNULL', + 'ISNULL', + 'JAVA_METHOD', + 'LCASE', + 'LEFT', + 'LENGTH', + 'LEVENSHTEIN', + 'LN', + 'LOCATE', + 'LOG', + 'LOG10', + 'LOG1P', + 'LOG2', + 'LOWER', + 'LPAD', + 'LTRIM', + 'MAP_FILTER', + 'MAP_ZIP_WITH', + 'MD5', + 'MOD', + 'MONOTONICALLY_INCREASING_ID', + 'NAMED_STRUCT', + 'NANVL', + 'NEGATIVE', + 'NVL', + 'NVL2', + 'OCTET_LENGTH', + 'OVERLAY', + 'PARSE_URL', + 'PI', + 'PMOD', + 'POSEXPLODE', + 'POSEXPLODE_OUTER', + 'POSITION', + 'POSITIVE', + 'POW', + 'POWER', + 'PRINTF', + 'RADIANS', + 'RAISE_ERROR', + 'RAND', + 'RANDN', + 'RANDOM', + 'REFLECT', + 'REGEXP_EXTRACT', + 'REGEXP_EXTRACT_ALL', + 'REGEXP_LIKE', + 'REGEXP_REPLACE', + 'REPEAT', + 'REPLACE', + 'REVERSE', + 'RIGHT', + 'RINT', + 'ROUND', + 'RPAD', + 'RTRIM', + 'SCHEMA_OF_CSV', + 'SENTENCES', + 'SHA', + 'SHA1', + 'SHA2', + 'SHIFTLEFT', + 'SHIFTRIGHT', + 'SHIFTRIGHTUNSIGNED', + 'SIGN', + 'SIGNUM', + 'SIN', + 'SINH', + 'SMALLINT', + 'SOUNDEX', + 'SPACE', + 'SPARK_PARTITION_ID', + 'SPLIT', + 'SQRT', + 'STACK', + 'SUBSTR', + 'SUBSTRING', + 'SUBSTRING_INDEX', + 'TAN', + 'TANH', + 'TIMESTAMP', + 'TINYINT', + 'TO_CSV', + 'TRANSFORM_KEYS', + 'TRANSFORM_VALUES', + 'TRANSLATE', + 'TRIM', + 'TRY_ADD', + 'TRY_DIVIDE', + 'TYPEOF', + 'UCASE', + 'UNBASE64', + 'UNHEX', + 'UPPER', + 'UUID', + 'VERSION', + 'WIDTH_BUCKET', + 'XPATH', + 'XPATH_BOOLEAN', + 'XPATH_DOUBLE', + 'XPATH_FLOAT', + 'XPATH_INT', + 'XPATH_LONG', + 'XPATH_NUMBER', + 'XPATH_SHORT', + 'XPATH_STRING', + 'XXHASH64', + 'ZIP_WITH', + + // cast + 'CAST', + // Shorthand functions to use in place of CASE expression - caseAbbrev: ['COALESCE', 'NULLIF'], + 'COALESCE', + 'NULLIF', + // Parameterized data types // https://spark.apache.org/docs/latest/sql-ref-datatypes.html - dataTypes: [ - 'DECIMAL', - 'DEC', - 'NUMERIC', - // No varchar type in Spark, only STRING. Added for the sake of tests - 'VARCHAR', - ], -}); + 'DECIMAL', + 'DEC', + 'NUMERIC', + // No varchar type in Spark, only STRING. Added for the sake of tests + 'VARCHAR', +]; diff --git a/src/languages/spark/spark.keywords.ts b/src/languages/spark/spark.keywords.ts index b7248679ca..fdc6f37bf0 100644 --- a/src/languages/spark/spark.keywords.ts +++ b/src/languages/spark/spark.keywords.ts @@ -1,277 +1,273 @@ -import { flatKeywordList } from '../../utils.js'; - -export const keywords = flatKeywordList({ +export const keywords: string[] = [ // https://deepkb.com/CO_000013/en/kb/IMPORT-fbfa59f0-2bf1-31fe-bb7b-0f9efe9932c6/spark-sql-keywords - all: [ - 'ADD', - 'AFTER', - 'ALL', - 'ALTER', - 'ANALYZE', - 'AND', - 'ANTI', - 'ANY', - 'ARCHIVE', - 'ARRAY', - 'AS', - 'ASC', - 'AT', - 'AUTHORIZATION', - 'BETWEEN', - 'BOTH', - 'BUCKET', - 'BUCKETS', - 'BY', - 'CACHE', - 'CASCADE', - 'CAST', - 'CHANGE', - 'CHECK', - 'CLEAR', - 'CLUSTER', - 'CLUSTERED', - 'CODEGEN', - 'COLLATE', - 'COLLECTION', - 'COLUMN', - 'COLUMNS', - 'COMMENT', - 'COMMIT', - 'COMPACT', - 'COMPACTIONS', - 'COMPUTE', - 'CONCATENATE', - 'CONSTRAINT', - 'COST', - 'CREATE', - 'CROSS', - 'CUBE', - 'CURRENT', - 'CURRENT_DATE', - 'CURRENT_TIME', - 'CURRENT_TIMESTAMP', - 'CURRENT_USER', - 'DATA', - 'DATABASE', - 'DATABASES', - 'DAY', - 'DBPROPERTIES', - 'DEFINED', - 'DELETE', - 'DELIMITED', - 'DESC', - 'DESCRIBE', - 'DFS', - 'DIRECTORIES', - 'DIRECTORY', - 'DISTINCT', - 'DISTRIBUTE', - 'DIV', - 'DROP', - 'ESCAPE', - 'ESCAPED', - 'EXCEPT', - 'EXCHANGE', - 'EXISTS', - 'EXPORT', - 'EXTENDED', - 'EXTERNAL', - 'EXTRACT', - 'FALSE', - 'FETCH', - 'FIELDS', - 'FILTER', - 'FILEFORMAT', - 'FIRST', - 'FIRST_VALUE', - 'FOLLOWING', - 'FOR', - 'FOREIGN', - 'FORMAT', - 'FORMATTED', - 'FULL', - 'FUNCTION', - 'FUNCTIONS', - 'GLOBAL', - 'GRANT', - 'GROUP', - 'GROUPING', - 'HOUR', - 'IF', - 'IGNORE', - 'IMPORT', - 'IN', - 'INDEX', - 'INDEXES', - 'INNER', - 'INPATH', - 'INPUTFORMAT', - 'INTERSECT', - 'INTERVAL', - 'INTO', - 'IS', - 'ITEMS', - 'KEYS', - 'LAST', - 'LAST_VALUE', - 'LATERAL', - 'LAZY', - 'LEADING', - 'LEFT', - 'LIKE', - 'LINES', - 'LIST', - 'LOCAL', - 'LOCATION', - 'LOCK', - 'LOCKS', - 'LOGICAL', - 'MACRO', - 'MAP', - 'MATCHED', - 'MERGE', - 'MINUTE', - 'MONTH', - 'MSCK', - 'NAMESPACE', - 'NAMESPACES', - 'NATURAL', - 'NO', - 'NOT', - 'NULL', - 'NULLS', - 'OF', - 'ONLY', - 'OPTION', - 'OPTIONS', - 'OR', - 'ORDER', - 'OUT', - 'OUTER', - 'OUTPUTFORMAT', - 'OVER', - 'OVERLAPS', - 'OVERLAY', - 'OVERWRITE', - 'OWNER', - 'PARTITION', - 'PARTITIONED', - 'PARTITIONS', - 'PERCENT', - 'PLACING', - 'POSITION', - 'PRECEDING', - 'PRIMARY', - 'PRINCIPALS', - 'PROPERTIES', - 'PURGE', - 'QUERY', - 'RANGE', - 'RECORDREADER', - 'RECORDWRITER', - 'RECOVER', - 'REDUCE', - 'REFERENCES', - 'RENAME', - 'REPAIR', - 'REPLACE', - 'RESPECT', - 'RESTRICT', - 'REVOKE', - 'RIGHT', - 'RLIKE', - 'ROLE', - 'ROLES', - 'ROLLBACK', - 'ROLLUP', - 'ROW', - 'ROWS', - 'SCHEMA', - 'SECOND', - 'SELECT', - 'SEMI', - 'SEPARATED', - 'SERDE', - 'SERDEPROPERTIES', - 'SESSION_USER', - 'SETS', - 'SHOW', - 'SKEWED', - 'SOME', - 'SORT', - 'SORTED', - 'START', - 'STATISTICS', - 'STORED', - 'STRATIFY', - 'STRUCT', - 'SUBSTR', - 'SUBSTRING', - 'TABLE', - 'TABLES', - 'TBLPROPERTIES', - 'TEMPORARY', - 'TERMINATED', - 'THEN', - 'TO', - 'TOUCH', - 'TRAILING', - 'TRANSACTION', - 'TRANSACTIONS', - 'TRIM', - 'TRUE', - 'TRUNCATE', - 'UNARCHIVE', - 'UNBOUNDED', - 'UNCACHE', - 'UNIQUE', - 'UNKNOWN', - 'UNLOCK', - 'UNSET', - 'USE', - 'USER', - 'USING', - 'VIEW', - 'WINDOW', - 'YEAR', - // other - 'ANALYSE', - 'ARRAY_ZIP', - 'COALESCE', - 'CONTAINS', - 'CONVERT', - 'DAYS', - 'DAY_HOUR', - 'DAY_MINUTE', - 'DAY_SECOND', - 'DECODE', - 'DEFAULT', - 'DISTINCTROW', - 'ENCODE', - 'EXPLODE', - 'EXPLODE_OUTER', - 'FIXED', - 'GREATEST', - 'GROUP_CONCAT', - 'HOURS', - 'HOUR_MINUTE', - 'HOUR_SECOND', - 'IFNULL', - 'LEAST', - 'LEVEL', - 'MINUTE_SECOND', - 'NULLIF', - 'OFFSET', - 'ON', - 'OPTIMIZE', - 'REGEXP', - 'SEPARATOR', - 'SIZE', - 'STRING', - 'TYPE', - 'TYPES', - 'UNSIGNED', - 'VARIABLES', - 'YEAR_MONTH', - ], -}); + 'ADD', + 'AFTER', + 'ALL', + 'ALTER', + 'ANALYZE', + 'AND', + 'ANTI', + 'ANY', + 'ARCHIVE', + 'ARRAY', + 'AS', + 'ASC', + 'AT', + 'AUTHORIZATION', + 'BETWEEN', + 'BOTH', + 'BUCKET', + 'BUCKETS', + 'BY', + 'CACHE', + 'CASCADE', + 'CAST', + 'CHANGE', + 'CHECK', + 'CLEAR', + 'CLUSTER', + 'CLUSTERED', + 'CODEGEN', + 'COLLATE', + 'COLLECTION', + 'COLUMN', + 'COLUMNS', + 'COMMENT', + 'COMMIT', + 'COMPACT', + 'COMPACTIONS', + 'COMPUTE', + 'CONCATENATE', + 'CONSTRAINT', + 'COST', + 'CREATE', + 'CROSS', + 'CUBE', + 'CURRENT', + 'CURRENT_DATE', + 'CURRENT_TIME', + 'CURRENT_TIMESTAMP', + 'CURRENT_USER', + 'DATA', + 'DATABASE', + 'DATABASES', + 'DAY', + 'DBPROPERTIES', + 'DEFINED', + 'DELETE', + 'DELIMITED', + 'DESC', + 'DESCRIBE', + 'DFS', + 'DIRECTORIES', + 'DIRECTORY', + 'DISTINCT', + 'DISTRIBUTE', + 'DIV', + 'DROP', + 'ESCAPE', + 'ESCAPED', + 'EXCEPT', + 'EXCHANGE', + 'EXISTS', + 'EXPORT', + 'EXTENDED', + 'EXTERNAL', + 'EXTRACT', + 'FALSE', + 'FETCH', + 'FIELDS', + 'FILTER', + 'FILEFORMAT', + 'FIRST', + 'FIRST_VALUE', + 'FOLLOWING', + 'FOR', + 'FOREIGN', + 'FORMAT', + 'FORMATTED', + 'FULL', + 'FUNCTION', + 'FUNCTIONS', + 'GLOBAL', + 'GRANT', + 'GROUP', + 'GROUPING', + 'HOUR', + 'IF', + 'IGNORE', + 'IMPORT', + 'IN', + 'INDEX', + 'INDEXES', + 'INNER', + 'INPATH', + 'INPUTFORMAT', + 'INTERSECT', + 'INTERVAL', + 'INTO', + 'IS', + 'ITEMS', + 'KEYS', + 'LAST', + 'LAST_VALUE', + 'LATERAL', + 'LAZY', + 'LEADING', + 'LEFT', + 'LIKE', + 'LINES', + 'LIST', + 'LOCAL', + 'LOCATION', + 'LOCK', + 'LOCKS', + 'LOGICAL', + 'MACRO', + 'MAP', + 'MATCHED', + 'MERGE', + 'MINUTE', + 'MONTH', + 'MSCK', + 'NAMESPACE', + 'NAMESPACES', + 'NATURAL', + 'NO', + 'NOT', + 'NULL', + 'NULLS', + 'OF', + 'ONLY', + 'OPTION', + 'OPTIONS', + 'OR', + 'ORDER', + 'OUT', + 'OUTER', + 'OUTPUTFORMAT', + 'OVER', + 'OVERLAPS', + 'OVERLAY', + 'OVERWRITE', + 'OWNER', + 'PARTITION', + 'PARTITIONED', + 'PARTITIONS', + 'PERCENT', + 'PLACING', + 'POSITION', + 'PRECEDING', + 'PRIMARY', + 'PRINCIPALS', + 'PROPERTIES', + 'PURGE', + 'QUERY', + 'RANGE', + 'RECORDREADER', + 'RECORDWRITER', + 'RECOVER', + 'REDUCE', + 'REFERENCES', + 'RENAME', + 'REPAIR', + 'REPLACE', + 'RESPECT', + 'RESTRICT', + 'REVOKE', + 'RIGHT', + 'RLIKE', + 'ROLE', + 'ROLES', + 'ROLLBACK', + 'ROLLUP', + 'ROW', + 'ROWS', + 'SCHEMA', + 'SECOND', + 'SELECT', + 'SEMI', + 'SEPARATED', + 'SERDE', + 'SERDEPROPERTIES', + 'SESSION_USER', + 'SETS', + 'SHOW', + 'SKEWED', + 'SOME', + 'SORT', + 'SORTED', + 'START', + 'STATISTICS', + 'STORED', + 'STRATIFY', + 'STRUCT', + 'SUBSTR', + 'SUBSTRING', + 'TABLE', + 'TABLES', + 'TBLPROPERTIES', + 'TEMPORARY', + 'TERMINATED', + 'THEN', + 'TO', + 'TOUCH', + 'TRAILING', + 'TRANSACTION', + 'TRANSACTIONS', + 'TRIM', + 'TRUE', + 'TRUNCATE', + 'UNARCHIVE', + 'UNBOUNDED', + 'UNCACHE', + 'UNIQUE', + 'UNKNOWN', + 'UNLOCK', + 'UNSET', + 'USE', + 'USER', + 'USING', + 'VIEW', + 'WINDOW', + 'YEAR', + // other + 'ANALYSE', + 'ARRAY_ZIP', + 'COALESCE', + 'CONTAINS', + 'CONVERT', + 'DAYS', + 'DAY_HOUR', + 'DAY_MINUTE', + 'DAY_SECOND', + 'DECODE', + 'DEFAULT', + 'DISTINCTROW', + 'ENCODE', + 'EXPLODE', + 'EXPLODE_OUTER', + 'FIXED', + 'GREATEST', + 'GROUP_CONCAT', + 'HOURS', + 'HOUR_MINUTE', + 'HOUR_SECOND', + 'IFNULL', + 'LEAST', + 'LEVEL', + 'MINUTE_SECOND', + 'NULLIF', + 'OFFSET', + 'ON', + 'OPTIMIZE', + 'REGEXP', + 'SEPARATOR', + 'SIZE', + 'STRING', + 'TYPE', + 'TYPES', + 'UNSIGNED', + 'VARIABLES', + 'YEAR_MONTH', +]; diff --git a/src/languages/sql/sql.functions.ts b/src/languages/sql/sql.functions.ts index b47ba77e2b..d608f6e5f3 100644 --- a/src/languages/sql/sql.functions.ts +++ b/src/languages/sql/sql.functions.ts @@ -1,121 +1,137 @@ -import { flatKeywordList } from '../../utils.js'; - -export const functions = flatKeywordList({ +export const functions: string[] = [ // https://jakewheat.github.io/sql-overview/sql-2008-foundation-grammar.html#_6_9_set_function_specification - set: ['GROUPING'], + 'GROUPING', + // https://jakewheat.github.io/sql-overview/sql-2008-foundation-grammar.html#_6_10_window_function - window: ['RANK', 'DENSE_RANK', 'PERCENT_RANK', 'CUME_DIST', 'ROW_NUMBER'], + 'RANK', + 'DENSE_RANK', + 'PERCENT_RANK', + 'CUME_DIST', + 'ROW_NUMBER', + // https://jakewheat.github.io/sql-overview/sql-2008-foundation-grammar.html#_6_27_numeric_value_function - numeric: [ - 'POSITION', - 'OCCURRENCES_REGEX', - 'POSITION_REGEX', - 'EXTRACT', - 'CHAR_LENGTH', - 'CHARACTER_LENGTH', - 'OCTET_LENGTH', - 'CARDINALITY', - 'ABS', - 'MOD', - 'LN', - 'EXP', - 'POWER', - 'SQRT', - 'FLOOR', - 'CEIL', - 'CEILING', - 'WIDTH_BUCKET', - ], + 'POSITION', + 'OCCURRENCES_REGEX', + 'POSITION_REGEX', + 'EXTRACT', + 'CHAR_LENGTH', + 'CHARACTER_LENGTH', + 'OCTET_LENGTH', + 'CARDINALITY', + 'ABS', + 'MOD', + 'LN', + 'EXP', + 'POWER', + 'SQRT', + 'FLOOR', + 'CEIL', + 'CEILING', + 'WIDTH_BUCKET', + // https://jakewheat.github.io/sql-overview/sql-2008-foundation-grammar.html#_6_29_string_value_function - string: [ - 'SUBSTRING', - 'SUBSTRING_REGEX', - 'UPPER', - 'LOWER', - 'CONVERT', - 'TRANSLATE', - 'TRANSLATE_REGEX', - 'TRIM', - 'OVERLAY', - 'NORMALIZE', - 'SPECIFICTYPE', - ], + 'SUBSTRING', + 'SUBSTRING_REGEX', + 'UPPER', + 'LOWER', + 'CONVERT', + 'TRANSLATE', + 'TRANSLATE_REGEX', + 'TRIM', + 'OVERLAY', + 'NORMALIZE', + 'SPECIFICTYPE', + // https://jakewheat.github.io/sql-overview/sql-2008-foundation-grammar.html#_6_31_datetime_value_function - datetime: ['CURRENT_DATE', 'CURRENT_TIME', 'LOCALTIME', 'CURRENT_TIMESTAMP', 'LOCALTIMESTAMP'], + 'CURRENT_DATE', + 'CURRENT_TIME', + 'LOCALTIME', + 'CURRENT_TIMESTAMP', + 'LOCALTIMESTAMP', + // https://jakewheat.github.io/sql-overview/sql-2008-foundation-grammar.html#_6_38_multiset_value_function // SET serves multiple roles: a SET() function and a SET keyword e.g. in UPDATE table SET ... - // multiset: ['SET'], (disabled for now) + // multiset + // 'SET', (disabled for now) + // https://jakewheat.github.io/sql-overview/sql-2008-foundation-grammar.html#_10_9_aggregate_function - aggregate: [ - 'COUNT', - 'AVG', - 'MAX', - 'MIN', - 'SUM', - // 'EVERY', - // 'ANY', - // 'SOME', - 'STDDEV_POP', - 'STDDEV_SAMP', - 'VAR_SAMP', - 'VAR_POP', - 'COLLECT', - 'FUSION', - 'INTERSECTION', - 'COVAR_POP', - 'COVAR_SAMP', - 'CORR', - 'REGR_SLOPE', - 'REGR_INTERCEPT', - 'REGR_COUNT', - 'REGR_R2', - 'REGR_AVGX', - 'REGR_AVGY', - 'REGR_SXX', - 'REGR_SYY', - 'REGR_SXY', - 'PERCENTILE_CONT', - 'PERCENTILE_DISC', - ], + 'COUNT', + 'AVG', + 'MAX', + 'MIN', + 'SUM', + // 'EVERY', + // 'ANY', + // 'SOME', + 'STDDEV_POP', + 'STDDEV_SAMP', + 'VAR_SAMP', + 'VAR_POP', + 'COLLECT', + 'FUSION', + 'INTERSECTION', + 'COVAR_POP', + 'COVAR_SAMP', + 'CORR', + 'REGR_SLOPE', + 'REGR_INTERCEPT', + 'REGR_COUNT', + 'REGR_R2', + 'REGR_AVGX', + 'REGR_AVGY', + 'REGR_SXX', + 'REGR_SYY', + 'REGR_SXY', + 'PERCENTILE_CONT', + 'PERCENTILE_DISC', + // CAST is a pretty complex case, involving multiple forms: // - CAST(col AS int) // - CAST(...) WITH ... // - CAST FROM int // - CREATE CAST(mycol AS int) WITH ... - cast: ['CAST'], + 'CAST', + // Shorthand functions to use in place of CASE expression - caseAbbrev: ['COALESCE', 'NULLIF'], + 'COALESCE', + 'NULLIF', + // Non-standard functions that have widespread support - nonStandard: ['ROUND', 'SIN', 'COS', 'TAN', 'ASIN', 'ACOS', 'ATAN'], + 'ROUND', + 'SIN', + 'COS', + 'TAN', + 'ASIN', + 'ACOS', + 'ATAN', + // Data types with parameters like VARCHAR(100) // https://jakewheat.github.io/sql-overview/sql-2008-foundation-grammar.html#predefined-type - dataTypes: [ - 'CHARACTER', - 'CHAR', - 'CHARACTER VARYING', - 'CHAR VARYING', - 'VARCHAR', - 'CHARACTER LARGE OBJECT', - 'CHAR LARGE OBJECT', - 'CLOB', - 'NATIONAL CHARACTER', - 'NATIONAL CHAR', - 'NCHAR', - 'NATIONAL CHARACTER VARYING', - 'NATIONAL CHAR VARYING', - 'NCHAR VARYING', - 'NATIONAL CHARACTER LARGE OBJECT', - 'NCHAR LARGE OBJECT', - 'NCLOB', - 'BINARY', - 'BINARY VARYING', - 'VARBINARY', - 'BINARY LARGE OBJECT', - 'BLOB', - 'NUMERIC', - 'DECIMAL', - 'DEC', - 'TIME', - 'TIMESTAMP', - ], -}); + 'CHARACTER', + 'CHAR', + 'CHARACTER VARYING', + 'CHAR VARYING', + 'VARCHAR', + 'CHARACTER LARGE OBJECT', + 'CHAR LARGE OBJECT', + 'CLOB', + 'NATIONAL CHARACTER', + 'NATIONAL CHAR', + 'NCHAR', + 'NATIONAL CHARACTER VARYING', + 'NATIONAL CHAR VARYING', + 'NCHAR VARYING', + 'NATIONAL CHARACTER LARGE OBJECT', + 'NCHAR LARGE OBJECT', + 'NCLOB', + 'BINARY', + 'BINARY VARYING', + 'VARBINARY', + 'BINARY LARGE OBJECT', + 'BLOB', + 'NUMERIC', + 'DECIMAL', + 'DEC', + 'TIME', + 'TIMESTAMP', +]; diff --git a/src/languages/sql/sql.keywords.ts b/src/languages/sql/sql.keywords.ts index 9cd887ce19..496dde3015 100644 --- a/src/languages/sql/sql.keywords.ts +++ b/src/languages/sql/sql.keywords.ts @@ -1,228 +1,224 @@ -import { flatKeywordList } from '../../utils.js'; - -export const keywords = flatKeywordList({ +export const keywords: string[] = [ // https://jakewheat.github.io/sql-overview/sql-2008-foundation-grammar.html#reserved-word - all: [ - 'ALL', - 'ALLOCATE', - 'ALTER', - 'ANY', // <- moved over from functions - 'ARE', - 'ARRAY', - 'AS', - 'ASENSITIVE', - 'ASYMMETRIC', - 'AT', - 'ATOMIC', - 'AUTHORIZATION', - 'BEGIN', - 'BETWEEN', - 'BIGINT', - 'BINARY', - 'BLOB', - 'BOOLEAN', - 'BOTH', - 'BY', - 'CALL', - 'CALLED', - 'CASCADED', - 'CAST', - 'CHAR', - 'CHARACTER', - 'CHECK', - 'CLOB', - 'CLOSE', - 'COALESCE', - 'COLLATE', - 'COLUMN', - 'COMMIT', - 'CONDITION', - 'CONNECT', - 'CONSTRAINT', - 'CORRESPONDING', - 'CREATE', - 'CROSS', - 'CUBE', - 'CURRENT', - 'CURRENT_CATALOG', - 'CURRENT_DEFAULT_TRANSFORM_GROUP', - 'CURRENT_PATH', - 'CURRENT_ROLE', - 'CURRENT_SCHEMA', - 'CURRENT_TRANSFORM_GROUP_FOR_TYPE', - 'CURRENT_USER', - 'CURSOR', - 'CYCLE', - 'DATE', - 'DAY', - 'DEALLOCATE', - 'DEC', - 'DECIMAL', - 'DECLARE', - 'DEFAULT', - 'DELETE', - 'DEREF', - 'DESCRIBE', - 'DETERMINISTIC', - 'DISCONNECT', - 'DISTINCT', - 'DOUBLE', - 'DROP', - 'DYNAMIC', - 'EACH', - 'ELEMENT', - 'END-EXEC', - 'ESCAPE', - 'EVERY', // <- moved over from functions - 'EXCEPT', - 'EXEC', - 'EXECUTE', - 'EXISTS', - 'EXTERNAL', - 'FALSE', - 'FETCH', - 'FILTER', - 'FLOAT', - 'FOR', - 'FOREIGN', - 'FREE', - 'FROM', - 'FULL', - 'FUNCTION', - 'GET', - 'GLOBAL', - 'GRANT', - 'GROUP', - 'HAVING', - 'HOLD', - 'HOUR', - 'IDENTITY', - 'IN', - 'INDICATOR', - 'INNER', - 'INOUT', - 'INSENSITIVE', - 'INSERT', - 'INT', - 'INTEGER', - 'INTERSECT', - 'INTERVAL', - 'INTO', - 'IS', - 'LANGUAGE', - 'LARGE', - 'LATERAL', - 'LEADING', - 'LEFT', - 'LIKE', - 'LIKE_REGEX', - 'LOCAL', - 'MATCH', - 'MEMBER', - 'MERGE', - 'METHOD', - 'MINUTE', - 'MODIFIES', - 'MODULE', - 'MONTH', - 'MULTISET', - 'NATIONAL', - 'NATURAL', - 'NCHAR', - 'NCLOB', - 'NEW', - 'NO', - 'NONE', - 'NOT', - 'NULL', - 'NULLIF', - 'NUMERIC', - 'OF', - 'OLD', - 'ON', - 'ONLY', - 'OPEN', - 'ORDER', - 'OUT', - 'OUTER', - 'OVER', - 'OVERLAPS', - 'PARAMETER', - 'PARTITION', - 'PRECISION', - 'PREPARE', - 'PRIMARY', - 'PROCEDURE', - 'RANGE', - 'READS', - 'REAL', - 'RECURSIVE', - 'REF', - 'REFERENCES', - 'REFERENCING', - 'RELEASE', - 'RESULT', - 'RETURN', - 'RETURNS', - 'REVOKE', - 'RIGHT', - 'ROLLBACK', - 'ROLLUP', - 'ROW', - 'ROWS', - 'SAVEPOINT', - 'SCOPE', - 'SCROLL', - 'SEARCH', - 'SECOND', - 'SELECT', - 'SENSITIVE', - 'SESSION_USER', - 'SET', - 'SIMILAR', - 'SMALLINT', - 'SOME', // <- moved over from functions - 'SPECIFIC', - 'SQL', - 'SQLEXCEPTION', - 'SQLSTATE', - 'SQLWARNING', - 'START', - 'STATIC', - 'SUBMULTISET', - 'SYMMETRIC', - 'SYSTEM', - 'SYSTEM_USER', - 'TABLE', - 'TABLESAMPLE', - 'THEN', - 'TIME', - 'TIMESTAMP', - 'TIMEZONE_HOUR', - 'TIMEZONE_MINUTE', - 'TO', - 'TRAILING', - 'TRANSLATION', - 'TREAT', - 'TRIGGER', - 'TRUE', - 'UESCAPE', - 'UNION', - 'UNIQUE', - 'UNKNOWN', - 'UNNEST', - 'UPDATE', - 'USER', - 'USING', - 'VALUE', - 'VALUES', - 'VARBINARY', - 'VARCHAR', - 'VARYING', - 'WHENEVER', - 'WINDOW', - 'WITHIN', - 'WITHOUT', - 'YEAR', - ], -}); + 'ALL', + 'ALLOCATE', + 'ALTER', + 'ANY', // <- moved over from functions + 'ARE', + 'ARRAY', + 'AS', + 'ASENSITIVE', + 'ASYMMETRIC', + 'AT', + 'ATOMIC', + 'AUTHORIZATION', + 'BEGIN', + 'BETWEEN', + 'BIGINT', + 'BINARY', + 'BLOB', + 'BOOLEAN', + 'BOTH', + 'BY', + 'CALL', + 'CALLED', + 'CASCADED', + 'CAST', + 'CHAR', + 'CHARACTER', + 'CHECK', + 'CLOB', + 'CLOSE', + 'COALESCE', + 'COLLATE', + 'COLUMN', + 'COMMIT', + 'CONDITION', + 'CONNECT', + 'CONSTRAINT', + 'CORRESPONDING', + 'CREATE', + 'CROSS', + 'CUBE', + 'CURRENT', + 'CURRENT_CATALOG', + 'CURRENT_DEFAULT_TRANSFORM_GROUP', + 'CURRENT_PATH', + 'CURRENT_ROLE', + 'CURRENT_SCHEMA', + 'CURRENT_TRANSFORM_GROUP_FOR_TYPE', + 'CURRENT_USER', + 'CURSOR', + 'CYCLE', + 'DATE', + 'DAY', + 'DEALLOCATE', + 'DEC', + 'DECIMAL', + 'DECLARE', + 'DEFAULT', + 'DELETE', + 'DEREF', + 'DESCRIBE', + 'DETERMINISTIC', + 'DISCONNECT', + 'DISTINCT', + 'DOUBLE', + 'DROP', + 'DYNAMIC', + 'EACH', + 'ELEMENT', + 'END-EXEC', + 'ESCAPE', + 'EVERY', // <- moved over from functions + 'EXCEPT', + 'EXEC', + 'EXECUTE', + 'EXISTS', + 'EXTERNAL', + 'FALSE', + 'FETCH', + 'FILTER', + 'FLOAT', + 'FOR', + 'FOREIGN', + 'FREE', + 'FROM', + 'FULL', + 'FUNCTION', + 'GET', + 'GLOBAL', + 'GRANT', + 'GROUP', + 'HAVING', + 'HOLD', + 'HOUR', + 'IDENTITY', + 'IN', + 'INDICATOR', + 'INNER', + 'INOUT', + 'INSENSITIVE', + 'INSERT', + 'INT', + 'INTEGER', + 'INTERSECT', + 'INTERVAL', + 'INTO', + 'IS', + 'LANGUAGE', + 'LARGE', + 'LATERAL', + 'LEADING', + 'LEFT', + 'LIKE', + 'LIKE_REGEX', + 'LOCAL', + 'MATCH', + 'MEMBER', + 'MERGE', + 'METHOD', + 'MINUTE', + 'MODIFIES', + 'MODULE', + 'MONTH', + 'MULTISET', + 'NATIONAL', + 'NATURAL', + 'NCHAR', + 'NCLOB', + 'NEW', + 'NO', + 'NONE', + 'NOT', + 'NULL', + 'NULLIF', + 'NUMERIC', + 'OF', + 'OLD', + 'ON', + 'ONLY', + 'OPEN', + 'ORDER', + 'OUT', + 'OUTER', + 'OVER', + 'OVERLAPS', + 'PARAMETER', + 'PARTITION', + 'PRECISION', + 'PREPARE', + 'PRIMARY', + 'PROCEDURE', + 'RANGE', + 'READS', + 'REAL', + 'RECURSIVE', + 'REF', + 'REFERENCES', + 'REFERENCING', + 'RELEASE', + 'RESULT', + 'RETURN', + 'RETURNS', + 'REVOKE', + 'RIGHT', + 'ROLLBACK', + 'ROLLUP', + 'ROW', + 'ROWS', + 'SAVEPOINT', + 'SCOPE', + 'SCROLL', + 'SEARCH', + 'SECOND', + 'SELECT', + 'SENSITIVE', + 'SESSION_USER', + 'SET', + 'SIMILAR', + 'SMALLINT', + 'SOME', // <- moved over from functions + 'SPECIFIC', + 'SQL', + 'SQLEXCEPTION', + 'SQLSTATE', + 'SQLWARNING', + 'START', + 'STATIC', + 'SUBMULTISET', + 'SYMMETRIC', + 'SYSTEM', + 'SYSTEM_USER', + 'TABLE', + 'TABLESAMPLE', + 'THEN', + 'TIME', + 'TIMESTAMP', + 'TIMEZONE_HOUR', + 'TIMEZONE_MINUTE', + 'TO', + 'TRAILING', + 'TRANSLATION', + 'TREAT', + 'TRIGGER', + 'TRUE', + 'UESCAPE', + 'UNION', + 'UNIQUE', + 'UNKNOWN', + 'UNNEST', + 'UPDATE', + 'USER', + 'USING', + 'VALUE', + 'VALUES', + 'VARBINARY', + 'VARCHAR', + 'VARYING', + 'WHENEVER', + 'WINDOW', + 'WITHIN', + 'WITHOUT', + 'YEAR', +]; diff --git a/src/languages/sqlite/sqlite.functions.ts b/src/languages/sqlite/sqlite.functions.ts index 54a807ce7d..782ea8e2d5 100644 --- a/src/languages/sqlite/sqlite.functions.ts +++ b/src/languages/sqlite/sqlite.functions.ts @@ -1,136 +1,143 @@ -import { flatKeywordList } from '../../utils.js'; - -export const functions = flatKeywordList({ +export const functions: string[] = [ // https://www.sqlite.org/lang_corefunc.html - scalar: [ - 'ABS', - 'CHANGES', - 'CHAR', - 'COALESCE', - 'FORMAT', - 'GLOB', - 'HEX', - 'IFNULL', - 'IIF', - 'INSTR', - 'LAST_INSERT_ROWID', - 'LENGTH', - 'LIKE', - 'LIKELIHOOD', - 'LIKELY', - 'LOAD_EXTENSION', - 'LOWER', - 'LTRIM', - 'NULLIF', - 'PRINTF', - 'QUOTE', - 'RANDOM', - 'RANDOMBLOB', - 'REPLACE', - 'ROUND', - 'RTRIM', - 'SIGN', - 'SOUNDEX', - 'SQLITE_COMPILEOPTION_GET', - 'SQLITE_COMPILEOPTION_USED', - 'SQLITE_OFFSET', - 'SQLITE_SOURCE_ID', - 'SQLITE_VERSION', - 'SUBSTR', - 'SUBSTRING', - 'TOTAL_CHANGES', - 'TRIM', - 'TYPEOF', - 'UNICODE', - 'UNLIKELY', - 'UPPER', - 'ZEROBLOB', - ], + 'ABS', + 'CHANGES', + 'CHAR', + 'COALESCE', + 'FORMAT', + 'GLOB', + 'HEX', + 'IFNULL', + 'IIF', + 'INSTR', + 'LAST_INSERT_ROWID', + 'LENGTH', + 'LIKE', + 'LIKELIHOOD', + 'LIKELY', + 'LOAD_EXTENSION', + 'LOWER', + 'LTRIM', + 'NULLIF', + 'PRINTF', + 'QUOTE', + 'RANDOM', + 'RANDOMBLOB', + 'REPLACE', + 'ROUND', + 'RTRIM', + 'SIGN', + 'SOUNDEX', + 'SQLITE_COMPILEOPTION_GET', + 'SQLITE_COMPILEOPTION_USED', + 'SQLITE_OFFSET', + 'SQLITE_SOURCE_ID', + 'SQLITE_VERSION', + 'SUBSTR', + 'SUBSTRING', + 'TOTAL_CHANGES', + 'TRIM', + 'TYPEOF', + 'UNICODE', + 'UNLIKELY', + 'UPPER', + 'ZEROBLOB', + // https://www.sqlite.org/lang_aggfunc.html - aggregate: ['AVG', 'COUNT', 'GROUP_CONCAT', 'MAX', 'MIN', 'SUM', 'TOTAL'], + 'AVG', + 'COUNT', + 'GROUP_CONCAT', + 'MAX', + 'MIN', + 'SUM', + 'TOTAL', + // https://www.sqlite.org/lang_datefunc.html - datetime: ['DATE', 'TIME', 'DATETIME', 'JULIANDAY', 'UNIXEPOCH', 'STRFTIME'], + 'DATE', + 'TIME', + 'DATETIME', + 'JULIANDAY', + 'UNIXEPOCH', + 'STRFTIME', + // https://www.sqlite.org/windowfunctions.html#biwinfunc - window: [ - 'row_number', - 'rank', - 'dense_rank', - 'percent_rank', - 'cume_dist', - 'ntile', - 'lag', - 'lead', - 'first_value', - 'last_value', - 'nth_value', - ], + 'row_number', + 'rank', + 'dense_rank', + 'percent_rank', + 'cume_dist', + 'ntile', + 'lag', + 'lead', + 'first_value', + 'last_value', + 'nth_value', + // https://www.sqlite.org/lang_mathfunc.html - math: [ - 'ACOS', - 'ACOSH', - 'ASIN', - 'ASINH', - 'ATAN', - 'ATAN2', - 'ATANH', - 'CEIL', - 'CEILING', - 'COS', - 'COSH', - 'DEGREES', - 'EXP', - 'FLOOR', - 'LN', - 'LOG', - 'LOG', - 'LOG10', - 'LOG2', - 'MOD', - 'PI', - 'POW', - 'POWER', - 'RADIANS', - 'SIN', - 'SINH', - 'SQRT', - 'TAN', - 'TANH', - 'TRUNC', - ], + 'ACOS', + 'ACOSH', + 'ASIN', + 'ASINH', + 'ATAN', + 'ATAN2', + 'ATANH', + 'CEIL', + 'CEILING', + 'COS', + 'COSH', + 'DEGREES', + 'EXP', + 'FLOOR', + 'LN', + 'LOG', + 'LOG', + 'LOG10', + 'LOG2', + 'MOD', + 'PI', + 'POW', + 'POWER', + 'RADIANS', + 'SIN', + 'SINH', + 'SQRT', + 'TAN', + 'TANH', + 'TRUNC', + // https://www.sqlite.org/json1.html - json: [ - 'JSON', - 'JSON_ARRAY', - 'JSON_ARRAY_LENGTH', - 'JSON_ARRAY_LENGTH', - 'JSON_EXTRACT', - 'JSON_INSERT', - 'JSON_OBJECT', - 'JSON_PATCH', - 'JSON_REMOVE', - 'JSON_REPLACE', - 'JSON_SET', - 'JSON_TYPE', - 'JSON_TYPE', - 'JSON_VALID', - 'JSON_QUOTE', - 'JSON_GROUP_ARRAY', - 'JSON_GROUP_OBJECT', - 'JSON_EACH', - 'JSON_TREE', - ], - cast: ['CAST'], + 'JSON', + 'JSON_ARRAY', + 'JSON_ARRAY_LENGTH', + 'JSON_ARRAY_LENGTH', + 'JSON_EXTRACT', + 'JSON_INSERT', + 'JSON_OBJECT', + 'JSON_PATCH', + 'JSON_REMOVE', + 'JSON_REPLACE', + 'JSON_SET', + 'JSON_TYPE', + 'JSON_TYPE', + 'JSON_VALID', + 'JSON_QUOTE', + 'JSON_GROUP_ARRAY', + 'JSON_GROUP_OBJECT', + 'JSON_EACH', + 'JSON_TREE', + + // cast + 'CAST', + // SQLite allows parameters for all data types // Well, in fact it allows any word as a data type, e.g. CREATE TABLE foo (col1 madeupname(123)); // https://www.sqlite.org/datatype3.html - dataTypes: [ - 'CHARACTER', - 'VARCHAR', - 'VARYING CHARACTER', - 'NCHAR', - 'NATIVE CHARACTER', - 'NVARCHAR', - 'NUMERIC', - 'DECIMAL', - ], -}); + 'CHARACTER', + 'VARCHAR', + 'VARYING CHARACTER', + 'NCHAR', + 'NATIVE CHARACTER', + 'NVARCHAR', + 'NUMERIC', + 'DECIMAL', +]; diff --git a/src/languages/sqlite/sqlite.keywords.ts b/src/languages/sqlite/sqlite.keywords.ts index 25274e10d3..2ab649a7b6 100644 --- a/src/languages/sqlite/sqlite.keywords.ts +++ b/src/languages/sqlite/sqlite.keywords.ts @@ -1,159 +1,155 @@ -import { flatKeywordList } from '../../utils.js'; - -export const keywords = flatKeywordList({ +export const keywords: string[] = [ // https://www.sqlite.org/lang_keywords.html - all: [ - 'ABORT', - 'ACTION', - 'ADD', - 'AFTER', - 'ALL', - 'ALTER', - 'AND', - 'ANY', - 'ARE', - 'ARRAY', - 'ALWAYS', - 'ANALYZE', - 'AS', - 'ASC', - 'ATTACH', - 'AUTOINCREMENT', - 'BEFORE', - 'BEGIN', - 'BETWEEN', - 'BY', - 'CASCADE', - 'CASE', - 'CAST', - 'CHECK', - 'COLLATE', - 'COLUMN', - 'COMMIT', - 'CONFLICT', - 'CONSTRAINT', - 'CREATE', - 'CROSS', - 'CURRENT', - 'CURRENT_DATE', - 'CURRENT_TIME', - 'CURRENT_TIMESTAMP', - 'DATABASE', - 'DEFAULT', - 'DEFERRABLE', - 'DEFERRED', - 'DELETE', - 'DESC', - 'DETACH', - 'DISTINCT', - 'DO', - 'DROP', - 'EACH', - 'ELSE', - 'END', - 'ESCAPE', - 'EXCEPT', - 'EXCLUDE', - 'EXCLUSIVE', - 'EXISTS', - 'EXPLAIN', - 'FAIL', - 'FILTER', - 'FIRST', - 'FOLLOWING', - 'FOR', - 'FOREIGN', - 'FROM', - 'FULL', - 'GENERATED', - 'GLOB', - 'GROUP', - 'GROUPS', - 'HAVING', - 'IF', - 'IGNORE', - 'IMMEDIATE', - 'IN', - 'INDEX', - 'INDEXED', - 'INITIALLY', - 'INNER', - 'INSERT', - 'INSTEAD', - 'INTERSECT', - 'INTO', - 'IS', - 'ISNULL', - 'JOIN', - 'KEY', - 'LAST', - 'LEFT', - 'LIKE', - 'LIMIT', - 'MATCH', - 'MATERIALIZED', - 'NATURAL', - 'NO', - 'NOT', - 'NOTHING', - 'NOTNULL', - 'NULL', - 'NULLS', - 'OF', - 'OFFSET', - 'ON', - 'ONLY', - 'OPEN', - 'OR', - 'ORDER', - 'OTHERS', - 'OUTER', - 'OVER', - 'PARTITION', - 'PLAN', - 'PRAGMA', - 'PRECEDING', - 'PRIMARY', - 'QUERY', - 'RAISE', - 'RANGE', - 'RECURSIVE', - 'REFERENCES', - 'REGEXP', - 'REINDEX', - 'RELEASE', - 'RENAME', - 'REPLACE', - 'RESTRICT', - 'RETURNING', - 'RIGHT', - 'ROLLBACK', - 'ROW', - 'ROWS', - 'SAVEPOINT', - 'SELECT', - 'SET', - 'TABLE', - 'TEMP', - 'TEMPORARY', - 'THEN', - 'TIES', - 'TO', - 'TRANSACTION', - 'TRIGGER', - 'UNBOUNDED', - 'UNION', - 'UNIQUE', - 'UPDATE', - 'USING', - 'VACUUM', - 'VALUES', - 'VIEW', - 'VIRTUAL', - 'WHEN', - 'WHERE', - 'WINDOW', - 'WITH', - 'WITHOUT', - ], -}); + 'ABORT', + 'ACTION', + 'ADD', + 'AFTER', + 'ALL', + 'ALTER', + 'AND', + 'ANY', + 'ARE', + 'ARRAY', + 'ALWAYS', + 'ANALYZE', + 'AS', + 'ASC', + 'ATTACH', + 'AUTOINCREMENT', + 'BEFORE', + 'BEGIN', + 'BETWEEN', + 'BY', + 'CASCADE', + 'CASE', + 'CAST', + 'CHECK', + 'COLLATE', + 'COLUMN', + 'COMMIT', + 'CONFLICT', + 'CONSTRAINT', + 'CREATE', + 'CROSS', + 'CURRENT', + 'CURRENT_DATE', + 'CURRENT_TIME', + 'CURRENT_TIMESTAMP', + 'DATABASE', + 'DEFAULT', + 'DEFERRABLE', + 'DEFERRED', + 'DELETE', + 'DESC', + 'DETACH', + 'DISTINCT', + 'DO', + 'DROP', + 'EACH', + 'ELSE', + 'END', + 'ESCAPE', + 'EXCEPT', + 'EXCLUDE', + 'EXCLUSIVE', + 'EXISTS', + 'EXPLAIN', + 'FAIL', + 'FILTER', + 'FIRST', + 'FOLLOWING', + 'FOR', + 'FOREIGN', + 'FROM', + 'FULL', + 'GENERATED', + 'GLOB', + 'GROUP', + 'GROUPS', + 'HAVING', + 'IF', + 'IGNORE', + 'IMMEDIATE', + 'IN', + 'INDEX', + 'INDEXED', + 'INITIALLY', + 'INNER', + 'INSERT', + 'INSTEAD', + 'INTERSECT', + 'INTO', + 'IS', + 'ISNULL', + 'JOIN', + 'KEY', + 'LAST', + 'LEFT', + 'LIKE', + 'LIMIT', + 'MATCH', + 'MATERIALIZED', + 'NATURAL', + 'NO', + 'NOT', + 'NOTHING', + 'NOTNULL', + 'NULL', + 'NULLS', + 'OF', + 'OFFSET', + 'ON', + 'ONLY', + 'OPEN', + 'OR', + 'ORDER', + 'OTHERS', + 'OUTER', + 'OVER', + 'PARTITION', + 'PLAN', + 'PRAGMA', + 'PRECEDING', + 'PRIMARY', + 'QUERY', + 'RAISE', + 'RANGE', + 'RECURSIVE', + 'REFERENCES', + 'REGEXP', + 'REINDEX', + 'RELEASE', + 'RENAME', + 'REPLACE', + 'RESTRICT', + 'RETURNING', + 'RIGHT', + 'ROLLBACK', + 'ROW', + 'ROWS', + 'SAVEPOINT', + 'SELECT', + 'SET', + 'TABLE', + 'TEMP', + 'TEMPORARY', + 'THEN', + 'TIES', + 'TO', + 'TRANSACTION', + 'TRIGGER', + 'UNBOUNDED', + 'UNION', + 'UNIQUE', + 'UPDATE', + 'USING', + 'VACUUM', + 'VALUES', + 'VIEW', + 'VIRTUAL', + 'WHEN', + 'WHERE', + 'WINDOW', + 'WITH', + 'WITHOUT', +]; diff --git a/src/languages/transactsql/transactsql.functions.ts b/src/languages/transactsql/transactsql.functions.ts index 2154957389..ae055632b2 100644 --- a/src/languages/transactsql/transactsql.functions.ts +++ b/src/languages/transactsql/transactsql.functions.ts @@ -1,320 +1,341 @@ -import { flatKeywordList } from '../../utils.js'; - -export const functions = flatKeywordList({ +export const functions: string[] = [ // https://docs.microsoft.com/en-us/sql/t-sql/functions/functions?view=sql-server-ver15 - aggregate: [ - 'APPROX_COUNT_DISTINCT', - 'AVG', - 'CHECKSUM_AGG', - 'COUNT', - 'COUNT_BIG', - 'GROUPING', - 'GROUPING_ID', - 'MAX', - 'MIN', - 'STDEV', - 'STDEVP', - 'SUM', - 'VAR', - 'VARP', - ], - analytic: [ - 'CUME_DIST', - 'FIRST_VALUE', - 'LAG', - 'LAST_VALUE', - 'LEAD', - 'PERCENTILE_CONT', - 'PERCENTILE_DISC', - 'PERCENT_RANK', - 'Collation - COLLATIONPROPERTY', - 'Collation - TERTIARY_WEIGHTS', - ], - configuration: [ - '@@DBTS', - '@@LANGID', - '@@LANGUAGE', - '@@LOCK_TIMEOUT', - '@@MAX_CONNECTIONS', - '@@MAX_PRECISION', - '@@NESTLEVEL', - '@@OPTIONS', - '@@REMSERVER', - '@@SERVERNAME', - '@@SERVICENAME', - '@@SPID', - '@@TEXTSIZE', - '@@VERSION', - ], - conversion: ['CAST', 'CONVERT', 'PARSE', 'TRY_CAST', 'TRY_CONVERT', 'TRY_PARSE'], - cryptographic: [ - 'ASYMKEY_ID', - 'ASYMKEYPROPERTY', - 'CERTPROPERTY', - 'CERT_ID', - 'CRYPT_GEN_RANDOM', - 'DECRYPTBYASYMKEY', - 'DECRYPTBYCERT', - 'DECRYPTBYKEY', - 'DECRYPTBYKEYAUTOASYMKEY', - 'DECRYPTBYKEYAUTOCERT', - 'DECRYPTBYPASSPHRASE', - 'ENCRYPTBYASYMKEY', - 'ENCRYPTBYCERT', - 'ENCRYPTBYKEY', - 'ENCRYPTBYPASSPHRASE', - 'HASHBYTES', - 'IS_OBJECTSIGNED', - 'KEY_GUID', - 'KEY_ID', - 'KEY_NAME', - 'SIGNBYASYMKEY', - 'SIGNBYCERT', - 'SYMKEYPROPERTY', - 'VERIFYSIGNEDBYCERT', - 'VERIFYSIGNEDBYASYMKEY', - ], - cursor: ['@@CURSOR_ROWS', '@@FETCH_STATUS', 'CURSOR_STATUS'], - dataType: [ - 'DATALENGTH', - 'IDENT_CURRENT', - 'IDENT_INCR', - 'IDENT_SEED', - 'IDENTITY', - 'SQL_VARIANT_PROPERTY', - ], - datetime: [ - '@@DATEFIRST', - 'CURRENT_TIMESTAMP', - 'CURRENT_TIMEZONE', - 'CURRENT_TIMEZONE_ID', - 'DATEADD', - 'DATEDIFF', - 'DATEDIFF_BIG', - 'DATEFROMPARTS', - 'DATENAME', - 'DATEPART', - 'DATETIME2FROMPARTS', - 'DATETIMEFROMPARTS', - 'DATETIMEOFFSETFROMPARTS', - 'DAY', - 'EOMONTH', - 'GETDATE', - 'GETUTCDATE', - 'ISDATE', - 'MONTH', - 'SMALLDATETIMEFROMPARTS', - 'SWITCHOFFSET', - 'SYSDATETIME', - 'SYSDATETIMEOFFSET', - 'SYSUTCDATETIME', - 'TIMEFROMPARTS', - 'TODATETIMEOFFSET', - 'YEAR', - 'JSON', - 'ISJSON', - 'JSON_VALUE', - 'JSON_QUERY', - 'JSON_MODIFY', - ], - mathematical: [ - 'ABS', - 'ACOS', - 'ASIN', - 'ATAN', - 'ATN2', - 'CEILING', - 'COS', - 'COT', - 'DEGREES', - 'EXP', - 'FLOOR', - 'LOG', - 'LOG10', - 'PI', - 'POWER', - 'RADIANS', - 'RAND', - 'ROUND', - 'SIGN', - 'SIN', - 'SQRT', - 'SQUARE', - 'TAN', - 'CHOOSE', - 'GREATEST', - 'IIF', - 'LEAST', - ], - metadata: [ - '@@PROCID', - 'APP_NAME', - 'APPLOCK_MODE', - 'APPLOCK_TEST', - 'ASSEMBLYPROPERTY', - 'COL_LENGTH', - 'COL_NAME', - 'COLUMNPROPERTY', - 'DATABASEPROPERTYEX', - 'DB_ID', - 'DB_NAME', - 'FILE_ID', - 'FILE_IDEX', - 'FILE_NAME', - 'FILEGROUP_ID', - 'FILEGROUP_NAME', - 'FILEGROUPPROPERTY', - 'FILEPROPERTY', - 'FILEPROPERTYEX', - 'FULLTEXTCATALOGPROPERTY', - 'FULLTEXTSERVICEPROPERTY', - 'INDEX_COL', - 'INDEXKEY_PROPERTY', - 'INDEXPROPERTY', - 'NEXT VALUE FOR', - 'OBJECT_DEFINITION', - 'OBJECT_ID', - 'OBJECT_NAME', - 'OBJECT_SCHEMA_NAME', - 'OBJECTPROPERTY', - 'OBJECTPROPERTYEX', - 'ORIGINAL_DB_NAME', - 'PARSENAME', - 'SCHEMA_ID', - 'SCHEMA_NAME', - 'SCOPE_IDENTITY', - 'SERVERPROPERTY', - 'STATS_DATE', - 'TYPE_ID', - 'TYPE_NAME', - 'TYPEPROPERTY', - ], - ranking: ['DENSE_RANK', 'NTILE', 'RANK', 'ROW_NUMBER', 'PUBLISHINGSERVERNAME'], - security: [ - 'CERTENCODED', - 'CERTPRIVATEKEY', - 'CURRENT_USER', - 'DATABASE_PRINCIPAL_ID', - 'HAS_DBACCESS', - 'HAS_PERMS_BY_NAME', - 'IS_MEMBER', - 'IS_ROLEMEMBER', - 'IS_SRVROLEMEMBER', - 'LOGINPROPERTY', - 'ORIGINAL_LOGIN', - 'PERMISSIONS', - 'PWDENCRYPT', - 'PWDCOMPARE', - 'SESSION_USER', - 'SESSIONPROPERTY', - 'SUSER_ID', - 'SUSER_NAME', - 'SUSER_SID', - 'SUSER_SNAME', - 'SYSTEM_USER', - 'USER', - 'USER_ID', - 'USER_NAME', - ], - string: [ - 'ASCII', - 'CHAR', - 'CHARINDEX', - 'CONCAT', - 'CONCAT_WS', - 'DIFFERENCE', - 'FORMAT', - 'LEFT', - 'LEN', - 'LOWER', - 'LTRIM', - 'NCHAR', - 'PATINDEX', - 'QUOTENAME', - 'REPLACE', - 'REPLICATE', - 'REVERSE', - 'RIGHT', - 'RTRIM', - 'SOUNDEX', - 'SPACE', - 'STR', - 'STRING_AGG', - 'STRING_ESCAPE', - 'STUFF', - 'SUBSTRING', - 'TRANSLATE', - 'TRIM', - 'UNICODE', - 'UPPER', - ], - system: [ - '$PARTITION', - '@@ERROR', - '@@IDENTITY', - '@@PACK_RECEIVED', - '@@ROWCOUNT', - '@@TRANCOUNT', - 'BINARY_CHECKSUM', - 'CHECKSUM', - 'COMPRESS', - 'CONNECTIONPROPERTY', - 'CONTEXT_INFO', - 'CURRENT_REQUEST_ID', - 'CURRENT_TRANSACTION_ID', - 'DECOMPRESS', - 'ERROR_LINE', - 'ERROR_MESSAGE', - 'ERROR_NUMBER', - 'ERROR_PROCEDURE', - 'ERROR_SEVERITY', - 'ERROR_STATE', - 'FORMATMESSAGE', - 'GET_FILESTREAM_TRANSACTION_CONTEXT', - 'GETANSINULL', - 'HOST_ID', - 'HOST_NAME', - 'ISNULL', - 'ISNUMERIC', - 'MIN_ACTIVE_ROWVERSION', - 'NEWID', - 'NEWSEQUENTIALID', - 'ROWCOUNT_BIG', - 'SESSION_CONTEXT', - 'XACT_STATE', - ], - statistical: [ - '@@CONNECTIONS', - '@@CPU_BUSY', - '@@IDLE', - '@@IO_BUSY', - '@@PACK_SENT', - '@@PACKET_ERRORS', - '@@TIMETICKS', - '@@TOTAL_ERRORS', - '@@TOTAL_READ', - '@@TOTAL_WRITE', - 'TEXTPTR', - 'TEXTVALID', - ], - trigger: ['COLUMNS_UPDATED', 'EVENTDATA', 'TRIGGER_NESTLEVEL', 'UPDATE'], + // aggregate + 'APPROX_COUNT_DISTINCT', + 'AVG', + 'CHECKSUM_AGG', + 'COUNT', + 'COUNT_BIG', + 'GROUPING', + 'GROUPING_ID', + 'MAX', + 'MIN', + 'STDEV', + 'STDEVP', + 'SUM', + 'VAR', + 'VARP', + + // analytic + 'CUME_DIST', + 'FIRST_VALUE', + 'LAG', + 'LAST_VALUE', + 'LEAD', + 'PERCENTILE_CONT', + 'PERCENTILE_DISC', + 'PERCENT_RANK', + 'Collation - COLLATIONPROPERTY', + 'Collation - TERTIARY_WEIGHTS', + + // configuration + '@@DBTS', + '@@LANGID', + '@@LANGUAGE', + '@@LOCK_TIMEOUT', + '@@MAX_CONNECTIONS', + '@@MAX_PRECISION', + '@@NESTLEVEL', + '@@OPTIONS', + '@@REMSERVER', + '@@SERVERNAME', + '@@SERVICENAME', + '@@SPID', + '@@TEXTSIZE', + '@@VERSION', + + // conversion + 'CAST', + 'CONVERT', + 'PARSE', + 'TRY_CAST', + 'TRY_CONVERT', + 'TRY_PARSE', + + // cryptographic + 'ASYMKEY_ID', + 'ASYMKEYPROPERTY', + 'CERTPROPERTY', + 'CERT_ID', + 'CRYPT_GEN_RANDOM', + 'DECRYPTBYASYMKEY', + 'DECRYPTBYCERT', + 'DECRYPTBYKEY', + 'DECRYPTBYKEYAUTOASYMKEY', + 'DECRYPTBYKEYAUTOCERT', + 'DECRYPTBYPASSPHRASE', + 'ENCRYPTBYASYMKEY', + 'ENCRYPTBYCERT', + 'ENCRYPTBYKEY', + 'ENCRYPTBYPASSPHRASE', + 'HASHBYTES', + 'IS_OBJECTSIGNED', + 'KEY_GUID', + 'KEY_ID', + 'KEY_NAME', + 'SIGNBYASYMKEY', + 'SIGNBYCERT', + 'SYMKEYPROPERTY', + 'VERIFYSIGNEDBYCERT', + 'VERIFYSIGNEDBYASYMKEY', + + // cursor + '@@CURSOR_ROWS', + '@@FETCH_STATUS', + 'CURSOR_STATUS', + + // dataType + 'DATALENGTH', + 'IDENT_CURRENT', + 'IDENT_INCR', + 'IDENT_SEED', + 'IDENTITY', + 'SQL_VARIANT_PROPERTY', + + // datetime + '@@DATEFIRST', + 'CURRENT_TIMESTAMP', + 'CURRENT_TIMEZONE', + 'CURRENT_TIMEZONE_ID', + 'DATEADD', + 'DATEDIFF', + 'DATEDIFF_BIG', + 'DATEFROMPARTS', + 'DATENAME', + 'DATEPART', + 'DATETIME2FROMPARTS', + 'DATETIMEFROMPARTS', + 'DATETIMEOFFSETFROMPARTS', + 'DAY', + 'EOMONTH', + 'GETDATE', + 'GETUTCDATE', + 'ISDATE', + 'MONTH', + 'SMALLDATETIMEFROMPARTS', + 'SWITCHOFFSET', + 'SYSDATETIME', + 'SYSDATETIMEOFFSET', + 'SYSUTCDATETIME', + 'TIMEFROMPARTS', + 'TODATETIMEOFFSET', + 'YEAR', + 'JSON', + 'ISJSON', + 'JSON_VALUE', + 'JSON_QUERY', + 'JSON_MODIFY', + + // mathematical + 'ABS', + 'ACOS', + 'ASIN', + 'ATAN', + 'ATN2', + 'CEILING', + 'COS', + 'COT', + 'DEGREES', + 'EXP', + 'FLOOR', + 'LOG', + 'LOG10', + 'PI', + 'POWER', + 'RADIANS', + 'RAND', + 'ROUND', + 'SIGN', + 'SIN', + 'SQRT', + 'SQUARE', + 'TAN', + 'CHOOSE', + 'GREATEST', + 'IIF', + 'LEAST', + + // metadata + '@@PROCID', + 'APP_NAME', + 'APPLOCK_MODE', + 'APPLOCK_TEST', + 'ASSEMBLYPROPERTY', + 'COL_LENGTH', + 'COL_NAME', + 'COLUMNPROPERTY', + 'DATABASEPROPERTYEX', + 'DB_ID', + 'DB_NAME', + 'FILE_ID', + 'FILE_IDEX', + 'FILE_NAME', + 'FILEGROUP_ID', + 'FILEGROUP_NAME', + 'FILEGROUPPROPERTY', + 'FILEPROPERTY', + 'FILEPROPERTYEX', + 'FULLTEXTCATALOGPROPERTY', + 'FULLTEXTSERVICEPROPERTY', + 'INDEX_COL', + 'INDEXKEY_PROPERTY', + 'INDEXPROPERTY', + 'NEXT VALUE FOR', + 'OBJECT_DEFINITION', + 'OBJECT_ID', + 'OBJECT_NAME', + 'OBJECT_SCHEMA_NAME', + 'OBJECTPROPERTY', + 'OBJECTPROPERTYEX', + 'ORIGINAL_DB_NAME', + 'PARSENAME', + 'SCHEMA_ID', + 'SCHEMA_NAME', + 'SCOPE_IDENTITY', + 'SERVERPROPERTY', + 'STATS_DATE', + 'TYPE_ID', + 'TYPE_NAME', + 'TYPEPROPERTY', + + // ranking + 'DENSE_RANK', + 'NTILE', + 'RANK', + 'ROW_NUMBER', + 'PUBLISHINGSERVERNAME', + + // security + 'CERTENCODED', + 'CERTPRIVATEKEY', + 'CURRENT_USER', + 'DATABASE_PRINCIPAL_ID', + 'HAS_DBACCESS', + 'HAS_PERMS_BY_NAME', + 'IS_MEMBER', + 'IS_ROLEMEMBER', + 'IS_SRVROLEMEMBER', + 'LOGINPROPERTY', + 'ORIGINAL_LOGIN', + 'PERMISSIONS', + 'PWDENCRYPT', + 'PWDCOMPARE', + 'SESSION_USER', + 'SESSIONPROPERTY', + 'SUSER_ID', + 'SUSER_NAME', + 'SUSER_SID', + 'SUSER_SNAME', + 'SYSTEM_USER', + 'USER', + 'USER_ID', + 'USER_NAME', + + // string + 'ASCII', + 'CHAR', + 'CHARINDEX', + 'CONCAT', + 'CONCAT_WS', + 'DIFFERENCE', + 'FORMAT', + 'LEFT', + 'LEN', + 'LOWER', + 'LTRIM', + 'NCHAR', + 'PATINDEX', + 'QUOTENAME', + 'REPLACE', + 'REPLICATE', + 'REVERSE', + 'RIGHT', + 'RTRIM', + 'SOUNDEX', + 'SPACE', + 'STR', + 'STRING_AGG', + 'STRING_ESCAPE', + 'STUFF', + 'SUBSTRING', + 'TRANSLATE', + 'TRIM', + 'UNICODE', + 'UPPER', + + // system + '$PARTITION', + '@@ERROR', + '@@IDENTITY', + '@@PACK_RECEIVED', + '@@ROWCOUNT', + '@@TRANCOUNT', + 'BINARY_CHECKSUM', + 'CHECKSUM', + 'COMPRESS', + 'CONNECTIONPROPERTY', + 'CONTEXT_INFO', + 'CURRENT_REQUEST_ID', + 'CURRENT_TRANSACTION_ID', + 'DECOMPRESS', + 'ERROR_LINE', + 'ERROR_MESSAGE', + 'ERROR_NUMBER', + 'ERROR_PROCEDURE', + 'ERROR_SEVERITY', + 'ERROR_STATE', + 'FORMATMESSAGE', + 'GET_FILESTREAM_TRANSACTION_CONTEXT', + 'GETANSINULL', + 'HOST_ID', + 'HOST_NAME', + 'ISNULL', + 'ISNUMERIC', + 'MIN_ACTIVE_ROWVERSION', + 'NEWID', + 'NEWSEQUENTIALID', + 'ROWCOUNT_BIG', + 'SESSION_CONTEXT', + 'XACT_STATE', + + // statistical + '@@CONNECTIONS', + '@@CPU_BUSY', + '@@IDLE', + '@@IO_BUSY', + '@@PACK_SENT', + '@@PACKET_ERRORS', + '@@TIMETICKS', + '@@TOTAL_ERRORS', + '@@TOTAL_READ', + '@@TOTAL_WRITE', + 'TEXTPTR', + 'TEXTVALID', + + // trigger + 'COLUMNS_UPDATED', + 'EVENTDATA', + 'TRIGGER_NESTLEVEL', + 'UPDATE', + // Shorthand functions to use in place of CASE expression - caseAbbrev: ['COALESCE', 'NULLIF'], + 'COALESCE', + 'NULLIF', + // Parameterized types // https://docs.microsoft.com/en-us/sql/t-sql/data-types/data-types-transact-sql?view=sql-server-ver15 - dataTypes: [ - 'DECIMAL', - 'NUMERIC', - 'FLOAT', - 'REAL', - 'DATETIME2', - 'DATETIMEOFFSET', - 'TIME', - 'CHAR', - 'VARCHAR', - 'NCHAR', - 'NVARCHAR', - 'BINARY', - 'VARBINARY', - ], -}); + + 'DECIMAL', + 'NUMERIC', + 'FLOAT', + 'REAL', + 'DATETIME2', + 'DATETIMEOFFSET', + 'TIME', + 'CHAR', + 'VARCHAR', + 'NCHAR', + 'NVARCHAR', + 'BINARY', + 'VARBINARY', +]; diff --git a/src/languages/transactsql/transactsql.keywords.ts b/src/languages/transactsql/transactsql.keywords.ts index ac23503205..9efe7bb2ee 100644 --- a/src/languages/transactsql/transactsql.keywords.ts +++ b/src/languages/transactsql/transactsql.keywords.ts @@ -1,416 +1,413 @@ -import { flatKeywordList } from '../../utils.js'; - -export const keywords = flatKeywordList({ +export const keywords: string[] = [ // https://docs.microsoft.com/en-us/sql/t-sql/language-elements/reserved-keywords-transact-sql?view=sql-server-ver15 - standard: [ - 'ADD', - 'ALL', - 'ALTER', - 'AND', - 'ANY', - 'AS', - 'ASC', - 'AUTHORIZATION', - 'BACKUP', - 'BEGIN', - 'BETWEEN', - 'BREAK', - 'BROWSE', - 'BULK', - 'BY', - 'CASCADE', - 'CHECK', - 'CHECKPOINT', - 'CLOSE', - 'CLUSTERED', - 'COALESCE', - 'COLLATE', - 'COLUMN', - 'COMMIT', - 'COMPUTE', - 'CONSTRAINT', - 'CONTAINS', - 'CONTAINSTABLE', - 'CONTINUE', - 'CONVERT', - 'CREATE', - 'CROSS', - 'CURRENT', - 'CURRENT_DATE', - 'CURRENT_TIME', - 'CURRENT_TIMESTAMP', - 'CURRENT_USER', - 'CURSOR', - 'DATABASE', - 'DBCC', - 'DEALLOCATE', - 'DECLARE', - 'DEFAULT', - 'DELETE', - 'DENY', - 'DESC', - 'DISK', - 'DISTINCT', - 'DISTRIBUTED', - 'DOUBLE', - 'DROP', - 'DUMP', - 'ERRLVL', - 'ESCAPE', - 'EXEC', - 'EXECUTE', - 'EXISTS', - 'EXIT', - 'EXTERNAL', - 'FETCH', - 'FILE', - 'FILLFACTOR', - 'FOR', - 'FOREIGN', - 'FREETEXT', - 'FREETEXTTABLE', - 'FROM', - 'FULL', - 'FUNCTION', - 'GOTO', - 'GRANT', - 'GROUP', - 'HAVING', - 'HOLDLOCK', - 'IDENTITY', - 'IDENTITYCOL', - 'IDENTITY_INSERT', - 'IF', - 'IN', - 'INDEX', - 'INNER', - 'INSERT', - 'INTERSECT', - 'INTO', - 'IS', - 'JOIN', - 'KEY', - 'KILL', - 'LEFT', - 'LIKE', - 'LINENO', - 'LOAD', - 'MERGE', - 'NATIONAL', - 'NOCHECK', - 'NONCLUSTERED', - 'NOT', - 'NULL', - 'NULLIF', - 'OF', - 'OFF', - 'OFFSETS', - 'ON', - 'OPEN', - 'OPENDATASOURCE', - 'OPENQUERY', - 'OPENROWSET', - 'OPENXML', - 'OPTION', - 'OR', - 'ORDER', - 'OUTER', - 'OVER', - 'PERCENT', - 'PIVOT', - 'PLAN', - 'PRECISION', - 'PRIMARY', - 'PRINT', - 'PROC', - 'PROCEDURE', - 'PUBLIC', - 'RAISERROR', - 'READ', - 'READTEXT', - 'RECONFIGURE', - 'REFERENCES', - 'REPLICATION', - 'RESTORE', - 'RESTRICT', - 'RETURN', - 'REVERT', - 'REVOKE', - 'RIGHT', - 'ROLLBACK', - 'ROWCOUNT', - 'ROWGUIDCOL', - 'RULE', - 'SAVE', - 'SCHEMA', - 'SECURITYAUDIT', - 'SELECT', - 'SEMANTICKEYPHRASETABLE', - 'SEMANTICSIMILARITYDETAILSTABLE', - 'SEMANTICSIMILARITYTABLE', - 'SESSION_USER', - 'SET', - 'SETUSER', - 'SHUTDOWN', - 'SOME', - 'STATISTICS', - 'SYSTEM_USER', - 'TABLE', - 'TABLESAMPLE', - 'TEXTSIZE', - 'THEN', - 'TO', - 'TOP', - 'TRAN', - 'TRANSACTION', - 'TRIGGER', - 'TRUNCATE', - 'TRY_CONVERT', - 'TSEQUAL', - 'UNION', - 'UNIQUE', - 'UNPIVOT', - 'UPDATE', - 'UPDATETEXT', - 'USE', - 'USER', - 'VALUES', - 'VARYING', - 'VIEW', - 'WAITFOR', - 'WHERE', - 'WHILE', - 'WITH', - 'WITHIN GROUP', - 'WRITETEXT', - ], - odbc: [ - 'ABSOLUTE', - 'ACTION', - 'ADA', - 'ADD', - 'ALL', - 'ALLOCATE', - 'ALTER', - 'AND', - 'ANY', - 'ARE', - 'AS', - 'ASC', - 'ASSERTION', - 'AT', - 'AUTHORIZATION', - 'AVG', - 'BEGIN', - 'BETWEEN', - 'BIT', - 'BIT_LENGTH', - 'BOTH', - 'BY', - 'CASCADE', - 'CASCADED', - 'CAST', - 'CATALOG', - 'CHAR', - 'CHARACTER', - 'CHARACTER_LENGTH', - 'CHAR_LENGTH', - 'CHECK', - 'CLOSE', - 'COALESCE', - 'COLLATE', - 'COLLATION', - 'COLUMN', - 'COMMIT', - 'CONNECT', - 'CONNECTION', - 'CONSTRAINT', - 'CONSTRAINTS', - 'CONTINUE', - 'CONVERT', - 'CORRESPONDING', - 'COUNT', - 'CREATE', - 'CROSS', - 'CURRENT', - 'CURRENT_DATE', - 'CURRENT_TIME', - 'CURRENT_TIMESTAMP', - 'CURRENT_USER', - 'CURSOR', - 'DATE', - 'DAY', - 'DEALLOCATE', - 'DEC', - 'DECIMAL', - 'DECLARE', - 'DEFAULT', - 'DEFERRABLE', - 'DEFERRED', - 'DELETE', - 'DESC', - 'DESCRIBE', - 'DESCRIPTOR', - 'DIAGNOSTICS', - 'DISCONNECT', - 'DISTINCT', - 'DOMAIN', - 'DOUBLE', - 'DROP', - 'END-EXEC', - 'ESCAPE', - 'EXCEPTION', - 'EXEC', - 'EXECUTE', - 'EXISTS', - 'EXTERNAL', - 'EXTRACT', - 'FALSE', - 'FETCH', - 'FIRST', - 'FLOAT', - 'FOR', - 'FOREIGN', - 'FORTRAN', - 'FOUND', - 'FROM', - 'FULL', - 'GET', - 'GLOBAL', - 'GO', - 'GOTO', - 'GRANT', - 'GROUP', - 'HAVING', - 'HOUR', - 'IDENTITY', - 'IMMEDIATE', - 'IN', - 'INCLUDE', - 'INDEX', - 'INDICATOR', - 'INITIALLY', - 'INNER', - 'INPUT', - 'INSENSITIVE', - 'INSERT', - 'INT', - 'INTEGER', - 'INTERSECT', - 'INTERVAL', - 'INTO', - 'IS', - 'ISOLATION', - 'JOIN', - 'KEY', - 'LANGUAGE', - 'LAST', - 'LEADING', - 'LEFT', - 'LEVEL', - 'LIKE', - 'LOCAL', - 'LOWER', - 'MATCH', - 'MAX', - 'MIN', - 'MINUTE', - 'MODULE', - 'MONTH', - 'NAMES', - 'NATIONAL', - 'NATURAL', - 'NCHAR', - 'NEXT', - 'NO', - 'NONE', - 'NOT', - 'NULL', - 'NULLIF', - 'NUMERIC', - 'OCTET_LENGTH', - 'OF', - 'ONLY', - 'OPEN', - 'OPTION', - 'OR', - 'ORDER', - 'OUTER', - 'OUTPUT', - 'OVERLAPS', - 'PAD', - 'PARTIAL', - 'PASCAL', - 'POSITION', - 'PRECISION', - 'PREPARE', - 'PRESERVE', - 'PRIMARY', - 'PRIOR', - 'PRIVILEGES', - 'PROCEDURE', - 'PUBLIC', - 'READ', - 'REAL', - 'REFERENCES', - 'RELATIVE', - 'RESTRICT', - 'REVOKE', - 'RIGHT', - 'ROLLBACK', - 'ROWS', - 'SCHEMA', - 'SCROLL', - 'SECOND', - 'SECTION', - 'SELECT', - 'SESSION', - 'SESSION_USER', - 'SET', - 'SIZE', - 'SMALLINT', - 'SOME', - 'SPACE', - 'SQL', - 'SQLCA', - 'SQLCODE', - 'SQLERROR', - 'SQLSTATE', - 'SQLWARNING', - 'SUBSTRING', - 'SUM', - 'SYSTEM_USER', - 'TABLE', - 'TEMPORARY', - 'TIME', - 'TIMESTAMP', - 'TIMEZONE_HOUR', - 'TIMEZONE_MINUTE', - 'TO', - 'TRAILING', - 'TRANSACTION', - 'TRANSLATE', - 'TRANSLATION', - 'TRIM', - 'TRUE', - 'UNION', - 'UNIQUE', - 'UNKNOWN', - 'UPDATE', - 'UPPER', - 'USAGE', - 'USER', - 'VALUE', - 'VALUES', - 'VARCHAR', - 'VARYING', - 'VIEW', - 'WHENEVER', - 'WHERE', - 'WITH', - 'WORK', - 'WRITE', - 'YEAR', - 'ZONE', - ], -}); + // standard + 'ADD', + 'ALL', + 'ALTER', + 'AND', + 'ANY', + 'AS', + 'ASC', + 'AUTHORIZATION', + 'BACKUP', + 'BEGIN', + 'BETWEEN', + 'BREAK', + 'BROWSE', + 'BULK', + 'BY', + 'CASCADE', + 'CHECK', + 'CHECKPOINT', + 'CLOSE', + 'CLUSTERED', + 'COALESCE', + 'COLLATE', + 'COLUMN', + 'COMMIT', + 'COMPUTE', + 'CONSTRAINT', + 'CONTAINS', + 'CONTAINSTABLE', + 'CONTINUE', + 'CONVERT', + 'CREATE', + 'CROSS', + 'CURRENT', + 'CURRENT_DATE', + 'CURRENT_TIME', + 'CURRENT_TIMESTAMP', + 'CURRENT_USER', + 'CURSOR', + 'DATABASE', + 'DBCC', + 'DEALLOCATE', + 'DECLARE', + 'DEFAULT', + 'DELETE', + 'DENY', + 'DESC', + 'DISK', + 'DISTINCT', + 'DISTRIBUTED', + 'DOUBLE', + 'DROP', + 'DUMP', + 'ERRLVL', + 'ESCAPE', + 'EXEC', + 'EXECUTE', + 'EXISTS', + 'EXIT', + 'EXTERNAL', + 'FETCH', + 'FILE', + 'FILLFACTOR', + 'FOR', + 'FOREIGN', + 'FREETEXT', + 'FREETEXTTABLE', + 'FROM', + 'FULL', + 'FUNCTION', + 'GOTO', + 'GRANT', + 'GROUP', + 'HAVING', + 'HOLDLOCK', + 'IDENTITY', + 'IDENTITYCOL', + 'IDENTITY_INSERT', + 'IF', + 'IN', + 'INDEX', + 'INNER', + 'INSERT', + 'INTERSECT', + 'INTO', + 'IS', + 'JOIN', + 'KEY', + 'KILL', + 'LEFT', + 'LIKE', + 'LINENO', + 'LOAD', + 'MERGE', + 'NATIONAL', + 'NOCHECK', + 'NONCLUSTERED', + 'NOT', + 'NULL', + 'NULLIF', + 'OF', + 'OFF', + 'OFFSETS', + 'ON', + 'OPEN', + 'OPENDATASOURCE', + 'OPENQUERY', + 'OPENROWSET', + 'OPENXML', + 'OPTION', + 'OR', + 'ORDER', + 'OUTER', + 'OVER', + 'PERCENT', + 'PIVOT', + 'PLAN', + 'PRECISION', + 'PRIMARY', + 'PRINT', + 'PROC', + 'PROCEDURE', + 'PUBLIC', + 'RAISERROR', + 'READ', + 'READTEXT', + 'RECONFIGURE', + 'REFERENCES', + 'REPLICATION', + 'RESTORE', + 'RESTRICT', + 'RETURN', + 'REVERT', + 'REVOKE', + 'RIGHT', + 'ROLLBACK', + 'ROWCOUNT', + 'ROWGUIDCOL', + 'RULE', + 'SAVE', + 'SCHEMA', + 'SECURITYAUDIT', + 'SELECT', + 'SEMANTICKEYPHRASETABLE', + 'SEMANTICSIMILARITYDETAILSTABLE', + 'SEMANTICSIMILARITYTABLE', + 'SESSION_USER', + 'SET', + 'SETUSER', + 'SHUTDOWN', + 'SOME', + 'STATISTICS', + 'SYSTEM_USER', + 'TABLE', + 'TABLESAMPLE', + 'TEXTSIZE', + 'THEN', + 'TO', + 'TOP', + 'TRAN', + 'TRANSACTION', + 'TRIGGER', + 'TRUNCATE', + 'TRY_CONVERT', + 'TSEQUAL', + 'UNION', + 'UNIQUE', + 'UNPIVOT', + 'UPDATE', + 'UPDATETEXT', + 'USE', + 'USER', + 'VALUES', + 'VARYING', + 'VIEW', + 'WAITFOR', + 'WHERE', + 'WHILE', + 'WITH', + 'WITHIN GROUP', + 'WRITETEXT', + + // odbc + 'ABSOLUTE', + 'ACTION', + 'ADA', + 'ADD', + 'ALL', + 'ALLOCATE', + 'ALTER', + 'AND', + 'ANY', + 'ARE', + 'AS', + 'ASC', + 'ASSERTION', + 'AT', + 'AUTHORIZATION', + 'AVG', + 'BEGIN', + 'BETWEEN', + 'BIT', + 'BIT_LENGTH', + 'BOTH', + 'BY', + 'CASCADE', + 'CASCADED', + 'CAST', + 'CATALOG', + 'CHAR', + 'CHARACTER', + 'CHARACTER_LENGTH', + 'CHAR_LENGTH', + 'CHECK', + 'CLOSE', + 'COALESCE', + 'COLLATE', + 'COLLATION', + 'COLUMN', + 'COMMIT', + 'CONNECT', + 'CONNECTION', + 'CONSTRAINT', + 'CONSTRAINTS', + 'CONTINUE', + 'CONVERT', + 'CORRESPONDING', + 'COUNT', + 'CREATE', + 'CROSS', + 'CURRENT', + 'CURRENT_DATE', + 'CURRENT_TIME', + 'CURRENT_TIMESTAMP', + 'CURRENT_USER', + 'CURSOR', + 'DATE', + 'DAY', + 'DEALLOCATE', + 'DEC', + 'DECIMAL', + 'DECLARE', + 'DEFAULT', + 'DEFERRABLE', + 'DEFERRED', + 'DELETE', + 'DESC', + 'DESCRIBE', + 'DESCRIPTOR', + 'DIAGNOSTICS', + 'DISCONNECT', + 'DISTINCT', + 'DOMAIN', + 'DOUBLE', + 'DROP', + 'END-EXEC', + 'ESCAPE', + 'EXCEPTION', + 'EXEC', + 'EXECUTE', + 'EXISTS', + 'EXTERNAL', + 'EXTRACT', + 'FALSE', + 'FETCH', + 'FIRST', + 'FLOAT', + 'FOR', + 'FOREIGN', + 'FORTRAN', + 'FOUND', + 'FROM', + 'FULL', + 'GET', + 'GLOBAL', + 'GO', + 'GOTO', + 'GRANT', + 'GROUP', + 'HAVING', + 'HOUR', + 'IDENTITY', + 'IMMEDIATE', + 'IN', + 'INCLUDE', + 'INDEX', + 'INDICATOR', + 'INITIALLY', + 'INNER', + 'INPUT', + 'INSENSITIVE', + 'INSERT', + 'INT', + 'INTEGER', + 'INTERSECT', + 'INTERVAL', + 'INTO', + 'IS', + 'ISOLATION', + 'JOIN', + 'KEY', + 'LANGUAGE', + 'LAST', + 'LEADING', + 'LEFT', + 'LEVEL', + 'LIKE', + 'LOCAL', + 'LOWER', + 'MATCH', + 'MAX', + 'MIN', + 'MINUTE', + 'MODULE', + 'MONTH', + 'NAMES', + 'NATIONAL', + 'NATURAL', + 'NCHAR', + 'NEXT', + 'NO', + 'NONE', + 'NOT', + 'NULL', + 'NULLIF', + 'NUMERIC', + 'OCTET_LENGTH', + 'OF', + 'ONLY', + 'OPEN', + 'OPTION', + 'OR', + 'ORDER', + 'OUTER', + 'OUTPUT', + 'OVERLAPS', + 'PAD', + 'PARTIAL', + 'PASCAL', + 'POSITION', + 'PRECISION', + 'PREPARE', + 'PRESERVE', + 'PRIMARY', + 'PRIOR', + 'PRIVILEGES', + 'PROCEDURE', + 'PUBLIC', + 'READ', + 'REAL', + 'REFERENCES', + 'RELATIVE', + 'RESTRICT', + 'REVOKE', + 'RIGHT', + 'ROLLBACK', + 'ROWS', + 'SCHEMA', + 'SCROLL', + 'SECOND', + 'SECTION', + 'SELECT', + 'SESSION', + 'SESSION_USER', + 'SET', + 'SIZE', + 'SMALLINT', + 'SOME', + 'SPACE', + 'SQL', + 'SQLCA', + 'SQLCODE', + 'SQLERROR', + 'SQLSTATE', + 'SQLWARNING', + 'SUBSTRING', + 'SUM', + 'SYSTEM_USER', + 'TABLE', + 'TEMPORARY', + 'TIME', + 'TIMESTAMP', + 'TIMEZONE_HOUR', + 'TIMEZONE_MINUTE', + 'TO', + 'TRAILING', + 'TRANSACTION', + 'TRANSLATE', + 'TRANSLATION', + 'TRIM', + 'TRUE', + 'UNION', + 'UNIQUE', + 'UNKNOWN', + 'UPDATE', + 'UPPER', + 'USAGE', + 'USER', + 'VALUE', + 'VALUES', + 'VARCHAR', + 'VARYING', + 'VIEW', + 'WHENEVER', + 'WHERE', + 'WITH', + 'WORK', + 'WRITE', + 'YEAR', + 'ZONE', +]; diff --git a/src/languages/trino/trino.functions.ts b/src/languages/trino/trino.functions.ts index 5f96964234..a3c3d3e31a 100644 --- a/src/languages/trino/trino.functions.ts +++ b/src/languages/trino/trino.functions.ts @@ -1,433 +1,436 @@ -import { flatKeywordList } from '../../utils.js'; - -export const functions = flatKeywordList({ +export const functions: string[] = [ // https://github.com/trinodb/trino/tree/432d2897bdef99388c1a47188743a061c4ac1f34/docs/src/main/sphinx/functions // rg '^\.\. function::' ./docs/src/main/sphinx/functions | cut -d' ' -f 3 | cut -d '(' -f 1 | sort | uniq // rg '\* ' ./docs/src/main/sphinx/functions/list-by-topic.rst | grep '\* :func:' | cut -d'`' -f 2 // rg '\* ' ./docs/src/main/sphinx/functions/list-by-topic.rst | grep -v '\* :func:' // grep -e '^- ' ./docs/src/main/sphinx/functions/list.rst | grep -e '^- :func:' | cut -d'`' -f2 // grep -e '^- ' ./docs/src/main/sphinx/functions/list.rst | grep -ve '^- :func:' - all: [ - 'ABS', - 'ACOS', - 'ALL_MATCH', - 'ANY_MATCH', - 'APPROX_DISTINCT', - 'APPROX_MOST_FREQUENT', - 'APPROX_PERCENTILE', - 'APPROX_SET', - 'ARBITRARY', - 'ARRAYS_OVERLAP', - 'ARRAY_AGG', - 'ARRAY_DISTINCT', - 'ARRAY_EXCEPT', - 'ARRAY_INTERSECT', - 'ARRAY_JOIN', - 'ARRAY_MAX', - 'ARRAY_MIN', - 'ARRAY_POSITION', - 'ARRAY_REMOVE', - 'ARRAY_SORT', - 'ARRAY_UNION', - 'ASIN', - 'ATAN', - 'ATAN2', - 'AT_TIMEZONE', - 'AVG', - 'BAR', - 'BETA_CDF', - 'BING_TILE', - 'BING_TILES_AROUND', - 'BING_TILE_AT', - 'BING_TILE_COORDINATES', - 'BING_TILE_POLYGON', - 'BING_TILE_QUADKEY', - 'BING_TILE_ZOOM_LEVEL', - 'BITWISE_AND', - 'BITWISE_AND_AGG', - 'BITWISE_LEFT_SHIFT', - 'BITWISE_NOT', - 'BITWISE_OR', - 'BITWISE_OR_AGG', - 'BITWISE_RIGHT_SHIFT', - 'BITWISE_RIGHT_SHIFT_ARITHMETIC', - 'BITWISE_XOR', - 'BIT_COUNT', - 'BOOL_AND', - 'BOOL_OR', - 'CARDINALITY', - 'CAST', - 'CBRT', - 'CEIL', - 'CEILING', - 'CHAR2HEXINT', - 'CHECKSUM', - 'CHR', - 'CLASSIFY', - 'COALESCE', - 'CODEPOINT', - 'COLOR', - 'COMBINATIONS', - 'CONCAT', - 'CONCAT_WS', - 'CONTAINS', - 'CONTAINS_SEQUENCE', - 'CONVEX_HULL_AGG', - 'CORR', - 'COS', - 'COSH', - 'COSINE_SIMILARITY', - 'COUNT', - 'COUNT_IF', - 'COVAR_POP', - 'COVAR_SAMP', - 'CRC32', - 'CUME_DIST', - 'CURRENT_CATALOG', - 'CURRENT_DATE', - 'CURRENT_GROUPS', - 'CURRENT_SCHEMA', - 'CURRENT_TIME', - 'CURRENT_TIMESTAMP', - 'CURRENT_TIMEZONE', - 'CURRENT_USER', - 'DATE', - 'DATE_ADD', - 'DATE_DIFF', - 'DATE_FORMAT', - 'DATE_PARSE', - 'DATE_TRUNC', - 'DAY', - 'DAY_OF_MONTH', - 'DAY_OF_WEEK', - 'DAY_OF_YEAR', - 'DEGREES', - 'DENSE_RANK', - 'DOW', - 'DOY', - 'E', - 'ELEMENT_AT', - 'EMPTY_APPROX_SET', - 'EVALUATE_CLASSIFIER_PREDICTIONS', - 'EVERY', - 'EXP', - 'EXTRACT', - 'FEATURES', - 'FILTER', - 'FIRST_VALUE', - 'FLATTEN', - 'FLOOR', - 'FORMAT', - 'FORMAT_DATETIME', - 'FORMAT_NUMBER', - 'FROM_BASE', - 'FROM_BASE32', - 'FROM_BASE64', - 'FROM_BASE64URL', - 'FROM_BIG_ENDIAN_32', - 'FROM_BIG_ENDIAN_64', - 'FROM_ENCODED_POLYLINE', - 'FROM_GEOJSON_GEOMETRY', - 'FROM_HEX', - 'FROM_IEEE754_32', - 'FROM_IEEE754_64', - 'FROM_ISO8601_DATE', - 'FROM_ISO8601_TIMESTAMP', - 'FROM_ISO8601_TIMESTAMP_NANOS', - 'FROM_UNIXTIME', - 'FROM_UNIXTIME_NANOS', - 'FROM_UTF8', - 'GEOMETRIC_MEAN', - 'GEOMETRY_FROM_HADOOP_SHAPE', - 'GEOMETRY_INVALID_REASON', - 'GEOMETRY_NEAREST_POINTS', - 'GEOMETRY_TO_BING_TILES', - 'GEOMETRY_UNION', - 'GEOMETRY_UNION_AGG', - 'GREATEST', - 'GREAT_CIRCLE_DISTANCE', - 'HAMMING_DISTANCE', - 'HASH_COUNTS', - 'HISTOGRAM', - 'HMAC_MD5', - 'HMAC_SHA1', - 'HMAC_SHA256', - 'HMAC_SHA512', - 'HOUR', - 'HUMAN_READABLE_SECONDS', - 'IF', - 'INDEX', - 'INFINITY', - 'INTERSECTION_CARDINALITY', - 'INVERSE_BETA_CDF', - 'INVERSE_NORMAL_CDF', - 'IS_FINITE', - 'IS_INFINITE', - 'IS_JSON_SCALAR', - 'IS_NAN', - 'JACCARD_INDEX', - 'JSON_ARRAY_CONTAINS', - 'JSON_ARRAY_GET', - 'JSON_ARRAY_LENGTH', - 'JSON_EXISTS', - 'JSON_EXTRACT', - 'JSON_EXTRACT_SCALAR', - 'JSON_FORMAT', - 'JSON_PARSE', - 'JSON_QUERY', - 'JSON_SIZE', - 'JSON_VALUE', - 'KURTOSIS', - 'LAG', - 'LAST_DAY_OF_MONTH', - 'LAST_VALUE', - 'LEAD', - 'LEARN_CLASSIFIER', - 'LEARN_LIBSVM_CLASSIFIER', - 'LEARN_LIBSVM_REGRESSOR', - 'LEARN_REGRESSOR', - 'LEAST', - 'LENGTH', - 'LEVENSHTEIN_DISTANCE', - 'LINE_INTERPOLATE_POINT', - 'LINE_INTERPOLATE_POINTS', - 'LINE_LOCATE_POINT', - 'LISTAGG', - 'LN', - 'LOCALTIME', - 'LOCALTIMESTAMP', - 'LOG', - 'LOG10', - 'LOG2', - 'LOWER', - 'LPAD', - 'LTRIM', - 'LUHN_CHECK', - 'MAKE_SET_DIGEST', - 'MAP', - 'MAP_AGG', - 'MAP_CONCAT', - 'MAP_ENTRIES', - 'MAP_FILTER', - 'MAP_FROM_ENTRIES', - 'MAP_KEYS', - 'MAP_UNION', - 'MAP_VALUES', - 'MAP_ZIP_WITH', - 'MAX', - 'MAX_BY', - 'MD5', - 'MERGE', - 'MERGE_SET_DIGEST', - 'MILLISECOND', - 'MIN', - 'MINUTE', - 'MIN_BY', - 'MOD', - 'MONTH', - 'MULTIMAP_AGG', - 'MULTIMAP_FROM_ENTRIES', - 'MURMUR3', - 'NAN', - 'NGRAMS', - 'NONE_MATCH', - 'NORMALIZE', - 'NORMAL_CDF', - 'NOW', - 'NTH_VALUE', - 'NTILE', - 'NULLIF', - 'NUMERIC_HISTOGRAM', - 'OBJECTID', - 'OBJECTID_TIMESTAMP', - 'PARSE_DATA_SIZE', - 'PARSE_DATETIME', - 'PARSE_DURATION', - 'PERCENT_RANK', - 'PI', - 'POSITION', - 'POW', - 'POWER', - 'QDIGEST_AGG', - 'QUARTER', - 'RADIANS', - 'RAND', - 'RANDOM', - 'RANK', - 'REDUCE', - 'REDUCE_AGG', - 'REGEXP_COUNT', - 'REGEXP_EXTRACT', - 'REGEXP_EXTRACT_ALL', - 'REGEXP_LIKE', - 'REGEXP_POSITION', - 'REGEXP_REPLACE', - 'REGEXP_SPLIT', - 'REGRESS', - 'REGR_INTERCEPT', - 'REGR_SLOPE', - 'RENDER', - 'REPEAT', - 'REPLACE', - 'REVERSE', - 'RGB', - 'ROUND', - 'ROW_NUMBER', - 'RPAD', - 'RTRIM', - 'SECOND', - 'SEQUENCE', - 'SHA1', - 'SHA256', - 'SHA512', - 'SHUFFLE', - 'SIGN', - 'SIMPLIFY_GEOMETRY', - 'SIN', - 'SKEWNESS', - 'SLICE', - 'SOUNDEX', - 'SPATIAL_PARTITIONING', - 'SPATIAL_PARTITIONS', - 'SPLIT', - 'SPLIT_PART', - 'SPLIT_TO_MAP', - 'SPLIT_TO_MULTIMAP', - 'SPOOKY_HASH_V2_32', - 'SPOOKY_HASH_V2_64', - 'SQRT', - 'STARTS_WITH', - 'STDDEV', - 'STDDEV_POP', - 'STDDEV_SAMP', - 'STRPOS', - 'ST_AREA', - 'ST_ASBINARY', - 'ST_ASTEXT', - 'ST_BOUNDARY', - 'ST_BUFFER', - 'ST_CENTROID', - 'ST_CONTAINS', - 'ST_CONVEXHULL', - 'ST_COORDDIM', - 'ST_CROSSES', - 'ST_DIFFERENCE', - 'ST_DIMENSION', - 'ST_DISJOINT', - 'ST_DISTANCE', - 'ST_ENDPOINT', - 'ST_ENVELOPE', - 'ST_ENVELOPEASPTS', - 'ST_EQUALS', - 'ST_EXTERIORRING', - 'ST_GEOMETRIES', - 'ST_GEOMETRYFROMTEXT', - 'ST_GEOMETRYN', - 'ST_GEOMETRYTYPE', - 'ST_GEOMFROMBINARY', - 'ST_INTERIORRINGN', - 'ST_INTERIORRINGS', - 'ST_INTERSECTION', - 'ST_INTERSECTS', - 'ST_ISCLOSED', - 'ST_ISEMPTY', - 'ST_ISRING', - 'ST_ISSIMPLE', - 'ST_ISVALID', - 'ST_LENGTH', - 'ST_LINEFROMTEXT', - 'ST_LINESTRING', - 'ST_MULTIPOINT', - 'ST_NUMGEOMETRIES', - 'ST_NUMINTERIORRING', - 'ST_NUMPOINTS', - 'ST_OVERLAPS', - 'ST_POINT', - 'ST_POINTN', - 'ST_POINTS', - 'ST_POLYGON', - 'ST_RELATE', - 'ST_STARTPOINT', - 'ST_SYMDIFFERENCE', - 'ST_TOUCHES', - 'ST_UNION', - 'ST_WITHIN', - 'ST_X', - 'ST_XMAX', - 'ST_XMIN', - 'ST_Y', - 'ST_YMAX', - 'ST_YMIN', - 'SUBSTR', - 'SUBSTRING', - 'SUM', - 'TAN', - 'TANH', - 'TDIGEST_AGG', - 'TIMESTAMP_OBJECTID', - 'TIMEZONE_HOUR', - 'TIMEZONE_MINUTE', - 'TO_BASE', - 'TO_BASE32', - 'TO_BASE64', - 'TO_BASE64URL', - 'TO_BIG_ENDIAN_32', - 'TO_BIG_ENDIAN_64', - 'TO_CHAR', - 'TO_DATE', - 'TO_ENCODED_POLYLINE', - 'TO_GEOJSON_GEOMETRY', - 'TO_GEOMETRY', - 'TO_HEX', - 'TO_IEEE754_32', - 'TO_IEEE754_64', - 'TO_ISO8601', - 'TO_MILLISECONDS', - 'TO_SPHERICAL_GEOGRAPHY', - 'TO_TIMESTAMP', - 'TO_UNIXTIME', - 'TO_UTF8', - 'TRANSFORM', - 'TRANSFORM_KEYS', - 'TRANSFORM_VALUES', - 'TRANSLATE', - 'TRIM', - 'TRIM_ARRAY', - 'TRUNCATE', - 'TRY', - 'TRY_CAST', - 'TYPEOF', - 'UPPER', - 'URL_DECODE', - 'URL_ENCODE', - 'URL_EXTRACT_FRAGMENT', - 'URL_EXTRACT_HOST', - 'URL_EXTRACT_PARAMETER', - 'URL_EXTRACT_PATH', - 'URL_EXTRACT_PORT', - 'URL_EXTRACT_PROTOCOL', - 'URL_EXTRACT_QUERY', - 'UUID', - 'VALUES_AT_QUANTILES', - 'VALUE_AT_QUANTILE', - 'VARIANCE', - 'VAR_POP', - 'VAR_SAMP', - 'VERSION', - 'WEEK', - 'WEEK_OF_YEAR', - 'WIDTH_BUCKET', - 'WILSON_INTERVAL_LOWER', - 'WILSON_INTERVAL_UPPER', - 'WITH_TIMEZONE', - 'WORD_STEM', - 'XXHASH64', - 'YEAR', - 'YEAR_OF_WEEK', - 'YOW', - 'ZIP', - 'ZIP_WITH', - ], + 'ABS', + 'ACOS', + 'ALL_MATCH', + 'ANY_MATCH', + 'APPROX_DISTINCT', + 'APPROX_MOST_FREQUENT', + 'APPROX_PERCENTILE', + 'APPROX_SET', + 'ARBITRARY', + 'ARRAYS_OVERLAP', + 'ARRAY_AGG', + 'ARRAY_DISTINCT', + 'ARRAY_EXCEPT', + 'ARRAY_INTERSECT', + 'ARRAY_JOIN', + 'ARRAY_MAX', + 'ARRAY_MIN', + 'ARRAY_POSITION', + 'ARRAY_REMOVE', + 'ARRAY_SORT', + 'ARRAY_UNION', + 'ASIN', + 'ATAN', + 'ATAN2', + 'AT_TIMEZONE', + 'AVG', + 'BAR', + 'BETA_CDF', + 'BING_TILE', + 'BING_TILES_AROUND', + 'BING_TILE_AT', + 'BING_TILE_COORDINATES', + 'BING_TILE_POLYGON', + 'BING_TILE_QUADKEY', + 'BING_TILE_ZOOM_LEVEL', + 'BITWISE_AND', + 'BITWISE_AND_AGG', + 'BITWISE_LEFT_SHIFT', + 'BITWISE_NOT', + 'BITWISE_OR', + 'BITWISE_OR_AGG', + 'BITWISE_RIGHT_SHIFT', + 'BITWISE_RIGHT_SHIFT_ARITHMETIC', + 'BITWISE_XOR', + 'BIT_COUNT', + 'BOOL_AND', + 'BOOL_OR', + 'CARDINALITY', + 'CAST', + 'CBRT', + 'CEIL', + 'CEILING', + 'CHAR2HEXINT', + 'CHECKSUM', + 'CHR', + 'CLASSIFY', + 'COALESCE', + 'CODEPOINT', + 'COLOR', + 'COMBINATIONS', + 'CONCAT', + 'CONCAT_WS', + 'CONTAINS', + 'CONTAINS_SEQUENCE', + 'CONVEX_HULL_AGG', + 'CORR', + 'COS', + 'COSH', + 'COSINE_SIMILARITY', + 'COUNT', + 'COUNT_IF', + 'COVAR_POP', + 'COVAR_SAMP', + 'CRC32', + 'CUME_DIST', + 'CURRENT_CATALOG', + 'CURRENT_DATE', + 'CURRENT_GROUPS', + 'CURRENT_SCHEMA', + 'CURRENT_TIME', + 'CURRENT_TIMESTAMP', + 'CURRENT_TIMEZONE', + 'CURRENT_USER', + 'DATE', + 'DATE_ADD', + 'DATE_DIFF', + 'DATE_FORMAT', + 'DATE_PARSE', + 'DATE_TRUNC', + 'DAY', + 'DAY_OF_MONTH', + 'DAY_OF_WEEK', + 'DAY_OF_YEAR', + 'DEGREES', + 'DENSE_RANK', + 'DOW', + 'DOY', + 'E', + 'ELEMENT_AT', + 'EMPTY_APPROX_SET', + 'EVALUATE_CLASSIFIER_PREDICTIONS', + 'EVERY', + 'EXP', + 'EXTRACT', + 'FEATURES', + 'FILTER', + 'FIRST_VALUE', + 'FLATTEN', + 'FLOOR', + 'FORMAT', + 'FORMAT_DATETIME', + 'FORMAT_NUMBER', + 'FROM_BASE', + 'FROM_BASE32', + 'FROM_BASE64', + 'FROM_BASE64URL', + 'FROM_BIG_ENDIAN_32', + 'FROM_BIG_ENDIAN_64', + 'FROM_ENCODED_POLYLINE', + 'FROM_GEOJSON_GEOMETRY', + 'FROM_HEX', + 'FROM_IEEE754_32', + 'FROM_IEEE754_64', + 'FROM_ISO8601_DATE', + 'FROM_ISO8601_TIMESTAMP', + 'FROM_ISO8601_TIMESTAMP_NANOS', + 'FROM_UNIXTIME', + 'FROM_UNIXTIME_NANOS', + 'FROM_UTF8', + 'GEOMETRIC_MEAN', + 'GEOMETRY_FROM_HADOOP_SHAPE', + 'GEOMETRY_INVALID_REASON', + 'GEOMETRY_NEAREST_POINTS', + 'GEOMETRY_TO_BING_TILES', + 'GEOMETRY_UNION', + 'GEOMETRY_UNION_AGG', + 'GREATEST', + 'GREAT_CIRCLE_DISTANCE', + 'HAMMING_DISTANCE', + 'HASH_COUNTS', + 'HISTOGRAM', + 'HMAC_MD5', + 'HMAC_SHA1', + 'HMAC_SHA256', + 'HMAC_SHA512', + 'HOUR', + 'HUMAN_READABLE_SECONDS', + 'IF', + 'INDEX', + 'INFINITY', + 'INTERSECTION_CARDINALITY', + 'INVERSE_BETA_CDF', + 'INVERSE_NORMAL_CDF', + 'IS_FINITE', + 'IS_INFINITE', + 'IS_JSON_SCALAR', + 'IS_NAN', + 'JACCARD_INDEX', + 'JSON_ARRAY_CONTAINS', + 'JSON_ARRAY_GET', + 'JSON_ARRAY_LENGTH', + 'JSON_EXISTS', + 'JSON_EXTRACT', + 'JSON_EXTRACT_SCALAR', + 'JSON_FORMAT', + 'JSON_PARSE', + 'JSON_QUERY', + 'JSON_SIZE', + 'JSON_VALUE', + 'KURTOSIS', + 'LAG', + 'LAST_DAY_OF_MONTH', + 'LAST_VALUE', + 'LEAD', + 'LEARN_CLASSIFIER', + 'LEARN_LIBSVM_CLASSIFIER', + 'LEARN_LIBSVM_REGRESSOR', + 'LEARN_REGRESSOR', + 'LEAST', + 'LENGTH', + 'LEVENSHTEIN_DISTANCE', + 'LINE_INTERPOLATE_POINT', + 'LINE_INTERPOLATE_POINTS', + 'LINE_LOCATE_POINT', + 'LISTAGG', + 'LN', + 'LOCALTIME', + 'LOCALTIMESTAMP', + 'LOG', + 'LOG10', + 'LOG2', + 'LOWER', + 'LPAD', + 'LTRIM', + 'LUHN_CHECK', + 'MAKE_SET_DIGEST', + 'MAP', + 'MAP_AGG', + 'MAP_CONCAT', + 'MAP_ENTRIES', + 'MAP_FILTER', + 'MAP_FROM_ENTRIES', + 'MAP_KEYS', + 'MAP_UNION', + 'MAP_VALUES', + 'MAP_ZIP_WITH', + 'MAX', + 'MAX_BY', + 'MD5', + 'MERGE', + 'MERGE_SET_DIGEST', + 'MILLISECOND', + 'MIN', + 'MINUTE', + 'MIN_BY', + 'MOD', + 'MONTH', + 'MULTIMAP_AGG', + 'MULTIMAP_FROM_ENTRIES', + 'MURMUR3', + 'NAN', + 'NGRAMS', + 'NONE_MATCH', + 'NORMALIZE', + 'NORMAL_CDF', + 'NOW', + 'NTH_VALUE', + 'NTILE', + 'NULLIF', + 'NUMERIC_HISTOGRAM', + 'OBJECTID', + 'OBJECTID_TIMESTAMP', + 'PARSE_DATA_SIZE', + 'PARSE_DATETIME', + 'PARSE_DURATION', + 'PERCENT_RANK', + 'PI', + 'POSITION', + 'POW', + 'POWER', + 'QDIGEST_AGG', + 'QUARTER', + 'RADIANS', + 'RAND', + 'RANDOM', + 'RANK', + 'REDUCE', + 'REDUCE_AGG', + 'REGEXP_COUNT', + 'REGEXP_EXTRACT', + 'REGEXP_EXTRACT_ALL', + 'REGEXP_LIKE', + 'REGEXP_POSITION', + 'REGEXP_REPLACE', + 'REGEXP_SPLIT', + 'REGRESS', + 'REGR_INTERCEPT', + 'REGR_SLOPE', + 'RENDER', + 'REPEAT', + 'REPLACE', + 'REVERSE', + 'RGB', + 'ROUND', + 'ROW_NUMBER', + 'RPAD', + 'RTRIM', + 'SECOND', + 'SEQUENCE', + 'SHA1', + 'SHA256', + 'SHA512', + 'SHUFFLE', + 'SIGN', + 'SIMPLIFY_GEOMETRY', + 'SIN', + 'SKEWNESS', + 'SLICE', + 'SOUNDEX', + 'SPATIAL_PARTITIONING', + 'SPATIAL_PARTITIONS', + 'SPLIT', + 'SPLIT_PART', + 'SPLIT_TO_MAP', + 'SPLIT_TO_MULTIMAP', + 'SPOOKY_HASH_V2_32', + 'SPOOKY_HASH_V2_64', + 'SQRT', + 'STARTS_WITH', + 'STDDEV', + 'STDDEV_POP', + 'STDDEV_SAMP', + 'STRPOS', + 'ST_AREA', + 'ST_ASBINARY', + 'ST_ASTEXT', + 'ST_BOUNDARY', + 'ST_BUFFER', + 'ST_CENTROID', + 'ST_CONTAINS', + 'ST_CONVEXHULL', + 'ST_COORDDIM', + 'ST_CROSSES', + 'ST_DIFFERENCE', + 'ST_DIMENSION', + 'ST_DISJOINT', + 'ST_DISTANCE', + 'ST_ENDPOINT', + 'ST_ENVELOPE', + 'ST_ENVELOPEASPTS', + 'ST_EQUALS', + 'ST_EXTERIORRING', + 'ST_GEOMETRIES', + 'ST_GEOMETRYFROMTEXT', + 'ST_GEOMETRYN', + 'ST_GEOMETRYTYPE', + 'ST_GEOMFROMBINARY', + 'ST_INTERIORRINGN', + 'ST_INTERIORRINGS', + 'ST_INTERSECTION', + 'ST_INTERSECTS', + 'ST_ISCLOSED', + 'ST_ISEMPTY', + 'ST_ISRING', + 'ST_ISSIMPLE', + 'ST_ISVALID', + 'ST_LENGTH', + 'ST_LINEFROMTEXT', + 'ST_LINESTRING', + 'ST_MULTIPOINT', + 'ST_NUMGEOMETRIES', + 'ST_NUMINTERIORRING', + 'ST_NUMPOINTS', + 'ST_OVERLAPS', + 'ST_POINT', + 'ST_POINTN', + 'ST_POINTS', + 'ST_POLYGON', + 'ST_RELATE', + 'ST_STARTPOINT', + 'ST_SYMDIFFERENCE', + 'ST_TOUCHES', + 'ST_UNION', + 'ST_WITHIN', + 'ST_X', + 'ST_XMAX', + 'ST_XMIN', + 'ST_Y', + 'ST_YMAX', + 'ST_YMIN', + 'SUBSTR', + 'SUBSTRING', + 'SUM', + 'TAN', + 'TANH', + 'TDIGEST_AGG', + 'TIMESTAMP_OBJECTID', + 'TIMEZONE_HOUR', + 'TIMEZONE_MINUTE', + 'TO_BASE', + 'TO_BASE32', + 'TO_BASE64', + 'TO_BASE64URL', + 'TO_BIG_ENDIAN_32', + 'TO_BIG_ENDIAN_64', + 'TO_CHAR', + 'TO_DATE', + 'TO_ENCODED_POLYLINE', + 'TO_GEOJSON_GEOMETRY', + 'TO_GEOMETRY', + 'TO_HEX', + 'TO_IEEE754_32', + 'TO_IEEE754_64', + 'TO_ISO8601', + 'TO_MILLISECONDS', + 'TO_SPHERICAL_GEOGRAPHY', + 'TO_TIMESTAMP', + 'TO_UNIXTIME', + 'TO_UTF8', + 'TRANSFORM', + 'TRANSFORM_KEYS', + 'TRANSFORM_VALUES', + 'TRANSLATE', + 'TRIM', + 'TRIM_ARRAY', + 'TRUNCATE', + 'TRY', + 'TRY_CAST', + 'TYPEOF', + 'UPPER', + 'URL_DECODE', + 'URL_ENCODE', + 'URL_EXTRACT_FRAGMENT', + 'URL_EXTRACT_HOST', + 'URL_EXTRACT_PARAMETER', + 'URL_EXTRACT_PATH', + 'URL_EXTRACT_PORT', + 'URL_EXTRACT_PROTOCOL', + 'URL_EXTRACT_QUERY', + 'UUID', + 'VALUES_AT_QUANTILES', + 'VALUE_AT_QUANTILE', + 'VARIANCE', + 'VAR_POP', + 'VAR_SAMP', + 'VERSION', + 'WEEK', + 'WEEK_OF_YEAR', + 'WIDTH_BUCKET', + 'WILSON_INTERVAL_LOWER', + 'WILSON_INTERVAL_UPPER', + 'WITH_TIMEZONE', + 'WORD_STEM', + 'XXHASH64', + 'YEAR', + 'YEAR_OF_WEEK', + 'YOW', + 'ZIP', + 'ZIP_WITH', + // https://trino.io/docs/current/sql/match-recognize.html#row-pattern-recognition-expressions - rowPattern: ['CLASSIFIER', 'FIRST', 'LAST', 'MATCH_NUMBER', 'NEXT', 'PERMUTE', 'PREV'], -}); + 'CLASSIFIER', + 'FIRST', + 'LAST', + 'MATCH_NUMBER', + 'NEXT', + 'PERMUTE', + 'PREV', +]; diff --git a/src/languages/trino/trino.keywords.ts b/src/languages/trino/trino.keywords.ts index 4a71cdd3bb..9781970225 100644 --- a/src/languages/trino/trino.keywords.ts +++ b/src/languages/trino/trino.keywords.ts @@ -1,283 +1,278 @@ -import { flatKeywordList } from '../../utils.js'; - -export const keywords = flatKeywordList({ +export const keywords: string[] = [ // https://github.com/trinodb/trino/blob/432d2897bdef99388c1a47188743a061c4ac1f34/core/trino-parser/src/main/antlr4/io/trino/sql/parser/SqlBase.g4#L858-L1128 - all: [ - 'ABSENT', - 'ADD', - 'ADMIN', - 'AFTER', - 'ALL', - 'ALTER', - 'ANALYZE', - 'AND', - 'ANY', - 'ARRAY', - 'AS', - 'ASC', - 'AT', - 'AUTHORIZATION', - 'BERNOULLI', - 'BETWEEN', - 'BOTH', - 'BY', - 'CALL', - 'CASCADE', - 'CASE', - 'CATALOGS', - 'COLUMN', - 'COLUMNS', - 'COMMENT', - 'COMMIT', - 'COMMITTED', - 'CONDITIONAL', - 'CONSTRAINT', - 'COPARTITION', - 'CREATE', - 'CROSS', - 'CUBE', - 'CURRENT', - 'CURRENT_PATH', - 'CURRENT_ROLE', - 'DATA', - 'DEALLOCATE', - 'DEFAULT', - 'DEFINE', - 'DEFINER', - 'DELETE', - 'DENY', - 'DESC', - 'DESCRIBE', - 'DESCRIPTOR', - 'DISTINCT', - 'DISTRIBUTED', - 'DOUBLE', - 'DROP', - 'ELSE', - 'EMPTY', - 'ENCODING', - 'END', - 'ERROR', - 'ESCAPE', - 'EXCEPT', - 'EXCLUDING', - 'EXECUTE', - 'EXISTS', - 'EXPLAIN', - 'FALSE', - 'FETCH', - 'FINAL', - 'FIRST', - 'FOLLOWING', - 'FOR', - 'FROM', - 'FULL', - 'FUNCTIONS', - 'GRANT', - 'GRANTED', - 'GRANTS', - 'GRAPHVIZ', - 'GROUP', - 'GROUPING', - 'GROUPS', - 'HAVING', - 'IGNORE', - 'IN', - 'INCLUDING', - 'INITIAL', - 'INNER', - 'INPUT', - 'INSERT', - 'INTERSECT', - 'INTERVAL', - 'INTO', - 'INVOKER', - 'IO', - 'IS', - 'ISOLATION', - 'JOIN', - 'JSON', - 'JSON_ARRAY', - 'JSON_OBJECT', - 'KEEP', - 'KEY', - 'KEYS', - 'LAST', - 'LATERAL', - 'LEADING', - 'LEFT', - 'LEVEL', - 'LIKE', - 'LIMIT', - 'LOCAL', - 'LOGICAL', - 'MATCH', - 'MATCHED', - 'MATCHES', - 'MATCH_RECOGNIZE', - 'MATERIALIZED', - 'MEASURES', - 'NATURAL', - 'NEXT', - 'NFC', - 'NFD', - 'NFKC', - 'NFKD', - 'NO', - 'NONE', - 'NOT', - 'NULL', - 'NULLS', - 'OBJECT', - 'OF', - 'OFFSET', - 'OMIT', - 'ON', - 'ONE', - 'ONLY', - 'OPTION', - 'OR', - 'ORDER', - 'ORDINALITY', - 'OUTER', - 'OUTPUT', - 'OVER', - 'OVERFLOW', - 'PARTITION', - 'PARTITIONS', - 'PASSING', - 'PAST', - 'PATH', - 'PATTERN', - 'PER', - 'PERMUTE', - 'PRECEDING', - 'PRECISION', - 'PREPARE', - 'PRIVILEGES', - 'PROPERTIES', - 'PRUNE', - 'QUOTES', - 'RANGE', - 'READ', - 'RECURSIVE', - 'REFRESH', - 'RENAME', - 'REPEATABLE', - 'RESET', - 'RESPECT', - 'RESTRICT', - 'RETURNING', - 'REVOKE', - 'RIGHT', - 'ROLE', - 'ROLES', - 'ROLLBACK', - 'ROLLUP', - 'ROW', - 'ROWS', - 'RUNNING', - 'SCALAR', - 'SCHEMA', - 'SCHEMAS', - 'SECURITY', - 'SEEK', - 'SELECT', - 'SERIALIZABLE', - 'SESSION', - 'SET', - 'SETS', - 'SHOW', - 'SKIP', - 'SOME', - 'START', - 'STATS', - 'STRING', - 'SUBSET', - 'SYSTEM', - 'TABLE', - 'TABLES', - 'TABLESAMPLE', - 'TEXT', - 'THEN', - 'TIES', - 'TIME', - 'TIMESTAMP', - 'TO', - 'TRAILING', - 'TRANSACTION', - 'TRUE', - 'TYPE', - 'UESCAPE', - 'UNBOUNDED', - 'UNCOMMITTED', - 'UNCONDITIONAL', - 'UNION', - 'UNIQUE', - 'UNKNOWN', - 'UNMATCHED', - 'UNNEST', - 'UPDATE', - 'USE', - 'USER', - 'USING', - 'UTF16', - 'UTF32', - 'UTF8', - 'VALIDATE', - 'VALUE', - 'VALUES', - 'VERBOSE', - 'VIEW', - 'WHEN', - 'WHERE', - 'WINDOW', - 'WITH', - 'WITHIN', - 'WITHOUT', - 'WORK', - 'WRAPPER', - 'WRITE', - 'ZONE', - ], + 'ABSENT', + 'ADD', + 'ADMIN', + 'AFTER', + 'ALL', + 'ALTER', + 'ANALYZE', + 'AND', + 'ANY', + 'ARRAY', + 'AS', + 'ASC', + 'AT', + 'AUTHORIZATION', + 'BERNOULLI', + 'BETWEEN', + 'BOTH', + 'BY', + 'CALL', + 'CASCADE', + 'CASE', + 'CATALOGS', + 'COLUMN', + 'COLUMNS', + 'COMMENT', + 'COMMIT', + 'COMMITTED', + 'CONDITIONAL', + 'CONSTRAINT', + 'COPARTITION', + 'CREATE', + 'CROSS', + 'CUBE', + 'CURRENT', + 'CURRENT_PATH', + 'CURRENT_ROLE', + 'DATA', + 'DEALLOCATE', + 'DEFAULT', + 'DEFINE', + 'DEFINER', + 'DELETE', + 'DENY', + 'DESC', + 'DESCRIBE', + 'DESCRIPTOR', + 'DISTINCT', + 'DISTRIBUTED', + 'DOUBLE', + 'DROP', + 'ELSE', + 'EMPTY', + 'ENCODING', + 'END', + 'ERROR', + 'ESCAPE', + 'EXCEPT', + 'EXCLUDING', + 'EXECUTE', + 'EXISTS', + 'EXPLAIN', + 'FALSE', + 'FETCH', + 'FINAL', + 'FIRST', + 'FOLLOWING', + 'FOR', + 'FROM', + 'FULL', + 'FUNCTIONS', + 'GRANT', + 'GRANTED', + 'GRANTS', + 'GRAPHVIZ', + 'GROUP', + 'GROUPING', + 'GROUPS', + 'HAVING', + 'IGNORE', + 'IN', + 'INCLUDING', + 'INITIAL', + 'INNER', + 'INPUT', + 'INSERT', + 'INTERSECT', + 'INTERVAL', + 'INTO', + 'INVOKER', + 'IO', + 'IS', + 'ISOLATION', + 'JOIN', + 'JSON', + 'JSON_ARRAY', + 'JSON_OBJECT', + 'KEEP', + 'KEY', + 'KEYS', + 'LAST', + 'LATERAL', + 'LEADING', + 'LEFT', + 'LEVEL', + 'LIKE', + 'LIMIT', + 'LOCAL', + 'LOGICAL', + 'MATCH', + 'MATCHED', + 'MATCHES', + 'MATCH_RECOGNIZE', + 'MATERIALIZED', + 'MEASURES', + 'NATURAL', + 'NEXT', + 'NFC', + 'NFD', + 'NFKC', + 'NFKD', + 'NO', + 'NONE', + 'NOT', + 'NULL', + 'NULLS', + 'OBJECT', + 'OF', + 'OFFSET', + 'OMIT', + 'ON', + 'ONE', + 'ONLY', + 'OPTION', + 'OR', + 'ORDER', + 'ORDINALITY', + 'OUTER', + 'OUTPUT', + 'OVER', + 'OVERFLOW', + 'PARTITION', + 'PARTITIONS', + 'PASSING', + 'PAST', + 'PATH', + 'PATTERN', + 'PER', + 'PERMUTE', + 'PRECEDING', + 'PRECISION', + 'PREPARE', + 'PRIVILEGES', + 'PROPERTIES', + 'PRUNE', + 'QUOTES', + 'RANGE', + 'READ', + 'RECURSIVE', + 'REFRESH', + 'RENAME', + 'REPEATABLE', + 'RESET', + 'RESPECT', + 'RESTRICT', + 'RETURNING', + 'REVOKE', + 'RIGHT', + 'ROLE', + 'ROLES', + 'ROLLBACK', + 'ROLLUP', + 'ROW', + 'ROWS', + 'RUNNING', + 'SCALAR', + 'SCHEMA', + 'SCHEMAS', + 'SECURITY', + 'SEEK', + 'SELECT', + 'SERIALIZABLE', + 'SESSION', + 'SET', + 'SETS', + 'SHOW', + 'SKIP', + 'SOME', + 'START', + 'STATS', + 'STRING', + 'SUBSET', + 'SYSTEM', + 'TABLE', + 'TABLES', + 'TABLESAMPLE', + 'TEXT', + 'THEN', + 'TIES', + 'TIME', + 'TIMESTAMP', + 'TO', + 'TRAILING', + 'TRANSACTION', + 'TRUE', + 'TYPE', + 'UESCAPE', + 'UNBOUNDED', + 'UNCOMMITTED', + 'UNCONDITIONAL', + 'UNION', + 'UNIQUE', + 'UNKNOWN', + 'UNMATCHED', + 'UNNEST', + 'UPDATE', + 'USE', + 'USER', + 'USING', + 'UTF16', + 'UTF32', + 'UTF8', + 'VALIDATE', + 'VALUE', + 'VALUES', + 'VERBOSE', + 'VIEW', + 'WHEN', + 'WHERE', + 'WINDOW', + 'WITH', + 'WITHIN', + 'WITHOUT', + 'WORK', + 'WRAPPER', + 'WRITE', + 'ZONE', + // https://github.com/trinodb/trino/blob/432d2897bdef99388c1a47188743a061c4ac1f34/core/trino-main/src/main/java/io/trino/metadata/TypeRegistry.java#L131-L168 // or https://trino.io/docs/current/language/types.html - types: [ - 'BIGINT', - 'INT', - 'INTEGER', - 'SMALLINT', - 'TINYINT', - 'BOOLEAN', - 'DATE', - 'DECIMAL', - 'REAL', - 'DOUBLE', - 'HYPERLOGLOG', - 'QDIGEST', - 'TDIGEST', - 'P4HYPERLOGLOG', - 'INTERVAL', - 'TIMESTAMP', - 'TIME', - 'VARBINARY', - 'VARCHAR', - 'CHAR', - 'ROW', - 'ARRAY', - 'MAP', - 'JSON', - 'JSON2016', - 'IPADDRESS', - 'GEOMETRY', - 'UUID', - 'SETDIGEST', - 'JONIREGEXP', - 'RE2JREGEXP', - 'LIKEPATTERN', - 'COLOR', - 'CODEPOINTS', - 'FUNCTION', - 'JSONPATH', - ], -}); + 'BIGINT', + 'INT', + 'INTEGER', + 'SMALLINT', + 'TINYINT', + 'BOOLEAN', + 'DATE', + 'DECIMAL', + 'REAL', + 'DOUBLE', + 'HYPERLOGLOG', + 'QDIGEST', + 'TDIGEST', + 'P4HYPERLOGLOG', + 'INTERVAL', + 'TIMESTAMP', + 'TIME', + 'VARBINARY', + 'VARCHAR', + 'CHAR', + 'ROW', + 'ARRAY', + 'MAP', + 'JSON', + 'JSON2016', + 'IPADDRESS', + 'GEOMETRY', + 'UUID', + 'SETDIGEST', + 'JONIREGEXP', + 'RE2JREGEXP', + 'LIKEPATTERN', + 'COLOR', + 'CODEPOINTS', + 'FUNCTION', + 'JSONPATH', +]; diff --git a/src/utils.ts b/src/utils.ts index 25eef752f4..0c65188780 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -15,10 +15,6 @@ export const maxLength = (strings: string[]) => // replaces long whitespace sequences with just one space export const equalizeWhitespace = (s: string) => s.replace(/\s+/gu, ' '); -// Used for flattening keyword lists -export const flatKeywordList = (obj: Record): string[] => - dedupe(Object.values(obj).flat()); - // True when string contains multiple lines export const isMultiline = (text: string): boolean => /\n/.test(text);