From 91d69de57f4a35b381117615b83f85603873b748 Mon Sep 17 00:00:00 2001 From: Ben S Date: Tue, 25 Nov 2014 19:44:29 +0000 Subject: [PATCH] Highlight hex literals --- rust.mm | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/rust.mm b/rust.mm index 3360646..854e3de 100644 --- a/rust.mm +++ b/rust.mm @@ -178,8 +178,28 @@ SInt32 skipUse(BBLMTextIterator &iter) SInt32 skipNumber(BBLMTextIterator &iter) { UInt32 length = 0; - UniChar ch; + UniChar ch = iter.GetNextChar(); bool hasSuffix = false; + bool isHex = false; + + if (ch == '0') + { + ch = iter.GetNextChar(); + if (ch == 'x') + { + isHex = true; + length += 2; + } + else if (ch) + { + length++; + iter--; + } + } + else if (ch) + { + iter--; + } while ((ch = iter.GetNextChar())) { @@ -187,6 +207,10 @@ SInt32 skipNumber(BBLMTextIterator &iter) { length++; } + else if (isHex && ((ch >= 'a' && ch <= 'f') || (ch >= 'A' && ch <= 'F'))) + { + length++; + } else if (ch == 'f' || ch == 'u' || ch == 'i') { hasSuffix = true;