prettier-plugin-solidity 2.0.0-beta.8 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +63 -59
- package/dist/3620299963220ca08ee1.wasm +0 -0
- package/dist/binary-operator-printers/addition.js +11 -0
- package/dist/binary-operator-printers/addition.js.map +1 -0
- package/dist/binary-operator-printers/bit.js +5 -2
- package/dist/binary-operator-printers/bit.js.map +1 -1
- package/dist/binary-operator-printers/equality.js +7 -0
- package/dist/binary-operator-printers/equality.js.map +1 -0
- package/dist/binary-operator-printers/exponentiation.js +20 -12
- package/dist/binary-operator-printers/exponentiation.js.map +1 -1
- package/dist/binary-operator-printers/index.js +4 -2
- package/dist/binary-operator-printers/index.js.map +1 -1
- package/dist/binary-operator-printers/inequality.js +8 -0
- package/dist/binary-operator-printers/inequality.js.map +1 -0
- package/dist/binary-operator-printers/logical.js +9 -24
- package/dist/binary-operator-printers/logical.js.map +1 -1
- package/dist/binary-operator-printers/multiplication.js +19 -0
- package/dist/binary-operator-printers/multiplication.js.map +1 -0
- package/dist/binary-operator-printers/printers/binary-operation-printer.js +5 -0
- package/dist/binary-operator-printers/printers/binary-operation-printer.js.map +1 -0
- package/dist/binary-operator-printers/printers/create-binary-operation-printer.js +24 -0
- package/dist/binary-operator-printers/printers/create-binary-operation-printer.js.map +1 -0
- package/dist/binary-operator-printers/printers/create-group-if-necessary-builder.js +10 -0
- package/dist/binary-operator-printers/printers/create-group-if-necessary-builder.js.map +1 -0
- package/dist/binary-operator-printers/printers/create-indent-if-necessary-builder.js +22 -0
- package/dist/binary-operator-printers/printers/create-indent-if-necessary-builder.js.map +1 -0
- package/dist/binary-operator-printers/shift.js +6 -2
- package/dist/binary-operator-printers/shift.js.map +1 -1
- package/dist/binary-operator-printers/utils/should-group-or-indent.js +3 -0
- package/dist/binary-operator-printers/utils/should-group-or-indent.js.map +1 -0
- package/dist/comments/handlers/handleContractDefinitionComments.js +9 -5
- package/dist/comments/handlers/handleContractDefinitionComments.js.map +1 -1
- package/dist/comments/handlers/handleModifierInvocationComments.js +2 -3
- package/dist/comments/handlers/handleModifierInvocationComments.js.map +1 -1
- package/dist/common/printer-helpers.js +4 -11
- package/dist/common/printer-helpers.js.map +1 -1
- package/dist/index.js +5 -7
- package/dist/index.js.map +1 -1
- package/dist/nodes/Conditional.js +2 -2
- package/dist/nodes/Conditional.js.map +1 -1
- package/dist/nodes/ContractDefinition.js +30 -10
- package/dist/nodes/ContractDefinition.js.map +1 -1
- package/dist/nodes/ExpressionStatement.js +1 -1
- package/dist/nodes/ExpressionStatement.js.map +1 -1
- package/dist/nodes/FunctionDefinition.js +3 -3
- package/dist/nodes/FunctionDefinition.js.map +1 -1
- package/dist/nodes/ImportDirective.js +3 -1
- package/dist/nodes/ImportDirective.js.map +1 -1
- package/dist/options.js +16 -0
- package/dist/options.js.map +1 -1
- package/dist/parser.js +4 -0
- package/dist/parser.js.map +1 -1
- package/dist/prettier-comments/language-js/comments.js +8 -9
- package/dist/prettier-comments/language-js/comments.js.map +1 -1
- package/dist/printer.js +2 -2
- package/dist/printer.js.map +1 -1
- package/dist/slang-comments/handlers/{add-collection-node-first-comment.js → add-collection-first-comment.js} +2 -2
- package/dist/slang-comments/handlers/add-collection-first-comment.js.map +1 -0
- package/dist/slang-comments/handlers/{add-collection-node-last-comment.js → add-collection-last-comment.js} +2 -2
- package/dist/slang-comments/handlers/add-collection-last-comment.js.map +1 -0
- package/dist/slang-comments/handlers/handle-block-comments.js +4 -4
- package/dist/slang-comments/handlers/handle-block-comments.js.map +1 -1
- package/dist/slang-comments/handlers/handle-contract-definition-comments.js +20 -10
- package/dist/slang-comments/handlers/handle-contract-definition-comments.js.map +1 -1
- package/dist/slang-comments/handlers/handle-contract-specifiers-comments.js +22 -0
- package/dist/slang-comments/handlers/handle-contract-specifiers-comments.js.map +1 -0
- package/dist/slang-comments/handlers/handle-else-branch-comments.js +2 -2
- package/dist/slang-comments/handlers/handle-else-branch-comments.js.map +1 -1
- package/dist/slang-comments/handlers/handle-if-statement-comments.js +3 -3
- package/dist/slang-comments/handlers/handle-if-statement-comments.js.map +1 -1
- package/dist/slang-comments/handlers/handle-interface-definition-comments.js +4 -4
- package/dist/slang-comments/handlers/handle-interface-definition-comments.js.map +1 -1
- package/dist/slang-comments/handlers/handle-library-definition-comments.js +4 -4
- package/dist/slang-comments/handlers/handle-library-definition-comments.js.map +1 -1
- package/dist/slang-comments/handlers/handle-modifier-invocation-comments.js +2 -2
- package/dist/slang-comments/handlers/handle-modifier-invocation-comments.js.map +1 -1
- package/dist/slang-comments/handlers/handle-parameters-declaration-comments.js +4 -4
- package/dist/slang-comments/handlers/handle-parameters-declaration-comments.js.map +1 -1
- package/dist/slang-comments/handlers/handle-positional-arguments-declaration-comments.js +4 -4
- package/dist/slang-comments/handlers/handle-positional-arguments-declaration-comments.js.map +1 -1
- package/dist/slang-comments/handlers/handle-storage-layout-specifier-comments.js +14 -0
- package/dist/slang-comments/handlers/handle-storage-layout-specifier-comments.js.map +1 -0
- package/dist/slang-comments/handlers/handle-struct-comments.js +22 -0
- package/dist/slang-comments/handlers/handle-struct-comments.js.map +1 -0
- package/dist/slang-comments/handlers/handle-while-statement-comments.js +2 -2
- package/dist/slang-comments/handlers/handle-while-statement-comments.js.map +1 -1
- package/dist/slang-comments/handlers/index.js +6 -0
- package/dist/slang-comments/handlers/index.js.map +1 -1
- package/dist/slang-comments/printer.js +1 -2
- package/dist/slang-comments/printer.js.map +1 -1
- package/dist/slang-nodes/AdditiveExpression.js +12 -1
- package/dist/slang-nodes/AdditiveExpression.js.map +1 -1
- package/dist/slang-nodes/BitwiseAndExpression.js +8 -1
- package/dist/slang-nodes/BitwiseAndExpression.js.map +1 -1
- package/dist/slang-nodes/BitwiseOrExpression.js +8 -1
- package/dist/slang-nodes/BitwiseOrExpression.js.map +1 -1
- package/dist/slang-nodes/BitwiseXorExpression.js +8 -1
- package/dist/slang-nodes/BitwiseXorExpression.js.map +1 -1
- package/dist/slang-nodes/ConditionalExpression.js +17 -22
- package/dist/slang-nodes/ConditionalExpression.js.map +1 -1
- package/dist/slang-nodes/ContractDefinition.js +9 -10
- package/dist/slang-nodes/ContractDefinition.js.map +1 -1
- package/dist/slang-nodes/ContractSpecifier.js +27 -0
- package/dist/slang-nodes/ContractSpecifier.js.map +1 -0
- package/dist/slang-nodes/ContractSpecifiers.js +31 -0
- package/dist/slang-nodes/ContractSpecifiers.js.map +1 -0
- package/dist/slang-nodes/EqualityExpression.js +10 -2
- package/dist/slang-nodes/EqualityExpression.js.map +1 -1
- package/dist/slang-nodes/ExponentiationExpression.js +16 -2
- package/dist/slang-nodes/ExponentiationExpression.js.map +1 -1
- package/dist/slang-nodes/FallbackFunctionDefinition.js +4 -4
- package/dist/slang-nodes/FallbackFunctionDefinition.js.map +1 -1
- package/dist/slang-nodes/FunctionCallExpression.js +7 -7
- package/dist/slang-nodes/FunctionCallExpression.js.map +1 -1
- package/dist/slang-nodes/FunctionDefinition.js +4 -4
- package/dist/slang-nodes/FunctionDefinition.js.map +1 -1
- package/dist/slang-nodes/IfStatement.js +5 -4
- package/dist/slang-nodes/IfStatement.js.map +1 -1
- package/dist/slang-nodes/ImportDeconstructionSymbols.js +1 -1
- package/dist/slang-nodes/ImportDeconstructionSymbols.js.map +1 -1
- package/dist/slang-nodes/IndexAccessExpression.js +11 -11
- package/dist/slang-nodes/IndexAccessExpression.js.map +1 -1
- package/dist/slang-nodes/InequalityExpression.js +8 -2
- package/dist/slang-nodes/InequalityExpression.js.map +1 -1
- package/dist/slang-nodes/MemberAccessExpression.js +11 -13
- package/dist/slang-nodes/MemberAccessExpression.js.map +1 -1
- package/dist/slang-nodes/MultiplicativeExpression.js +13 -1
- package/dist/slang-nodes/MultiplicativeExpression.js.map +1 -1
- package/dist/slang-nodes/ReceiveFunctionDefinition.js +4 -4
- package/dist/slang-nodes/ReceiveFunctionDefinition.js.map +1 -1
- package/dist/slang-nodes/ReturnStatement.js +6 -6
- package/dist/slang-nodes/ReturnStatement.js.map +1 -1
- package/dist/slang-nodes/ShiftExpression.js +11 -1
- package/dist/slang-nodes/ShiftExpression.js.map +1 -1
- package/dist/slang-nodes/StateVariableDefinition.js +3 -9
- package/dist/slang-nodes/StateVariableDefinition.js.map +1 -1
- package/dist/slang-nodes/StateVariableDefinitionValue.js +1 -2
- package/dist/slang-nodes/StateVariableDefinitionValue.js.map +1 -1
- package/dist/slang-nodes/StorageLayoutSpecifier.js +25 -0
- package/dist/slang-nodes/StorageLayoutSpecifier.js.map +1 -0
- package/dist/slang-nodes/TupleDeconstructionStatement.js +3 -5
- package/dist/slang-nodes/TupleDeconstructionStatement.js.map +1 -1
- package/dist/slang-nodes/UnnamedFunctionDefinition.js +3 -3
- package/dist/slang-nodes/UnnamedFunctionDefinition.js.map +1 -1
- package/dist/slang-nodes/VariableDeclarationStatement.js +12 -12
- package/dist/slang-nodes/VariableDeclarationStatement.js.map +1 -1
- package/dist/slang-printers/create-binary-operation-printer.js +14 -9
- package/dist/slang-printers/create-binary-operation-printer.js.map +1 -1
- package/dist/slang-printers/print-binary-operation.js +24 -25
- package/dist/slang-printers/print-binary-operation.js.map +1 -1
- package/dist/slang-printers/print-comments.js +1 -1
- package/dist/slang-printers/print-comments.js.map +1 -1
- package/dist/slang-printers/print-logical-operation.js +5 -13
- package/dist/slang-printers/print-logical-operation.js.map +1 -1
- package/dist/slang-printers/print-preserving-empty-lines.js +1 -1
- package/dist/slang-printers/print-preserving-empty-lines.js.map +1 -1
- package/dist/slang-utils/create-hug-function.js +5 -4
- package/dist/slang-utils/create-hug-function.js.map +1 -1
- package/dist/slang-utils/create-parser.js +31 -86
- package/dist/slang-utils/create-parser.js.map +1 -1
- package/dist/slang-utils/metadata.js +31 -35
- package/dist/slang-utils/metadata.js.map +1 -1
- package/dist/slang-utils/sort-contract-specifiers.js +12 -0
- package/dist/slang-utils/sort-contract-specifiers.js.map +1 -0
- package/dist/slang-utils/sort-function-attributes.js +1 -3
- package/dist/slang-utils/sort-function-attributes.js.map +1 -1
- package/dist/slangPrinter.js +10 -18
- package/dist/slangPrinter.js.map +1 -1
- package/dist/slangSolidityParser.js +6 -9
- package/dist/slangSolidityParser.js.map +1 -1
- package/dist/standalone.js +1 -1
- package/dist/standalone.js.map +1 -1
- package/package.json +23 -20
- package/src/binary-operator-printers/addition.js +11 -0
- package/src/binary-operator-printers/bit.js +5 -2
- package/src/binary-operator-printers/equality.js +7 -0
- package/src/binary-operator-printers/exponentiation.js +22 -13
- package/src/binary-operator-printers/index.js +4 -2
- package/src/binary-operator-printers/inequality.js +8 -0
- package/src/binary-operator-printers/logical.js +12 -26
- package/src/binary-operator-printers/multiplication.js +19 -0
- package/src/binary-operator-printers/printers/binary-operation-printer.js +9 -0
- package/src/binary-operator-printers/printers/create-binary-operation-printer.js +31 -0
- package/src/binary-operator-printers/printers/create-group-if-necessary-builder.js +12 -0
- package/src/binary-operator-printers/printers/create-indent-if-necessary-builder.js +23 -0
- package/src/binary-operator-printers/shift.js +6 -2
- package/src/binary-operator-printers/utils/should-group-or-indent.js +3 -0
- package/src/comments/handlers/handleContractDefinitionComments.js +18 -6
- package/src/comments/handlers/handleModifierInvocationComments.js +7 -4
- package/src/common/printer-helpers.js +4 -15
- package/src/index.ts +6 -8
- package/src/nodes/Conditional.js +2 -2
- package/src/nodes/ContractDefinition.js +31 -11
- package/src/nodes/ExpressionStatement.js +1 -1
- package/src/nodes/FunctionDefinition.js +3 -4
- package/src/nodes/ImportDirective.js +5 -1
- package/src/options.ts +16 -0
- package/src/parser.js +4 -0
- package/src/prettier-comments/language-js/comments.js +10 -16
- package/src/printer.js +2 -5
- package/src/slang-comments/handlers/{add-collection-node-first-comment.ts → add-collection-first-comment.ts} +3 -3
- package/src/slang-comments/handlers/{add-collection-node-last-comment.ts → add-collection-last-comment.ts} +3 -3
- package/src/slang-comments/handlers/handle-block-comments.ts +4 -4
- package/src/slang-comments/handlers/handle-contract-definition-comments.ts +23 -15
- package/src/slang-comments/handlers/handle-contract-specifiers-comments.ts +33 -0
- package/src/slang-comments/handlers/handle-else-branch-comments.ts +2 -2
- package/src/slang-comments/handlers/handle-if-statement-comments.ts +3 -6
- package/src/slang-comments/handlers/handle-interface-definition-comments.ts +4 -4
- package/src/slang-comments/handlers/handle-library-definition-comments.ts +4 -4
- package/src/slang-comments/handlers/handle-modifier-invocation-comments.ts +2 -2
- package/src/slang-comments/handlers/handle-parameters-declaration-comments.ts +4 -4
- package/src/slang-comments/handlers/handle-positional-arguments-declaration-comments.ts +4 -4
- package/src/slang-comments/handlers/handle-storage-layout-specifier-comments.ts +23 -0
- package/src/slang-comments/handlers/handle-struct-comments.ts +39 -0
- package/src/slang-comments/handlers/handle-while-statement-comments.ts +2 -2
- package/src/slang-comments/handlers/index.ts +6 -0
- package/src/slang-comments/printer.ts +1 -3
- package/src/slang-nodes/AdditiveExpression.ts +15 -1
- package/src/slang-nodes/BitwiseAndExpression.ts +11 -1
- package/src/slang-nodes/BitwiseOrExpression.ts +14 -4
- package/src/slang-nodes/BitwiseXorExpression.ts +11 -1
- package/src/slang-nodes/ConditionalExpression.ts +14 -20
- package/src/slang-nodes/ContractDefinition.ts +10 -11
- package/src/slang-nodes/ContractSpecifier.ts +48 -0
- package/src/slang-nodes/ContractSpecifiers.ts +52 -0
- package/src/slang-nodes/EqualityExpression.ts +15 -2
- package/src/slang-nodes/ExponentiationExpression.ts +17 -4
- package/src/slang-nodes/FallbackFunctionDefinition.ts +4 -4
- package/src/slang-nodes/FunctionCallExpression.ts +7 -7
- package/src/slang-nodes/FunctionDefinition.ts +4 -4
- package/src/slang-nodes/IfStatement.ts +5 -4
- package/src/slang-nodes/ImportDeconstructionSymbols.ts +1 -1
- package/src/slang-nodes/IndexAccessExpression.ts +11 -12
- package/src/slang-nodes/InequalityExpression.ts +11 -2
- package/src/slang-nodes/MemberAccessExpression.ts +13 -17
- package/src/slang-nodes/MultiplicativeExpression.ts +16 -1
- package/src/slang-nodes/PositionalArguments.ts +2 -2
- package/src/slang-nodes/ReceiveFunctionDefinition.ts +4 -4
- package/src/slang-nodes/ReturnStatement.ts +5 -6
- package/src/slang-nodes/ShiftExpression.ts +14 -1
- package/src/slang-nodes/StateVariableDefinition.ts +3 -10
- package/src/slang-nodes/StateVariableDefinitionValue.ts +1 -2
- package/src/slang-nodes/StorageLayoutSpecifier.ts +45 -0
- package/src/slang-nodes/StringLiteral.ts +1 -1
- package/src/slang-nodes/TupleDeconstructionStatement.ts +6 -9
- package/src/slang-nodes/UnnamedFunctionDefinition.ts +3 -3
- package/src/slang-nodes/VariableDeclarationStatement.ts +15 -16
- package/src/slang-nodes/types.d.ts +15 -1
- package/src/slang-printers/create-binary-operation-printer.ts +16 -11
- package/src/slang-printers/print-binary-operation.ts +48 -39
- package/src/slang-printers/print-comments.ts +1 -1
- package/src/slang-printers/print-logical-operation.ts +8 -17
- package/src/slang-printers/print-preserving-empty-lines.ts +3 -7
- package/src/slang-utils/create-hug-function.ts +5 -5
- package/src/slang-utils/create-parser.ts +56 -119
- package/src/slang-utils/metadata.ts +33 -37
- package/src/slang-utils/sort-contract-specifiers.ts +22 -0
- package/src/slang-utils/sort-function-attributes.ts +2 -5
- package/src/slangPrinter.ts +12 -23
- package/src/slangSolidityParser.ts +9 -12
- package/src/types.d.ts +7 -219
- package/dist/78244c53725e2131398e.wasm +0 -0
- package/dist/binary-operator-printers/arithmetic.js +0 -44
- package/dist/binary-operator-printers/arithmetic.js.map +0 -1
- package/dist/binary-operator-printers/comparison.js +0 -38
- package/dist/binary-operator-printers/comparison.js.map +0 -1
- package/dist/common/backward-compatibility.js +0 -27
- package/dist/common/backward-compatibility.js.map +0 -1
- package/dist/slang-comments/handlers/add-collection-node-first-comment.js.map +0 -1
- package/dist/slang-comments/handlers/add-collection-node-last-comment.js.map +0 -1
- package/dist/slang-printers/print-comparison-operation.js +0 -35
- package/dist/slang-printers/print-comparison-operation.js.map +0 -1
- package/dist/slang-utils/prettier-version-satisfies.js +0 -6
- package/dist/slang-utils/prettier-version-satisfies.js.map +0 -1
- package/dist/slang-utils/print-warning.js +0 -12
- package/dist/slang-utils/print-warning.js.map +0 -1
- package/src/binary-operator-printers/arithmetic.js +0 -51
- package/src/binary-operator-printers/comparison.js +0 -36
- package/src/common/backward-compatibility.js +0 -34
- package/src/slang-printers/print-comparison-operation.ts +0 -45
- package/src/slang-utils/prettier-version-satisfies.ts +0 -8
- package/src/slang-utils/print-warning.ts +0 -12
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
# prettier-plugin-solidity
|
|
2
2
|
|
|
3
|
+
[](https://github.com/prettier-solidity/prettier-plugin-solidity/actions)
|
|
3
4
|
[](https://t.me/+kgTgkFgIwJkwMjcx)
|
|
4
|
-
[](https://
|
|
5
|
+
[](https://x.com/PrettierSol)
|
|
5
6
|
[](https://www.gitpoap.io/gh/prettier-solidity/prettier-plugin-solidity)
|
|
6
7
|
|
|
7
8
|
<p align="center">
|
|
8
9
|
<img width="375" height="375" src="https://user-images.githubusercontent.com/1022054/59317198-f1149b80-8d15-11e9-9b0f-0c5e7d4b8b81.png">
|
|
9
10
|
</p>
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
> ℹ️ This README is for the new major version of Prettier Plugin Solidity.
|
|
13
|
+
>
|
|
14
|
+
> The differences from v1 are minimal, but there are some breaking changes.
|
|
15
|
+
>
|
|
16
|
+
> To migrate from v1, follow the [migration guide](#migrating-from-v1).
|
|
17
|
+
>
|
|
18
|
+
> If you're looking for the previous version, check out the [v1 branch](https://github.com/prettier-solidity/prettier-plugin-solidity/tree/v1).
|
|
12
19
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
Nomic Foundation has put a lot of effort in providing a set of compiler APIs that helped us rethink our approach to parsing and rely on their flexibility, detail oriented solution and continuos support of new and old Solidity syntaxes.
|
|
16
|
-
|
|
17
|
-
Since v2.0.0 this package will ship with the Slang parser and this change must be implemented in existing configurations by replacing `parser: 'solidity-parse'` with `parser: 'slang-solidity'`.
|
|
20
|
+
A [Prettier](https://prettier.io/) plugin for automatically formatting your [Solidity](https://docs.soliditylang.org/en/latest/) code.
|
|
18
21
|
|
|
19
22
|
## Installation and usage
|
|
20
23
|
|
|
@@ -26,15 +29,13 @@ Install both `prettier` and `prettier-plugin-solidity`:
|
|
|
26
29
|
npm install --save-dev prettier prettier-plugin-solidity
|
|
27
30
|
```
|
|
28
31
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
Run prettier in your contracts:
|
|
32
|
+
Run prettier on your contracts:
|
|
32
33
|
|
|
33
34
|
```Bash
|
|
34
35
|
npx prettier --write --plugin=prettier-plugin-solidity 'contracts/**/*.sol'
|
|
35
36
|
```
|
|
36
37
|
|
|
37
|
-
You can add
|
|
38
|
+
You can add an npm script to run prettier on all your contracts:
|
|
38
39
|
|
|
39
40
|
```
|
|
40
41
|
"prettier": "prettier --write --plugin=prettier-plugin-solidity 'contracts/**/*.sol'"
|
|
@@ -50,13 +51,11 @@ Or you can use it as part of your linting to check that all your code is prettif
|
|
|
50
51
|
|
|
51
52
|
### Using in the Browser
|
|
52
53
|
|
|
53
|
-
_Added in v1.1.0_
|
|
54
|
-
|
|
55
54
|
To use this package in the browser, you need to load Prettier's standalone bundle before loading the build provided in this package.
|
|
56
55
|
|
|
57
56
|
Prettier's unpkg field points to `https://unpkg.com/prettier/standalone.js`, in a similar way this plugin points to `https://unpkg.com/prettier-plugin-solidity/dist/standalone.js`.
|
|
58
57
|
|
|
59
|
-
Once the scripts are loaded you will have access the globals `prettier` and `prettierPlugins`.
|
|
58
|
+
Once the scripts are loaded you will have access to the globals `prettier` and `prettierPlugins`.
|
|
60
59
|
|
|
61
60
|
We follow Prettier's strategy for populating their plugins in the object `prettierPlugins`, you can load other plugins like `https://unpkg.com/prettier@2.8.0/parser-markdown.js` and Prettier will have access to multiple parsers.
|
|
62
61
|
|
|
@@ -71,7 +70,7 @@ We follow Prettier's strategy for populating their plugins in the object `pretti
|
|
|
71
70
|
|
|
72
71
|
async function format(code) {
|
|
73
72
|
return await prettier.format(code, {
|
|
74
|
-
parser: 'slang
|
|
73
|
+
parser: 'slang',
|
|
75
74
|
plugins: [solidityPlugin]
|
|
76
75
|
});
|
|
77
76
|
}
|
|
@@ -81,26 +80,24 @@ We follow Prettier's strategy for populating their plugins in the object `pretti
|
|
|
81
80
|
</script>
|
|
82
81
|
```
|
|
83
82
|
|
|
84
|
-
For more details
|
|
83
|
+
For more details, have a look at [Prettier's documentation](https://prettier.io/docs/en/browser.html).
|
|
85
84
|
|
|
86
85
|
### Creating a package for the Browser
|
|
87
86
|
|
|
88
|
-
_Added in v1.2.0_
|
|
89
|
-
|
|
90
87
|
If you are creating your own package to be run in a browser, you might want to import the standalone files directly.
|
|
91
88
|
|
|
92
89
|
```Javascript
|
|
93
|
-
import prettier from
|
|
94
|
-
import solidityPlugin from
|
|
90
|
+
import prettier from "prettier/standalone";
|
|
91
|
+
import solidityPlugin from "prettier-plugin-solidity/standalone";
|
|
95
92
|
|
|
96
93
|
async function format(code) {
|
|
97
94
|
return await prettier.format(code, {
|
|
98
|
-
parser: "slang
|
|
95
|
+
parser: "slang",
|
|
99
96
|
plugins: [solidityPlugin],
|
|
100
97
|
});
|
|
101
98
|
}
|
|
102
99
|
|
|
103
|
-
const originalCode =
|
|
100
|
+
const originalCode = "contract Foo {}";
|
|
104
101
|
const formattedCode = format(originalCode);
|
|
105
102
|
```
|
|
106
103
|
|
|
@@ -116,7 +113,7 @@ The following is the default configuration internally used by this plugin.
|
|
|
116
113
|
{
|
|
117
114
|
"files": "*.sol",
|
|
118
115
|
"options": {
|
|
119
|
-
"parser": "slang
|
|
116
|
+
"parser": "slang",
|
|
120
117
|
"printWidth": 80,
|
|
121
118
|
"tabWidth": 4,
|
|
122
119
|
"useTabs": false,
|
|
@@ -136,7 +133,7 @@ Most options are described in Prettier's [documentation](https://prettier.io/doc
|
|
|
136
133
|
|
|
137
134
|
### Compiler
|
|
138
135
|
|
|
139
|
-
Many versions of the Solidity compiler have changes that affect how the code should be formatted. This plugin, by default, tries to format the code in the most compatible way that
|
|
136
|
+
Many versions of the Solidity compiler have changes that affect how the code should be formatted. This plugin, by default, tries to format the code in the most compatible way that is possible, but you can use the `compiler` option to nudge it in the right direction.
|
|
140
137
|
|
|
141
138
|
One example of this is import directives. Before `0.7.4`, the compiler didn't accept multi-line import statements, so we always format them in a single line. But if you use the `compiler` option to indicate that you are using a version greater or equal than `0.7.4`, the plugin will use multi-line imports when it makes sense.
|
|
142
139
|
|
|
@@ -161,7 +158,6 @@ The Solidity versions taken into consideration during formatting are:
|
|
|
161
158
|
```
|
|
162
159
|
|
|
163
160
|
- `v0.8.0`: Introduced these [changes](https://docs.soliditylang.org/en/v0.8.0/080-breaking-changes.html)
|
|
164
|
-
|
|
165
161
|
- The type `byte` has been removed. It was an alias of `bytes1`.
|
|
166
162
|
- Exponentiation is right associative, i.e., the expression `a**b**c` is parsed as `a**(b**c)`. Before 0.8.0, it was parsed as `(a**b)**c`.
|
|
167
163
|
|
|
@@ -216,9 +212,18 @@ You might have a multi-version project, where different files are compiled with
|
|
|
216
212
|
| ------- | --------------------- | ---------------------- |
|
|
217
213
|
| None | `--compiler <string>` | `compiler: "<string>"` |
|
|
218
214
|
|
|
219
|
-
###
|
|
215
|
+
### Parser
|
|
216
|
+
|
|
217
|
+
You can configure the parser used by Prettier Solidity. Two Solidity parsers are supported:
|
|
220
218
|
|
|
221
|
-
|
|
219
|
+
- [Slang](https://nomicfoundation.github.io/slang) (the default), a more powerful and correct parser that results in better formatting for some edge cases, especially when comments are involved.
|
|
220
|
+
- [Solidity Parser for JavaScript](https://github.com/solidity-parser/parser/), an [ANTLR](https://www.antlr.org/)-based parser. This is the version that Prettier Solidity v1 used by default. This parser is still supported in v2, but it's deprecated and will be removed in the next major version. You can use this parser by setting `parser: "antlr"` in your Prettier configuration.
|
|
221
|
+
|
|
222
|
+
| Default | CLI Override | API Override |
|
|
223
|
+
| ------- | ------------------- | -------------------- |
|
|
224
|
+
| `slang` | `--parser <string>` | `parser: "<string>"` |
|
|
225
|
+
|
|
226
|
+
### Experimental Ternaries
|
|
222
227
|
|
|
223
228
|
Mimicking prettier's [new ternary formatting](https://prettier.io/blog/2023/11/13/curious-ternaries) for the community to try.
|
|
224
229
|
|
|
@@ -260,8 +265,7 @@ Plug 'prettier/vim-prettier', {
|
|
|
260
265
|
\ 'solidity'] }
|
|
261
266
|
```
|
|
262
267
|
|
|
263
|
-
We modified the `do` instruction to also install this plugin. Then you'll have to configure the plugin to always use the
|
|
264
|
-
version installed in the vim plugin's directory. The vim-plug directory depends on value you use in `call plug#begin('~/.vim/<dir>')`:
|
|
268
|
+
We modified the `do` instruction to also install this plugin. Then you'll have to configure the plugin to always use the version installed in the vim plugin's directory. The vim-plug directory depends on the value you use in `call plug#begin('~/.vim/<dir>')`:
|
|
265
269
|
|
|
266
270
|
```vim
|
|
267
271
|
let g:prettier#exec_cmd_path = '~/.vim/plugged/vim-prettier/node_modules/.bin/prettier'
|
|
@@ -280,34 +284,29 @@ Now Prettier will be run every time the file is saved.
|
|
|
280
284
|
|
|
281
285
|
### VSCode
|
|
282
286
|
|
|
283
|
-
VSCode is not familiar with the Solidity language.
|
|
284
|
-
There are 2 extensions that you can install to provide support for Solidity:
|
|
287
|
+
VSCode is not familiar with the Solidity language. There are two extensions that you can install to provide support for Solidity:
|
|
285
288
|
|
|
286
|
-
- [`solidity`](https://marketplace.visualstudio.com/items?itemName=JuanBlanco.solidity)
|
|
287
289
|
- [`hardhat-solidity`](https://marketplace.visualstudio.com/items?itemName=NomicFoundation.hardhat-solidity)
|
|
290
|
+
- [`solidity`](https://marketplace.visualstudio.com/items?itemName=JuanBlanco.solidity)
|
|
291
|
+
|
|
292
|
+
We recommend using the `hardhat-solidity` extension:
|
|
288
293
|
|
|
289
294
|
```Bash
|
|
290
|
-
code --install-extension JuanBlanco.solidity
|
|
291
|
-
# or
|
|
292
295
|
code --install-extension NomicFoundation.hardhat-solidity
|
|
293
296
|
```
|
|
294
297
|
|
|
295
|
-
> :warning: **These 2 extensions offer similar functionality and will clash with each other**: Please choose which one matches your projects better.
|
|
296
|
-
|
|
297
298
|
These extensions provide basic integration with Prettier; in most cases, no further action is needed.
|
|
298
299
|
|
|
299
|
-
Make sure your editor has format
|
|
300
|
-
When you save VSCode will ask you what formatter would you like to use for the Solidity language, you can choose `JuanBlanco.solidity` or `NomicFoundation.hardhat-solidity`.
|
|
300
|
+
Make sure your editor has format-on-save set to true. When you save, VSCode will ask you what formatter would you like to use for the Solidity language. We recommend choosing `NomicFoundation.hardhat-solidity`.
|
|
301
301
|
|
|
302
302
|
At this point VSCode's `settings.json` should have a configuration similar to this:
|
|
303
303
|
|
|
304
|
-
```
|
|
304
|
+
```JSON5
|
|
305
305
|
{
|
|
306
306
|
"editor.formatOnSave": true,
|
|
307
307
|
"solidity.formatter": "prettier", // This is the default so it might be missing.
|
|
308
308
|
"[solidity]": {
|
|
309
|
-
|
|
310
|
-
// "editor.defaultFormatter": "NomicFoundation.hardhat-solidity"
|
|
309
|
+
"editor.defaultFormatter": "NomicFoundation.hardhat-solidity"
|
|
311
310
|
}
|
|
312
311
|
}
|
|
313
312
|
```
|
|
@@ -318,7 +317,7 @@ If you want more control over other details, you should proceed to install [`pre
|
|
|
318
317
|
code --install-extension esbenp.prettier-vscode
|
|
319
318
|
```
|
|
320
319
|
|
|
321
|
-
To interact with
|
|
320
|
+
To interact with third-party plugins, `prettier-vscode` will look in the project's npm modules, so you'll need to have `prettier` and `prettier-plugin-solidity` in your `package.json`
|
|
322
321
|
|
|
323
322
|
```Bash
|
|
324
323
|
npm install --save-dev prettier prettier-plugin-solidity
|
|
@@ -326,7 +325,7 @@ npm install --save-dev prettier prettier-plugin-solidity
|
|
|
326
325
|
|
|
327
326
|
This will allow you to specify the version of the plugin in case you want to use the latest version of the plugin or need to freeze the formatting since new versions of this plugin will implement tweaks on the possible formats.
|
|
328
327
|
|
|
329
|
-
You'll have to let VSCode what formatter you prefer.
|
|
328
|
+
You'll have to let VSCode know what formatter you prefer.
|
|
330
329
|
This can be done by opening the command palette and executing:
|
|
331
330
|
|
|
332
331
|
```
|
|
@@ -349,7 +348,7 @@ Now VSCode's `settings.json` should have this:
|
|
|
349
348
|
|
|
350
349
|
Note: By design, Prettier prioritizes a local over a global configuration. If you have a `.prettierrc` file in your project, your VSCode's default settings or rules in `settings.json` are ignored ([prettier/prettier-vscode#1079](https://github.com/prettier/prettier-vscode/issues/1079)).
|
|
351
350
|
|
|
352
|
-
###
|
|
351
|
+
### pnpm
|
|
353
352
|
|
|
354
353
|
To make Prettier Solidity work in your project, you have to add a `.prettierrc` file as shown [here](#configuration-file).
|
|
355
354
|
|
|
@@ -389,6 +388,26 @@ contract Foo is Bar {
|
|
|
389
388
|
|
|
390
389
|
Notice that the unnecessary parentheses in `modifier2` were removed in the function but not in the constructor.
|
|
391
390
|
|
|
391
|
+
## Migrating from v1
|
|
392
|
+
|
|
393
|
+
In most cases, upgrading to v2 of Prettier Solidity should be as easy as installing the latest version:
|
|
394
|
+
|
|
395
|
+
```bash
|
|
396
|
+
npm install prettier-plugin-solidity@latest
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
If you had the parser explicitly set in your config, you'll get this error:
|
|
400
|
+
|
|
401
|
+
```
|
|
402
|
+
[error] Couldn't resolve parser "solidity-parse".
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
To fix it, simply update the `parser` option in your `.prettierrc`:
|
|
406
|
+
|
|
407
|
+
```
|
|
408
|
+
"parser": "slang",
|
|
409
|
+
```
|
|
410
|
+
|
|
392
411
|
## Contributing
|
|
393
412
|
|
|
394
413
|
1. [Fork it](https://github.com/prettier-solidity/prettier-plugin-solidity/fork)
|
|
@@ -398,21 +417,6 @@ Notice that the unnecessary parentheses in `modifier2` were removed in the funct
|
|
|
398
417
|
5. Push to the branch (`git push origin feature/fooBar`)
|
|
399
418
|
6. Create a new Pull Request
|
|
400
419
|
|
|
401
|
-
## Who's using it?
|
|
402
|
-
|
|
403
|
-
These are some of the projects using Prettier Solidity:
|
|
404
|
-
|
|
405
|
-
- [Bancor](https://app.bancor.network)
|
|
406
|
-
- [Gelato](https://gelato.network/)
|
|
407
|
-
- [Gnosis Protocol](https://docs.gnosis.io/protocol/)
|
|
408
|
-
- [PieDAO](https://www.piedao.org/)
|
|
409
|
-
- [Sablier](https://sablier.finance/)
|
|
410
|
-
- [Synthetix](https://www.synthetix.io)
|
|
411
|
-
- [The Sandbox](https://www.sandbox.game/en/)
|
|
412
|
-
- [UMA](https://umaproject.org/)
|
|
413
|
-
- [Uniswap](https://uniswap.org)
|
|
414
|
-
- [Zora](https://zora.co)
|
|
415
|
-
|
|
416
420
|
## License
|
|
417
421
|
|
|
418
422
|
Distributed under the MIT license. See [LICENSE](LICENSE) for more information.
|
|
Binary file
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { binaryOperationPrinter } from './printers/binary-operation-printer.js';
|
|
2
|
+
import { bit } from './bit.js';
|
|
3
|
+
import { shift } from './shift.js';
|
|
4
|
+
import { inequality } from './inequality.js';
|
|
5
|
+
import { equality } from './equality.js';
|
|
6
|
+
import { logical } from './logical.js';
|
|
7
|
+
export const addition = {
|
|
8
|
+
match: (op) => ['+', '-'].includes(op),
|
|
9
|
+
print: binaryOperationPrinter([shift, bit, inequality, equality, logical])
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=addition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addition.js","sourceRoot":"","sources":["../../src/binary-operator-printers/addition.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC;IACtC,KAAK,EAAE,sBAAsB,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;CAC3E,CAAC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { binaryOperationPrinter } from './printers/binary-operation-printer.js';
|
|
2
|
+
import { inequality } from './inequality.js';
|
|
3
|
+
import { equality } from './equality.js';
|
|
4
|
+
import { logical } from './logical.js';
|
|
2
5
|
export const bit = {
|
|
3
6
|
match: (op) => ['&', '|', '^'].includes(op),
|
|
4
|
-
print:
|
|
7
|
+
print: binaryOperationPrinter([inequality, equality, logical])
|
|
5
8
|
};
|
|
6
9
|
//# sourceMappingURL=bit.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bit.js","sourceRoot":"","sources":["../../src/binary-operator-printers/bit.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"bit.js","sourceRoot":"","sources":["../../src/binary-operator-printers/bit.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,MAAM,CAAC,MAAM,GAAG,GAAG;IACjB,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC;IAC3C,KAAK,EAAE,sBAAsB,CAAC,CAAC,UAAU,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;CAC/D,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { binaryOperationPrinter } from './printers/binary-operation-printer.js';
|
|
2
|
+
import { logical } from './logical.js';
|
|
3
|
+
export const equality = {
|
|
4
|
+
match: (op) => ['==', '!='].includes(op),
|
|
5
|
+
print: binaryOperationPrinter([logical])
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=equality.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"equality.js","sourceRoot":"","sources":["../../src/binary-operator-printers/equality.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC;IACxC,KAAK,EAAE,sBAAsB,CAAC,CAAC,OAAO,CAAC,CAAC;CACzC,CAAC"}
|
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
import { doc } from 'prettier';
|
|
2
|
-
|
|
2
|
+
import { createBinaryOperationPrinter } from './printers/create-binary-operation-printer.js';
|
|
3
|
+
import { createIndentIfNecessaryBuilder } from './printers/create-indent-if-necessary-builder.js';
|
|
4
|
+
import { multiplication } from './multiplication.js';
|
|
5
|
+
import { addition } from './addition.js';
|
|
6
|
+
import { shift } from './shift.js';
|
|
7
|
+
import { bit } from './bit.js';
|
|
8
|
+
import { inequality } from './inequality.js';
|
|
9
|
+
import { equality } from './equality.js';
|
|
10
|
+
import { logical } from './logical.js';
|
|
11
|
+
const { group } = doc.builders;
|
|
3
12
|
export const exponentiation = {
|
|
4
13
|
match: (op) => op === '**',
|
|
5
|
-
print: (
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
14
|
+
print: createBinaryOperationPrinter(() => (document) => group(document), // always group
|
|
15
|
+
createIndentIfNecessaryBuilder([
|
|
16
|
+
multiplication,
|
|
17
|
+
addition,
|
|
18
|
+
shift,
|
|
19
|
+
bit,
|
|
20
|
+
inequality,
|
|
21
|
+
equality,
|
|
22
|
+
logical
|
|
23
|
+
]))
|
|
16
24
|
};
|
|
17
25
|
//# sourceMappingURL=exponentiation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exponentiation.js","sourceRoot":"","sources":["../../src/binary-operator-printers/exponentiation.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"exponentiation.js","sourceRoot":"","sources":["../../src/binary-operator-printers/exponentiation.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,4BAA4B,EAAE,MAAM,+CAA+C,CAAC;AAC7F,OAAO,EAAE,8BAA8B,EAAE,MAAM,kDAAkD,CAAC;AAClG,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,CAAC,QAAQ,CAAC;AAE/B,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,IAAI;IAC1B,KAAK,EAAE,4BAA4B,CACjC,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,eAAe;IACpD,8BAA8B,CAAC;QAC7B,cAAc;QACd,QAAQ;QACR,KAAK;QACL,GAAG;QACH,UAAU;QACV,QAAQ;QACR,OAAO;KACR,CAAC,CACH;CACF,CAAC"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './addition.js';
|
|
2
2
|
export * from './assignment.js';
|
|
3
3
|
export * from './bit.js';
|
|
4
|
-
export * from './
|
|
4
|
+
export * from './equality.js';
|
|
5
5
|
export * from './exponentiation.js';
|
|
6
|
+
export * from './inequality.js';
|
|
6
7
|
export * from './logical.js';
|
|
8
|
+
export * from './multiplication.js';
|
|
7
9
|
export * from './shift.js';
|
|
8
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/binary-operator-printers/index.js"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/binary-operator-printers/index.js"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { binaryOperationPrinter } from './printers/binary-operation-printer.js';
|
|
2
|
+
import { logical } from './logical.js';
|
|
3
|
+
import { equality } from './equality.js';
|
|
4
|
+
export const inequality = {
|
|
5
|
+
match: (op) => ['<', '>', '<=', '>='].includes(op),
|
|
6
|
+
print: binaryOperationPrinter([logical, equality])
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=inequality.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inequality.js","sourceRoot":"","sources":["../../src/binary-operator-printers/inequality.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC;IAClD,KAAK,EAAE,sBAAsB,CAAC,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;CACnD,CAAC"}
|
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
import { doc } from 'prettier';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { createBinaryOperationPrinter } from './printers/create-binary-operation-printer.js';
|
|
3
|
+
import { createGroupIfNecessaryBuilder } from './printers/create-group-if-necessary-builder.js';
|
|
4
|
+
import { notIndentParentTypes } from './printers/create-indent-if-necessary-builder.js';
|
|
5
|
+
import { shouldGroupOrIndent } from './utils/should-group-or-indent.js';
|
|
6
|
+
const { indent } = doc.builders;
|
|
4
7
|
const indentIfNecessaryBuilder = (path, options) => (document) => {
|
|
5
|
-
let node = path
|
|
6
|
-
for (let i = 0;; i += 1) {
|
|
8
|
+
for (let i = 0, { node } = path;; i += 1) {
|
|
7
9
|
const parentNode = path.getParentNode(i);
|
|
8
|
-
if (parentNode.type
|
|
9
|
-
return document;
|
|
10
|
-
if (parentNode.type === 'IfStatement')
|
|
11
|
-
return document;
|
|
12
|
-
if (parentNode.type === 'WhileStatement')
|
|
10
|
+
if (notIndentParentTypes.includes(parentNode.type))
|
|
13
11
|
return document;
|
|
14
12
|
if (options.experimentalTernaries &&
|
|
15
13
|
parentNode.type === 'Conditional' &&
|
|
16
14
|
parentNode.condition === node)
|
|
17
15
|
return document;
|
|
18
|
-
if (parentNode
|
|
16
|
+
if (shouldGroupOrIndent(parentNode, []))
|
|
19
17
|
return indent(document);
|
|
20
18
|
if (node === parentNode.right)
|
|
21
19
|
return document;
|
|
@@ -24,19 +22,6 @@ const indentIfNecessaryBuilder = (path, options) => (document) => {
|
|
|
24
22
|
};
|
|
25
23
|
export const logical = {
|
|
26
24
|
match: (op) => ['&&', '||'].includes(op),
|
|
27
|
-
print: (
|
|
28
|
-
const groupIfNecessary = groupIfNecessaryBuilder(path);
|
|
29
|
-
const indentIfNecessary = indentIfNecessaryBuilder(path, options);
|
|
30
|
-
const right = [node.operator, line, path.call(print, 'right')];
|
|
31
|
-
// If it's a single binary operation, avoid having a small right
|
|
32
|
-
// operand like - 1 on its own line
|
|
33
|
-
const shouldGroup = node.left.type !== 'BinaryOperation' &&
|
|
34
|
-
path.getParentNode().type !== 'BinaryOperation';
|
|
35
|
-
return groupIfNecessary([
|
|
36
|
-
path.call(print, 'left'),
|
|
37
|
-
' ',
|
|
38
|
-
indentIfNecessary(shouldGroup ? group(right) : right)
|
|
39
|
-
]);
|
|
40
|
-
}
|
|
25
|
+
print: createBinaryOperationPrinter(createGroupIfNecessaryBuilder([]), indentIfNecessaryBuilder)
|
|
41
26
|
};
|
|
42
27
|
//# sourceMappingURL=logical.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logical.js","sourceRoot":"","sources":["../../src/binary-operator-printers/logical.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"logical.js","sourceRoot":"","sources":["../../src/binary-operator-printers/logical.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,4BAA4B,EAAE,MAAM,+CAA+C,CAAC;AAC7F,OAAO,EAAE,6BAA6B,EAAE,MAAM,iDAAiD,CAAC;AAChG,OAAO,EAAE,oBAAoB,EAAE,MAAM,kDAAkD,CAAC;AACxF,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAExE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,QAAQ,CAAC;AAEhC,MAAM,wBAAwB,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE;IAC/D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,EAAE,GAAG,IAAI,GAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1C,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;QACzC,IAAI,oBAAoB,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC;YAAE,OAAO,QAAQ,CAAC;QACpE,IACE,OAAO,CAAC,qBAAqB;YAC7B,UAAU,CAAC,IAAI,KAAK,aAAa;YACjC,UAAU,CAAC,SAAS,KAAK,IAAI;YAE7B,OAAO,QAAQ,CAAC;QAClB,IAAI,mBAAmB,CAAC,UAAU,EAAE,EAAE,CAAC;YAAE,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC;QACjE,IAAI,IAAI,KAAK,UAAU,CAAC,KAAK;YAAE,OAAO,QAAQ,CAAC;QAC/C,IAAI,GAAG,UAAU,CAAC;IACpB,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC;IACxC,KAAK,EAAE,4BAA4B,CACjC,6BAA6B,CAAC,EAAE,CAAC,EACjC,wBAAwB,CACzB;CACF,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { binaryOperationPrinter } from './printers/binary-operation-printer.js';
|
|
2
|
+
import { addition } from './addition.js';
|
|
3
|
+
import { bit } from './bit.js';
|
|
4
|
+
import { equality } from './equality.js';
|
|
5
|
+
import { inequality } from './inequality.js';
|
|
6
|
+
import { shift } from './shift.js';
|
|
7
|
+
import { logical } from './logical.js';
|
|
8
|
+
export const multiplication = {
|
|
9
|
+
match: (op) => ['*', '/', '%'].includes(op),
|
|
10
|
+
print: binaryOperationPrinter([
|
|
11
|
+
addition,
|
|
12
|
+
shift,
|
|
13
|
+
bit,
|
|
14
|
+
inequality,
|
|
15
|
+
equality,
|
|
16
|
+
logical
|
|
17
|
+
])
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=multiplication.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multiplication.js","sourceRoot":"","sources":["../../src/binary-operator-printers/multiplication.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC;IAC3C,KAAK,EAAE,sBAAsB,CAAC;QAC5B,QAAQ;QACR,KAAK;QACL,GAAG;QACH,UAAU;QACV,QAAQ;QACR,OAAO;KACR,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createBinaryOperationPrinter } from './create-binary-operation-printer.js';
|
|
2
|
+
import { createGroupIfNecessaryBuilder } from './create-group-if-necessary-builder.js';
|
|
3
|
+
import { createIndentIfNecessaryBuilder } from './create-indent-if-necessary-builder.js';
|
|
4
|
+
export const binaryOperationPrinter = (shouldGroupAndIndentMatchers) => createBinaryOperationPrinter(createGroupIfNecessaryBuilder(shouldGroupAndIndentMatchers), createIndentIfNecessaryBuilder(shouldGroupAndIndentMatchers));
|
|
5
|
+
//# sourceMappingURL=binary-operation-printer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binary-operation-printer.js","sourceRoot":"","sources":["../../../src/binary-operator-printers/printers/binary-operation-printer.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AACpF,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AACvF,OAAO,EAAE,8BAA8B,EAAE,MAAM,yCAAyC,CAAC;AAEzF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,4BAA4B,EAAE,EAAE,CACrE,4BAA4B,CAC1B,6BAA6B,CAAC,4BAA4B,CAAC,EAC3D,8BAA8B,CAAC,4BAA4B,CAAC,CAC7D,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { doc } from 'prettier';
|
|
2
|
+
import { assignment } from '../assignment.js';
|
|
3
|
+
const { group, line } = doc.builders;
|
|
4
|
+
const rightOperandPrinter = (node, path, print, options) => {
|
|
5
|
+
const right = options.experimentalOperatorPosition === 'end'
|
|
6
|
+
? [' ', node.operator, line, path.call(print, 'right')]
|
|
7
|
+
: [line, node.operator, ' ', path.call(print, 'right')];
|
|
8
|
+
// If it's a single binary operation, avoid having a small right
|
|
9
|
+
// operand like - 1 on its own line
|
|
10
|
+
const { parent } = path;
|
|
11
|
+
return node.left.type !== 'BinaryOperation' &&
|
|
12
|
+
(parent.type !== 'BinaryOperation' || assignment.match(parent.operator))
|
|
13
|
+
? group(right)
|
|
14
|
+
: right;
|
|
15
|
+
};
|
|
16
|
+
export const createBinaryOperationPrinter = (groupIfNecessaryBuilder, indentIfNecessaryBuilder) => (node, path, print, options) => {
|
|
17
|
+
const groupIfNecessary = groupIfNecessaryBuilder(path);
|
|
18
|
+
const indentIfNecessary = indentIfNecessaryBuilder(path, options);
|
|
19
|
+
return groupIfNecessary([
|
|
20
|
+
path.call(print, 'left'),
|
|
21
|
+
indentIfNecessary(rightOperandPrinter(node, path, print, options))
|
|
22
|
+
]);
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=create-binary-operation-printer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-binary-operation-printer.js","sourceRoot":"","sources":["../../../src/binary-operator-printers/printers/create-binary-operation-printer.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC,QAAQ,CAAC;AAErC,MAAM,mBAAmB,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;IACzD,MAAM,KAAK,GACT,OAAO,CAAC,4BAA4B,KAAK,KAAK;QAC5C,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QACvD,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;IAE5D,gEAAgE;IAChE,mCAAmC;IACnC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACxB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,iBAAiB;QACzC,CAAC,MAAM,CAAC,IAAI,KAAK,iBAAiB,IAAI,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACxE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC;QACd,CAAC,CAAC,KAAK,CAAC;AACZ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,4BAA4B,GACvC,CAAC,uBAAuB,EAAE,wBAAwB,EAAE,EAAE,CACtD,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;IAC7B,MAAM,gBAAgB,GAAG,uBAAuB,CAAC,IAAI,CAAC,CAAC;IACvD,MAAM,iBAAiB,GAAG,wBAAwB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAElE,OAAO,gBAAgB,CAAC;QACtB,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC;QACxB,iBAAiB,CAAC,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;KACnE,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { doc } from 'prettier';
|
|
2
|
+
import { shouldGroupOrIndent } from '../utils/should-group-or-indent.js';
|
|
3
|
+
const { group } = doc.builders;
|
|
4
|
+
export const createGroupIfNecessaryBuilder = (shouldIndentMatchers) => (path) => (document) => {
|
|
5
|
+
const { parent } = path;
|
|
6
|
+
if (shouldGroupOrIndent(parent, shouldIndentMatchers))
|
|
7
|
+
return group(document);
|
|
8
|
+
return document;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=create-group-if-necessary-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-group-if-necessary-builder.js","sourceRoot":"","sources":["../../../src/binary-operator-printers/printers/create-group-if-necessary-builder.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAEzE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,CAAC,QAAQ,CAAC;AAE/B,MAAM,CAAC,MAAM,6BAA6B,GACxC,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE;IAC/C,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACxB,IAAI,mBAAmB,CAAC,MAAM,EAAE,oBAAoB,CAAC;QACnD,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC;IACzB,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { doc } from 'prettier';
|
|
2
|
+
import { shouldGroupOrIndent } from '../utils/should-group-or-indent.js';
|
|
3
|
+
const { indent } = doc.builders;
|
|
4
|
+
export const notIndentParentTypes = [
|
|
5
|
+
'ReturnStatement',
|
|
6
|
+
'IfStatement',
|
|
7
|
+
'ForStatement',
|
|
8
|
+
'WhileStatement'
|
|
9
|
+
];
|
|
10
|
+
export const createIndentIfNecessaryBuilder = (shouldIndentMatchers) => (path) => (document) => {
|
|
11
|
+
for (let i = 0, { node } = path;; i += 1) {
|
|
12
|
+
const parentNode = path.getParentNode(i);
|
|
13
|
+
if (notIndentParentTypes.includes(parentNode.type))
|
|
14
|
+
return document;
|
|
15
|
+
if (shouldGroupOrIndent(parentNode, shouldIndentMatchers))
|
|
16
|
+
return indent(document);
|
|
17
|
+
if (node === parentNode.right)
|
|
18
|
+
return document;
|
|
19
|
+
node = parentNode;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=create-indent-if-necessary-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-indent-if-necessary-builder.js","sourceRoot":"","sources":["../../../src/binary-operator-printers/printers/create-indent-if-necessary-builder.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAEzE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,QAAQ,CAAC;AAEhC,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,iBAAiB;IACjB,aAAa;IACb,cAAc;IACd,gBAAgB;CACjB,CAAC;AAEF,MAAM,CAAC,MAAM,8BAA8B,GACzC,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE;IAC/C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,EAAE,GAAG,IAAI,GAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1C,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;QACzC,IAAI,oBAAoB,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC;YAAE,OAAO,QAAQ,CAAC;QACpE,IAAI,mBAAmB,CAAC,UAAU,EAAE,oBAAoB,CAAC;YACvD,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC1B,IAAI,IAAI,KAAK,UAAU,CAAC,KAAK;YAAE,OAAO,QAAQ,CAAC;QAC/C,IAAI,GAAG,UAAU,CAAC;IACpB,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { binaryOperationPrinter } from './printers/binary-operation-printer.js';
|
|
2
|
+
import { bit } from './bit.js';
|
|
3
|
+
import { inequality } from './inequality.js';
|
|
4
|
+
import { equality } from './equality.js';
|
|
5
|
+
import { logical } from './logical.js';
|
|
2
6
|
export const shift = {
|
|
3
7
|
match: (op) => ['<<', '>>'].includes(op),
|
|
4
|
-
print:
|
|
8
|
+
print: binaryOperationPrinter([bit, inequality, equality, logical])
|
|
5
9
|
};
|
|
6
10
|
//# sourceMappingURL=shift.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shift.js","sourceRoot":"","sources":["../../src/binary-operator-printers/shift.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"shift.js","sourceRoot":"","sources":["../../src/binary-operator-printers/shift.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC;IACxC,KAAK,EAAE,sBAAsB,CAAC,CAAC,GAAG,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;CACpE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"should-group-or-indent.js","sourceRoot":"","sources":["../../../src/binary-operator-printers/utils/should-group-or-indent.js"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,EAAE,CAClE,IAAI,KAAK,iBAAiB;IAC1B,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC"}
|