sql-formatter
Advanced tools
Comparing version 12.0.1 to 12.0.2
@@ -35,3 +35,3 @@ import nearley from 'nearley'; | ||
} else { | ||
throw new Error('Parse error: Ambiguous grammar'); | ||
throw new Error(`Parse error: Ambiguous grammar\n${JSON.stringify(results, undefined, 2)}`); | ||
} | ||
@@ -38,0 +38,0 @@ } |
@@ -49,2 +49,24 @@ // Generated automatically by nearley, version 2.20.1 | ||
const addCommentsToArray = (nodes, { | ||
leading, | ||
trailing | ||
}) => { | ||
if (leading !== null && leading !== void 0 && leading.length) { | ||
const [first, ...rest] = nodes; | ||
nodes = [addComments(first, { | ||
leading | ||
}), ...rest]; | ||
} | ||
if (trailing !== null && trailing !== void 0 && trailing.length) { | ||
const lead = nodes.slice(0, -1); | ||
const last = nodes[nodes.length - 1]; | ||
nodes = [...lead, addComments(last, { | ||
trailing | ||
})]; | ||
} | ||
return nodes; | ||
}; | ||
; | ||
@@ -270,2 +292,13 @@ ; | ||
}, { | ||
"name": "expression_chain$ebnf$1", | ||
"symbols": [] | ||
}, { | ||
"name": "expression_chain$ebnf$1", | ||
"symbols": ["expression_chain$ebnf$1", "_expression_with_comments"], | ||
"postprocess": d => d[0].concat([d[1]]) | ||
}, { | ||
"name": "expression_chain", | ||
"symbols": ["expression", "expression_chain$ebnf$1"], | ||
"postprocess": ([expr, chain]) => [expr, ...chain] | ||
}, { | ||
"name": "expression_with_comments_", | ||
@@ -277,2 +310,8 @@ "symbols": ["expression", "_"], | ||
}, { | ||
"name": "_expression_with_comments", | ||
"symbols": ["_", "expression"], | ||
"postprocess": ([_, expr]) => addComments(expr, { | ||
leading: _ | ||
}) | ||
}, { | ||
"name": "free_form_sql$subexpression$1", | ||
@@ -481,3 +520,3 @@ "symbols": ["asteriskless_free_form_sql"] | ||
type: "BETWEEN" | ||
} : BETWEEN, "_", "expression", "_", lexer.has("AND") ? { | ||
} : BETWEEN, "_", "expression_chain", "_", lexer.has("AND") ? { | ||
type: "AND" | ||
@@ -488,6 +527,6 @@ } : AND, "_", "expression"], | ||
betweenKw: toKeywordNode(betweenToken), | ||
expr1: [addComments(expr1, { | ||
expr1: addCommentsToArray(expr1, { | ||
leading: _1, | ||
trailing: _2 | ||
})], | ||
}), | ||
andKw: toKeywordNode(andToken), | ||
@@ -494,0 +533,0 @@ expr2: [addComments(expr2, { |
{ | ||
"name": "sql-formatter", | ||
"version": "12.0.1", | ||
"version": "12.0.2", | ||
"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 not supported yet
Sorry, the diff of this file is not supported yet
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
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
2147016
8121