Another merge with master.

Updated Doxygen error numbers yet again, as Python errors got added in the
meanwhile, pushing the Doxygen ones further off.

And re-merged PEP8/whitespace-related conflicts in autodoc_runme.py once again
(if anybody is looking for a motivating example about why significant
whitespace is bad, here is a great use case).
This commit is contained in:
Vadim Zeitlin 2015-07-20 00:40:32 +02:00
commit 302955a152
448 changed files with 8836 additions and 5079 deletions

View file

@ -632,7 +632,10 @@ int yylex(void) {
*/
nexttok = Scanner_token(scan);
do {
nexttok = Scanner_token(scan);
} while (nexttok == SWIG_TOKEN_ENDLINE || nexttok == SWIG_TOKEN_COMMENT);
if (Scanner_isoperator(nexttok)) {
/* One of the standard C/C++ symbolic operators */
Append(s,Scanner_text(scan));
@ -703,6 +706,8 @@ int yylex(void) {
Append(s," ");
}
Append(s,Scanner_text(scan));
} else if (nexttok == SWIG_TOKEN_ENDLINE) {
} else if (nexttok == SWIG_TOKEN_COMMENT) {
} else {
Append(s,Scanner_text(scan));
needspace = 0;
@ -739,7 +744,7 @@ int yylex(void) {
Setfile(cs,cparse_file);
Scanner_push(scan,cs);
Delete(cs);
return COPERATOR;
return CONVERSIONOPERATOR;
}
}
if (termtoken)
@ -908,7 +913,7 @@ int yylex(void) {
return (WARN);
/* Note down the apparently unknown directive for error reporting. */
cparse_unknown_directive = Swig_copy_string(yytext);
cparse_unknown_directive = NewString(yytext);
}
/* Have an unknown identifier, as a last step, we'll do a typedef lookup on it. */

View file

@ -27,7 +27,6 @@ to work, see Byacc man page: http://invisible-island.net/byacc/manpage/yacc.html
#include "preprocessor.h"
#include <ctype.h>
/* We do this for portability */
#undef alloca
#define alloca malloc
@ -52,7 +51,7 @@ static String *Classprefix = 0;
static String *Namespaceprefix = 0;
static int inclass = 0;
static Node *currentOuterClass = 0; /* for nested classes */
static char *last_cpptype = 0;
static const char *last_cpptype = 0;
static int inherit_list = 0;
static Parm *template_parameters = 0;
static int extendmode = 0;
@ -466,6 +465,10 @@ static void add_symbols(Node *n) {
if ((Cmp(Getattr(n,"storage"),"virtual") == 0) && (Cmp(Getattr(n,"value"),"0") == 0)) {
only_csymbol = 0;
}
if (Cmp(nodeType(n),"destructor") == 0) {
/* Needed for "unref" feature */
only_csymbol = 0;
}
}
} else {
Setattr(n,"access", "public");
@ -794,14 +797,14 @@ static String *make_class_name(String *name) {
/* Use typedef name as class name */
static void add_typedef_name(Node *n, Node *decl, String *oldName, Symtab *cscope, String *scpname) {
static void add_typedef_name(Node *n, Node *declnode, String *oldName, Symtab *cscope, String *scpname) {
String *class_rename = 0;
SwigType *decltype = Getattr(decl, "decl");
if (!decltype || !Len(decltype)) {
SwigType *decl = Getattr(declnode, "decl");
if (!decl || !Len(decl)) {
String *cname;
String *tdscopename;
String *class_scope = Swig_symbol_qualifiedscopename(cscope);
String *name = Getattr(decl, "name");
String *name = Getattr(declnode, "name");
cname = Copy(name);
Setattr(n, "tdname", cname);
tdscopename = class_scope ? NewStringf("%s::%s", class_scope, name) : Copy(name);
@ -812,7 +815,7 @@ static void add_typedef_name(Node *n, Node *decl, String *oldName, Symtab *cscop
if (!Equal(scpname, tdscopename) && !Getattr(classes_typedefs, tdscopename)) {
Setattr(classes_typedefs, tdscopename, n);
}
Setattr(n, "decl", decltype);
Setattr(n, "decl", decl);
Delete(class_scope);
Delete(cname);
Delete(tdscopename);
@ -835,7 +838,7 @@ static String *remove_block(Node *kw, const String *inputcode) {
String *name = Getattr(kw,"name");
if (name && (Cmp(name,"noblock") == 0)) {
char *cstr = Char(inputcode);
size_t len = Len(inputcode);
int len = Len(inputcode);
if (len && cstr[0] == '{') {
--len; ++cstr;
if (len && cstr[len - 1] == '}') { --len; }
@ -1072,7 +1075,6 @@ static void update_nested_classes(Node *n)
static Node *nested_forward_declaration(const char *storage, const char *kind, String *sname, String *name, Node *cpp_opt_declarators) {
Node *nn = 0;
int warned = 0;
if (sname) {
/* Add forward declaration of the nested type */
@ -1116,13 +1118,12 @@ static Node *nested_forward_declaration(const char *storage, const char *kind, S
if (!currentOuterClass || !GetFlag(currentOuterClass, "nested")) {
if (nn && Equal(nodeType(nn), "classforward")) {
Node *n = nn;
SWIG_WARN_NODE_BEGIN(n);
Swig_warning(WARN_PARSE_NAMED_NESTED_CLASS, cparse_file, cparse_line,"Nested %s not currently supported (%s ignored)\n", kind, sname ? sname : name);
SWIG_WARN_NODE_END(n);
warned = 1;
}
if (!warned) {
if (!GetFlag(n, "feature:ignore")) {
SWIG_WARN_NODE_BEGIN(n);
Swig_warning(WARN_PARSE_NAMED_NESTED_CLASS, cparse_file, cparse_line,"Nested %s not currently supported (%s ignored)\n", kind, sname ? sname : name);
SWIG_WARN_NODE_END(n);
}
} else {
Swig_warning(WARN_PARSE_UNNAMED_NESTED_CLASS, cparse_file, cparse_line, "Nested %s not currently supported (ignored).\n", kind);
}
}
@ -1243,7 +1244,6 @@ static void default_arguments(Node *n) {
Node *function = n;
if (function) {
ParmList *varargs = Getattr(function,"feature:varargs");
if (varargs) {
/* Handles the %varargs directive by looking for "feature:varargs" and
@ -1393,7 +1393,7 @@ static void mark_nodes_as_extend(Node *n) {
%}
%union {
char *id;
const char *id;
List *bases;
struct Define {
String *val;
@ -1468,7 +1468,7 @@ static void mark_nodes_as_extend(Node *n) {
%token NONID DSTAR DCNOT
%token <intvalue> TEMPLATE
%token <str> OPERATOR
%token <str> COPERATOR
%token <str> CONVERSIONOPERATOR
%token PARSETYPE PARSEPARM PARSEPARMS
%token <str> DOXYGENSTRING
%token <str> DOXYGENPOSTSTRING
@ -1513,7 +1513,7 @@ static void mark_nodes_as_extend(Node *n) {
/* Misc */
%type <id> identifier;
%type <dtype> initializer cpp_const exception_specification;
%type <id> storage_class;
%type <id> storage_class extern_string;
%type <pl> parms ptail rawparms varargs_parms ;
%type <pl> templateparameters templateparameterstail;
%type <p> parm valparm rawvalparms valparms valptail ;
@ -1527,7 +1527,7 @@ static void mark_nodes_as_extend(Node *n) {
%type <dtype> definetype def_args etype default_delete deleted_definition explicit_default;
%type <dtype> expr exprnum exprcompound valexpr;
%type <id> ename ;
%type <id> template_decl;
%type <id> less_valparms_greater;
%type <str> type_qualifier ;
%type <id> type_qualifier_raw;
%type <id> idstring idstringopt;
@ -1535,11 +1535,11 @@ static void mark_nodes_as_extend(Node *n) {
%type <str> pragma_arg;
%type <loc> includetype;
%type <type> pointer primitive_type;
%type <decl> declarator direct_declarator notso_direct_declarator parameter_declarator typemap_parameter_declarator;
%type <decl> declarator direct_declarator notso_direct_declarator parameter_declarator plain_declarator;
%type <decl> abstract_declarator direct_abstract_declarator ctor_end;
%type <tmap> typemap_type;
%type <str> idcolon idcolontail idcolonnt idcolontailnt idtemplate stringbrace stringbracesemi;
%type <id> string stringnum wstring;
%type <str> idcolon idcolontail idcolonnt idcolontailnt idtemplate idtemplatetemplate stringbrace stringbracesemi;
%type <str> string stringnum wstring;
%type <tparms> template_parms;
%type <dtype> cpp_end cpp_vend;
%type <intvalue> rename_namewarn;
@ -1648,10 +1648,11 @@ declaration : swig_directive { $$ = $1; }
This is nearly impossible to parse normally. We just let the
first part generate a syntax error and then resynchronize on the
COPERATOR token---discarding the rest of the definition. Ugh.
CONVERSIONOPERATOR token---discarding the rest of the definition. Ugh.
*/
| error COPERATOR {
| error CONVERSIONOPERATOR {
$$ = 0;
skip_decl();
}
@ -1856,7 +1857,7 @@ echo_directive : ECHO HBLOCK {
}
| ECHO string {
char temp[64];
String *s = NewString($2);
String *s = $2;
Replace(s,"$file",cparse_file, DOH_REPLACE_ANY);
sprintf(temp,"%d", cparse_line);
Replace(s,"$line",temp,DOH_REPLACE_ANY);
@ -1961,7 +1962,7 @@ fragment_directive: FRAGMENT LPAREN fname COMMA kwargs RPAREN HBLOCK {
include_directive: includetype options string BEGINFILE {
$1.filename = Copy(cparse_file);
$1.line = cparse_line;
scanner_set_location(NewString($3),1);
scanner_set_location($3,1);
if ($2) {
String *maininput = Getattr($2, "maininput");
if (maininput)
@ -2216,7 +2217,7 @@ pragma_directive : PRAGMA pragma_lang identifier EQUAL pragma_arg {
}
;
pragma_arg : string { $$ = NewString($1); }
pragma_arg : string { $$ = $1; }
| HBLOCK { $$ = $1; }
;
@ -2368,7 +2369,7 @@ feature_directive : FEATURE LPAREN idstring RPAREN declarator cpp_const stringbr
scanner_clear_rename();
}
| FEATURE LPAREN idstring COMMA stringnum RPAREN declarator cpp_const SEMI {
String *val = Len($5) ? NewString($5) : 0;
String *val = Len($5) ? $5 : 0;
new_feature($3, val, 0, $7.id, $7.type, $7.parms, $8.qualifier);
$$ = 0;
scanner_clear_rename();
@ -2380,7 +2381,7 @@ feature_directive : FEATURE LPAREN idstring RPAREN declarator cpp_const stringbr
scanner_clear_rename();
}
| FEATURE LPAREN idstring COMMA stringnum featattr RPAREN declarator cpp_const SEMI {
String *val = Len($5) ? NewString($5) : 0;
String *val = Len($5) ? $5 : 0;
new_feature($3, val, $6, $8.id, $8.type, $8.parms, $9.qualifier);
$$ = 0;
scanner_clear_rename();
@ -2394,7 +2395,7 @@ feature_directive : FEATURE LPAREN idstring RPAREN declarator cpp_const stringbr
scanner_clear_rename();
}
| FEATURE LPAREN idstring COMMA stringnum RPAREN SEMI {
String *val = Len($5) ? NewString($5) : 0;
String *val = Len($5) ? $5 : 0;
new_feature($3, val, 0, 0, 0, 0, 0);
$$ = 0;
scanner_clear_rename();
@ -2406,7 +2407,7 @@ feature_directive : FEATURE LPAREN idstring RPAREN declarator cpp_const stringbr
scanner_clear_rename();
}
| FEATURE LPAREN idstring COMMA stringnum featattr RPAREN SEMI {
String *val = Len($5) ? NewString($5) : 0;
String *val = Len($5) ? $5 : 0;
new_feature($3, val, $6, 0, 0, 0, 0);
$$ = 0;
scanner_clear_rename();
@ -2581,7 +2582,7 @@ tm_tail : COMMA typemap_parm tm_tail {
| empty { $$ = 0;}
;
typemap_parm : type typemap_parameter_declarator {
typemap_parm : type plain_declarator {
Parm *parm;
SwigType_push($1,$2.type);
$$ = new_node("typemapitem");
@ -2783,7 +2784,7 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va
String *symname = Swig_name_make(templnode,0,$3,0,0);
*/
String *symname = $3;
String *symname = NewString($3);
Swig_cparse_template_expand(templnode,symname,temparms,tscope);
Setattr(templnode,"sym:name",symname);
} else {
@ -2918,7 +2919,6 @@ warn_directive : WARN string {
}
;
/* ======================================================================
* C Parsing
* ====================================================================== */
@ -2966,10 +2966,11 @@ c_declaration : c_decl {
Swig_warning(WARN_CPP11_LAMBDA, cparse_file, cparse_line, "Lambda expressions and closures are not fully supported yet.\n");
SWIG_WARN_NODE_END($$);
}
| USING idcolon EQUAL {
skip_decl();
| USING idcolon EQUAL type plain_declarator SEMI {
$$ = new_node("using");
Setattr($$,"name",$2);
SwigType_push($4,$5.type);
Setattr($$,"uname",$4);
add_symbols($$);
SWIG_WARN_NODE_BEGIN($$);
Swig_warning(WARN_CPP11_ALIAS_DECLARATION, cparse_file, cparse_line, "The 'using' keyword in type aliasing is not fully supported yet.\n");
@ -2977,15 +2978,17 @@ c_declaration : c_decl {
$$ = 0; /* TODO - ignored for now */
}
| TEMPLATE LESSTHAN template_parms GREATERTHAN USING idcolon EQUAL identifier {
skip_decl();
| TEMPLATE LESSTHAN template_parms GREATERTHAN USING idcolon EQUAL type plain_declarator SEMI {
$$ = new_node("using");
Setattr($$,"uname",$8);
Setattr($$,"name",$6);
SwigType_push($8,$9.type);
Setattr($$,"uname",$8);
add_symbols($$);
SWIG_WARN_NODE_BEGIN($$);
Swig_warning(WARN_CPP11_ALIAS_TEMPLATE, cparse_file, cparse_line, "The 'using' keyword in template aliasing is not fully supported yet.\n");
SWIG_WARN_NODE_END($$);
$$ = 0; /* TODO - ignored for now */
}
;
@ -3186,7 +3189,9 @@ initializer : def_args {
cpp_alternate_rettype : primitive_type { $$ = $1; }
| TYPE_BOOL { $$ = $1; }
| TYPE_VOID { $$ = $1; }
/*
| TYPE_TYPEDEF template_decl { $$ = NewStringf("%s%s",$1,$2); }
*/
| TYPE_RAW { $$ = $1; }
| idcolon { $$ = $1; }
| decltype { $$ = $1; }
@ -4617,7 +4622,7 @@ cpp_destructor_decl : NOT idtemplate LPAREN parms RPAREN cpp_end {
/* C++ type conversion operator */
cpp_conversion_operator : storage_class COPERATOR type pointer LPAREN parms RPAREN cpp_vend {
cpp_conversion_operator : storage_class CONVERSIONOPERATOR type pointer LPAREN parms RPAREN cpp_vend {
$$ = new_node("cdecl");
Setattr($$,"type",$3);
Setattr($$,"name",$2);
@ -4632,7 +4637,7 @@ cpp_conversion_operator : storage_class COPERATOR type pointer LPAREN parms RPAR
Setattr($$,"conversion_operator","1");
add_symbols($$);
}
| storage_class COPERATOR type AND LPAREN parms RPAREN cpp_vend {
| storage_class CONVERSIONOPERATOR type AND LPAREN parms RPAREN cpp_vend {
SwigType *decl;
$$ = new_node("cdecl");
Setattr($$,"type",$3);
@ -4649,7 +4654,7 @@ cpp_conversion_operator : storage_class COPERATOR type pointer LPAREN parms RPAR
Setattr($$,"conversion_operator","1");
add_symbols($$);
}
| storage_class COPERATOR type LAND LPAREN parms RPAREN cpp_vend {
| storage_class CONVERSIONOPERATOR type LAND LPAREN parms RPAREN cpp_vend {
SwigType *decl;
$$ = new_node("cdecl");
Setattr($$,"type",$3);
@ -4667,7 +4672,7 @@ cpp_conversion_operator : storage_class COPERATOR type pointer LPAREN parms RPAR
add_symbols($$);
}
| storage_class COPERATOR type pointer AND LPAREN parms RPAREN cpp_vend {
| storage_class CONVERSIONOPERATOR type pointer AND LPAREN parms RPAREN cpp_vend {
SwigType *decl;
$$ = new_node("cdecl");
Setattr($$,"type",$3);
@ -4686,7 +4691,7 @@ cpp_conversion_operator : storage_class COPERATOR type pointer LPAREN parms RPAR
add_symbols($$);
}
| storage_class COPERATOR type LPAREN parms RPAREN cpp_vend {
| storage_class CONVERSIONOPERATOR type LPAREN parms RPAREN cpp_vend {
String *t = NewStringEmpty();
$$ = new_node("cdecl");
Setattr($$,"type",$3);
@ -4823,7 +4828,9 @@ anon_bitfield_type : primitive_type { $$ = $1;
}
| TYPE_BOOL { $$ = $1; }
| TYPE_VOID { $$ = $1; }
/*
| TYPE_TYPEDEF template_decl { $$ = NewStringf("%s%s",$1,$2); }
*/
| TYPE_RAW { $$ = $1; }
| idcolon {
@ -4834,28 +4841,22 @@ anon_bitfield_type : primitive_type { $$ = $1;
/* ======================================================================
* PRIMITIVES
* ====================================================================== */
storage_class : EXTERN { $$ = "extern"; }
| EXTERN string {
if (strcmp($2,"C") == 0) {
extern_string : EXTERN string {
if (Strcmp($2,"C") == 0) {
$$ = "externc";
} else if (strcmp($2,"C++") == 0) {
} else if (Strcmp($2,"C++") == 0) {
$$ = "extern";
} else {
Swig_warning(WARN_PARSE_UNDEFINED_EXTERN,cparse_file, cparse_line,"Unrecognized extern type \"%s\".\n", $2);
$$ = 0;
}
}
| EXTERN string THREAD_LOCAL {
if (strcmp($2,"C") == 0) {
$$ = "externc thread_local";
} else if (strcmp($2,"C++") == 0) {
$$ = "extern thread_local";
} else {
Swig_warning(WARN_PARSE_UNDEFINED_EXTERN,cparse_file, cparse_line,"Unrecognized extern type \"%s\".\n", $2);
$$ = 0;
}
}
;
storage_class : EXTERN { $$ = "extern"; }
| extern_string { $$ = $1; }
| extern_string THREAD_LOCAL { $$ = "thread_local"; }
| extern_string TYPEDEF { $$ = "typedef"; }
| STATIC { $$ = "static"; }
| TYPEDEF { $$ = "typedef"; }
| VIRTUAL { $$ = "virtual"; }
@ -4920,6 +4921,7 @@ parm : rawtype parameter_declarator {
Setattr($$,"value",$2.defarg);
}
}
| TEMPLATE LESSTHAN cpptype GREATERTHAN cpptype idcolon def_args {
$$ = NewParmWithoutFileLineInfo(NewStringf("template<class> %s %s", $5,$6), 0);
previousNode = currentNode;
@ -5084,7 +5086,7 @@ parameter_declarator : declarator def_args {
}
;
typemap_parameter_declarator : declarator {
plain_declarator : declarator {
$$ = $1;
if (SwigType_isfunction($1.type)) {
Delete(SwigType_pop_function($1.type));
@ -5794,7 +5796,9 @@ type_right : primitive_type { $$ = $1;
}
| TYPE_BOOL { $$ = $1; }
| TYPE_VOID { $$ = $1; }
/*
| TYPE_TYPEDEF template_decl { $$ = NewStringf("%s%s",$1,$2); }
*/
| c_enum_key idcolon { $$ = NewStringf("enum %s", $2); }
| TYPE_RAW { $$ = $1; }
@ -5977,17 +5981,6 @@ definetype : { /* scanner_check_typedef(); */ } expr {
| default_delete {
$$ = $1;
}
/*
| string {
$$.val = NewString($1);
$$.rawval = NewStringf("\"%(escape)s\"",$$.val);
$$.type = T_STRING;
$$.bitfield = 0;
$$.throws = 0;
$$.throwf = 0;
$$.nexcept = 0;
}
*/
;
default_delete : deleted_definition {
@ -6123,7 +6116,7 @@ expr : valexpr { $$ = $1; }
valexpr : exprnum { $$ = $1; }
| string {
$$.val = NewString($1);
$$.val = $1;
$$.type = T_STRING;
}
| SIZEOF LPAREN type parameter_declarator RPAREN {
@ -6138,7 +6131,7 @@ valexpr : exprnum { $$ = $1; }
}
| exprcompound { $$ = $1; }
| wstring {
$$.val = NewString($1);
$$.val = $1;
$$.rawval = NewStringf("L\"%s\"", $$.val);
$$.type = T_WSTRING;
}
@ -6633,14 +6626,13 @@ mem_initializer : idcolon LPAREN {
}
;
template_decl : LESSTHAN valparms GREATERTHAN {
less_valparms_greater : LESSTHAN valparms GREATERTHAN {
String *s = NewStringEmpty();
SwigType_add_template(s,$2);
$$ = Char(s);
scanner_last_id(1);
}
| empty { $$ = (char*)""; }
;
}
;
/* Identifiers including the C++11 identifiers with special meaning */
identifier : ID { $$ = $1; }
@ -6649,8 +6641,8 @@ identifier : ID { $$ = $1; }
;
idstring : identifier { $$ = $1; }
| default_delete { $$ = $1.val; }
| string { $$ = $1; }
| default_delete { $$ = Char($1.val); }
| string { $$ = Char($1); }
;
idstringopt : idstring { $$ = $1; }
@ -6662,35 +6654,38 @@ idcolon : idtemplate idcolontail {
if (!$$) $$ = NewStringf("%s%s", $1,$2);
Delete($2);
}
| NONID DCOLON idtemplate idcolontail {
| NONID DCOLON idtemplatetemplate idcolontail {
$$ = NewStringf("::%s%s",$3,$4);
Delete($4);
}
| idtemplate {
$$ = NewString($1);
}
| NONID DCOLON idtemplate {
| NONID DCOLON idtemplatetemplate {
$$ = NewStringf("::%s",$3);
}
| OPERATOR {
$$ = NewString($1);
$$ = NewStringf("%s", $1);
}
| OPERATOR less_valparms_greater {
$$ = NewStringf("%s%s", $1, $2);
}
| NONID DCOLON OPERATOR {
$$ = NewStringf("::%s",$3);
}
;
idcolontail : DCOLON idtemplate idcolontail {
idcolontail : DCOLON idtemplatetemplate idcolontail {
$$ = NewStringf("::%s%s",$2,$3);
Delete($3);
}
| DCOLON idtemplate {
| DCOLON idtemplatetemplate {
$$ = NewStringf("::%s",$2);
}
| DCOLON OPERATOR {
$$ = NewStringf("::%s",$2);
}
/* | DCOLON COPERATOR {
/* | DCOLON CONVERSIONOPERATOR {
$$ = NewString($2);
} */
@ -6700,12 +6695,20 @@ idcolontail : DCOLON idtemplate idcolontail {
;
idtemplate : identifier template_decl {
$$ = NewStringf("%s%s",$1,$2);
/* if (Len($2)) {
scanner_last_id(1);
} */
}
idtemplate : identifier {
$$ = NewStringf("%s", $1);
}
| identifier less_valparms_greater {
$$ = NewStringf("%s%s", $1, $2);
}
;
idtemplatetemplate : idtemplate {
$$ = $1;
}
| TEMPLATE identifier less_valparms_greater {
$$ = NewStringf("%s%s", $2, $3);
}
;
/* Identifier, but no templates */
@ -6749,30 +6752,24 @@ idcolontailnt : DCOLON identifier idcolontailnt {
/* Concatenated strings */
string : string STRING {
$$ = (char *) malloc(strlen($1)+strlen($2)+1);
strcpy($$,$1);
strcat($$,$2);
$$ = NewStringf("%s%s", $1, $2);
}
| STRING { $$ = $1;}
| STRING { $$ = NewString($1);}
;
/* Concatenated wide strings: L"str1" L"str2" */
wstring : wstring WSTRING {
$$ = (char *) malloc(strlen($1)+strlen($2)+1);
strcpy($$,$1);
strcat($$,$2);
$$ = NewStringf("%s%s", $1, $2);
}
/* Concatenated wide string and normal string literal: L"str1" "str2" */
/*not all the compilers support this concatenation mode, so perhaps better to postpone it*/
/*| wstring STRING { here $2 comes unescaped, we have to escape it back first via NewStringf("%(escape)s)"
$$ = (char *) malloc(strlen($1)+strlen($2)+1);
strcpy($$,$1);
strcat($$,$2);
$$ = NewStringf("%s%s", $1, $2);
}*/
| WSTRING { $$ = $1;}
| WSTRING { $$ = NewString($1);}
;
stringbrace : string {
$$ = NewString($1);
$$ = $1;
}
| LBRACE {
skip_balanced('{','}');
@ -6888,3 +6885,4 @@ ParmList *Swig_cparse_parms(String *s, Node *file_line_node) {
/* Printf(stdout,"typeparse: '%s' ---> '%s'\n", s, top); */
return top;
}

View file

@ -97,6 +97,15 @@ static int cparse_template_expand(Node *n, String *tname, String *rname, String
Append(cpatchlist, Getattr(n, "sym:name"));
}
}
if (checkAttribute(n, "storage", "friend")) {
String *symname = Getattr(n, "sym:name");
if (symname) {
String *stripped_name = SwigType_templateprefix(symname);
Setattr(n, "sym:name", stripped_name);
Delete(stripped_name);
}
Append(typelist, Getattr(n, "name"));
}
add_parms(Getattr(n, "parms"), cpatchlist, typelist);
add_parms(Getattr(n, "throws"), cpatchlist, typelist);
@ -228,7 +237,7 @@ String *partial_arg(String *s, String *p) {
if (!c) {
return Copy(s);
}
prefix = NewStringWithSize(cp, c - cp);
prefix = NewStringWithSize(cp, (int)(c - cp));
newarg = Copy(s);
Replace(newarg, prefix, "", DOH_REPLACE_ANY | DOH_REPLACE_FIRST);
Delete(prefix);