Skip to content

Commit cbd8b1c

Browse files
authored
Handle escaped backslashes before closing quote (#480)
1 parent b504261 commit cbd8b1c

File tree

4 files changed

+33
-5
lines changed

4 files changed

+33
-5
lines changed

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
"escape-string-regexp": "^4.0.0",
8282
"prettier": "^2.2.1",
8383
"semver": "^7.3.5",
84-
"solidity-comments-extractor": "^0.0.6",
84+
"solidity-comments-extractor": "^0.0.7",
8585
"string-width": "^4.2.2"
8686
}
8787
}

tests/Comments/Comments.sol

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,13 @@ interface Comments10 {
9292
) /* comment outside the parameters */ external;
9393

9494
function someOtherFunction(/* checking for Block comment */) external;
95-
}
95+
}
96+
97+
contract Comments11 {
98+
string a = "\\";
99+
string b = '\\';
100+
101+
function f() public {
102+
// this should not be removed
103+
}
104+
}

tests/Comments/__snapshots__/jsfmt.spec.js.snap

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,16 @@ interface Comments10 {
101101
102102
function someOtherFunction(/* checking for Block comment */) external;
103103
}
104+
105+
contract Comments11 {
106+
string a = "\\\\";
107+
string b = '\\\\';
108+
109+
function f() public {
110+
// this should not be removed
111+
}
112+
}
113+
104114
=====================================output=====================================
105115
pragma solidity ^0.4.24;
106116
@@ -221,5 +231,14 @@ interface Comments10 {
221231
) external;
222232
}
223233
234+
contract Comments11 {
235+
string a = "\\\\";
236+
string b = "\\\\";
237+
238+
function f() public {
239+
// this should not be removed
240+
}
241+
}
242+
224243
================================================================================
225244
`;

0 commit comments

Comments
 (0)