Mercurial > ~dholland > hg > tradcpp > index.cgi
comparison 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 |
comparison
equal
deleted
inserted
replaced
127:a0a86380456e | 128:1cda505ddc78 |
---|---|
60 { | 60 { |
61 char *s, *t, *u = NULL; | 61 char *s, *t, *u = NULL; |
62 bool incomment = false; | 62 bool incomment = false; |
63 bool inesc = false; | 63 bool inesc = false; |
64 bool inquote = false; | 64 bool inquote = false; |
65 char quote = '\0'; | |
65 | 66 |
66 for (s = t = buf; *s; s++) { | 67 for (s = t = buf; *s; s++) { |
67 if (incomment) { | 68 if (incomment) { |
68 if (s[0] == '*' && s[1] == '/') { | 69 if (s[0] == '*' && s[1] == '/') { |
69 s++; | 70 s++; |
75 } else { | 76 } else { |
76 if (inesc) { | 77 if (inesc) { |
77 inesc = false; | 78 inesc = false; |
78 } else if (s[0] == '\\') { | 79 } else if (s[0] == '\\') { |
79 inesc = true; | 80 inesc = true; |
80 } else if (s[0] == '"') { | 81 } else if (!inquote && |
81 inquote = !inquote; | 82 (s[0] == '"' || s[0] == '\'')) { |
83 inquote = true; | |
84 quote = s[0]; | |
85 } else if (inquote && s[0] == quote) { | |
86 inquote = false; | |
82 } | 87 } |
83 | 88 |
84 if (t != s) { | 89 if (t != s) { |
85 *t = *s; | 90 *t = *s; |
86 } | 91 } |