From 487b87d13ac792538a7ff596e3c660355448c1c8 Mon Sep 17 00:00:00 2001 From: Ben S Date: Mon, 23 Nov 2015 13:30:03 +0000 Subject: [PATCH] Avoid highlighting tuple indexes as numbers --- rust.mm | 4 +++- smoke.rs | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/rust.mm b/rust.mm index 864e44e..f52d27f 100644 --- a/rust.mm +++ b/rust.mm @@ -939,7 +939,9 @@ OSErr calculateRuns(BBLMParamBlock ¶ms, const BBLMCallbackBlock *callbacks) runStart = iter.Offset(); } - wordchr = isalpha(ch) || isdigit(ch) || ch == '_'; + // '.' is considered a word char to avoid the "0.0" in "tuple.0.0" + // being classified as a floating-point number. + wordchr = isalpha(ch) || isdigit(ch) || ch == '_' || ch == '.'; } makeCodeRun(iter, runStart, *callbacks); diff --git a/smoke.rs b/smoke.rs index 812fe64..e2f41c7 100644 --- a/smoke.rs +++ b/smoke.rs @@ -85,8 +85,11 @@ 5.974e24 // lowercase e 7.348e+22 // uppercase E and plus + .1234 // no leading zero (invalid) + let tuple = ((8, 4), 48); - let a = tuple.0.0; + tuple.0 + tuple.0.0 // tuple indexing (not really numbers) // Numeric Suffixes // ----------------