Simplify macro-highlighting code

This commit is contained in:
Ben S
2015-02-15 13:43:15 +00:00
parent 81197c7d45
commit da342c1b7d
2 changed files with 17 additions and 89 deletions

98
rust.mm
View File

@@ -667,98 +667,18 @@ OSErr calculateRuns(BBLMParamBlock &params, const BBLMCallbackBlock *callbacks)
iter--; iter--;
} }
} }
else if (ch == 'a') else if (ch == 'a' && iter.strcmp("cro_rules!", 10) == 0)
{ {
// I am ashamed of how nested this code is. iter += 10;
ch = iter.GetNextChar(); ch = iter.GetNextChar();
if (ch == 'c') if (isspace(ch))
{ {
ch = iter.GetNextChar(); if (!makeCodeRun(iter, runStart, *callbacks)) return noErr;
if (ch == 'r') runStart = iter.Offset();
{ runLen = skipWhitespace(iter);
ch = iter.GetNextChar(); runLen += skipWord(iter);
if (ch == 'o') if (!addRun(functionColour, runStart, runLen, *callbacks)) return noErr;
{ runStart = iter.Offset();
ch = iter.GetNextChar();
if (ch == '_')
{
ch = iter.GetNextChar();
if (ch == 'r')
{
ch = iter.GetNextChar();
if (ch == 'u')
{
ch = iter.GetNextChar();
if (ch == 'l')
{
ch = iter.GetNextChar();
if (ch == 'e')
{
ch = iter.GetNextChar();
if (ch == 's')
{
ch = iter.GetNextChar();
if (ch == '!')
{
ch = iter.GetNextChar();
if (isspace(ch))
{
if (!makeCodeRun(iter, runStart, *callbacks)) return noErr;
runStart = iter.Offset();
runLen = skipWhitespace(iter);
runLen += skipWord(iter);
if (!addRun(functionColour, runStart, runLen, *callbacks)) return noErr;
runStart = iter.Offset();
}
else if (ch)
{
iter--;
}
}
else if (ch)
{
iter--;
}
}
else if (ch)
{
iter--;
}
}
else if (ch)
{
iter--;
}
}
else if (ch)
{
iter--;
}
}
else if (ch)
{
iter--;
}
}
else if (ch)
{
iter--;
}
}
else if (ch)
{
iter--;
}
}
else if (ch)
{
iter--;
}
}
else if (ch)
{
iter--;
}
} }
else if (ch) else if (ch)
{ {

View File

@@ -106,7 +106,15 @@
// ---------- // ----------
#[attribute] #[attribute]
#[derive(This, That, Other)]
#![top_level_attribute] #![top_level_attribute]
#not_an_attribute #not_an_attribute
#[macro_use] use this_is_not_an_attribute; #[macro_use] use this_is_not_an_attribute;
// Macros
// ------
macro_rules! parse {
($thing: expr) => { $thing };
}