Well it was bound to happen eventualy, after writing and rewriting my program I have something solid. But I have a minor problem ~ My parser is not returning correctly. I have made it so it will ignore 'strings' (It's a mock compiler of sorts). However, it doesn't seem to want to ignore them, it still returns if a delimeter is inside a string.


What should happen (psuedocode):
Code:
Function call:
 Function searches a string for instances of character 1:
  Character 1 is found ~ Function searches for character two OR special character
   Special Character is found:
    Flag Special exclusion until the character is found again.
    or
    Unflag special exclusion until the character is found again.

   Character 2 is found AND Special Exclusion is not flagged:
    Return string
   Character 2 is found AND Special Exclusion is flagged:
    Ignore and continue normally
Hopefully that explained it, now for the actual code: -- Excuse my poor formatting, it's know it's an awful sin unto man -,-.

Code:
std::string GetStringBetweenTokensSpecial(std::string st, char T1, char T2, char SRC, int* a = false, int* b = false) {
 int x = 0;
 std::string buffer;
 BOOL SpecialRule = false;

 while(x <= st.length()) {

  if(st[x] == T1 && SpecialRule == false) {
   if(a)
    *a = x;
   x++;

   while(x <= st.length()) {

    if(st[x] == SRC) {
     if(!SpecialRule)
      SpecialRule = true;
     else
      SpecialRule = false;
     }

    if(st[x] == T2 && SpecialRule == false) {
     if(b)
      *b = x;
     return buffer;
    }

    buffer += st[x++];
   }

  }

  x++;
 }
 return "";
}
The call:

Code:
#define StringSyntax    '"' ~ //This is  ' " ' hard to read that without spaces.
#define Spacer		','

  buffer = GetStringBetweenTokensSpecial(buffer, Spacer, Spacer, StringSyntax, &a, &b);
I have no idea what's wrong with this, I've rewritten this four times already, it just refuses to work -,-.