aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--lexers/LexVHDL.cxx10
1 files changed, 9 insertions, 1 deletions
diff --git a/lexers/LexVHDL.cxx b/lexers/LexVHDL.cxx
index 474726c8f..35383f3d8 100644
--- a/lexers/LexVHDL.cxx
+++ b/lexers/LexVHDL.cxx
@@ -72,6 +72,7 @@ static void ColouriseVHDLDoc(
WordList &User = *keywordlists[6];
StyleContext sc(startPos, length, initStyle, styler);
+ bool isExtendedId = false; // true when parsing an extended identifier
for (; sc.More(); sc.Forward())
{
@@ -84,7 +85,7 @@ static void ColouriseVHDLDoc(
sc.SetState(SCE_VHDL_DEFAULT);
}
} else if (sc.state == SCE_VHDL_IDENTIFIER) {
- if (!IsAWordChar(sc.ch) || (sc.ch == '.')) {
+ if (!isExtendedId && (!IsAWordChar(sc.ch) || (sc.ch == '.'))) {
char s[100];
sc.GetCurrentLowered(s, sizeof(s));
if (Keywords.InList(s)) {
@@ -103,6 +104,10 @@ static void ColouriseVHDLDoc(
sc.ChangeState(SCE_VHDL_USERWORD);
}
sc.SetState(SCE_VHDL_DEFAULT);
+ } else if (isExtendedId && ((sc.ch == '\\') || sc.atLineEnd)) {
+ // extended identifiers are terminated by backslash, check for end of line in case we have invalid syntax
+ isExtendedId = false;
+ sc.ForwardSetState(SCE_VHDL_DEFAULT);
}
} else if (sc.state == SCE_VHDL_COMMENT || sc.state == SCE_VHDL_COMMENTLINEBANG) {
if (sc.atLineEnd) {
@@ -141,6 +146,9 @@ static void ColouriseVHDLDoc(
sc.SetState(SCE_VHDL_BLOCK_COMMENT);
} else if (sc.ch == '\"') {
sc.SetState(SCE_VHDL_STRING);
+ } else if (sc.ch == '\\') {
+ isExtendedId = true;
+ sc.SetState(SCE_VHDL_IDENTIFIER);
} else if (isoperator(static_cast<char>(sc.ch))) {
sc.SetState(SCE_VHDL_OPERATOR);
}