Skip to content

Commit 74072dd

Browse files
committed
Merge branch 'parser-0.42.0'
2 parents 92a1f44 + 35dcda7 commit 74072dd

14 files changed

Lines changed: 46 additions & 70 deletions

README.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -211,17 +211,6 @@ There are also several SQL-specific options:
211211

212212
_Since 0.13.0_
213213

214-
- **`sqlAcceptUnsupportedGrammar`**: `boolean` (default `false`)
215-
216-
Normally when the plugin encounters SQL syntax it doesn't support
217-
it will throw an error and won't format anything at all.
218-
With this option enabled, it will skip over SQL statements it doesn't recognize, leaving them as-is.
219-
220-
**Deprecated:** Use conditional comments `/* sql-parser-cst-disable */` and
221-
`/* sql-parser-cst-enable */` instead.
222-
223-
_Since 0.12.0_
224-
225214
- **`sqlExperimentalPlpgsql`**: `boolean` (default `false`)
226215

227216
When enabled, the plugin will attempt to format PL/pgSQL function bodies.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
],
4040
"dependencies": {
4141
"prettier": "^3.0.3",
42-
"sql-parser-cst": "^0.41.2"
42+
"sql-parser-cst": "^0.42.0"
4343
},
4444
"devDependencies": {
4545
"@types/jest": "^30.0.0",

src/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ const createParser = (dialect: DialectName): Parser<Node> => ({
5252
includeComments: true,
5353
filename: options.filepath,
5454
paramTypes: (options as AllPrettierOptions<Node>).sqlParamTypes,
55-
acceptUnsupportedGrammar: (options as AllPrettierOptions<Node>)
56-
.sqlAcceptUnsupportedGrammar,
5755
}),
5856
text,
5957
options as AllPrettierOptions<Node>,

src/options.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ export interface SqlPluginOptions {
1010
sqlParamTypes: NonNullable<CstParserOptions["paramTypes"]>;
1111
sqlCanonicalSyntax: boolean;
1212
sqlFinalSemicolon: boolean;
13-
sqlAcceptUnsupportedGrammar: boolean;
1413
sqlExperimentalPlpgsql: boolean;
1514
}
1615

@@ -158,14 +157,6 @@ export const options: SupportOptions = {
158157
description: "Enforces a semicolon at the end of last SQL statement",
159158
// Since 0.13.0
160159
},
161-
sqlAcceptUnsupportedGrammar: {
162-
type: "boolean",
163-
category: "SQL",
164-
default: false,
165-
description:
166-
"Skips formatting unsupported SQL statements instead of exiting with an error",
167-
// Since 0.12.0
168-
},
169160
sqlExperimentalPlpgsql: {
170161
type: "boolean",
171162
category: "SQL",

src/syntax/other_clauses.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ export const otherClausesMap: CstToDocMap<AllOtherClauses> = {
1212
returning_clause: (print) =>
1313
group([print("returningKw"), indent([line, print("columns")])]),
1414

15+
// INTO clause
16+
into_variables_clause: (print) =>
17+
group([
18+
print.spaced(["intoKw", "strictKw"]),
19+
indent([line, print("variables")]),
20+
]),
21+
1522
as_clause: (print, node) => {
1623
if (isStringLiteral(node.expr) || isDynamicallyLoadedFunction(node.expr)) {
1724
return group(print.spaced(["asKw", "expr"]));

src/syntax/prepared_statements.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ export const preparedStatementsMap: CstToDocMap<AllPreparedStatementNodes> = {
2626
print("executeKw"),
2727
indent([line, print.separated(line, ["expr", "using"])]),
2828
]),
29-
execute_into_clause: (print) => print.spaced(["intoKw", "variables"]),
3029
execute_using_clause: (print) =>
3130
group([print("usingKw"), indent([line, print("values")])]),
3231

src/syntax/procedural_language.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,8 @@ export const proceduralLanguageMap: CstToDocMap<AllProceduralNodes> = {
2222
// BEGIN .. END
2323
block_stmt: (print, node) =>
2424
group([
25-
stripTrailingHardline(print("declareClause")),
26-
[
27-
node.declareClause ? hardline : [],
28-
print.spaced(["beginKw", "atomicKw"]),
29-
],
25+
stripTrailingHardline(print("declare")),
26+
[node.declare ? hardline : [], print.spaced(["beginKw", "atomicKw"])],
3027
node.program.statements.length > 0
3128
? indent([hardline, stripTrailingHardline(print("program"))])
3229
: print("program"),
@@ -47,6 +44,8 @@ export const proceduralLanguageMap: CstToDocMap<AllProceduralNodes> = {
4744
]),
4845
),
4946
declare_init: (print) => print.spaced(["operator", "expr"]),
47+
declare_alias_stmt: (print) =>
48+
group(print.spaced(["newName", "aliasForKw", "oldName"])),
5049

5150
// EXCEPTION
5251
exception_clause: (print, node) => {

src/syntax/select.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,6 @@ export const selectMap: CstToDocMap<AllSelectNodes> = {
252252
// INTO clause
253253
into_table_clause: (print) =>
254254
print.spaced(["intoKw", "kind", "tableKw", "name"]),
255-
into_variables_clause: (print) =>
256-
group([print("intoKw"), indent([line, print("variables")])]),
257255
into_dumpfile_clause: (print) => print.spaced(["intoDumpfileKw", "filename"]),
258256
into_outfile_clause: (print, node) => {
259257
const hasOptions = node.charset || node.fields || node.lines;

src/syntax/transformMap.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ import { transactionMap } from "./transaction";
4242
import { triggerMap } from "./trigger";
4343
import { truncateMap } from "./truncate";
4444
import { typeMap } from "./type";
45-
import { unsupportedGrammarMap } from "./unsupported_grammar";
4645
import { updateMap } from "./update";
4746
import { viewMap } from "./view";
4847

@@ -94,7 +93,6 @@ export const transformMap: CstToDocMap<Node> = {
9493
...triggerMap,
9594
...truncateMap,
9695
...typeMap,
97-
...unsupportedGrammarMap,
9896
...updateMap,
9997
...viewMap,
10098

src/syntax/unsupported_grammar.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)