Refinement of noquote string replace to fix
[ 605162 ] Typemap local variables. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4366 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
456ce0c450
commit
6592e9d64e
1 changed files with 16 additions and 0 deletions
|
|
@ -460,11 +460,27 @@ String_ungetc(DOH *so, int ch)
|
||||||
static char *
|
static char *
|
||||||
end_quote(char *s)
|
end_quote(char *s)
|
||||||
{
|
{
|
||||||
|
char *qs;
|
||||||
char qc;
|
char qc;
|
||||||
char *q;
|
char *q;
|
||||||
|
char *nl;
|
||||||
qc = *s;
|
qc = *s;
|
||||||
|
qs = s;
|
||||||
while (1) {
|
while (1) {
|
||||||
q = strpbrk(s+1,"\"\'");
|
q = strpbrk(s+1,"\"\'");
|
||||||
|
nl = strchr(s+1,'\n');
|
||||||
|
if (nl && (nl < q)) {
|
||||||
|
/* A new line appears before the end of the string */
|
||||||
|
if (*(nl-1) == '\\') {
|
||||||
|
s = nl+1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
/* String was terminated by a newline. Wing it */
|
||||||
|
return qs;
|
||||||
|
}
|
||||||
|
if (!q && nl) {
|
||||||
|
return qs;
|
||||||
|
}
|
||||||
if (!q) return 0;
|
if (!q) return 0;
|
||||||
if ((*q == qc) && (*(q-1) != '\\')) return q;
|
if ((*q == qc) && (*(q-1) != '\\')) return q;
|
||||||
s = q;
|
s = q;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue