You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Comments can be embedded in a line using parentheses () or for the remainder of a lineusing a semi-colon. The semi-colon is not treated as the start of a comment when enclosed in parentheses.
69
-
conststripAndExtractComments=(()=>{
69
+
conststripComments=(()=>{
70
70
// eslint-disable-next-line no-useless-escape
71
71
constre1=newRegExp(/\(([^\)]*)\)/g);// Match anything inside parentheses
72
72
constre2=newRegExp(/;(.*)$/g);// Match anything after a semi-colon to the end of the line
73
-
constre3=newRegExp(/\s+/g);
74
73
75
74
return(line)=>{
76
75
constcomments=[];
77
76
// Extract comments from parentheses
78
77
line=line.replace(re1,(match,p1)=>{
79
-
conststrippedLine=p1.trim();
80
-
comments.push(strippedLine);// Add the match to comments
78
+
constlineWithoutComments=p1.trim();
79
+
comments.push(lineWithoutComments);// Add the match to comments
81
80
return'';
82
81
});
83
82
// Extract comments after a semi-colon
84
83
line=line.replace(re2,(match,p1)=>{
85
-
conststrippedLine=p1.trim();
86
-
comments.push(strippedLine);// Add the match to comments
84
+
constlineWithoutComments=p1.trim();
85
+
comments.push(lineWithoutComments);// Add the match to comments
0 commit comments