From 79a65307f0297b927e472842f834fa4a21ecf529 Mon Sep 17 00:00:00 2001 From: Ben S Date: Wed, 24 Dec 2014 14:11:32 +0000 Subject: [PATCH] Changes to the way numbers are highlighted They were being highlighted after underscores in variable names, and underscores weren't being catered for in non-base-ten numeric literals. Now, fixed! --- rust.mm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rust.mm b/rust.mm index 6f6d993..63b883e 100644 --- a/rust.mm +++ b/rust.mm @@ -196,15 +196,15 @@ SInt32 skipNumber(BBLMTextIterator &iter) { length++; } - else if ((base == 2) && (ch == '0' || ch == '1')) + else if ((base == 2) && (ch == '0' || ch == '1' || ((ch == '_' || ch == '.') && length > 0))) { length++; } - else if ((base == 8) && (ch >= '0' && ch <= '7')) + else if ((base == 8) && ((ch >= '0' && ch <= '7') || ((ch == '_' || ch == '.') && length > 0))) { length++; } - else if ((base == 16) && ((ch >= 'a' && ch <= 'f') || (ch >= 'A' && ch <= 'F') || isdigit(ch))) + else if ((base == 16) && ((ch >= 'a' && ch <= 'f') || (ch >= 'A' && ch <= 'F') || isdigit(ch) || ((ch == '_' || ch == '.') && length > 0))) { length++; } @@ -762,7 +762,7 @@ OSErr calculateRuns(BBLMParamBlock ¶ms, const BBLMCallbackBlock *callbacks) runStart = iter.Offset(); } - wordchr = isalpha(ch) || isdigit(ch); + wordchr = isalpha(ch) || isdigit(ch) || ch == '_'; } makeCodeRun(iter, runStart, *callbacks);