Smarten up attribute highlighting

This commit is contained in:
Ben S
2015-02-15 13:07:24 +00:00
parent 5452afbb9c
commit e6c0074733
2 changed files with 39 additions and 4 deletions

30
rust.mm
View File

@@ -134,13 +134,37 @@ SInt32 skipWord(BBLMTextIterator &iter)
SInt32 skipAttribute(BBLMTextIterator &iter)
{
SInt32 length = 1;
SInt32 length = 0;
UniChar ch;
iter++;
if (iter.strcmp("#[", 2) == 0)
{
length += 2;
iter += 2;
}
else if (iter.strcmp("#![", 3) == 0)
{
length += 3;
iter += 3;
}
else if (iter.strcmp("#", 1) == 0)
{
iter++;
return 1;
}
else
{
return 0;
}
while ((ch = iter.GetNextChar()))
{
if (ch == '\n' || ch == '\r')
if (ch == ']')
{
length++;
break;
}
else if (ch == '\n' || ch == '\r')
{
break;
}

View File

@@ -50,6 +50,8 @@
r##"there's a " in this string"## // the string shouldn't end until ##
r##"there's a # in this string"## // even if there's a # in the middle
// " // in case the above failed :)
// Decimal Numbers
// ---------------
@@ -84,7 +86,7 @@
7.348e+22 // uppercase E and plus
let tuple = ((8, 4), 48);
let a = tuple.1.1
let a = tuple.0.0;
// Numeric Suffixes
// ----------------
@@ -99,3 +101,12 @@
0.1f32
12E+99_f64
2.f64 // Invalid!
// Attributes
// ----------
#[attribute]
#![top_level_attribute]
#not_an_attribute
#[macro_use] use this_is_not_an_attribute;