Skip to content

Commit 1e186e7

Browse files
committed
[sas mode] Remove buggy comment matching
Closes #4664
1 parent 8b1e6a5 commit 1e186e7

File tree

1 file changed

+7
-20
lines changed

1 file changed

+7
-20
lines changed

mode/sas/sas.js

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212

1313
//Definitions
14-
// comment -- text withing * ; or /* */
14+
// comment -- text within * ; or /* */
1515
// keyword -- SAS language variable
1616
// variable -- macro variables starts with '&' or variable formats
1717
// variable-2 -- DATA Step, proc, or macro names
@@ -116,28 +116,15 @@
116116
return "comment";
117117
}
118118

119+
if (ch == "*" && stream.column() == stream.indentation()) {
120+
stream.skipToEnd()
121+
return "comment"
122+
}
123+
119124
// DoubleOperator match
120125
var doubleOperator = ch + stream.peek();
121126

122-
// Match all line comments.
123-
var myString = stream.string;
124-
var myRegexp = /(?:^\s*|[;]\s*)(\*.*?);/ig;
125-
var match = myRegexp.exec(myString);
126-
if (match !== null) {
127-
if (match.index === 0 && (stream.column() !== (match.index + match[0].length - 1))) {
128-
stream.backUp(stream.column());
129-
stream.skipTo(';');
130-
stream.next();
131-
return 'comment';
132-
} else if (match.index + 1 < stream.column() && stream.column() < match.index + match[0].length - 1) {
133-
// the ';' triggers the match so move one past it to start
134-
// the comment block that is why match.index+1
135-
stream.backUp(stream.column() - match.index - 1);
136-
stream.skipTo(';');
137-
stream.next();
138-
return 'comment';
139-
}
140-
} else if ((ch === '"' || ch === "'") && !state.continueString) {
127+
if ((ch === '"' || ch === "'") && !state.continueString) {
141128
state.continueString = ch
142129
return "string"
143130
} else if (state.continueString) {

0 commit comments

Comments
 (0)