aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJad Altahan <xviyy@aol.com>2019-05-22 16:11:45 +1000
committerJad Altahan <xviyy@aol.com>2019-05-22 16:11:45 +1000
commit9ea53d08ad3e3fcba48a608690efd5cd48c32c55 (patch)
treefd3ad676b3b3de51b9a211da5a641a85dfee91dd
parent0c13bb0159ba453211718d2c33c962155f4fd106 (diff)
downloadscintilla-mirror-9ea53d08ad3e3fcba48a608690efd5cd48c32c55.tar.gz
Backport: Support for VB2017 bin literals & digit separators
Backport of changeset 7502:395c5832d38c.
-rw-r--r--doc/ScintillaHistory.html4
-rw-r--r--lexers/LexVB.cxx6
-rw-r--r--test/examples/x.vb4
-rw-r--r--test/examples/x.vb.styled4
4 files changed, 17 insertions, 1 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index d3eae6697..47ddbcea4 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -553,6 +553,10 @@
Lexer added for X12.
<a href="https://sourceforge.net/p/scintilla/feature-requests/1280/">Feature #1280</a>.
</li>
+ <li>
+ VB lexer adds support for VB2017 binary literal &amp;B and digit separators 123_456.
+ <a href="https://sourceforge.net/p/scintilla/feature-requests/1288/">Feature #1288</a>.
+ </li>
<li>
Improved performance of line folding code on large files when no folds are contracted.
This improves the time taken to open or close large files.
diff --git a/lexers/LexVB.cxx b/lexers/LexVB.cxx
index 3b380c4fd..ceac8d2fe 100644
--- a/lexers/LexVB.cxx
+++ b/lexers/LexVB.cxx
@@ -53,7 +53,7 @@ static inline bool IsANumberChar(int ch) {
// but probably enough in most cases.
return (ch < 0x80) &&
(isdigit(ch) || toupper(ch) == 'E' ||
- ch == '.' || ch == '-' || ch == '+');
+ ch == '.' || ch == '-' || ch == '+' || ch == '_');
}
static void ColouriseVBDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
@@ -199,6 +199,10 @@ static void ColouriseVBDoc(Sci_PositionU startPos, Sci_Position length, int init
// Octal number
sc.SetState(SCE_B_NUMBER);
sc.Forward();
+ } else if (sc.ch == '&' && tolower(sc.chNext) == 'b') {
+ // Binary number
+ sc.SetState(SCE_B_NUMBER);
+ sc.Forward();
} else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
sc.SetState(SCE_B_NUMBER);
} else if (IsAWordStart(sc.ch) || (sc.ch == '[')) {
diff --git a/test/examples/x.vb b/test/examples/x.vb
index a4503704b..a672831a0 100644
--- a/test/examples/x.vb
+++ b/test/examples/x.vb
@@ -7,3 +7,7 @@ Dim d As String = "\\\\server\\share\\file.txt"
""C "c"C "cc"C
' Date
d = #5/31/1993# or # 01/01/0001 12:00:00AM #
+' Number
+123_456___789
+123_
+&b10101_01010
diff --git a/test/examples/x.vb.styled b/test/examples/x.vb.styled
index e0c86f918..1d19c8ae8 100644
--- a/test/examples/x.vb.styled
+++ b/test/examples/x.vb.styled
@@ -7,3 +7,7 @@
{4}""C{0} {4}"c"C{0} {4}"cc"C{0}
{1}' Date
{7}d{0} {6}={0} {8}#5/31/1993#{0} {3}or{0} {8}# 01/01/0001 12:00:00AM #{0}
+{1}' Number
+{2}123_456___789{0}
+{2}123_{0}
+{2}&b10101_01010{0}