Fix to escape code handling.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4494 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
26f516695e
commit
a13e0a67c1
3 changed files with 13 additions and 5 deletions
|
|
@ -446,8 +446,9 @@ static void get_escape() {
|
|||
yylen--;
|
||||
return;
|
||||
}
|
||||
if (c == '0') {
|
||||
if (isdigit(c)) {
|
||||
state = 10;
|
||||
result = (c-'0');
|
||||
}
|
||||
else if (c == 'x') {
|
||||
state = 20;
|
||||
|
|
@ -761,7 +762,7 @@ int yylook(void) {
|
|||
if (( c = nextchar()) == 0) return 0;
|
||||
if (c == '*') {
|
||||
return DSTAR;
|
||||
} if (c == '~') {
|
||||
} else if (c == '~') {
|
||||
return DCNOT;
|
||||
} else {
|
||||
retract(1);
|
||||
|
|
@ -997,6 +998,7 @@ void scanner_ignore_typedef() {
|
|||
}
|
||||
|
||||
void scanner_last_id(int x) {
|
||||
/* printf("Setting last_id = %d\n", x); */
|
||||
last_id = x;
|
||||
}
|
||||
|
||||
|
|
@ -1028,14 +1030,18 @@ int yylex(void) {
|
|||
next_token = 0;
|
||||
return l;
|
||||
}
|
||||
/* Printf(stdout,"%d\n", last_id);*/
|
||||
l = yylook();
|
||||
|
||||
|
||||
if (l == NONID) {
|
||||
last_id = 1;
|
||||
} else {
|
||||
last_id = 0;
|
||||
}
|
||||
/*
|
||||
yytext[yylen]= 0;
|
||||
Printf(stdout,"%d '%s' %d\n", l, yytext, last_id);
|
||||
*/
|
||||
|
||||
/* We got some sort of non-white space object. We set the start_line
|
||||
variable unless it has already been set */
|
||||
|
|
|
|||
|
|
@ -4134,13 +4134,15 @@ definetype : { /* scanner_check_typedef(); */ } expr {
|
|||
}
|
||||
| CHARCONST {
|
||||
$$.val = NewString($1);
|
||||
$$.rawval = NewStringf("\'%(escape)s\'",$$.val);
|
||||
/*
|
||||
if (Len($$.val)) {
|
||||
/* $$.rawval = NewStringf("\'%(escape)s\'",$$.val); */
|
||||
$$.rawval = NewStringf("\'%s\'", $$.val);
|
||||
} else {
|
||||
$$.rawval = NewString("\'\\0'");
|
||||
$$.val = NewString("\\0");
|
||||
}
|
||||
*/
|
||||
$$.type = T_CHAR;
|
||||
$$.bitfield = 0;
|
||||
$$.throws = 0;
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ String *Swig_string_escape(String *s) {
|
|||
} else if (c == ' ') {
|
||||
Putc(c,ns);
|
||||
} else if (!isgraph(c)) {
|
||||
Printf(ns,"\\0%o", c);
|
||||
Printf(ns,"\\%o", c);
|
||||
} else {
|
||||
Putc(c,ns);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue