sql-formatter
Advanced tools
Comparing version 4.0.0-beta.6 to 4.0.0-beta.7
@@ -67,3 +67,3 @@ "use strict"; | ||
this.NUMBER_REGEX = /^((\x2D[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*)?[0-9]+(\.[0-9]+)?([Ee]\x2D?[0-9]+(\.[0-9]+)?)?|0x[0-9A-Fa-f]+|0b[01]+)\b/; | ||
this.OPERATOR_REGEX = regexFactory.createOperatorRegex([].concat(_toConsumableArray(cfg.operators || []), ['!=', '<>', '==', '<=', '>=', '!<', '!>', '||', ':='])); | ||
this.OPERATOR_REGEX = regexFactory.createOperatorRegex(['<>', '<=', '>='].concat(_toConsumableArray(cfg.operators || []))); | ||
this.BLOCK_COMMENT_REGEX = /^(\/\*(?:(?![])[\s\S])*?(?:\*\/|$))/; | ||
@@ -70,0 +70,0 @@ this.LINE_COMMENT_REGEX = regexFactory.createLineCommentRegex(cfg.lineCommentTypes); |
@@ -39,3 +39,4 @@ "use strict"; | ||
var reservedTopLevelWordsNoIndent = ['INTERSECT', 'INTERSECT ALL', 'MINUS', 'UNION', 'UNION ALL']; | ||
var reservedNewlineWords = ['AND', 'CROSS JOIN', 'INNER JOIN', 'JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'OR', 'OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN']; | ||
var reservedNewlineWords = ['AND', 'OR', // joins | ||
'JOIN', 'INNER JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN', 'FULL JOIN', 'FULL OUTER JOIN', 'CROSS JOIN', 'NATURAL JOIN']; // For reference: https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_72/db2/rbafzintro.htm | ||
@@ -67,3 +68,4 @@ var Db2Formatter = /*#__PURE__*/function (_Formatter) { | ||
lineCommentTypes: ['--'], | ||
specialWordChars: ['#', '@'] | ||
specialWordChars: ['#', '@'], | ||
operators: ['**', '!=', '!>', '!>', '||'] | ||
}); | ||
@@ -70,0 +72,0 @@ } |
@@ -39,3 +39,5 @@ "use strict"; | ||
var reservedTopLevelWordsNoIndent = ['INTERSECT', 'INTERSECT ALL', 'UNION', 'UNION ALL']; | ||
var reservedNewlineWords = ['AND', 'CROSS JOIN', 'ELSE', 'INNER JOIN', 'JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'OR', 'OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN', 'WHEN']; | ||
var reservedNewlineWords = ['AND', 'ELSE', 'OR', 'WHEN', // joins | ||
'JOIN', 'INNER JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN', 'CROSS JOIN', 'NATURAL JOIN', // non-standard joins | ||
'STRAIGHT_JOIN', 'NATURAL LEFT JOIN', 'NATURAL LEFT OUTER JOIN', 'NATURAL RIGHT JOIN', 'NATURAL RIGHT OUTER JOIN']; // For reference: https://mariadb.com/kb/en/sql-statements-structure/ | ||
@@ -42,0 +44,0 @@ var MariaDbFormatter = /*#__PURE__*/function (_Formatter) { |
@@ -39,3 +39,5 @@ "use strict"; | ||
var reservedTopLevelWordsNoIndent = ['INTERSECT', 'INTERSECT ALL', 'UNION', 'UNION ALL']; | ||
var reservedNewlineWords = ['AND', 'CROSS JOIN', 'ELSE', 'INNER JOIN', 'JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'OR', 'OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN', 'WHEN']; | ||
var reservedNewlineWords = ['AND', 'ELSE', 'OR', 'WHEN', // joins | ||
'JOIN', 'INNER JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN', 'CROSS JOIN', 'NATURAL JOIN', // non-standard joins | ||
'STRAIGHT_JOIN', 'NATURAL LEFT JOIN', 'NATURAL LEFT OUTER JOIN', 'NATURAL RIGHT JOIN', 'NATURAL RIGHT OUTER JOIN']; | ||
@@ -42,0 +44,0 @@ var MySqlFormatter = /*#__PURE__*/function (_Formatter) { |
@@ -39,3 +39,4 @@ "use strict"; | ||
var reservedTopLevelWordsNoIndent = ['INTERSECT', 'INTERSECT ALL', 'MINUS', 'UNION', 'UNION ALL']; | ||
var reservedNewlineWords = ['AND', 'INNER JOIN', 'JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'OR', 'OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN', 'XOR']; | ||
var reservedNewlineWords = ['AND', 'OR', 'XOR', // joins | ||
'JOIN', 'INNER JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN']; // For reference: http://docs.couchbase.com.s3-website-us-west-1.amazonaws.com/server/6.0/n1ql/n1ql-language-reference/index.html | ||
@@ -65,3 +66,4 @@ var N1qlFormatter = /*#__PURE__*/function (_Formatter) { | ||
namedPlaceholderTypes: ['$'], | ||
lineCommentTypes: ['#', '--'] | ||
lineCommentTypes: ['#', '--'], | ||
operators: ['==', '!='] | ||
}); | ||
@@ -68,0 +70,0 @@ } |
@@ -43,3 +43,4 @@ "use strict"; | ||
var reservedTopLevelWordsNoIndent = ['INTERSECT', 'INTERSECT ALL', 'MINUS', 'UNION', 'UNION ALL']; | ||
var reservedNewlineWords = ['AND', 'CROSS APPLY', 'CROSS JOIN', 'ELSE', 'END', 'INNER JOIN', 'JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'OR', 'OUTER APPLY', 'OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN', 'WHEN', 'XOR']; | ||
var reservedNewlineWords = ['AND', 'CROSS APPLY', 'ELSE', 'END', 'OR', 'OUTER APPLY', 'WHEN', 'XOR', // joins | ||
'JOIN', 'INNER JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN', 'FULL JOIN', 'FULL OUTER JOIN', 'CROSS JOIN', 'NATURAL JOIN']; | ||
@@ -71,3 +72,4 @@ var PlSqlFormatter = /*#__PURE__*/function (_Formatter) { | ||
lineCommentTypes: ['--'], | ||
specialWordChars: ['_', '$', '#', '.', '@'] | ||
specialWordChars: ['_', '$', '#', '.', '@'], | ||
operators: ['||', '**', '!=', ':='] | ||
}); | ||
@@ -74,0 +76,0 @@ } |
@@ -39,3 +39,4 @@ "use strict"; | ||
var reservedTopLevelWordsNoIndent = ['INTERSECT', 'INTERSECT ALL', 'UNION', 'UNION ALL']; | ||
var reservedNewlineWords = ['AND', 'CROSS JOIN', 'ELSE', 'INNER JOIN', 'JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'OR', 'OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN', 'WHEN']; | ||
var reservedNewlineWords = ['AND', 'ELSE', 'OR', 'WHEN', // joins | ||
'JOIN', 'INNER JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN', 'FULL JOIN', 'FULL OUTER JOIN', 'CROSS JOIN', 'NATURAL JOIN']; | ||
@@ -67,3 +68,3 @@ var PostgreSqlFormatter = /*#__PURE__*/function (_Formatter) { | ||
lineCommentTypes: ['--'], | ||
operators: ['<<', '>>', '||/', '|/', '::', '->>', '->', '~~*', '~~', '!~~*', '!~~', '~*', '!~*', '!~'] | ||
operators: ['!=', '<<', '>>', '||/', '|/', '::', '->>', '->', '~~*', '~~', '!~~*', '!~~', '~*', '!~*', '!~', '!!'] | ||
}); | ||
@@ -70,0 +71,0 @@ } |
@@ -39,11 +39,12 @@ "use strict"; | ||
var reservedTopLevelWordsNoIndent = []; | ||
var reservedNewlineWords = ['AND', 'CROSS JOIN', 'ELSE', 'INNER JOIN', 'JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'OR', 'OUTER APPLY', 'OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN', 'WHEN', 'VACUUM', 'COPY', 'UNLOAD', 'ANALYZE', 'ANALYSE', 'DISTKEY', 'SORTKEY', 'COMPOUND', 'INTERLEAVED']; | ||
var reservedNewlineWords = ['AND', 'ELSE', 'OR', 'OUTER APPLY', 'WHEN', 'VACUUM', 'COPY', 'UNLOAD', 'ANALYZE', 'ANALYSE', 'DISTKEY', 'SORTKEY', 'COMPOUND', 'INTERLEAVED', // joins | ||
'JOIN', 'INNER JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN', 'FULL JOIN', 'FULL OUTER JOIN', 'CROSS JOIN', 'NATURAL JOIN']; | ||
var StandardSqlFormatter = /*#__PURE__*/function (_Formatter) { | ||
_inherits(StandardSqlFormatter, _Formatter); | ||
var RedshiftFormatter = /*#__PURE__*/function (_Formatter) { | ||
_inherits(RedshiftFormatter, _Formatter); | ||
var _super = _createSuper(StandardSqlFormatter); | ||
var _super = _createSuper(RedshiftFormatter); | ||
function StandardSqlFormatter() { | ||
_classCallCheck(this, StandardSqlFormatter); | ||
function RedshiftFormatter() { | ||
_classCallCheck(this, RedshiftFormatter); | ||
@@ -53,3 +54,3 @@ return _super.apply(this, arguments); | ||
_createClass(StandardSqlFormatter, [{ | ||
_createClass(RedshiftFormatter, [{ | ||
key: "tokenizer", | ||
@@ -67,3 +68,4 @@ value: function tokenizer() { | ||
namedPlaceholderTypes: ['@', '#', '$'], | ||
lineCommentTypes: ['--'] | ||
lineCommentTypes: ['--'], | ||
operators: ['|/', '||/', '<<', '>>', '!=', '||'] | ||
}); | ||
@@ -73,6 +75,6 @@ } | ||
return StandardSqlFormatter; | ||
return RedshiftFormatter; | ||
}(_Formatter2["default"]); | ||
exports["default"] = StandardSqlFormatter; | ||
exports["default"] = RedshiftFormatter; | ||
module.exports = exports.default; |
@@ -43,3 +43,5 @@ "use strict"; | ||
var reservedTopLevelWordsNoIndent = ['EXCEPT ALL', 'EXCEPT', 'INTERSECT ALL', 'INTERSECT', 'UNION ALL', 'UNION']; | ||
var reservedNewlineWords = ['AND', 'ANTI JOIN', 'CREATE OR', 'CREATE', 'CROSS JOIN', 'ELSE', 'FULL OUTER JOIN', 'INNER JOIN', 'JOIN', 'LATERAL VIEW', 'LEFT ANTI JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'LEFT SEMI JOIN', 'NATURAL ANTI JOIN', 'NATURAL FULL OUTER JOIN', 'NATURAL INNER JOIN', 'NATURAL JOIN', 'NATURAL LEFT ANTI JOIN', 'NATURAL LEFT OUTER JOIN', 'NATURAL LEFT SEMI JOIN', 'NATURAL OUTER JOIN', 'NATURAL RIGHT OUTER JOIN', 'NATURAL RIGHT SEMI JOIN', 'NATURAL SEMI JOIN', 'OR', 'OUTER APPLY', 'OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN', 'RIGHT SEMI JOIN', 'SEMI JOIN', 'WHEN', 'XOR']; | ||
var reservedNewlineWords = ['AND', 'CREATE OR', 'CREATE', 'ELSE', 'LATERAL VIEW', 'OR', 'OUTER APPLY', 'WHEN', 'XOR', // joins | ||
'JOIN', 'INNER JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN', 'FULL JOIN', 'FULL OUTER JOIN', 'CROSS JOIN', 'NATURAL JOIN', // non-standard-joins | ||
'ANTI JOIN', 'SEMI JOIN', 'LEFT ANTI JOIN', 'LEFT SEMI JOIN', 'RIGHT OUTER JOIN', 'RIGHT SEMI JOIN', 'NATURAL ANTI JOIN', 'NATURAL FULL OUTER JOIN', 'NATURAL INNER JOIN', 'NATURAL LEFT ANTI JOIN', 'NATURAL LEFT OUTER JOIN', 'NATURAL LEFT SEMI JOIN', 'NATURAL OUTER JOIN', 'NATURAL RIGHT OUTER JOIN', 'NATURAL RIGHT SEMI JOIN', 'NATURAL SEMI JOIN']; | ||
@@ -70,3 +72,4 @@ var SparkSqlFormatter = /*#__PURE__*/function (_Formatter) { | ||
namedPlaceholderTypes: ['$'], | ||
lineCommentTypes: ['--'] | ||
lineCommentTypes: ['--'], | ||
operators: ['!=', '<=>', '&&', '||', '=='] | ||
}); | ||
@@ -73,0 +76,0 @@ } |
@@ -39,3 +39,4 @@ "use strict"; | ||
var reservedTopLevelWordsNoIndent = ['INTERSECT', 'INTERSECT ALL', 'MINUS', 'UNION', 'UNION ALL']; | ||
var reservedNewlineWords = ['AND', 'CROSS APPLY', 'CROSS JOIN', 'ELSE', 'INNER JOIN', 'JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'OR', 'OUTER APPLY', 'OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN', 'WHEN', 'XOR']; | ||
var reservedNewlineWords = ['AND', 'CROSS APPLY', 'ELSE', 'OR', 'OUTER APPLY', 'WHEN', 'XOR', // joins | ||
'JOIN', 'INNER JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN', 'FULL JOIN', 'FULL OUTER JOIN', 'CROSS JOIN', 'NATURAL JOIN']; | ||
@@ -61,8 +62,8 @@ var StandardSqlFormatter = /*#__PURE__*/function (_Formatter) { | ||
reservedTopLevelWordsNoIndent: reservedTopLevelWordsNoIndent, | ||
stringTypes: ["\"\"", "N''", "''", '``', '[]'], | ||
stringTypes: ["\"\"", "''"], | ||
openParens: ['(', 'CASE'], | ||
closeParens: [')', 'END'], | ||
indexedPlaceholderTypes: ['?'], | ||
namedPlaceholderTypes: ['@', ':'], | ||
lineCommentTypes: ['#', '--'] | ||
namedPlaceholderTypes: [], | ||
lineCommentTypes: ['--'] | ||
}); | ||
@@ -69,0 +70,0 @@ } |
@@ -39,3 +39,4 @@ "use strict"; | ||
var reservedTopLevelWordsNoIndent = ['INTERSECT', 'INTERSECT ALL', 'MINUS', 'UNION', 'UNION ALL']; | ||
var reservedNewlineWords = ['AND', 'CROSS JOIN', 'ELSE', 'INNER JOIN', 'JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'OR', 'OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN', 'WHEN']; | ||
var reservedNewlineWords = ['AND', 'ELSE', 'OR', 'WHEN', // joins | ||
'JOIN', 'INNER JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN', 'FULL JOIN', 'FULL OUTER JOIN', 'CROSS JOIN']; | ||
@@ -42,0 +43,0 @@ var TSqlFormatter = /*#__PURE__*/function (_Formatter) { |
{ | ||
"name": "sql-formatter", | ||
"version": "4.0.0-beta.6", | ||
"version": "4.0.0-beta.7", | ||
"description": "Format whitespace in a SQL query to make it more readable", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -26,12 +26,6 @@ import tokenTypes from './tokenTypes'; | ||
this.OPERATOR_REGEX = regexFactory.createOperatorRegex([ | ||
...(cfg.operators || []), | ||
'!=', | ||
'<>', | ||
'==', | ||
'<=', | ||
'>=', | ||
'!<', | ||
'!>', | ||
'||', | ||
':=', | ||
...(cfg.operators || []), | ||
]); | ||
@@ -38,0 +32,0 @@ |
@@ -538,13 +538,17 @@ import Formatter from '../core/Formatter'; | ||
'AND', | ||
'CROSS JOIN', | ||
'OR', | ||
// joins | ||
'JOIN', | ||
'INNER JOIN', | ||
'JOIN', | ||
'LEFT JOIN', | ||
'LEFT OUTER JOIN', | ||
'OR', | ||
'OUTER JOIN', | ||
'RIGHT JOIN', | ||
'RIGHT OUTER JOIN', | ||
'FULL JOIN', | ||
'FULL OUTER JOIN', | ||
'CROSS JOIN', | ||
'NATURAL JOIN', | ||
]; | ||
// For reference: https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_72/db2/rbafzintro.htm | ||
export default class Db2Formatter extends Formatter { | ||
@@ -564,4 +568,5 @@ tokenizer() { | ||
specialWordChars: ['#', '@'], | ||
operators: ['**', '!=', '!>', '!>', '||'], | ||
}); | ||
} | ||
} |
@@ -279,15 +279,23 @@ import Formatter from '../core/Formatter'; | ||
'AND', | ||
'CROSS JOIN', | ||
'ELSE', | ||
'OR', | ||
'WHEN', | ||
// joins | ||
'JOIN', | ||
'INNER JOIN', | ||
'JOIN', | ||
'LEFT JOIN', | ||
'LEFT OUTER JOIN', | ||
'OR', | ||
'OUTER JOIN', | ||
'RIGHT JOIN', | ||
'RIGHT OUTER JOIN', | ||
'WHEN', | ||
'CROSS JOIN', | ||
'NATURAL JOIN', | ||
// non-standard joins | ||
'STRAIGHT_JOIN', | ||
'NATURAL LEFT JOIN', | ||
'NATURAL LEFT OUTER JOIN', | ||
'NATURAL RIGHT JOIN', | ||
'NATURAL RIGHT OUTER JOIN', | ||
]; | ||
// For reference: https://mariadb.com/kb/en/sql-statements-structure/ | ||
export default class MariaDbFormatter extends Formatter { | ||
@@ -294,0 +302,0 @@ tokenizer() { |
@@ -292,13 +292,20 @@ import Formatter from '../core/Formatter'; | ||
'AND', | ||
'CROSS JOIN', | ||
'ELSE', | ||
'OR', | ||
'WHEN', | ||
// joins | ||
'JOIN', | ||
'INNER JOIN', | ||
'JOIN', | ||
'LEFT JOIN', | ||
'LEFT OUTER JOIN', | ||
'OR', | ||
'OUTER JOIN', | ||
'RIGHT JOIN', | ||
'RIGHT OUTER JOIN', | ||
'WHEN', | ||
'CROSS JOIN', | ||
'NATURAL JOIN', | ||
// non-standard joins | ||
'STRAIGHT_JOIN', | ||
'NATURAL LEFT JOIN', | ||
'NATURAL LEFT OUTER JOIN', | ||
'NATURAL RIGHT JOIN', | ||
'NATURAL RIGHT OUTER JOIN', | ||
]; | ||
@@ -305,0 +312,0 @@ |
@@ -211,13 +211,14 @@ import Formatter from '../core/Formatter'; | ||
'AND', | ||
'OR', | ||
'XOR', | ||
// joins | ||
'JOIN', | ||
'INNER JOIN', | ||
'JOIN', | ||
'LEFT JOIN', | ||
'LEFT OUTER JOIN', | ||
'OR', | ||
'OUTER JOIN', | ||
'RIGHT JOIN', | ||
'RIGHT OUTER JOIN', | ||
'XOR', | ||
]; | ||
// For reference: http://docs.couchbase.com.s3-website-us-west-1.amazonaws.com/server/6.0/n1ql/n1ql-language-reference/index.html | ||
export default class N1qlFormatter extends Formatter { | ||
@@ -235,4 +236,5 @@ tokenizer() { | ||
lineCommentTypes: ['#', '--'], | ||
operators: ['==', '!='], | ||
}); | ||
} | ||
} |
@@ -398,16 +398,19 @@ import Formatter from '../core/Formatter'; | ||
'CROSS APPLY', | ||
'CROSS JOIN', | ||
'ELSE', | ||
'END', | ||
'OR', | ||
'OUTER APPLY', | ||
'WHEN', | ||
'XOR', | ||
// joins | ||
'JOIN', | ||
'INNER JOIN', | ||
'JOIN', | ||
'LEFT JOIN', | ||
'LEFT OUTER JOIN', | ||
'OR', | ||
'OUTER APPLY', | ||
'OUTER JOIN', | ||
'RIGHT JOIN', | ||
'RIGHT OUTER JOIN', | ||
'WHEN', | ||
'XOR', | ||
'FULL JOIN', | ||
'FULL OUTER JOIN', | ||
'CROSS JOIN', | ||
'NATURAL JOIN', | ||
]; | ||
@@ -429,2 +432,3 @@ | ||
specialWordChars: ['_', '$', '#', '.', '@'], | ||
operators: ['||', '**', '!=', ':='], | ||
}); | ||
@@ -431,0 +435,0 @@ } |
@@ -487,13 +487,16 @@ import Formatter from '../core/Formatter'; | ||
'AND', | ||
'CROSS JOIN', | ||
'ELSE', | ||
'OR', | ||
'WHEN', | ||
// joins | ||
'JOIN', | ||
'INNER JOIN', | ||
'JOIN', | ||
'LEFT JOIN', | ||
'LEFT OUTER JOIN', | ||
'OR', | ||
'OUTER JOIN', | ||
'RIGHT JOIN', | ||
'RIGHT OUTER JOIN', | ||
'WHEN', | ||
'FULL JOIN', | ||
'FULL OUTER JOIN', | ||
'CROSS JOIN', | ||
'NATURAL JOIN', | ||
]; | ||
@@ -515,2 +518,3 @@ | ||
operators: [ | ||
'!=', | ||
'<<', | ||
@@ -530,2 +534,3 @@ '>>', | ||
'!~', | ||
'!!', | ||
], | ||
@@ -532,0 +537,0 @@ }); |
@@ -342,13 +342,5 @@ import Formatter from '../core/Formatter'; | ||
'AND', | ||
'CROSS JOIN', | ||
'ELSE', | ||
'INNER JOIN', | ||
'JOIN', | ||
'LEFT JOIN', | ||
'LEFT OUTER JOIN', | ||
'OR', | ||
'OUTER APPLY', | ||
'OUTER JOIN', | ||
'RIGHT JOIN', | ||
'RIGHT OUTER JOIN', | ||
'WHEN', | ||
@@ -364,5 +356,16 @@ 'VACUUM', | ||
'INTERLEAVED', | ||
// joins | ||
'JOIN', | ||
'INNER JOIN', | ||
'LEFT JOIN', | ||
'LEFT OUTER JOIN', | ||
'RIGHT JOIN', | ||
'RIGHT OUTER JOIN', | ||
'FULL JOIN', | ||
'FULL OUTER JOIN', | ||
'CROSS JOIN', | ||
'NATURAL JOIN', | ||
]; | ||
export default class StandardSqlFormatter extends Formatter { | ||
export default class RedshiftFormatter extends Formatter { | ||
tokenizer() { | ||
@@ -380,4 +383,5 @@ return new Tokenizer({ | ||
lineCommentTypes: ['--'], | ||
operators: ['|/', '||/', '<<', '>>', '!=', '||'], | ||
}); | ||
} | ||
} |
@@ -197,19 +197,31 @@ import Formatter from '../core/Formatter'; | ||
'AND', | ||
'ANTI JOIN', | ||
'CREATE OR', | ||
'CREATE', | ||
'CROSS JOIN', | ||
'ELSE', | ||
'FULL OUTER JOIN', | ||
'LATERAL VIEW', | ||
'OR', | ||
'OUTER APPLY', | ||
'WHEN', | ||
'XOR', | ||
// joins | ||
'JOIN', | ||
'INNER JOIN', | ||
'JOIN', | ||
'LATERAL VIEW', | ||
'LEFT ANTI JOIN', | ||
'LEFT JOIN', | ||
'LEFT OUTER JOIN', | ||
'RIGHT JOIN', | ||
'RIGHT OUTER JOIN', | ||
'FULL JOIN', | ||
'FULL OUTER JOIN', | ||
'CROSS JOIN', | ||
'NATURAL JOIN', | ||
// non-standard-joins | ||
'ANTI JOIN', | ||
'SEMI JOIN', | ||
'LEFT ANTI JOIN', | ||
'LEFT SEMI JOIN', | ||
'RIGHT OUTER JOIN', | ||
'RIGHT SEMI JOIN', | ||
'NATURAL ANTI JOIN', | ||
'NATURAL FULL OUTER JOIN', | ||
'NATURAL INNER JOIN', | ||
'NATURAL JOIN', | ||
'NATURAL LEFT ANTI JOIN', | ||
@@ -222,11 +234,2 @@ 'NATURAL LEFT OUTER JOIN', | ||
'NATURAL SEMI JOIN', | ||
'OR', | ||
'OUTER APPLY', | ||
'OUTER JOIN', | ||
'RIGHT JOIN', | ||
'RIGHT OUTER JOIN', | ||
'RIGHT SEMI JOIN', | ||
'SEMI JOIN', | ||
'WHEN', | ||
'XOR', | ||
]; | ||
@@ -247,2 +250,3 @@ | ||
lineCommentTypes: ['--'], | ||
operators: ['!=', '<=>', '&&', '||', '=='], | ||
}); | ||
@@ -249,0 +253,0 @@ } |
@@ -309,15 +309,18 @@ import Formatter from '../core/Formatter'; | ||
'CROSS APPLY', | ||
'CROSS JOIN', | ||
'ELSE', | ||
'OR', | ||
'OUTER APPLY', | ||
'WHEN', | ||
'XOR', | ||
// joins | ||
'JOIN', | ||
'INNER JOIN', | ||
'JOIN', | ||
'LEFT JOIN', | ||
'LEFT OUTER JOIN', | ||
'OR', | ||
'OUTER APPLY', | ||
'OUTER JOIN', | ||
'RIGHT JOIN', | ||
'RIGHT OUTER JOIN', | ||
'WHEN', | ||
'XOR', | ||
'FULL JOIN', | ||
'FULL OUTER JOIN', | ||
'CROSS JOIN', | ||
'NATURAL JOIN', | ||
]; | ||
@@ -332,10 +335,10 @@ | ||
reservedTopLevelWordsNoIndent, | ||
stringTypes: [`""`, "N''", "''", '``', '[]'], | ||
stringTypes: [`""`, "''"], | ||
openParens: ['(', 'CASE'], | ||
closeParens: [')', 'END'], | ||
indexedPlaceholderTypes: ['?'], | ||
namedPlaceholderTypes: ['@', ':'], | ||
lineCommentTypes: ['#', '--'], | ||
namedPlaceholderTypes: [], | ||
lineCommentTypes: ['--'], | ||
}); | ||
} | ||
} |
@@ -220,13 +220,15 @@ import Formatter from '../core/Formatter'; | ||
'AND', | ||
'CROSS JOIN', | ||
'ELSE', | ||
'OR', | ||
'WHEN', | ||
// joins | ||
'JOIN', | ||
'INNER JOIN', | ||
'JOIN', | ||
'LEFT JOIN', | ||
'LEFT OUTER JOIN', | ||
'OR', | ||
'OUTER JOIN', | ||
'RIGHT JOIN', | ||
'RIGHT OUTER JOIN', | ||
'WHEN', | ||
'FULL JOIN', | ||
'FULL OUTER JOIN', | ||
'CROSS JOIN', | ||
]; | ||
@@ -233,0 +235,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
793812
8479
147
1
1
16