Added support for user-defined string literals.

Added testcase cpp0x_userdefined_literals.i


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-matevz@11494 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Matevz Jekovec 2009-08-04 00:51:21 +00:00
commit 8a4efbc6d3
4 changed files with 53 additions and 2 deletions

View file

@ -5145,7 +5145,7 @@ direct_declarator : idcolon {
$$.parms = 0;
$$.have_parms = 0;
}
| NOT idcolon {
$$.id = Char(NewStringf("~%s",$2));
$$.type = 0;
@ -5227,6 +5227,27 @@ direct_declarator : idcolon {
Delete($$.type);
$$.type = t;
}
}
/* User-defined string literals. eg.
int operator""_mySuffix(const char* val, int length) {...} */
/* This produces one S/R conflict. */
| OPERATOR ID LPAREN parms RPAREN {
SwigType *t;
Append($1, Char($2));
$$.id = Char($1);
t = NewStringEmpty();
SwigType_add_function(t,$4);
if (!$$.have_parms) {
$$.parms = $4;
$$.have_parms = 1;
}
if (!$$.type) {
$$.type = t;
} else {
SwigType_push(t, $$.type);
Delete($$.type);
$$.type = t;
}
}
;