Here is a preview of the c-style comments part, the NoColor is a vector that contains zones that are already in use by a comment or something else so that no other colors are added to it:
Code:
///////////////////////////////////////////////
// C-Style Comments ///////////////////////////
/* Comment setup ------------------- */
const int CommentCSize = Colors[ColorChoices[3]].size();
/* End setup ----------------------- */
do
{
current = code.find("/*", end);
if (current != string::npos)
{
// Insert the color for comments
code.insert(current, Colors[ColorChoices[3]]);
nz.begin = current;
// Now lets search for the matching pair
end = code.find("*/", current + CommentCSize + 3);
if (end != string::npos)
{
// Insert the closing color tag
code.insert(end + 2, ColorEnd);
nz.end = end + ColorEnd.size() + 1;
}
// If there is no end, erase what we have
// inserted and report a syntax error
else
{
code.erase(current, current + CommentCSize);
return SYNTAXERROR;
}
// If everything works add the current
// comment zone to the no more color vector
NoColor.push_back(nz);
}
}
while (current != string::npos);
// End C-Style Comments ///////////////////////
////////////////////////////////////////////////