Skip to content

Commit 14a3b27

Browse files
committed
fixed bug about highlighting keywords which are actually just . accessed properties
1 parent 40717c0 commit 14a3b27

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

syntaxur/syntaxur.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
var segs = [], unmatched, left_context,
3636
next_match_idx = 0, prev_match_idx = 0
3737
;
38-
38+
3939
while (next_match_idx < code.length) {
4040
unmatched = "";
4141

@@ -76,7 +76,7 @@
7676
}
7777
else if (
7878
match[0].match(/function|return|var|let|const|for|while|do|if|else|try|catch|finally|throw|break|continue|switch|case|default|delete|debugger|in|instanceof|new|this|typeof|void|with|class|export|import|extends|super|yield/) &&
79-
!left_context.match(/\.$/)
79+
!left_context.match(/\.\s*$/)
8080
) {
8181
segs.push({
8282
type: SEGMENT_KEYWORD,
@@ -108,8 +108,7 @@
108108

109109
segs = split(seg.val);
110110
if (segs.length > 0) {
111-
segs.unshift(i,1); // add splice arguments onto front of array
112-
segments.splice.apply(segments,segs);
111+
segments.splice.apply([i,1].concat(segments),segs);
113112
i += segs.length - 2;
114113
}
115114
}

0 commit comments

Comments
 (0)