vygr / C-PCB

C++14 PCB autorouter
GNU General Public License v2.0
75 stars 17 forks source link

Unmatched \" quote defined key word STRING_QUOTE. May has potentially parsing error.s. #14

Open Davidlihuang opened 1 year ago

Davidlihuang commented 1 year ago

-----.dsn------------------------------------------------------------------------------ (string_quote ") (space_in_quoted_tokens on) (host_cad "KiCad's Pcbnew")

---result below ------------------------------------------------------------------------ pcb D:\pdavies\Documents\KiCad\wetroom-shield\wetroom-shield.dsn parser string_quote ) (space_in_quoted_tokens on) (host_cad KiCad's Pcbnew" host_version (2013-07-07 BZR 4022)-stable

--- fixed ---------------------------------------------------------------------- pcb D:\pdavies\Documents\KiCad\wetroom-shield\wetroom-shield.dsn parser string_quote " space_in_quoted_tokens on host_cad KiCad's Pcbnew host_version (2013-07-07 BZR 4022)-stable ----solution------------------------------------------------------------------- It is better to treat the value of string_quote as a string identifier. Of course, we can also use a temporary solution to check whether the current node is a string_quote when encountering ("), and not treat it as a string.

-- code ---------------------------------------------------------------------- c_pcb_dsn.cpp:read_tree

if (b == '"')
        {
            if(nodeName != "string_quote")
            {
                in.get(c);
                t.m_branches.push_back(read_quoted_string(in));
                in.get(c);
                continue;
            }
            else
            {
                in.get(c);
                std::string str;
                str.push_back(b);
                t.m_branches.push_back(tree{str, {}});

                continue;
            }
        }