뭐가 문제인지 모르겠다, 제발 도와줘라...


작은 따옴표 안에 있는 이스케이프 시퀀스가 정상 작동하도록 만드는 코드인데

왜 안되는지 아무리 봐도 이해가 안 된다. 


#include <iostream>

#include <string>

#include <stack>


bool checkMatching(std::string ch);


int main() {


    std::string Str, temp;


    while (true) {


        std::getline(std::cin, temp);


        if (temp == "EOF")break;

        Str.append(temp);

        Str.append("\n");

        std::cin.clear();

    }

    checkMatching(Str);


    


    return 0;

}


bool checkMatching(std::string ch) {


    std::stack<char> check;

    int nline = 0;

    int ncount = 0;


    bool quot = false;

    bool Bigquot = false;

    bool note1 = false;

    bool note2 = false;


    for (int i = 0; i < ch.length(); i++) {


        if (ch[i] == '\\' && ch[i + 1] == '\'') {

            i++;

            continue;

        }

        if (ch[i] == '\/' && ch[i + 1] == '\/' && note1 == false && note2 == false) note1 = true;      // '//' 주석일 때는 \n으로 탈출 또 ' " /* 아무것도 없어야 함

        else if (ch[i] == '\n') {

            note1 = false;

            nline++;

        }

        

        if (ch[i] == '\/' && ch[i + 1] == '*'&& note1 == false && note2 == false) note2 = true;

        else if (ch[i] == '*' && ch[i + 1] == '\/' && note2 == true) note2 == false;



        if (ch[i] == '\'' && note1 == false && note2 == false&& quot == false) quot = true;

        else if (ch[i] == '\'' && quot == true ) {

                quot = false;

                ncount++;

            }

        


        if (ch[i] == '\"' && note1 == false && note2 == false && Bigquot == false) Bigquot = true;

        else if (ch[i] == '\"' && Bigquot == true) Bigquot = false;


        if ((ch[i] == '(' || ch[i] == '{' || ch[i] == '[') &&

            (note1 == false && note2 == false && quot == false && Bigquot == false)) {

            check.push(ch[i]);

        }

        

        if ((ch[i] == ')' || ch[i] == '}' || ch[i] == ']') &&

            (note1 == false && note2 == false && quot == false && Bigquot == false)) {


            if (check.empty()) {

                nline++;

                std::cout << "Error," << " Line_count : " << nline <<"," << " quotes_count : " << ncount;

                return !check.empty();

            }


            char prev = check.top();

            check.pop();


            if ((prev == '(' && ch[i] == ')') ||

                (prev == '{' && ch[i] == '}') ||

                (prev == '[' && ch[i] == ']')) {

                

                //ncount++;

            }



        }

        

    }


    if (check.empty()) std::cout << "OK," << " Line_count : " << nline << "," << " quotes_count : " << ncount;

    else    std::cout << "Error," << " Line_count : " << nline << "," << " quotes_count : " << ncount;



    return check.empty();


}