sql-formatter
Advanced tools
Comparing version 8.2.0 to 9.0.0-beta1
@@ -115,3 +115,3 @@ "use strict"; | ||
value: function isMissingTypeCastAs() { | ||
return this.aliasAs === 'never' && this.isWithinSelect() && _token.isToken.CAST(this.getPreviousReservedToken()) && _token.isToken.AS(this.lookAhead()) && (this.lookAhead(2).type === _token.TokenType.IDENTIFIER || this.lookAhead(2).type === _token.TokenType.RESERVED_KEYWORD) && this.lookAhead(3).value === ')'; | ||
return this.aliasAs === 'never' && this.isWithinSelect() && _token.isToken.CAST(this.getPreviousReservedToken()) && _token.isToken.AS(this.lookAhead()) && (this.lookAhead(2).type === _token.TokenType.IDENTIFIER || this.lookAhead(2).type === _token.TokenType.RESERVED_KEYWORD || this.lookAhead(2).type === _token.TokenType.RESERVED_FUNCTION_NAME) && this.lookAhead(3).value === ')'; | ||
} // checks for WITH `table` [AS] ( | ||
@@ -118,0 +118,0 @@ |
@@ -244,2 +244,3 @@ "use strict"; | ||
case _token.TokenType.RESERVED_KEYWORD: | ||
case _token.TokenType.RESERVED_FUNCTION_NAME: | ||
return this.formatKeyword(token); | ||
@@ -246,0 +247,0 @@ |
@@ -24,14 +24,2 @@ "use strict"; | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } | ||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } | ||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -74,3 +62,4 @@ | ||
// 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', | ||
'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 | ||
@@ -139,3 +128,6 @@ bitwise: ['BIT_COUNT'], | ||
other: ['BQ.JOBS.CANCEL', 'BQ.REFRESH_MATERIALIZED_VIEW'], | ||
pivot: ['PIVOT', 'UNPIVOT'] | ||
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'] | ||
}; | ||
@@ -246,3 +238,4 @@ /** | ||
reservedDependentClauses: reservedDependentClauses, | ||
reservedKeywords: (0, _utils.dedupe)([].concat(_toConsumableArray(Object.values(reservedFunctions).flat()), _toConsumableArray(Object.values(reservedKeywords).flat()))), | ||
reservedKeywords: (0, _utils.dedupe)(Object.values(reservedKeywords).flat()), | ||
reservedFunctionNames: (0, _utils.dedupe)(Object.values(reservedFunctions).flat()), | ||
openParens: ['(', '['], | ||
@@ -288,3 +281,3 @@ closeParens: [')', ']'], | ||
return detectArraySubscripts(combineParameterizedTypes(tokens)); | ||
} // Converts OFFSET token inside array from RESERVED_COMMAND to RESERVED_KEYWORD | ||
} // Converts OFFSET token inside array from RESERVED_COMMAND to RESERVED_FUNCTION_NAME | ||
// See: https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#array_subscript_operator | ||
@@ -299,3 +292,3 @@ | ||
return _objectSpread(_objectSpread({}, token), {}, { | ||
type: _token.TokenType.RESERVED_KEYWORD | ||
type: _token.TokenType.RESERVED_FUNCTION_NAME | ||
}); | ||
@@ -302,0 +295,0 @@ } else { |
@@ -18,14 +18,2 @@ "use strict"; | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } | ||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } | ||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -68,3 +56,5 @@ | ||
// https://www.ibm.com/docs/en/db2-for-zos/12?topic=expressions-olap-specification | ||
olap: ['FIRST_VALUE', 'LAG', 'LAST_VALUE', 'LEAD', 'NTH_VALUE', 'NTILE', 'RATIO_TO_REPORT'] | ||
olap: ['FIRST_VALUE', 'LAG', 'LAST_VALUE', 'LEAD', 'NTH_VALUE', 'NTILE', 'RATIO_TO_REPORT'], | ||
// Type casting | ||
cast: ['CAST'] | ||
}; | ||
@@ -79,3 +69,4 @@ /** | ||
// https://www.ibm.com/docs/en/db2-for-zos/11?topic=words-reserved#db2z_reservedwords__newresword | ||
standard: ['ALL', 'ALLOCATE', 'ALLOW', 'ALTERAND', 'ANY', 'AS', 'ARRAY', 'ARRAY_EXISTS', 'ASENSITIVE', 'ASSOCIATE', 'ASUTIME', 'AT', 'AUDIT', 'AUX', 'AUXILIARY', 'BEFORE', 'BEGIN', 'BETWEEN', 'BUFFERPOOL', 'BY', 'CAPTURE', 'CASCADED', 'CAST', 'CCSID', 'CHARACTER', 'CHECK', 'CLONE', 'CLUSTER', 'COLLECTION', 'COLLID', 'COLUMN', 'CONDITION', 'CONNECTION', 'CONSTRAINT', 'CONTENT', 'CONTINUE', 'CREATE', 'CUBE', 'CURRENT', 'CURRENT_DATE', 'CURRENT_LC_CTYPE', 'CURRENT_PATH', 'CURRENT_SCHEMA', 'CURRENT_TIME', 'CURRENT_TIMESTAMP', 'CURRVAL', 'CURSOR', 'DATA', 'DATABASE', 'DBINFO', 'DECLARE', 'DEFAULT', 'DESCRIPTOR', 'DETERMINISTIC', 'DISABLE', 'DISALLOW', 'DISTINCT', 'DO', 'DOCUMENT', 'DSSIZE', 'DYNAMIC', 'EDITPROC', 'ENCODING', 'ENCRYPTION', 'ENDING', 'END-EXEC', 'ERASE', 'ESCAPE', 'EXCEPTION', 'EXISTS', 'EXIT', 'EXTERNAL', 'FENCED', 'FIELDPROC', 'FINAL', 'FIRST', 'FOR', 'FREE', 'FULL', 'FUNCTION', 'GENERATED', 'GET', 'GLOBAL', 'GOTO', 'GROUP', 'HANDLER', 'HOLD', 'HOURS', 'IF', 'IMMEDIATE', 'IN', 'INCLUSIVE', 'INDEX', 'INHERIT', 'INNER', 'INOUT', 'INSENSITIVE', 'INTO', 'IS', 'ISOBID', 'ITERATE', 'JAR', 'KEEP', 'KEY', 'LANGUAGE', 'LAST', 'LC_CTYPE', 'LEAVE', 'LIKE', 'LOCAL', 'LOCALE', 'LOCATOR', 'LOCATORS', 'LOCK', 'LOCKMAX', 'LOCKSIZE', 'LONG', 'LOOP', 'MAINTAINED', 'MATERIALIZED', 'MICROSECONDS', 'MINUTEMINUTES', 'MODIFIES', 'MONTHS', 'NEXT', 'NEXTVAL', 'NO', 'NONE', 'NOT', 'NULL', 'NULLS', 'NUMPARTS', 'OBID', 'OF', 'OLD', 'ON DELETE', 'ON UPDATE', 'OPTIMIZATION', 'OPTIMIZE', 'ORDER', 'ORGANIZATION', 'OUT', 'OUTER', 'PACKAGE', 'PARAMETER', 'PART', 'PADDED', 'PARTITION', 'PARTITIONED', 'PARTITIONING', 'PATH', 'PIECESIZE', 'PERIOD', 'PLAN', 'PRECISION', 'PREVVAL', 'PRIOR', 'PRIQTY', 'PRIVILEGES', 'PROCEDURE', 'PROGRAM', 'PSID', 'PUBLIC', 'QUERY', 'QUERYNO', 'READS', 'REFERENCES', 'RESIGNAL', 'RESTRICT', 'RESULT', 'RESULT_SET_LOCATOR', 'RETURN', 'RETURNS', 'ROLE', 'ROLLUP', 'ROUND_CEILING', 'ROUND_DOWN', 'ROUND_FLOOR', 'ROUND_HALF_DOWN', 'ROUND_HALF_EVEN', 'ROUND_HALF_UP', 'ROUND_UP', 'ROW', 'ROWSET', 'SCHEMA', 'SCRATCHPAD', 'SECONDS', 'SECQTY', 'SECURITY', 'SEQUENCE', 'SENSITIVE', 'SESSION_USER', 'SIMPLE', 'SOME', 'SOURCE', 'SPECIFIC', 'STANDARD', 'STATIC', 'STATEMENT', 'STAY', 'STOGROUP', 'STORES', 'STYLE', 'SUMMARY', 'SYNONYM', 'SYSDATE', 'SYSTEM', 'SYSTIMESTAMP', 'TABLE', 'TABLESPACE', 'THEN', 'TO', 'TRIGGER', 'TYPE', 'UNDO', 'UNIQUE', 'UNTIL', 'USER', 'VALIDPROC', 'VARIABLE', 'VARIANT', 'VCAT', 'VERSIONING', 'VIEW', 'VOLATILE', 'VOLUMES', 'WHILE', 'WLM', 'XMLEXISTS', 'XMLCAST', 'YEARS', 'ZONE'], | ||
standard: ['ALL', 'ALLOCATE', 'ALLOW', 'ALTERAND', 'ANY', 'AS', 'ARRAY', 'ARRAY_EXISTS', 'ASENSITIVE', 'ASSOCIATE', 'ASUTIME', 'AT', 'AUDIT', 'AUX', 'AUXILIARY', 'BEFORE', 'BEGIN', 'BETWEEN', 'BUFFERPOOL', 'BY', 'CAPTURE', 'CASCADED', // 'CAST', | ||
'CCSID', 'CHARACTER', 'CHECK', 'CLONE', 'CLUSTER', 'COLLECTION', 'COLLID', 'COLUMN', 'CONDITION', 'CONNECTION', 'CONSTRAINT', 'CONTENT', 'CONTINUE', 'CREATE', 'CUBE', 'CURRENT', 'CURRENT_DATE', 'CURRENT_LC_CTYPE', 'CURRENT_PATH', 'CURRENT_SCHEMA', 'CURRENT_TIME', 'CURRENT_TIMESTAMP', 'CURRVAL', 'CURSOR', 'DATA', 'DATABASE', 'DBINFO', 'DECLARE', 'DEFAULT', 'DESCRIPTOR', 'DETERMINISTIC', 'DISABLE', 'DISALLOW', 'DISTINCT', 'DO', 'DOCUMENT', 'DSSIZE', 'DYNAMIC', 'EDITPROC', 'ENCODING', 'ENCRYPTION', 'ENDING', 'END-EXEC', 'ERASE', 'ESCAPE', 'EXCEPTION', 'EXISTS', 'EXIT', 'EXTERNAL', 'FENCED', 'FIELDPROC', 'FINAL', 'FIRST', 'FOR', 'FREE', 'FULL', 'FUNCTION', 'GENERATED', 'GET', 'GLOBAL', 'GOTO', 'GROUP', 'HANDLER', 'HOLD', 'HOURS', 'IF', 'IMMEDIATE', 'IN', 'INCLUSIVE', 'INDEX', 'INHERIT', 'INNER', 'INOUT', 'INSENSITIVE', 'INTO', 'IS', 'ISOBID', 'ITERATE', 'JAR', 'KEEP', 'KEY', 'LANGUAGE', 'LAST', 'LC_CTYPE', 'LEAVE', 'LIKE', 'LOCAL', 'LOCALE', 'LOCATOR', 'LOCATORS', 'LOCK', 'LOCKMAX', 'LOCKSIZE', 'LONG', 'LOOP', 'MAINTAINED', 'MATERIALIZED', 'MICROSECONDS', 'MINUTEMINUTES', 'MODIFIES', 'MONTHS', 'NEXT', 'NEXTVAL', 'NO', 'NONE', 'NOT', 'NULL', 'NULLS', 'NUMPARTS', 'OBID', 'OF', 'OLD', 'ON DELETE', 'ON UPDATE', 'OPTIMIZATION', 'OPTIMIZE', 'ORDER', 'ORGANIZATION', 'OUT', 'OUTER', 'PACKAGE', 'PARAMETER', 'PART', 'PADDED', 'PARTITION', 'PARTITIONED', 'PARTITIONING', 'PATH', 'PIECESIZE', 'PERIOD', 'PLAN', 'PRECISION', 'PREVVAL', 'PRIOR', 'PRIQTY', 'PRIVILEGES', 'PROCEDURE', 'PROGRAM', 'PSID', 'PUBLIC', 'QUERY', 'QUERYNO', 'READS', 'REFERENCES', 'RESIGNAL', 'RESTRICT', 'RESULT', 'RESULT_SET_LOCATOR', 'RETURN', 'RETURNS', 'ROLE', 'ROLLUP', 'ROUND_CEILING', 'ROUND_DOWN', 'ROUND_FLOOR', 'ROUND_HALF_DOWN', 'ROUND_HALF_EVEN', 'ROUND_HALF_UP', 'ROUND_UP', 'ROW', 'ROWSET', 'SCHEMA', 'SCRATCHPAD', 'SECONDS', 'SECQTY', 'SECURITY', 'SEQUENCE', 'SENSITIVE', 'SESSION_USER', 'SIMPLE', 'SOME', 'SOURCE', 'SPECIFIC', 'STANDARD', 'STATIC', 'STATEMENT', 'STAY', 'STOGROUP', 'STORES', 'STYLE', 'SUMMARY', 'SYNONYM', 'SYSDATE', 'SYSTEM', 'SYSTIMESTAMP', 'TABLE', 'TABLESPACE', 'THEN', 'TO', 'TRIGGER', 'TYPE', 'UNDO', 'UNIQUE', 'UNTIL', 'USER', 'VALIDPROC', 'VARIABLE', 'VARIANT', 'VCAT', 'VERSIONING', 'VIEW', 'VOLATILE', 'VOLUMES', 'WHILE', 'WLM', 'XMLEXISTS', 'XMLCAST', 'YEARS', 'ZONE'], | ||
// https://www.ibm.com/docs/en/db2-for-zos/11?topic=utilities-db2-online | ||
@@ -126,3 +117,4 @@ onlineUtilies: ['BACKUP SYSTEM', 'CATENFM', 'CATMAINT', 'CHECK DATA', 'CHECK INDEX', 'CHECK LOB', 'COPY', 'COPYTOCOPY', 'DIAGNOSE', 'EXEC SQL', 'LISTDEF', 'LOAD', 'MERGECOPY', 'MODIFY RECOVERY', 'MODIFY STATISTICS', 'OPTIONS', 'QUIESCE', 'REBUILD INDEX', 'RECOVER', 'REORG INDEX', 'REORG TABLESPACE', 'REPAIR', 'REPORT', 'RESTORE SYSTEM', 'RUNSTATS', 'STOSPACE', 'TEMPLATE', 'UNLOAD'], | ||
reservedDependentClauses: reservedDependentClauses, | ||
reservedKeywords: (0, _utils.dedupe)([].concat(_toConsumableArray(Object.values(reservedFunctions).flat()), _toConsumableArray(Object.values(reservedKeywords).flat()))), | ||
reservedKeywords: (0, _utils.dedupe)(Object.values(reservedKeywords).flat()), | ||
reservedFunctionNames: (0, _utils.dedupe)(Object.values(reservedFunctions).flat()), | ||
stringTypes: [{ | ||
@@ -129,0 +121,0 @@ quote: "''", |
@@ -18,14 +18,2 @@ "use strict"; | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } | ||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } | ||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -70,3 +58,10 @@ | ||
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'] | ||
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'], | ||
// 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'] | ||
}; | ||
@@ -157,3 +152,4 @@ /** | ||
reservedDependentClauses: reservedDependentClauses, | ||
reservedKeywords: (0, _utils.dedupe)([].concat(_toConsumableArray(Object.values(reservedFunctions).flat()), _toConsumableArray(Object.values(reservedKeywords).flat()))), | ||
reservedKeywords: (0, _utils.dedupe)(Object.values(reservedKeywords).flat()), | ||
reservedFunctionNames: (0, _utils.dedupe)(Object.values(reservedFunctions).flat()), | ||
openParens: ['(', '['], | ||
@@ -160,0 +156,0 @@ closeParens: [')', ']'], |
@@ -52,3 +52,8 @@ "use strict"; | ||
// https://mariadb.com/kb/en/information-schema-sql_functions-table/ | ||
var reservedFunctions = ['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', 'NULLIF', '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']; | ||
var reservedFunctions = ['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']; | ||
/** | ||
@@ -103,3 +108,4 @@ * Priority 5 (last) | ||
reservedLogicalOperators: ['AND', 'OR', 'XOR'], | ||
reservedKeywords: (0, _utils.dedupe)([].concat(reservedKeywords, reservedFunctions)), | ||
reservedKeywords: (0, _utils.dedupe)(reservedKeywords), | ||
reservedFunctionNames: (0, _utils.dedupe)(reservedFunctions), | ||
stringTypes: ['""', { | ||
@@ -151,3 +157,3 @@ quote: "''", | ||
return _objectSpread(_objectSpread({}, token), {}, { | ||
type: _token.TokenType.RESERVED_KEYWORD | ||
type: _token.TokenType.RESERVED_FUNCTION_NAME | ||
}); | ||
@@ -154,0 +160,0 @@ } |
@@ -55,5 +55,9 @@ "use strict"; | ||
var reservedFunctions = ['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', | ||
'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']; | ||
'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 | ||
]; | ||
/** | ||
@@ -66,3 +70,4 @@ * Priority 5 (last) | ||
var reservedKeywords = ['ACCESSIBLE', 'ACCOUNT', 'ACTION', 'ACTIVE', 'ADMIN', 'AFTER', 'AGAINST', 'AGGREGATE', 'ALGORITHM', 'ALL', 'ALTER', 'ALWAYS', 'ANALYSE', 'ANALYZE', 'ANY', 'ARRAY', 'AS', 'ASC', 'ASENSITIVE', 'AT', 'ATTRIBUTE', 'AUTHENTICATION', 'AUTOEXTEND_SIZE', 'AUTO_INCREMENT', 'AVG_ROW_LENGTH', 'BACKUP', 'BEFORE', 'BEGIN', 'BETWEEN', 'BIGINT', 'BIT', 'BLOB', 'BLOCK', 'BOOL', 'BOOLEAN', 'BOTH', 'BTREE', 'BUCKETS', 'BY', 'BYTE', 'CACHE', 'CASCADE', 'CASCADED', 'CATALOG_NAME', 'CHAIN', 'CHALLENGE_RESPONSE', 'CHANGE', 'CHANGED', 'CHANNEL', 'CHARACTER', 'CHARACTER SET', 'CHECK', 'CHECKSUM', 'CIPHER', 'CLASS_ORIGIN', 'CLIENT', 'CLOSE', 'CODE', 'COLLATE', 'COLUMN', 'COLUMNS', 'COLUMN_FORMAT', 'COLUMN_NAME', 'COMMENT', 'COMMITTED', 'COMPACT', 'COMPLETION', 'COMPONENT', 'COMPRESSED', 'COMPRESSION', 'CONCURRENT', 'CONDITION', 'CONNECTION', 'CONSISTENT', 'CONSTRAINT', 'CONSTRAINT_CATALOG', 'CONSTRAINT_NAME', 'CONSTRAINT_SCHEMA', 'CONTAINS', 'CONTEXT', 'CONTINUE', 'CPU', 'CREATE', 'CROSS', 'CUBE', 'CURRENT', 'CURSOR', 'CURSOR_NAME', 'DATA', 'DATABASES', 'DATAFILE', 'DATETIME', 'DAY_HOUR', 'DAY_MICROSECOND', 'DAY_MINUTE', 'DAY_SECOND', 'DEALLOCATE', 'DEC', 'DECIMAL', 'DECLARE', 'DEFAULT_AUTH', 'DEFINER', 'DEFINITION', 'DELAYED', 'DELAY_KEY_WRITE', 'DESC', 'DESCRIPTION', 'DES_KEY_FILE', 'DETERMINISTIC', 'DIAGNOSTICS', 'DIRECTORY', 'DISABLE', 'DISCARD', 'DISK', 'DISTINCT', 'DISTINCTROW', 'DOUBLE', 'DROP', 'DUAL', 'DUMPFILE', 'DUPLICATE', 'DYNAMIC', 'EACH', 'EMPTY', 'ENABLE', 'ENCLOSED', 'ENCRYPTION', 'ENDS', 'ENFORCED', 'ENGINE', 'ENGINES', 'ENGINE_ATTRIBUTE', 'ENUM', 'ERROR', 'ERRORS', 'ESCAPE', 'ESCAPED', 'EVENT', 'EVENTS', 'EVERY', 'EXCHANGE', 'EXCLUDE', 'EXISTS', 'EXIT', 'EXPANSION', 'EXPIRE', 'EXPORT', 'EXTENDED', 'EXTENT_SIZE', 'FACTOR', 'FAILED_LOGIN_ATTEMPTS', 'FALSE', 'FAST', 'FAULTS', 'FETCH', 'FIELDS', 'FILE', 'FILE_BLOCK_SIZE', 'FILTER', 'FINISH', 'FIRST', 'FIXED', 'FLOAT', 'FLOAT4', 'FLOAT8', 'FOLLOWING', 'FOLLOWS', 'FOR', 'FORCE', 'FOREIGN', 'FOUND', 'FULL', 'FULLTEXT', 'FUNCTION', 'GENERAL', 'GENERATED', 'GEOMCOLLECTION', 'GEOMETRY', 'GEOMETRYCOLLECTION', 'GET', 'GET_MASTER_PUBLIC_KEY', 'GET_SOURCE_PUBLIC_KEY', 'GLOBAL', '@@GLOBAL', 'GRANTS', 'GROUP', 'GROUPS', 'GROUP_REPLICATION', 'GTID_ONLY', 'HASH', 'HIGH_PRIORITY', 'HISTOGRAM', 'HISTORY', 'HOST', 'HOSTS', 'HOUR_MICROSECOND', 'HOUR_MINUTE', 'HOUR_SECOND', 'IDENTIFIED', 'IGNORE', 'IGNORE_SERVER_IDS', 'IMPORT', 'INACTIVE', 'INDEX', 'INDEXES', 'INFILE', 'INITIAL', 'INITIAL_SIZE', 'INITIATE', 'INNER', 'INOUT', 'INSENSITIVE', 'INSERT_METHOD', 'INSTALL', 'INSTANCE', 'INT', 'INT1', 'INT2', 'INT3', 'INT4', 'INT8', 'INTEGER', 'INTO', 'INVISIBLE', 'INVOKER', 'IO', 'IO_AFTER_GTIDS', 'IO_BEFORE_GTIDS', 'IO_THREAD', 'IPC', 'ISOLATION', 'ISSUER', 'ITERATE', 'JSON', 'KEY', 'KEYRING', 'KEYS', 'KEY_BLOCK_SIZE', 'LANGUAGE', 'LAST', 'LATERAL', 'LEADING', 'LEAVE', 'LEAVES', 'LESS', 'LEVEL', 'LINEAR', 'LINES', 'LINESTRING', 'LIST', 'LOAD', 'LOCAL', 'LOCK', 'LOCKED', 'LOCKS', 'LOGFILE', 'LOGS', 'LONG', 'LONGBLOB', 'LONGTEXT', 'LOOP', 'LOW_PRIORITY', 'MASTER', 'MASTER_AUTO_POSITION', 'MASTER_BIND', 'MASTER_COMPRESSION_ALGORITHMS', 'MASTER_CONNECT_RETRY', 'MASTER_DELAY', 'MASTER_HEARTBEAT_PERIOD', 'MASTER_HOST', 'MASTER_LOG_FILE', 'MASTER_LOG_POS', 'MASTER_PASSWORD', 'MASTER_PORT', 'MASTER_PUBLIC_KEY_PATH', 'MASTER_RETRY_COUNT', 'MASTER_SERVER_ID', 'MASTER_SSL', 'MASTER_SSL_CA', 'MASTER_SSL_CAPATH', 'MASTER_SSL_CERT', 'MASTER_SSL_CIPHER', 'MASTER_SSL_CRL', 'MASTER_SSL_CRLPATH', 'MASTER_SSL_KEY', 'MASTER_SSL_VERIFY_SERVER_CERT', 'MASTER_TLS_CIPHERSUITES', 'MASTER_TLS_VERSION', 'MASTER_USER', 'MASTER_ZSTD_COMPRESSION_LEVEL', 'MAXVALUE', 'MAX_CONNECTIONS_PER_HOUR', 'MAX_QUERIES_PER_HOUR', 'MAX_ROWS', 'MAX_SIZE', 'MAX_UPDATES_PER_HOUR', 'MAX_USER_CONNECTIONS', 'MEDIUM', 'MEDIUMBLOB', 'MEDIUMINT', 'MEDIUMTEXT', 'MEMBER', 'MEMORY', 'MERGE', 'MESSAGE_TEXT', 'MIDDLEINT', 'MIGRATE', 'MINUTE_MICROSECOND', 'MINUTE_SECOND', 'MIN_ROWS', 'MODE', 'MODIFIES', 'MODIFY', 'MULTILINESTRING', 'MULTIPOINT', 'MULTIPOLYGON', 'MUTEX', 'MYSQL_ERRNO', 'NAME', 'NAMES', 'NATIONAL', 'NATURAL', 'NCHAR', 'NDB', 'NDBCLUSTER', 'NESTED', 'NETWORK_NAMESPACE', 'NEVER', 'NEW', 'NEXT', 'NO', 'NODEGROUP', 'NONE', 'NOWAIT', 'NO_WAIT', 'NO_WRITE_TO_BINLOG', 'NULL', 'NULLS', 'NUMBER', 'NUMERIC', 'NVARCHAR', 'OF', 'OFF', 'OFFSET', 'OJ', 'OLD', 'ON DELETE', 'ON UPDATE', 'ONE', 'ONLY', 'OPEN', 'OPTIMIZE', 'OPTIMIZER_COSTS', 'OPTION', 'OPTIONAL', 'OPTIONALLY', 'OPTIONS', 'ORDER', 'ORDINALITY', 'ORGANIZATION', 'OTHERS', 'OUT', 'OUTER', 'OUTFILE', 'OVER', 'OWNER', 'PACK_KEYS', 'PAGE', 'PARSER', 'PARSE_GCOL_EXPR', 'PARTIAL', 'PARTITION', 'PARTITIONING', 'PARTITIONS', 'PASSWORD', 'PASSWORD_LOCK_TIME', 'PATH', 'PERSIST', '@@PERSIST', 'PERSIST_ONLY', '@@PERSIST_ONLY', 'PHASE', 'PLUGIN', 'PLUGINS', 'PLUGIN_DIR', 'POINT', 'POLYGON', 'PORT', 'PRECEDES', 'PRECEDING', 'PRECISION', 'PRESERVE', 'PREV', 'PRIMARY', 'PRIVILEGES', 'PRIVILEGE_CHECKS_USER', 'PROCEDURE', 'PROCESS', 'PROCESSLIST', 'PROFILE', 'PROFILES', 'PROXY', 'PURGE', 'QUERY', 'QUICK', 'RANDOM', 'RANGE', 'READ', 'READS', 'READ_ONLY', 'READ_WRITE', 'REAL', 'REBUILD', 'RECOVER', 'RECURSIVE', 'REDOFILE', 'REDO_BUFFER_SIZE', 'REDUNDANT', 'REFERENCE', 'REFERENCES', 'REGISTRATION', 'RELAY', 'RELAYLOG', 'RELAY_LOG_FILE', 'RELAY_LOG_POS', 'RELAY_THREAD', 'RELEASE', 'RELOAD', 'REMOTE', 'REMOVE', 'RENAME', 'REORGANIZE', 'REPAIR', 'REPEATABLE', 'REPLICA', 'REPLICAS', 'REPLICATE_DO_DB', 'REPLICATE_DO_TABLE', 'REPLICATE_IGNORE_DB', 'REPLICATE_IGNORE_TABLE', 'REPLICATE_REWRITE_DB', 'REPLICATE_WILD_DO_TABLE', 'REPLICATE_WILD_IGNORE_TABLE', 'REPLICATION', 'REQUIRE', 'REQUIRE_ROW_FORMAT', 'RESIGNAL', 'RESOURCE', 'RESPECT', 'RESTORE', 'RESTRICT', 'RESUME', 'RETAIN', 'RETURN', 'RETURNED_SQLSTATE', 'RETURNING', 'RETURNS', 'REUSE', 'ROLE', 'ROLLUP', 'ROTATE', 'ROUTINE', 'ROW', 'ROWS', 'ROW_FORMAT', 'RTREE', 'SCHEDULE', 'SCHEMAS', 'SCHEMA_NAME', 'SECONDARY', 'SECONDARY_ENGINE', 'SECONDARY_ENGINE_ATTRIBUTE', 'SECONDARY_LOAD', 'SECONDARY_UNLOAD', 'SECOND_MICROSECOND', 'SECURITY', 'SENSITIVE', 'SEPARATOR', 'SERIAL', 'SERIALIZABLE', 'SERVER', 'SESSION', '@@SESSION', 'SHARE', 'SIGNAL', 'SIGNED', 'SIMPLE', 'SKIP', 'SLAVE', 'SLOW', 'SMALLINT', 'SNAPSHOT', 'SOCKET', 'SOME', 'SONAME', 'SOUNDS', 'SOURCE', 'SOURCE_AUTO_POSITION', 'SOURCE_BIND', 'SOURCE_COMPRESSION_ALGORITHMS', 'SOURCE_CONNECT_RETRY', 'SOURCE_DELAY', 'SOURCE_HEARTBEAT_PERIOD', 'SOURCE_HOST', 'SOURCE_LOG_FILE', 'SOURCE_LOG_POS', 'SOURCE_PASSWORD', 'SOURCE_PORT', 'SOURCE_PUBLIC_KEY_PATH', 'SOURCE_RETRY_COUNT', 'SOURCE_SSL', 'SOURCE_SSL_CA', 'SOURCE_SSL_CAPATH', 'SOURCE_SSL_CERT', 'SOURCE_SSL_CIPHER', 'SOURCE_SSL_CRL', 'SOURCE_SSL_CRLPATH', 'SOURCE_SSL_KEY', 'SOURCE_SSL_VERIFY_SERVER_CERT', 'SOURCE_TLS_CIPHERSUITES', 'SOURCE_TLS_VERSION', 'SOURCE_USER', 'SOURCE_ZSTD_COMPRESSION_LEVEL', 'SPATIAL', 'SPECIFIC', 'SQL', 'SQLEXCEPTION', 'SQLSTATE', 'SQLWARNING', 'SQL_AFTER_GTIDS', 'SQL_AFTER_MTS_GAPS', 'SQL_BEFORE_GTIDS', 'SQL_BIG_RESULT', 'SQL_BUFFER_RESULT', 'SQL_CACHE', 'SQL_CALC_FOUND_ROWS', 'SQL_NO_CACHE', 'SQL_SMALL_RESULT', 'SQL_THREAD', 'SQL_TSI_DAY', 'SQL_TSI_HOUR', 'SQL_TSI_MINUTE', 'SQL_TSI_MONTH', 'SQL_TSI_QUARTER', 'SQL_TSI_SECOND', 'SQL_TSI_WEEK', 'SQL_TSI_YEAR', 'SRID', 'SSL', 'STACKED', 'START', 'STARTING', 'STARTS', 'STATS_AUTO_RECALC', 'STATS_PERSISTENT', 'STATS_SAMPLE_PAGES', 'STATUS', 'STOP', 'STORAGE', 'STORED', 'STREAM', 'STRING', 'SUBCLASS_ORIGIN', 'SUBJECT', 'SUBPARTITION', 'SUBPARTITIONS', 'SUPER', 'SUSPEND', 'SWAPS', 'SWITCHES', 'SYSTEM', 'TABLES', 'TABLESPACE', 'TABLE_CHECKSUM', 'TABLE_NAME', 'TEMPORARY', 'TEMPTABLE', 'TERMINATED', 'TEXT', 'THAN', 'THEN', 'THREAD_PRIORITY', 'TIES', 'TINYBLOB', 'TINYINT', 'TINYTEXT', 'TLS', 'TO', 'TRAILING', 'TRANSACTION', 'TRIGGER', 'TRIGGERS', 'TRUE', 'TYPE', 'TYPES', 'UNBOUNDED', 'UNCOMMITTED', 'UNDEFINED', 'UNDO', 'UNDOFILE', 'UNDO_BUFFER_SIZE', 'UNICODE', 'UNINSTALL', 'UNIQUE', 'UNKNOWN', 'UNLOCK', 'UNREGISTER', 'UNSIGNED', 'UNTIL', 'UPGRADE', 'USAGE', 'USER_RESOURCES', 'USE_FRM', 'VALIDATION', 'VALUE', 'VARBINARY', 'VARCHAR', 'VARCHARACTER', 'VARIABLES', 'VARYING', 'VCPU', 'VIEW', 'VIRTUAL', 'VISIBLE', 'WAIT', 'WARNINGS', 'WHILE', 'WINDOW', 'WITHOUT', 'WORK', 'WRAPPER', 'WRITE', 'X509', 'XID', 'XML', 'YEAR_MONTH', 'ZEROFILL', 'ZONE']; | ||
var reservedKeywords = ['ACCESSIBLE', 'ACCOUNT', 'ACTION', 'ACTIVE', 'ADMIN', 'AFTER', 'AGAINST', 'AGGREGATE', 'ALGORITHM', 'ALL', 'ALTER', 'ALWAYS', 'ANALYSE', 'ANALYZE', 'ANY', 'ARRAY', 'AS', 'ASC', 'ASENSITIVE', 'AT', 'ATTRIBUTE', 'AUTHENTICATION', 'AUTOEXTEND_SIZE', 'AUTO_INCREMENT', 'AVG_ROW_LENGTH', 'BACKUP', 'BEFORE', 'BEGIN', 'BETWEEN', 'BIGINT', 'BIT', 'BLOB', 'BLOCK', 'BOOL', 'BOOLEAN', 'BOTH', 'BTREE', 'BUCKETS', 'BY', 'BYTE', 'CACHE', 'CASCADE', 'CASCADED', 'CATALOG_NAME', 'CHAIN', 'CHALLENGE_RESPONSE', 'CHANGE', 'CHANGED', 'CHANNEL', 'CHARACTER', 'CHARACTER SET', 'CHECK', 'CHECKSUM', 'CIPHER', 'CLASS_ORIGIN', 'CLIENT', 'CLOSE', 'CODE', 'COLLATE', 'COLUMN', 'COLUMNS', 'COLUMN_FORMAT', 'COLUMN_NAME', 'COMMENT', 'COMMITTED', 'COMPACT', 'COMPLETION', 'COMPONENT', 'COMPRESSED', 'COMPRESSION', 'CONCURRENT', 'CONDITION', 'CONNECTION', 'CONSISTENT', 'CONSTRAINT', 'CONSTRAINT_CATALOG', 'CONSTRAINT_NAME', 'CONSTRAINT_SCHEMA', 'CONTAINS', 'CONTEXT', 'CONTINUE', 'CPU', 'CREATE', 'CROSS', 'CUBE', 'CURRENT', 'CURSOR', 'CURSOR_NAME', 'DATA', 'DATABASES', 'DATAFILE', 'DATETIME', 'DAY_HOUR', 'DAY_MICROSECOND', 'DAY_MINUTE', 'DAY_SECOND', 'DEALLOCATE', 'DEC', 'DECIMAL', 'DECLARE', 'DEFAULT_AUTH', 'DEFINER', 'DEFINITION', 'DELAYED', 'DELAY_KEY_WRITE', 'DESC', 'DESCRIPTION', 'DES_KEY_FILE', 'DETERMINISTIC', 'DIAGNOSTICS', 'DIRECTORY', 'DISABLE', 'DISCARD', 'DISK', 'DISTINCT', 'DISTINCTROW', 'DOUBLE', 'DROP', 'DUAL', 'DUMPFILE', 'DUPLICATE', 'DYNAMIC', 'EACH', 'EMPTY', 'ENABLE', 'ENCLOSED', 'ENCRYPTION', 'ENDS', 'ENFORCED', 'ENGINE', 'ENGINES', 'ENGINE_ATTRIBUTE', 'ENUM', 'ERROR', 'ERRORS', 'ESCAPE', 'ESCAPED', 'EVENT', 'EVENTS', 'EVERY', 'EXCHANGE', 'EXCLUDE', 'EXISTS', 'EXIT', 'EXPANSION', 'EXPIRE', 'EXPORT', 'EXTENDED', 'EXTENT_SIZE', 'FACTOR', 'FAILED_LOGIN_ATTEMPTS', 'FALSE', 'FAST', 'FAULTS', 'FETCH', 'FIELDS', 'FILE', 'FILE_BLOCK_SIZE', 'FILTER', 'FINISH', 'FIRST', 'FIXED', 'FLOAT', 'FLOAT4', 'FLOAT8', 'FOLLOWING', 'FOLLOWS', 'FOR', 'FORCE', 'FOREIGN', 'FOUND', 'FULL', 'FULLTEXT', 'FUNCTION', 'GENERAL', 'GENERATED', 'GEOMCOLLECTION', 'GEOMETRY', 'GEOMETRYCOLLECTION', 'GET', 'GET_MASTER_PUBLIC_KEY', 'GET_SOURCE_PUBLIC_KEY', 'GLOBAL', '@@GLOBAL', 'GRANTS', 'GROUP', 'GROUPS', 'GROUP_REPLICATION', 'GTID_ONLY', 'HASH', 'HIGH_PRIORITY', 'HISTOGRAM', 'HISTORY', 'HOST', 'HOSTS', 'HOUR_MICROSECOND', 'HOUR_MINUTE', 'HOUR_SECOND', 'IDENTIFIED', 'IGNORE', 'IGNORE_SERVER_IDS', 'IMPORT', 'INACTIVE', 'INDEX', 'INDEXES', 'INFILE', 'INITIAL', 'INITIAL_SIZE', 'INITIATE', 'INNER', 'INOUT', 'INSENSITIVE', 'INSERT_METHOD', 'INSTALL', 'INSTANCE', 'IN', // <-- moved over from functions | ||
'INT', 'INT1', 'INT2', 'INT3', 'INT4', 'INT8', 'INTEGER', 'INTO', 'INVISIBLE', 'INVOKER', 'IO', 'IO_AFTER_GTIDS', 'IO_BEFORE_GTIDS', 'IO_THREAD', 'IPC', 'ISOLATION', 'ISSUER', 'ITERATE', 'JSON', 'KEY', 'KEYRING', 'KEYS', 'KEY_BLOCK_SIZE', 'LANGUAGE', 'LAST', 'LATERAL', 'LEADING', 'LEAVE', 'LEAVES', 'LESS', 'LEVEL', 'LINEAR', 'LINES', 'LINESTRING', 'LIST', 'LOAD', 'LOCAL', 'LOCK', 'LOCKED', 'LOCKS', 'LOGFILE', 'LOGS', 'LONG', 'LONGBLOB', 'LONGTEXT', 'LOOP', 'LOW_PRIORITY', 'MASTER', 'MASTER_AUTO_POSITION', 'MASTER_BIND', 'MASTER_COMPRESSION_ALGORITHMS', 'MASTER_CONNECT_RETRY', 'MASTER_DELAY', 'MASTER_HEARTBEAT_PERIOD', 'MASTER_HOST', 'MASTER_LOG_FILE', 'MASTER_LOG_POS', 'MASTER_PASSWORD', 'MASTER_PORT', 'MASTER_PUBLIC_KEY_PATH', 'MASTER_RETRY_COUNT', 'MASTER_SERVER_ID', 'MASTER_SSL', 'MASTER_SSL_CA', 'MASTER_SSL_CAPATH', 'MASTER_SSL_CERT', 'MASTER_SSL_CIPHER', 'MASTER_SSL_CRL', 'MASTER_SSL_CRLPATH', 'MASTER_SSL_KEY', 'MASTER_SSL_VERIFY_SERVER_CERT', 'MASTER_TLS_CIPHERSUITES', 'MASTER_TLS_VERSION', 'MASTER_USER', 'MASTER_ZSTD_COMPRESSION_LEVEL', 'MAXVALUE', 'MAX_CONNECTIONS_PER_HOUR', 'MAX_QUERIES_PER_HOUR', 'MAX_ROWS', 'MAX_SIZE', 'MAX_UPDATES_PER_HOUR', 'MAX_USER_CONNECTIONS', 'MEDIUM', 'MEDIUMBLOB', 'MEDIUMINT', 'MEDIUMTEXT', 'MEMBER', 'MEMORY', 'MERGE', 'MESSAGE_TEXT', 'MIDDLEINT', 'MIGRATE', 'MINUTE_MICROSECOND', 'MINUTE_SECOND', 'MIN_ROWS', 'MODE', 'MODIFIES', 'MODIFY', 'MULTILINESTRING', 'MULTIPOINT', 'MULTIPOLYGON', 'MUTEX', 'MYSQL_ERRNO', 'NAME', 'NAMES', 'NATIONAL', 'NATURAL', 'NCHAR', 'NDB', 'NDBCLUSTER', 'NESTED', 'NETWORK_NAMESPACE', 'NEVER', 'NEW', 'NEXT', 'NO', 'NODEGROUP', 'NONE', 'NOWAIT', 'NO_WAIT', 'NO_WRITE_TO_BINLOG', 'NULL', 'NULLS', 'NUMBER', 'NUMERIC', 'NVARCHAR', 'OF', 'OFF', 'OFFSET', 'OJ', 'OLD', 'ON DELETE', 'ON UPDATE', 'ONE', 'ONLY', 'OPEN', 'OPTIMIZE', 'OPTIMIZER_COSTS', 'OPTION', 'OPTIONAL', 'OPTIONALLY', 'OPTIONS', 'ORDER', 'ORDINALITY', 'ORGANIZATION', 'OTHERS', 'OUT', 'OUTER', 'OUTFILE', 'OVER', 'OWNER', 'PACK_KEYS', 'PAGE', 'PARSER', 'PARSE_GCOL_EXPR', 'PARTIAL', 'PARTITION', 'PARTITIONING', 'PARTITIONS', 'PASSWORD', 'PASSWORD_LOCK_TIME', 'PATH', 'PERSIST', '@@PERSIST', 'PERSIST_ONLY', '@@PERSIST_ONLY', 'PHASE', 'PLUGIN', 'PLUGINS', 'PLUGIN_DIR', 'POINT', 'POLYGON', 'PORT', 'PRECEDES', 'PRECEDING', 'PRECISION', 'PRESERVE', 'PREV', 'PRIMARY', 'PRIVILEGES', 'PRIVILEGE_CHECKS_USER', 'PROCEDURE', 'PROCESS', 'PROCESSLIST', 'PROFILE', 'PROFILES', 'PROXY', 'PURGE', 'QUERY', 'QUICK', 'RANDOM', 'RANGE', 'READ', 'READS', 'READ_ONLY', 'READ_WRITE', 'REAL', 'REBUILD', 'RECOVER', 'RECURSIVE', 'REDOFILE', 'REDO_BUFFER_SIZE', 'REDUNDANT', 'REFERENCE', 'REFERENCES', 'REGISTRATION', 'RELAY', 'RELAYLOG', 'RELAY_LOG_FILE', 'RELAY_LOG_POS', 'RELAY_THREAD', 'RELEASE', 'RELOAD', 'REMOTE', 'REMOVE', 'RENAME', 'REORGANIZE', 'REPAIR', 'REPEATABLE', 'REPLICA', 'REPLICAS', 'REPLICATE_DO_DB', 'REPLICATE_DO_TABLE', 'REPLICATE_IGNORE_DB', 'REPLICATE_IGNORE_TABLE', 'REPLICATE_REWRITE_DB', 'REPLICATE_WILD_DO_TABLE', 'REPLICATE_WILD_IGNORE_TABLE', 'REPLICATION', 'REQUIRE', 'REQUIRE_ROW_FORMAT', 'RESIGNAL', 'RESOURCE', 'RESPECT', 'RESTORE', 'RESTRICT', 'RESUME', 'RETAIN', 'RETURN', 'RETURNED_SQLSTATE', 'RETURNING', 'RETURNS', 'REUSE', 'ROLE', 'ROLLUP', 'ROTATE', 'ROUTINE', 'ROW', 'ROWS', 'ROW_FORMAT', 'RTREE', 'SCHEDULE', 'SCHEMAS', 'SCHEMA_NAME', 'SECONDARY', 'SECONDARY_ENGINE', 'SECONDARY_ENGINE_ATTRIBUTE', 'SECONDARY_LOAD', 'SECONDARY_UNLOAD', 'SECOND_MICROSECOND', 'SECURITY', 'SENSITIVE', 'SEPARATOR', 'SERIAL', 'SERIALIZABLE', 'SERVER', 'SESSION', '@@SESSION', 'SHARE', 'SIGNAL', 'SIGNED', 'SIMPLE', 'SKIP', 'SLAVE', 'SLOW', 'SMALLINT', 'SNAPSHOT', 'SOCKET', 'SOME', 'SONAME', 'SOUNDS', 'SOURCE', 'SOURCE_AUTO_POSITION', 'SOURCE_BIND', 'SOURCE_COMPRESSION_ALGORITHMS', 'SOURCE_CONNECT_RETRY', 'SOURCE_DELAY', 'SOURCE_HEARTBEAT_PERIOD', 'SOURCE_HOST', 'SOURCE_LOG_FILE', 'SOURCE_LOG_POS', 'SOURCE_PASSWORD', 'SOURCE_PORT', 'SOURCE_PUBLIC_KEY_PATH', 'SOURCE_RETRY_COUNT', 'SOURCE_SSL', 'SOURCE_SSL_CA', 'SOURCE_SSL_CAPATH', 'SOURCE_SSL_CERT', 'SOURCE_SSL_CIPHER', 'SOURCE_SSL_CRL', 'SOURCE_SSL_CRLPATH', 'SOURCE_SSL_KEY', 'SOURCE_SSL_VERIFY_SERVER_CERT', 'SOURCE_TLS_CIPHERSUITES', 'SOURCE_TLS_VERSION', 'SOURCE_USER', 'SOURCE_ZSTD_COMPRESSION_LEVEL', 'SPATIAL', 'SPECIFIC', 'SQL', 'SQLEXCEPTION', 'SQLSTATE', 'SQLWARNING', 'SQL_AFTER_GTIDS', 'SQL_AFTER_MTS_GAPS', 'SQL_BEFORE_GTIDS', 'SQL_BIG_RESULT', 'SQL_BUFFER_RESULT', 'SQL_CACHE', 'SQL_CALC_FOUND_ROWS', 'SQL_NO_CACHE', 'SQL_SMALL_RESULT', 'SQL_THREAD', 'SQL_TSI_DAY', 'SQL_TSI_HOUR', 'SQL_TSI_MINUTE', 'SQL_TSI_MONTH', 'SQL_TSI_QUARTER', 'SQL_TSI_SECOND', 'SQL_TSI_WEEK', 'SQL_TSI_YEAR', 'SRID', 'SSL', 'STACKED', 'START', 'STARTING', 'STARTS', 'STATS_AUTO_RECALC', 'STATS_PERSISTENT', 'STATS_SAMPLE_PAGES', 'STATUS', 'STOP', 'STORAGE', 'STORED', 'STREAM', 'STRING', 'SUBCLASS_ORIGIN', 'SUBJECT', 'SUBPARTITION', 'SUBPARTITIONS', 'SUPER', 'SUSPEND', 'SWAPS', 'SWITCHES', 'SYSTEM', 'TABLES', 'TABLESPACE', 'TABLE_CHECKSUM', 'TABLE_NAME', 'TEMPORARY', 'TEMPTABLE', 'TERMINATED', 'TEXT', 'THAN', 'THEN', 'THREAD_PRIORITY', 'TIES', 'TINYBLOB', 'TINYINT', 'TINYTEXT', 'TLS', 'TO', 'TRAILING', 'TRANSACTION', 'TRIGGER', 'TRIGGERS', 'TRUE', 'TYPE', 'TYPES', 'UNBOUNDED', 'UNCOMMITTED', 'UNDEFINED', 'UNDO', 'UNDOFILE', 'UNDO_BUFFER_SIZE', 'UNICODE', 'UNINSTALL', 'UNIQUE', 'UNKNOWN', 'UNLOCK', 'UNREGISTER', 'UNSIGNED', 'UNTIL', 'UPGRADE', 'USAGE', 'USER_RESOURCES', 'USE_FRM', 'VALIDATION', 'VALUE', 'VARBINARY', 'VARCHAR', 'VARCHARACTER', 'VARIABLES', 'VARYING', 'VCPU', 'VIEW', 'VIRTUAL', 'VISIBLE', 'WAIT', 'WARNINGS', 'WHILE', 'WINDOW', 'WITHOUT', 'WORK', 'WRAPPER', 'WRITE', 'X509', 'XID', 'XML', 'YEAR_MONTH', 'ZEROFILL', 'ZONE']; | ||
/** | ||
@@ -110,3 +115,4 @@ * Priority 1 (first) | ||
reservedLogicalOperators: ['AND', 'OR', 'XOR'], | ||
reservedKeywords: (0, _utils.dedupe)([].concat(reservedKeywords, reservedFunctions)), | ||
reservedKeywords: (0, _utils.dedupe)(reservedKeywords), | ||
reservedFunctionNames: (0, _utils.dedupe)(reservedFunctions), | ||
stringTypes: ['""', { | ||
@@ -158,3 +164,3 @@ quote: "''", | ||
return _objectSpread(_objectSpread({}, token), {}, { | ||
type: _token.TokenType.RESERVED_KEYWORD | ||
type: _token.TokenType.RESERVED_FUNCTION_NAME | ||
}); | ||
@@ -161,0 +167,0 @@ } |
@@ -50,3 +50,6 @@ "use strict"; | ||
'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']; | ||
'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']; | ||
/** | ||
@@ -102,3 +105,4 @@ * Priority 5 (last) | ||
reservedLogicalOperators: ['AND', 'OR', 'XOR'], | ||
reservedKeywords: (0, _utils.dedupe)([].concat(reservedKeywords, reservedFunctions)), | ||
reservedKeywords: (0, _utils.dedupe)(reservedKeywords), | ||
reservedFunctionNames: (0, _utils.dedupe)(reservedFunctions), | ||
// NOTE: single quotes are actually not supported in N1QL, | ||
@@ -105,0 +109,0 @@ // but we support them anyway as all other SQL dialects do, |
@@ -24,14 +24,2 @@ "use strict"; | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } | ||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } | ||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -78,3 +66,9 @@ | ||
objectReference: ['DEREF', 'MAKE_REF', 'REF', 'REFTOHEX', 'VALUE'], | ||
model: ['CV', 'ITERATION_NUMBER', 'PRESENTNNV', 'PRESENTV', 'PREVIOUS'] | ||
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'] | ||
}; | ||
@@ -131,3 +125,4 @@ /** | ||
reservedLogicalOperators: ['AND', 'OR', 'XOR'], | ||
reservedKeywords: (0, _utils.dedupe)([].concat(reservedKeywords, _toConsumableArray(Object.values(reservedFunctions).flat()))), | ||
reservedKeywords: (0, _utils.dedupe)(reservedKeywords), | ||
reservedFunctionNames: (0, _utils.dedupe)(Object.values(reservedFunctions).flat()), | ||
// TODO: support custom-delimited strings: Q'{..}' q'<..>' etc | ||
@@ -134,0 +129,0 @@ stringTypes: [{ |
@@ -18,14 +18,2 @@ "use strict"; | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } | ||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } | ||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -99,3 +87,5 @@ | ||
// 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'], | ||
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'], | ||
// https://www.postgresql.org/docs/14/functions-window.html | ||
@@ -114,3 +104,7 @@ window: ['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-statistics.html | ||
stats: ['PG_MCV_LIST_ITEMS'] | ||
stats: ['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'] | ||
}; | ||
@@ -124,4 +118,6 @@ /** | ||
var reservedKeywords = ['ABSENT', 'ABSOLUTE', 'ACCESS', 'ACCORDING', 'ACTION', 'ADA', 'ADMIN', 'AGGREGATE', 'ALL', 'ALLOCATE', 'ALSO', 'ALTER', 'ALWAYS', 'ANALYSE', 'ARE', 'ARRAY', 'ARRAY_MAX_CARDINALITY', 'AS', 'ASC', 'ASENSITIVE', 'ASSERTION', 'ASSIGNMENT', 'ASYMMETRIC', 'AT', 'ATOMIC', 'ATTACH', 'ATTRIBUTE', 'ATTRIBUTES', 'AUTHORIZATION', 'BACKWARD', 'BASE64', 'BEFORE', 'BEGIN_FRAME', 'BEGIN_PARTITION', 'BERNOULLI', 'BETWEEN', 'BIGINT', 'BINARY', 'BIT', 'BLOB', 'BLOCKED', 'BOM', 'BOOLEAN', 'BOTH', 'BREADTH', 'BY', 'CACHE', 'CALLED', 'CASCADE', 'CASCADED', 'CAST', 'CATALOG', 'CATALOG_NAME', 'CHAIN', 'CHAINING', 'CHAR', 'CHARACTER', 'CHARACTERISTICS', 'CHARACTERS', 'CHARACTER_SET_CATALOG', 'CHARACTER_SET_NAME', 'CHARACTER_SET_SCHEMA', 'CHECK', 'CLASS', 'CLASSIFIER', 'CLASS_ORIGIN', 'CLOB', 'COBOL', 'COLLATE', 'COLLATION', 'COLLATION_CATALOG', 'COLLATION_NAME', 'COLLATION_SCHEMA', 'COLLECT', 'COLUMN', 'COLUMNS', 'COLUMN_NAME', 'COMMAND_FUNCTION', 'COMMAND_FUNCTION_CODE', 'COMMENTS', 'COMMITTED', 'COMPRESSION', 'CONCURRENTLY', 'CONDITION', 'CONDITIONAL', 'CONDITION_NUMBER', 'CONFIGURATION', 'CONFLICT', 'CONNECT', 'CONNECTION', 'CONNECTION_NAME', 'CONSTRAINT', 'CONSTRAINTS', 'CONSTRAINT_CATALOG', 'CONSTRAINT_NAME', 'CONSTRAINT_SCHEMA', 'CONSTRUCTOR', 'CONTAINS', 'CONTENT', 'CONTINUE', 'CONTROL', 'CONVERSION', 'CORRESPONDING', 'COST', 'CREATE', 'CROSS', 'CSV', 'CUBE', 'CURRENT', 'CURRENT_DEFAULT_TRANSFORM_GROUP', 'CURRENT_PATH', 'CURRENT_ROW', 'CURRENT_TRANSFORM_GROUP_FOR_TYPE', 'CURSOR', 'CURSOR_NAME', 'CYCLE', 'DATA', 'DATABASE', 'DATALINK', 'DATE', 'DATETIME_INTERVAL_CODE', 'DATETIME_INTERVAL_PRECISION', 'DAY', 'DB', 'DEC', 'DECFLOAT', 'DECIMAL', 'DEFAULT', 'DEFAULTS', 'DEFERRABLE', 'DEFERRED', 'DEFINE', 'DEFINED', 'DEFINER', 'DEGREE', 'DELIMITER', 'DELIMITERS', 'DEPENDS', 'DEPTH', 'DEREF', 'DERIVED', 'DESC', 'DESCRIBE', 'DESCRIPTOR', 'DETACH', 'DETERMINISTIC', 'DIAGNOSTICS', 'DICTIONARY', 'DISABLE', 'DISCONNECT', 'DISPATCH', 'DISTINCT', 'DLNEWCOPY', 'DLPREVIOUSCOPY', 'DLURLCOMPLETE', 'DLURLCOMPLETEONLY', 'DLURLCOMPLETEWRITE', 'DLURLPATH', 'DLURLPATHONLY', 'DLURLPATHWRITE', 'DLURLSCHEME', 'DLURLSERVER', 'DLVALUE', 'DOCUMENT', 'DOMAIN', 'DOUBLE', 'DROP', 'DYNAMIC', 'DYNAMIC_FUNCTION', 'DYNAMIC_FUNCTION_CODE', 'EACH', 'ELEMENT', 'EMPTY', 'ENABLE', 'ENCODING', 'ENCRYPTED', 'END-EXEC', 'END_FRAME', 'END_PARTITION', 'ENFORCED', 'ENUM', 'EQUALS', 'ERROR', 'ESCAPE', 'EVENT', 'EXCEPTION', 'EXCLUDE', 'EXCLUDING', 'EXCLUSIVE', 'EXEC', 'EXISTS', 'EXPRESSION', 'EXTENSION', 'EXTERNAL', 'FALSE', 'FILE', 'FILTER', 'FINAL', 'FINALIZE', 'FINISH', 'FIRST', 'FLAG', 'FLOAT', 'FOLLOWING', 'FOR', 'FORCE', 'FOREIGN', 'FORTRAN', 'FORWARD', 'FOUND', 'FRAME_ROW', 'FREE', 'FREEZE', 'FS', 'FULFILL', 'FULL', 'FUNCTION', 'FUNCTIONS', 'FUSION', 'GENERAL', 'GENERATED', 'GET', 'GLOBAL', 'GO', 'GOTO', 'GRANTED', 'GROUP', 'GROUPS', 'HANDLER', 'HEADER', 'HEX', 'HIERARCHY', 'HOLD', 'HOUR', // 'ID', | ||
'IDENTITY', 'IF', 'IGNORE', 'ILIKE', 'IMMEDIATE', 'IMMEDIATELY', 'IMMUTABLE', 'IMPLEMENTATION', 'IMPLICIT', 'IMPORT', 'IN', 'INCLUDE', 'INCLUDING', 'INCREMENT', 'INDENT', 'INDEX', 'INDEXES', 'INDICATOR', 'INHERIT', 'INHERITS', 'INITIAL', 'INITIALLY', 'INLINE', 'INNER', 'INOUT', 'INPUT', 'INSENSITIVE', 'INSTANCE', 'INSTANTIABLE', 'INSTEAD', 'INT', 'INTEGER', 'INTEGRITY', 'INTERSECTION', 'INTERVAL', 'INTO', 'INVOKER', 'IS', 'ISNULL', 'ISOLATION', 'JSON', 'JSON_ARRAY', 'JSON_ARRAYAGG', 'JSON_EXISTS', 'JSON_OBJECTAGG', 'JSON_QUERY', 'JSON_TABLE', 'JSON_TABLE_PRIMITIVE', 'JSON_VALUE', 'KEEP', 'KEY', 'KEYS', 'KEY_MEMBER', 'KEY_TYPE', 'LABEL', 'LANGUAGE', 'LARGE', 'LAST', 'LATERAL', 'LEADING', 'LEAKPROOF', 'LEVEL', 'LIBRARY', 'LIKE', 'LIKE_REGEX', 'LINK', 'LISTAGG', 'LOCAL', 'LOCATION', 'LOCATOR', 'LOCKED', 'LOGGED', 'MAP', 'MAPPING', 'MATCH', 'MATCHED', 'MATCHES', 'MATCH_NUMBER', 'MATCH_RECOGNIZE', 'MATERIALIZED', 'MAXVALUE', 'MEASURES', 'MEMBER', 'MERGE', 'MESSAGE_LENGTH', 'MESSAGE_OCTET_LENGTH', 'MESSAGE_TEXT', 'METHOD', 'MINUTE', 'MINVALUE', 'MODIFIES', 'MODULE', 'MONTH', 'MORE', 'MULTISET', 'MUMPS', 'NAME', 'NAMES', 'NAMESPACE', 'NATIONAL', 'NATURAL', 'NCHAR', 'NCLOB', 'NESTED', 'NESTING', 'NEW', 'NEXT', 'NFC', 'NFD', 'NFKC', 'NFKD', 'NIL', 'NO', 'NONE', 'NORMALIZED', 'NOT', 'NOTHING', 'NOTNULL', 'NOWAIT', 'NULL', 'NULLABLE', 'NULLS', 'NUMBER', 'NUMERIC', 'OBJECT', 'OCCURRENCES_REGEX', 'OCTETS', 'OF', 'OFF', 'OFFSET', 'OIDS', 'OLD', 'OMIT', 'ON COMMIT', 'ON DELETE', 'ON UPDATE', 'ONE', 'ONLY', 'OPEN', 'OPERATOR', 'OPTION', 'OPTIONS', 'ORDER', 'ORDERING', 'ORDINALITY', 'OTHERS', 'OUT', 'OUTER', 'OUTPUT', 'OVER', 'OVERFLOW', 'OVERLAPS', 'OVERRIDING', 'OWNED', 'OWNER', 'PAD', 'PARALLEL', 'PARAMETER', 'PARAMETER_MODE', 'PARAMETER_NAME', 'PARAMETER_ORDINAL_POSITION', 'PARAMETER_SPECIFIC_CATALOG', 'PARAMETER_SPECIFIC_NAME', 'PARAMETER_SPECIFIC_SCHEMA', 'PARSER', 'PARTIAL', 'PARTITION', 'PASCAL', 'PASS', 'PASSING', 'PASSTHROUGH', 'PASSWORD', 'PAST', 'PATTERN', 'PER', 'PERCENT', 'PERIOD', 'PERMISSION', 'PERMUTE', 'PLACING', 'PLAN', 'PLANS', 'PLI', 'POLICY', 'PORTION', 'POSITION_REGEX', 'PRECEDES', 'PRECEDING', 'PRECISION', 'PREPARED', 'PRESERVE', 'PRIMARY', 'PRIOR', 'PRIVATE', 'PRIVILEGES', 'PROCEDURAL', 'PROCEDURE', 'PROCEDURES', 'PROGRAM', 'PRUNE', 'PTF', 'PUBLIC', 'PUBLICATION', 'QUOTE', 'QUOTES', 'RANGE', 'READ', 'READS', 'REAL', 'REASSIGN', 'RECHECK', 'RECOVERY', 'RECURSIVE', 'REF', 'REFERENCES', 'REFERENCING', 'REFRESH', 'RELATIVE', 'RELEASE', 'RENAME', 'REPEATABLE', 'REPLICA', 'REQUIRING', 'RESPECT', 'RESTART', 'RESTORE', 'RESTRICT', 'RESULT', 'RETURN', 'RETURNED_CARDINALITY', 'RETURNED_LENGTH', 'RETURNED_OCTET_LENGTH', 'RETURNED_SQLSTATE', 'RETURNS', 'ROLE', 'ROLLUP', 'ROUTINE', 'ROUTINES', 'ROUTINE_CATALOG', 'ROUTINE_NAME', 'ROUTINE_SCHEMA', 'ROW', 'ROWS', 'ROW_COUNT', 'RULE', 'RUNNING', 'SCALAR', 'SCHEMA', 'SCHEMAS', 'SCHEMA_NAME', 'SCOPE', 'SCOPE_CATALOG', 'SCOPE_NAME', 'SCOPE_SCHEMA', 'SCROLL', 'SEARCH', 'SECOND', 'SECTION', 'SECURITY', 'SEEK', 'SELECTIVE', 'SELF', 'SENSITIVE', 'SEQUENCE', 'SEQUENCES', 'SERIALIZABLE', 'SERVER', 'SERVER_NAME', 'SESSION', 'SETOF', 'SETS', 'SHARE', 'SIMILAR', 'SIMPLE', 'SIZE', 'SKIP', 'SMALLINT', 'SNAPSHOT', 'SOURCE', 'SPACE', 'SPECIFIC', 'SPECIFICTYPE', 'SPECIFIC_NAME', 'SQL', 'SQLCODE', 'SQLERROR', 'SQLEXCEPTION', 'SQLSTATE', 'SQLWARNING', 'STABLE', 'STANDALONE', 'START', 'STATE', 'STATEMENT', 'STATIC', 'STATISTICS', 'STDIN', 'STDOUT', 'STORAGE', 'STORED', 'STRICT', 'STRUCTURE', 'STYLE', 'SUBCLASS_ORIGIN', 'SUBMULTISET', 'SUBSCRIPTION', 'SUBSET', 'SUBSTRING_REGEX', 'SUCCEEDS', 'SUPPORT', 'SYMMETRIC', 'SYSID', 'SYSTEM', 'SYSTEM_TIME', 'SYSTEM_USER', 'TABLE', 'TABLES', 'TABLESAMPLE', 'TABLESPACE', 'TABLE_NAME', 'TEMP', 'TEMPLATE', 'TEMPORARY', 'THEN', 'THROUGH', 'TIES', 'TIME', 'TIMESTAMP', 'TIMEZONE_HOUR', 'TIMEZONE_MINUTE', 'TO', 'TOKEN', 'TOP_LEVEL_COUNT', 'TRAILING', 'TRANSACTION', 'TRANSACTIONS_COMMITTED', 'TRANSACTIONS_ROLLED_BACK', 'TRANSACTION_ACTIVE', 'TRANSFORM', 'TRANSFORMS', 'TRANSLATE_REGEX', 'TRANSLATION', 'TREAT', 'TRIGGER', 'TRIGGER_CATALOG', 'TRIGGER_NAME', 'TRIGGER_SCHEMA', 'TRUE', 'TRUSTED', 'TYPE', 'TYPES', 'UESCAPE', 'UNBOUNDED', 'UNCOMMITTED', 'UNCONDITIONAL', 'UNDER', 'UNENCRYPTED', 'UNIQUE', 'UNKNOWN', 'UNLINK', 'UNLOGGED', 'UNMATCHED', 'UNNAMED', 'UNTIL', 'UNTYPED', 'URI', 'USAGE', 'USER_DEFINED_TYPE_CATALOG', 'USER_DEFINED_TYPE_CODE', 'USER_DEFINED_TYPE_NAME', 'USER_DEFINED_TYPE_SCHEMA', 'UTF16', 'UTF32', 'UTF8', 'VALID', 'VALIDATE', 'VALIDATOR', 'VALUE', 'VALUE_OF', 'VARBINARY', 'VARCHAR', 'VARIADIC', 'VARYING', 'VERBOSE', 'VERSIONING', 'VIEW', 'VIEWS', 'VOLATILE', 'WHENEVER', 'WHITESPACE', 'WINDOW', 'WITHIN', 'WITHOUT', 'WORK', 'WRAPPER', 'WRITE', 'XML', 'XMLATTRIBUTES', 'XMLBINARY', 'XMLCAST', 'XMLDECLARATION', 'XMLDOCUMENT', 'XMLITERATE', 'XMLNAMESPACES', 'XMLQUERY', 'XMLSCHEMA', 'XMLTEXT', 'XMLVALIDATE', 'YEAR', 'YES', 'ZONE']; | ||
var reservedKeywords = ['ABSENT', 'ABSOLUTE', 'ACCESS', 'ACCORDING', 'ACTION', 'ADA', 'ADMIN', 'AGGREGATE', 'ALL', 'ALLOCATE', 'ALSO', 'ALTER', 'ALWAYS', 'ANALYSE', 'ANY', // <-- moved over from functions | ||
'ARE', 'ARRAY', 'ARRAY_MAX_CARDINALITY', 'AS', 'ASC', 'ASENSITIVE', 'ASSERTION', 'ASSIGNMENT', 'ASYMMETRIC', 'AT', 'ATOMIC', 'ATTACH', 'ATTRIBUTE', 'ATTRIBUTES', 'AUTHORIZATION', 'BACKWARD', 'BASE64', 'BEFORE', 'BEGIN_FRAME', 'BEGIN_PARTITION', 'BERNOULLI', 'BETWEEN', 'BIGINT', 'BINARY', 'BIT', 'BLOB', 'BLOCKED', 'BOM', 'BOOLEAN', 'BOTH', 'BREADTH', 'BY', 'CACHE', 'CALLED', 'CASCADE', 'CASCADED', 'CAST', 'CATALOG', 'CATALOG_NAME', 'CHAIN', 'CHAINING', 'CHAR', 'CHARACTER', 'CHARACTERISTICS', 'CHARACTERS', 'CHARACTER_SET_CATALOG', 'CHARACTER_SET_NAME', 'CHARACTER_SET_SCHEMA', 'CHECK', 'CLASS', 'CLASSIFIER', 'CLASS_ORIGIN', 'CLOB', 'COBOL', 'COLLATE', 'COLLATION', 'COLLATION_CATALOG', 'COLLATION_NAME', 'COLLATION_SCHEMA', 'COLLECT', 'COLUMN', 'COLUMNS', 'COLUMN_NAME', 'COMMAND_FUNCTION', 'COMMAND_FUNCTION_CODE', 'COMMENTS', 'COMMITTED', 'COMPRESSION', 'CONCURRENTLY', 'CONDITION', 'CONDITIONAL', 'CONDITION_NUMBER', 'CONFIGURATION', 'CONFLICT', 'CONNECT', 'CONNECTION', 'CONNECTION_NAME', 'CONSTRAINT', 'CONSTRAINTS', 'CONSTRAINT_CATALOG', 'CONSTRAINT_NAME', 'CONSTRAINT_SCHEMA', 'CONSTRUCTOR', 'CONTAINS', 'CONTENT', 'CONTINUE', 'CONTROL', 'CONVERSION', 'CORRESPONDING', 'COST', 'CREATE', 'CROSS', 'CSV', 'CUBE', 'CURRENT', 'CURRENT_DEFAULT_TRANSFORM_GROUP', 'CURRENT_PATH', 'CURRENT_ROW', 'CURRENT_TRANSFORM_GROUP_FOR_TYPE', 'CURSOR', 'CURSOR_NAME', 'CYCLE', 'DATA', 'DATABASE', 'DATALINK', 'DATE', 'DATETIME_INTERVAL_CODE', 'DATETIME_INTERVAL_PRECISION', 'DAY', 'DB', 'DEC', 'DECFLOAT', 'DECIMAL', 'DEFAULT', 'DEFAULTS', 'DEFERRABLE', 'DEFERRED', 'DEFINE', 'DEFINED', 'DEFINER', 'DEGREE', 'DELIMITER', 'DELIMITERS', 'DEPENDS', 'DEPTH', 'DEREF', 'DERIVED', 'DESC', 'DESCRIBE', 'DESCRIPTOR', 'DETACH', 'DETERMINISTIC', 'DIAGNOSTICS', 'DICTIONARY', 'DISABLE', 'DISCONNECT', 'DISPATCH', 'DISTINCT', 'DLNEWCOPY', 'DLPREVIOUSCOPY', 'DLURLCOMPLETE', 'DLURLCOMPLETEONLY', 'DLURLCOMPLETEWRITE', 'DLURLPATH', 'DLURLPATHONLY', 'DLURLPATHWRITE', 'DLURLSCHEME', 'DLURLSERVER', 'DLVALUE', 'DOCUMENT', 'DOMAIN', 'DOUBLE', 'DROP', 'DYNAMIC', 'DYNAMIC_FUNCTION', 'DYNAMIC_FUNCTION_CODE', 'EACH', 'ELEMENT', 'EMPTY', 'ENABLE', 'ENCODING', 'ENCRYPTED', 'END-EXEC', 'END_FRAME', 'END_PARTITION', 'ENFORCED', 'ENUM', 'EQUALS', 'ERROR', 'ESCAPE', 'EVENT', 'EXCEPTION', 'EXCLUDE', 'EXCLUDING', 'EXCLUSIVE', 'EXEC', 'EXISTS', 'EXPRESSION', 'EXTENSION', 'EXTERNAL', 'FALSE', 'FILE', 'FILTER', 'FINAL', 'FINALIZE', 'FINISH', 'FIRST', 'FLAG', 'FLOAT', 'FOLLOWING', 'FOR', 'FORCE', 'FOREIGN', 'FORTRAN', 'FORWARD', 'FOUND', 'FRAME_ROW', 'FREE', 'FREEZE', 'FS', 'FULFILL', 'FULL', 'FUNCTION', 'FUNCTIONS', 'FUSION', 'GENERAL', 'GENERATED', 'GET', 'GLOBAL', 'GO', 'GOTO', 'GRANTED', 'GROUP', 'GROUPS', 'HANDLER', 'HEADER', 'HEX', 'HIERARCHY', 'HOLD', 'HOUR', // 'ID', | ||
'IDENTITY', 'IF', 'IGNORE', 'ILIKE', 'IMMEDIATE', 'IMMEDIATELY', 'IMMUTABLE', 'IMPLEMENTATION', 'IMPLICIT', 'IMPORT', 'IN', 'INCLUDE', 'INCLUDING', 'INCREMENT', 'INDENT', 'INDEX', 'INDEXES', 'INDICATOR', 'INHERIT', 'INHERITS', 'INITIAL', 'INITIALLY', 'INLINE', 'INNER', 'INOUT', 'INPUT', 'INSENSITIVE', 'INSTANCE', 'INSTANTIABLE', 'INSTEAD', 'INT', 'INTEGER', 'INTEGRITY', 'INTERSECTION', 'INTERVAL', 'INTO', 'INVOKER', 'IS', 'ISNULL', 'ISOLATION', 'JSON', 'JSON_ARRAY', 'JSON_ARRAYAGG', 'JSON_EXISTS', 'JSON_OBJECTAGG', 'JSON_QUERY', 'JSON_TABLE', 'JSON_TABLE_PRIMITIVE', 'JSON_VALUE', 'KEEP', 'KEY', 'KEYS', 'KEY_MEMBER', 'KEY_TYPE', 'LABEL', 'LANGUAGE', 'LARGE', 'LAST', 'LATERAL', 'LEADING', 'LEAKPROOF', 'LEVEL', 'LIBRARY', 'LIKE', 'LIKE_REGEX', 'LINK', 'LISTAGG', 'LOCAL', 'LOCATION', 'LOCATOR', 'LOCKED', 'LOGGED', 'MAP', 'MAPPING', 'MATCH', 'MATCHED', 'MATCHES', 'MATCH_NUMBER', 'MATCH_RECOGNIZE', 'MATERIALIZED', 'MAXVALUE', 'MEASURES', 'MEMBER', 'MERGE', 'MESSAGE_LENGTH', 'MESSAGE_OCTET_LENGTH', 'MESSAGE_TEXT', 'METHOD', 'MINUTE', 'MINVALUE', 'MODIFIES', 'MODULE', 'MONTH', 'MORE', 'MULTISET', 'MUMPS', 'NAME', 'NAMES', 'NAMESPACE', 'NATIONAL', 'NATURAL', 'NCHAR', 'NCLOB', 'NESTED', 'NESTING', 'NEW', 'NEXT', 'NFC', 'NFD', 'NFKC', 'NFKD', 'NIL', 'NO', 'NONE', 'NORMALIZED', 'NOT', 'NOTHING', 'NOTNULL', 'NOWAIT', 'NULL', 'NULLABLE', 'NULLS', 'NUMBER', 'NUMERIC', 'OBJECT', 'OCCURRENCES_REGEX', 'OCTETS', 'OF', 'OFF', 'OFFSET', 'OIDS', 'OLD', 'OMIT', 'ON COMMIT', 'ON DELETE', 'ON UPDATE', 'ONE', 'ONLY', 'OPEN', 'OPERATOR', 'OPTION', 'OPTIONS', 'ORDER', 'ORDERING', 'ORDINALITY', 'OTHERS', 'OUT', 'OUTER', 'OUTPUT', 'OVER', 'OVERFLOW', 'OVERLAPS', 'OVERRIDING', 'OWNED', 'OWNER', 'PAD', 'PARALLEL', 'PARAMETER', 'PARAMETER_MODE', 'PARAMETER_NAME', 'PARAMETER_ORDINAL_POSITION', 'PARAMETER_SPECIFIC_CATALOG', 'PARAMETER_SPECIFIC_NAME', 'PARAMETER_SPECIFIC_SCHEMA', 'PARSER', 'PARTIAL', 'PARTITION', 'PASCAL', 'PASS', 'PASSING', 'PASSTHROUGH', 'PASSWORD', 'PAST', 'PATTERN', 'PER', 'PERCENT', 'PERIOD', 'PERMISSION', 'PERMUTE', 'PLACING', 'PLAN', 'PLANS', 'PLI', 'POLICY', 'PORTION', 'POSITION_REGEX', 'PRECEDES', 'PRECEDING', 'PRECISION', 'PREPARED', 'PRESERVE', 'PRIMARY', 'PRIOR', 'PRIVATE', 'PRIVILEGES', 'PROCEDURAL', 'PROCEDURE', 'PROCEDURES', 'PROGRAM', 'PRUNE', 'PTF', 'PUBLIC', 'PUBLICATION', 'QUOTE', 'QUOTES', 'RANGE', 'READ', 'READS', 'REAL', 'REASSIGN', 'RECHECK', 'RECOVERY', 'RECURSIVE', 'REF', 'REFERENCES', 'REFERENCING', 'REFRESH', 'RELATIVE', 'RELEASE', 'RENAME', 'REPEATABLE', 'REPLICA', 'REQUIRING', 'RESPECT', 'RESTART', 'RESTORE', 'RESTRICT', 'RESULT', 'RETURN', 'RETURNED_CARDINALITY', 'RETURNED_LENGTH', 'RETURNED_OCTET_LENGTH', 'RETURNED_SQLSTATE', 'RETURNS', 'ROLE', 'ROLLUP', 'ROUTINE', 'ROUTINES', 'ROUTINE_CATALOG', 'ROUTINE_NAME', 'ROUTINE_SCHEMA', 'ROW', 'ROWS', 'ROW_COUNT', 'RULE', 'RUNNING', 'SCALAR', 'SCHEMA', 'SCHEMAS', 'SCHEMA_NAME', 'SCOPE', 'SCOPE_CATALOG', 'SCOPE_NAME', 'SCOPE_SCHEMA', 'SCROLL', 'SEARCH', 'SECOND', 'SECTION', 'SECURITY', 'SEEK', 'SELECTIVE', 'SELF', 'SENSITIVE', 'SEQUENCE', 'SEQUENCES', 'SERIALIZABLE', 'SERVER', 'SERVER_NAME', 'SESSION', 'SETOF', 'SETS', 'SHARE', 'SIMILAR', 'SIMPLE', 'SIZE', 'SKIP', 'SMALLINT', 'SNAPSHOT', 'SOME', // <-- moved over from functions | ||
'SOURCE', 'SPACE', 'SPECIFIC', 'SPECIFICTYPE', 'SPECIFIC_NAME', 'SQL', 'SQLCODE', 'SQLERROR', 'SQLEXCEPTION', 'SQLSTATE', 'SQLWARNING', 'STABLE', 'STANDALONE', 'START', 'STATE', 'STATEMENT', 'STATIC', 'STATISTICS', 'STDIN', 'STDOUT', 'STORAGE', 'STORED', 'STRICT', 'STRUCTURE', 'STYLE', 'SUBCLASS_ORIGIN', 'SUBMULTISET', 'SUBSCRIPTION', 'SUBSET', 'SUBSTRING_REGEX', 'SUCCEEDS', 'SUPPORT', 'SYMMETRIC', 'SYSID', 'SYSTEM', 'SYSTEM_TIME', 'SYSTEM_USER', 'TABLE', 'TABLES', 'TABLESAMPLE', 'TABLESPACE', 'TABLE_NAME', 'TEMP', 'TEMPLATE', 'TEMPORARY', 'THEN', 'THROUGH', 'TIES', 'TIME', 'TIMESTAMP', 'TIMEZONE_HOUR', 'TIMEZONE_MINUTE', 'TO', 'TOKEN', 'TOP_LEVEL_COUNT', 'TRAILING', 'TRANSACTION', 'TRANSACTIONS_COMMITTED', 'TRANSACTIONS_ROLLED_BACK', 'TRANSACTION_ACTIVE', 'TRANSFORM', 'TRANSFORMS', 'TRANSLATE_REGEX', 'TRANSLATION', 'TREAT', 'TRIGGER', 'TRIGGER_CATALOG', 'TRIGGER_NAME', 'TRIGGER_SCHEMA', 'TRUE', 'TRUSTED', 'TYPE', 'TYPES', 'UESCAPE', 'UNBOUNDED', 'UNCOMMITTED', 'UNCONDITIONAL', 'UNDER', 'UNENCRYPTED', 'UNIQUE', 'UNKNOWN', 'UNLINK', 'UNLOGGED', 'UNMATCHED', 'UNNAMED', 'UNTIL', 'UNTYPED', 'URI', 'USAGE', 'USER_DEFINED_TYPE_CATALOG', 'USER_DEFINED_TYPE_CODE', 'USER_DEFINED_TYPE_NAME', 'USER_DEFINED_TYPE_SCHEMA', 'UTF16', 'UTF32', 'UTF8', 'VALID', 'VALIDATE', 'VALIDATOR', 'VALUE', 'VALUE_OF', 'VARBINARY', 'VARCHAR', 'VARIADIC', 'VARYING', 'VERBOSE', 'VERSIONING', 'VIEW', 'VIEWS', 'VOLATILE', 'WHENEVER', 'WHITESPACE', 'WINDOW', 'WITHIN', 'WITHOUT', 'WORK', 'WRAPPER', 'WRITE', 'XML', 'XMLATTRIBUTES', 'XMLBINARY', 'XMLCAST', 'XMLDECLARATION', 'XMLDOCUMENT', 'XMLITERATE', 'XMLNAMESPACES', 'XMLQUERY', 'XMLSCHEMA', 'XMLTEXT', 'XMLVALIDATE', 'YEAR', 'YES', 'ZONE']; | ||
/** | ||
@@ -179,3 +175,4 @@ * Priority 1 (first) | ||
reservedDependentClauses: reservedDependentClauses, | ||
reservedKeywords: (0, _utils.dedupe)([].concat(reservedKeywords, _toConsumableArray(Object.values(reservedFunctions).flat()))), | ||
reservedKeywords: (0, _utils.dedupe)(reservedKeywords), | ||
reservedFunctionNames: (0, _utils.dedupe)(Object.values(reservedFunctions).flat()), | ||
openParens: ['(', '['], | ||
@@ -182,0 +179,0 @@ closeParens: [')', ']'], |
@@ -18,14 +18,2 @@ "use strict"; | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } | ||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } | ||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -92,3 +80,4 @@ | ||
// 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'] | ||
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'] | ||
}; | ||
@@ -176,3 +165,4 @@ /** | ||
reservedDependentClauses: reservedDependentClauses, | ||
reservedKeywords: (0, _utils.dedupe)([].concat(_toConsumableArray(Object.values(reservedKeywords).flat()), _toConsumableArray(Object.values(reservedFunctions).flat()))), | ||
reservedKeywords: (0, _utils.dedupe)(Object.values(reservedKeywords).flat()), | ||
reservedFunctionNames: (0, _utils.dedupe)(Object.values(reservedFunctions).flat()), | ||
stringTypes: ["''"], | ||
@@ -179,0 +169,0 @@ identTypes: ["\"\""], |
@@ -24,14 +24,2 @@ "use strict"; | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } | ||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } | ||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -67,3 +55,5 @@ | ||
// 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'], | ||
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'], | ||
// http://spark.apache.org/docs/latest/sql-ref-functions-builtin.html#window-functions | ||
@@ -81,3 +71,10 @@ window: ['CUME_DIST', 'DENSE_RANK', 'LAG', 'LEAD', 'NTH_VALUE', 'NTILE', 'PERCENT_RANK', 'RANK', 'ROW_NUMBER'], | ||
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'] | ||
'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'], | ||
// 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'] | ||
}; | ||
@@ -142,3 +139,4 @@ /** | ||
reservedLogicalOperators: ['AND', 'OR', 'XOR'], | ||
reservedKeywords: (0, _utils.dedupe)([].concat(reservedKeywords, _toConsumableArray(Object.values(reservedFunctions).flat()))), | ||
reservedKeywords: (0, _utils.dedupe)(reservedKeywords), | ||
reservedFunctionNames: (0, _utils.dedupe)(Object.values(reservedFunctions).flat()), | ||
openParens: ['(', '['], | ||
@@ -175,5 +173,5 @@ closeParens: [')', ']'], | ||
if (_token.isToken.WINDOW(token) && nextToken.type === _token.TokenType.OPEN_PAREN) { | ||
// This is a function call, treat it as a reserved word | ||
// This is a function call, treat it as a reserved function name | ||
return _objectSpread(_objectSpread({}, token), {}, { | ||
type: _token.TokenType.RESERVED_KEYWORD | ||
type: _token.TokenType.RESERVED_FUNCTION_NAME | ||
}); | ||
@@ -180,0 +178,0 @@ } // TODO: deprecate this once ITEMS is merged with COLLECTION |
@@ -18,14 +18,2 @@ "use strict"; | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } | ||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } | ||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -68,3 +56,7 @@ | ||
// 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'] // CAST is a pretty complex case, involving multiple forms: | ||
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'], | ||
// CAST is a pretty complex case, involving multiple forms: | ||
// - CAST(col AS int) | ||
@@ -74,4 +66,10 @@ // - CAST(...) WITH ... | ||
// - CREATE CAST(mycol AS int) WITH ... | ||
// cast: ['CAST'], (disabled for now) | ||
cast: ['CAST'], | ||
// Shorthand functions to use in place of CASE expression | ||
caseAbbrev: ['COALESCE', 'NULLIF'], | ||
// Non-standard functions that have widespread support | ||
nonStandard: ['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'] | ||
}; | ||
@@ -86,3 +84,9 @@ /** | ||
var reservedKeywords = ['ALL', 'ALLOCATE', 'ALTER', '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', '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 DELETE', 'ON UPDATE', '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', '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', 'VALUE', 'VALUES', 'VARBINARY', 'VARCHAR', 'VARYING', 'WHENEVER', 'WINDOW', 'WITHIN', 'WITHOUT', 'YEAR']; | ||
var reservedKeywords = ['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 DELETE', 'ON UPDATE', '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', 'VALUE', 'VALUES', 'VARBINARY', 'VARCHAR', 'VARYING', 'WHENEVER', 'WINDOW', 'WITHIN', 'WITHOUT', 'YEAR']; | ||
/** | ||
@@ -124,3 +128,4 @@ * Priority 1 (first) | ||
reservedDependentClauses: reservedDependentClauses, | ||
reservedKeywords: (0, _utils.dedupe)([].concat(reservedKeywords, _toConsumableArray(Object.values(reservedFunctions).flat()))), | ||
reservedKeywords: (0, _utils.dedupe)(reservedKeywords), | ||
reservedFunctionNames: (0, _utils.dedupe)(Object.values(reservedFunctions).flat()), | ||
stringTypes: [{ | ||
@@ -127,0 +132,0 @@ quote: "''", |
@@ -18,14 +18,2 @@ "use strict"; | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } | ||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } | ||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -59,3 +47,14 @@ | ||
// https://www.sqlite.org/lang_datefunc.html | ||
datetime: ['DATE', 'TIME', 'DATETIME', 'JULIANDAY', 'UNIXEPOCH', 'STRFTIME'] | ||
datetime: ['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'], | ||
// 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'], | ||
// 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'], | ||
// 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'] | ||
}; // https://www.sqlite.org/lang_keywords.html | ||
@@ -92,3 +91,4 @@ | ||
reservedDependentClauses: reservedDependentClauses, | ||
reservedKeywords: (0, _utils.dedupe)([].concat(reservedKeywords, _toConsumableArray(Object.values(reservedFunctions).flat()))), | ||
reservedKeywords: (0, _utils.dedupe)(reservedKeywords), | ||
reservedFunctionNames: (0, _utils.dedupe)(Object.values(reservedFunctions).flat()), | ||
stringTypes: [{ | ||
@@ -95,0 +95,0 @@ quote: "''", |
@@ -18,14 +18,2 @@ "use strict"; | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } | ||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } | ||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -75,3 +63,8 @@ | ||
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'] | ||
trigger: ['COLUMNS_UPDATED', 'EVENTDATA', 'TRIGGER_NESTLEVEL', 'UPDATE'], | ||
// Shorthand functions to use in place of CASE expression | ||
caseAbbrev: ['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'] | ||
}; // TODO: dedupe these reserved word lists | ||
@@ -136,3 +129,4 @@ // https://docs.microsoft.com/en-us/sql/t-sql/language-elements/reserved-keywords-transact-sql?view=sql-server-ver15 | ||
reservedDependentClauses: reservedDependentClauses, | ||
reservedKeywords: (0, _utils.dedupe)([].concat(_toConsumableArray(Object.values(reservedKeywords).flat()), _toConsumableArray(Object.values(reservedFunctions).flat()))), | ||
reservedKeywords: (0, _utils.dedupe)(Object.values(reservedKeywords).flat()), | ||
reservedFunctionNames: (0, _utils.dedupe)(Object.values(reservedFunctions).flat()), | ||
stringTypes: [{ | ||
@@ -139,0 +133,0 @@ quote: "''", |
@@ -17,3 +17,3 @@ "use strict"; | ||
exports.NULL_REGEX = NULL_REGEX; | ||
var WHITESPACE_REGEX = new RegExp("([\\t-\\r \\xA0\\u1680\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+)", "y"); | ||
var WHITESPACE_REGEX = new RegExp("[\\t-\\r \\xA0\\u1680\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+", "y"); | ||
exports.WHITESPACE_REGEX = WHITESPACE_REGEX; | ||
@@ -20,0 +20,0 @@ |
@@ -20,2 +20,3 @@ "use strict"; | ||
TokenType["RESERVED_KEYWORD"] = "RESERVED_KEYWORD"; | ||
TokenType["RESERVED_FUNCTION_NAME"] = "RESERVED_FUNCTION_NAME"; | ||
TokenType["RESERVED_LOGICAL_OPERATOR"] = "RESERVED_LOGICAL_OPERATOR"; | ||
@@ -89,3 +90,3 @@ TokenType["RESERVED_DEPENDENT_CLAUSE"] = "RESERVED_DEPENDENT_CLAUSE"; | ||
value: 'CAST', | ||
type: TokenType.RESERVED_KEYWORD | ||
type: TokenType.RESERVED_FUNCTION_NAME | ||
}), | ||
@@ -146,3 +147,3 @@ BY: testToken({ | ||
var isReserved = function isReserved(token) { | ||
return token.type === TokenType.RESERVED_KEYWORD || token.type === TokenType.RESERVED_LOGICAL_OPERATOR || token.type === TokenType.RESERVED_DEPENDENT_CLAUSE || token.type === TokenType.RESERVED_JOIN_CONDITION || token.type === TokenType.RESERVED_COMMAND || token.type === TokenType.RESERVED_BINARY_COMMAND || token.type === TokenType.RESERVED_JOIN || token.type === TokenType.RESERVED_CASE_START || token.type === TokenType.RESERVED_CASE_END; | ||
return token.type === TokenType.RESERVED_KEYWORD || token.type === TokenType.RESERVED_FUNCTION_NAME || token.type === TokenType.RESERVED_LOGICAL_OPERATOR || token.type === TokenType.RESERVED_DEPENDENT_CLAUSE || token.type === TokenType.RESERVED_JOIN_CONDITION || token.type === TokenType.RESERVED_COMMAND || token.type === TokenType.RESERVED_BINARY_COMMAND || token.type === TokenType.RESERVED_JOIN || token.type === TokenType.RESERVED_CASE_START || token.type === TokenType.RESERVED_CASE_END; | ||
}; | ||
@@ -149,0 +150,0 @@ |
@@ -111,2 +111,7 @@ "use strict"; | ||
} | ||
}), _defineProperty(_this$validRules, _token.TokenType.RESERVED_FUNCTION_NAME, { | ||
regex: regex.reservedWord(cfg.reservedFunctionNames, cfg.identChars), | ||
value: function value(v) { | ||
return v.toUpperCase(); | ||
} | ||
}), _defineProperty(_this$validRules, _token.TokenType.RESERVED_LOGICAL_OPERATOR, { | ||
@@ -113,0 +118,0 @@ regex: regex.reservedWord((_cfg$reservedLogicalO = cfg.reservedLogicalOperators) !== null && _cfg$reservedLogicalO !== void 0 ? _cfg$reservedLogicalO : ['AND', 'OR'], cfg.identChars), |
@@ -56,4 +56,4 @@ "use strict"; | ||
while (this.index < this.input.length) { | ||
// grab any preceding whitespace | ||
var whitespaceBefore = this.getWhitespace(); | ||
// skip any preceding whitespace | ||
this.skipWhitespace(); | ||
@@ -68,5 +68,3 @@ if (this.index < this.input.length) { | ||
tokens.push(_objectSpread(_objectSpread({}, token), {}, { | ||
whitespaceBefore: whitespaceBefore | ||
})); | ||
tokens.push(token); | ||
} | ||
@@ -78,4 +76,4 @@ } | ||
}, { | ||
key: "getWhitespace", | ||
value: function getWhitespace() { | ||
key: "skipWhitespace", | ||
value: function skipWhitespace() { | ||
_regexUtil.WHITESPACE_REGEX.lastIndex = this.index; | ||
@@ -88,5 +86,2 @@ | ||
this.index += matches[0].length; | ||
return matches[0]; | ||
} else { | ||
return ''; | ||
} | ||
@@ -130,3 +125,3 @@ } | ||
return this.matchToken(_token2.TokenType.RESERVED_CASE_START) || this.matchToken(_token2.TokenType.RESERVED_CASE_END) || this.matchToken(_token2.TokenType.RESERVED_COMMAND) || this.matchToken(_token2.TokenType.RESERVED_BINARY_COMMAND) || this.matchToken(_token2.TokenType.RESERVED_DEPENDENT_CLAUSE) || this.matchToken(_token2.TokenType.RESERVED_JOIN) || this.matchToken(_token2.TokenType.RESERVED_KEYWORD) || this.matchToken(_token2.TokenType.RESERVED_LOGICAL_OPERATOR) || this.matchToken(_token2.TokenType.RESERVED_JOIN_CONDITION); | ||
return this.matchToken(_token2.TokenType.RESERVED_CASE_START) || this.matchToken(_token2.TokenType.RESERVED_CASE_END) || this.matchToken(_token2.TokenType.RESERVED_COMMAND) || this.matchToken(_token2.TokenType.RESERVED_BINARY_COMMAND) || this.matchToken(_token2.TokenType.RESERVED_DEPENDENT_CLAUSE) || this.matchToken(_token2.TokenType.RESERVED_JOIN) || this.matchToken(_token2.TokenType.RESERVED_FUNCTION_NAME) || this.matchToken(_token2.TokenType.RESERVED_KEYWORD) || this.matchToken(_token2.TokenType.RESERVED_LOGICAL_OPERATOR) || this.matchToken(_token2.TokenType.RESERVED_JOIN_CONDITION); | ||
} // Shorthand for `match` that looks up regex from rules | ||
@@ -133,0 +128,0 @@ |
@@ -110,3 +110,3 @@ "use strict"; | ||
value: function functionCall() { | ||
if ((this.look().type === _token2.TokenType.RESERVED_KEYWORD || this.look().type === _token2.TokenType.IDENTIFIER) && this.look(1).value === '(' && !this.look(1).whitespaceBefore) { | ||
if (this.look().type === _token2.TokenType.RESERVED_FUNCTION_NAME && this.look(1).value === '(') { | ||
return { | ||
@@ -113,0 +113,0 @@ type: _ast.NodeType.function_call, |
@@ -8,2 +8,3 @@ /** Token type enum for all possible Token categories */ | ||
RESERVED_KEYWORD = "RESERVED_KEYWORD", | ||
RESERVED_FUNCTION_NAME = "RESERVED_FUNCTION_NAME", | ||
RESERVED_LOGICAL_OPERATOR = "RESERVED_LOGICAL_OPERATOR", | ||
@@ -37,3 +38,2 @@ RESERVED_DEPENDENT_CLAUSE = "RESERVED_DEPENDENT_CLAUSE", | ||
key?: string; | ||
whitespaceBefore?: string; | ||
} | ||
@@ -40,0 +40,0 @@ /** |
@@ -10,2 +10,3 @@ import { Token } from "./token"; | ||
reservedJoinConditions?: string[]; | ||
reservedFunctionNames: string[]; | ||
reservedKeywords: string[]; | ||
@@ -12,0 +13,0 @@ stringTypes: regexTypes.QuoteType[]; |
@@ -20,3 +20,3 @@ import { Token, TokenType } from "./token"; | ||
tokenize(input: string): Token[]; | ||
private getWhitespace; | ||
private skipWhitespace; | ||
private getNextToken; | ||
@@ -23,0 +23,0 @@ private matchPlaceholderToken; |
{ | ||
"name": "sql-formatter", | ||
"version": "8.2.0", | ||
"version": "9.0.0-beta1", | ||
"description": "Format whitespace in a SQL query to make it more readable", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1553526
6465
2