Skip to content
Snippets Groups Projects
Commit a7e29eee authored by Adrian Heine's avatar Adrian Heine
Browse files

[swift mode] Correctly highlight nested comments

parent c05c5956
No related branches found
No related tags found
No related merge requests found
......@@ -138,8 +138,17 @@
}
function tokenComment(stream, state) {
stream.match(/^(?:[^*]|\*(?!\/))*/)
if (stream.match("*/")) state.tokenize.pop()
var ch
while (true) {
stream.match(/^[^/*]+/, true)
ch = stream.next()
if (!ch) break
if (ch === "/" && stream.eat("*")) {
state.tokenize.push(tokenComment)
} else if (ch === "*" && stream.eat("/")) {
state.tokenize.pop()
}
}
return "comment"
}
......
......@@ -142,6 +142,13 @@
"[variable print][punctuation (][variable foo][property ._123][punctuation )]",
"[variable print][punctuation (]")
MT("nested_comments",
"[comment /*]",
"[comment But wait /* this is a nested comment */ for real]",
"[comment /**** let * me * show * you ****/]",
"[comment ///// let / me / show / you /////]",
"[comment */]");
// TODO: correctly identify when multiple variables are being declared
// by use of a comma-separated list.
// TODO: correctly identify when variables are being declared in a tuple.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment