vygr / C-PCB

C++14 PCB autorouter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Davidlihuang opened this issue · comments

-----.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;
			}
		}