More lambda support - for optional lambda declarators

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-matevz@13859 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2012-10-04 06:01:38 +00:00
commit 35458b4a5d
3 changed files with 33 additions and 12 deletions

View file

@ -3292,18 +3292,23 @@ cpp_alternate_rettype : primitive_type { $$ = $1; }
| decltype { $$ = $1; }
;
/*
Lambda functions and expressions, such as:
auto myFunc = [](int x, int y) -> int { return x+y; };
auto myFunc = [](int x, int y) { return x+y; };
auto myFunc = [](int x, int y) { return x+y; }(1, 2);
*/
/* ------------------------------------------------------------
Lambda functions and expressions, such as:
auto myFunc = [] { return something; };
auto myFunc = [](int x, int y) { return x+y; };
auto myFunc = [](int x, int y) -> int { return x+y; };
auto myFunc = [](int x, int y) throw() -> int { return x+y; };
auto six = [](int x, int y) { return x+y; }(4, 2);
------------------------------------------------------------ */
cpp_lambda_decl : storage_class AUTO idcolon EQUAL lambda_introducer LPAREN parms RPAREN cpp_const lambda_body lambda_tail {
$$ = 0;
}
| storage_class AUTO idcolon EQUAL lambda_introducer LPAREN parms RPAREN cpp_const ARROW type lambda_body lambda_tail {
$$ = 0;
}
| storage_class AUTO idcolon EQUAL lambda_introducer lambda_body lambda_tail {
$$ = 0;
}
;
lambda_introducer : LBRACKET {