Mercurial > ~dholland > hg > tradcpp > index.cgi
diff directive.c @ 128:1cda505ddc78
Don't expand macros within character constants.
author | David A. Holland |
---|---|
date | Fri, 14 Jun 2013 20:59:24 -0400 (2013-06-15) |
parents | a0a86380456e |
children | a2c2fe8dbea3 d6e6b3940780 |
line wrap: on
line diff
--- a/directive.c Wed Jun 12 10:52:56 2013 -0400 +++ b/directive.c Fri Jun 14 20:59:24 2013 -0400 @@ -62,6 +62,7 @@ bool incomment = false; bool inesc = false; bool inquote = false; + char quote = '\0'; for (s = t = buf; *s; s++) { if (incomment) { @@ -77,8 +78,12 @@ inesc = false; } else if (s[0] == '\\') { inesc = true; - } else if (s[0] == '"') { - inquote = !inquote; + } else if (!inquote && + (s[0] == '"' || s[0] == '\'')) { + inquote = true; + quote = s[0]; + } else if (inquote && s[0] == quote) { + inquote = false; } if (t != s) {