aboutsummaryrefslogtreecommitdiffhomepage
path: root/lexers/LexYAML.cxx
diff options
context:
space:
mode:
authorJim Pattee <unknown>2017-04-10 08:14:34 +1000
committerJim Pattee <unknown>2017-04-10 08:14:34 +1000
commitfc7ac54d5936008e1e2db8f490ae105e4acebfbb (patch)
treefd5fcdecbb3f312b03eb5d6425f83b5b1f97504d /lexers/LexYAML.cxx
parentda34a05d99e324ffc3ca802ca9d65db2a4e7eac9 (diff)
downloadscintilla-mirror-fc7ac54d5936008e1e2db8f490ae105e4acebfbb.tar.gz
Bug [#1931]. Recognize comments in more situations and treat "..." like "---".
Diffstat (limited to 'lexers/LexYAML.cxx')
-rw-r--r--lexers/LexYAML.cxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/lexers/LexYAML.cxx b/lexers/LexYAML.cxx
index 9f28bb843..3709538b7 100644
--- a/lexers/LexYAML.cxx
+++ b/lexers/LexYAML.cxx
@@ -98,7 +98,7 @@ static void ColouriseYAMLLine(
}
}
styler.SetLineState(currentLine, 0);
- if (strncmp(lineBuffer, "---", 3) == 0) { // Document marker
+ if (strncmp(lineBuffer, "---", 3) == 0 || strncmp(lineBuffer, "...", 3) == 0) { // Document marker
styler.SetLineState(currentLine, YAML_STATE_DOCUMENT);
styler.ColourTo(endPos, SCE_YAML_DOCUMENT);
return;
@@ -119,6 +119,10 @@ static void ColouriseYAMLLine(
while (i < lengthLine) {
if (lineBuffer[i] == '\'' || lineBuffer[i] == '\"') {
bInQuotes = !bInQuotes;
+ } else if (lineBuffer[i] == '#' && isspacechar(lineBuffer[i - 1]) && !bInQuotes) {
+ styler.ColourTo(startLine + i - 1, SCE_YAML_DEFAULT);
+ styler.ColourTo(endPos, SCE_YAML_COMMENT);
+ return;
} else if (lineBuffer[i] == ':' && !bInQuotes) {
styler.ColourTo(startLine + i - 1, SCE_YAML_IDENTIFIER);
styler.ColourTo(startLine + i, SCE_YAML_OPERATOR);