Fix parsing of default argument expressions containing ->.
This commit is contained in:
parent
cd9b7c3c34
commit
ef378407d0
3 changed files with 33 additions and 2 deletions
|
|
@ -7,6 +7,10 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
|
||||||
Version 4.0.0 (in progress)
|
Version 4.0.0 (in progress)
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
|
2018-01-05: wsfulton
|
||||||
|
Fix default arguments using expressions containing -> syntax error. Problem reported on
|
||||||
|
swig-user mailing list.
|
||||||
|
|
||||||
2017-12-30: wsfulton
|
2017-12-30: wsfulton
|
||||||
[Python] Replace pep8 with pycodestyle for checking the Python code style when
|
[Python] Replace pep8 with pycodestyle for checking the Python code style when
|
||||||
running Python tests.
|
running Python tests.
|
||||||
|
|
|
||||||
|
|
@ -164,6 +164,7 @@ CPP_TEST_CASES += \
|
||||||
cpp_typedef \
|
cpp_typedef \
|
||||||
curiously_recurring_template_pattern \
|
curiously_recurring_template_pattern \
|
||||||
default_args \
|
default_args \
|
||||||
|
default_arg_expressions \
|
||||||
default_arg_values \
|
default_arg_values \
|
||||||
default_constructor \
|
default_constructor \
|
||||||
defvalue_constructor \
|
defvalue_constructor \
|
||||||
|
|
|
||||||
|
|
@ -1604,7 +1604,7 @@ static String *add_qualifier_to_declarator(SwigType *type, SwigType *qualifier)
|
||||||
%type <type> type rawtype type_right anon_bitfield_type decltype ;
|
%type <type> type rawtype type_right anon_bitfield_type decltype ;
|
||||||
%type <bases> base_list inherit raw_inherit;
|
%type <bases> base_list inherit raw_inherit;
|
||||||
%type <dtype> definetype def_args etype default_delete deleted_definition explicit_default;
|
%type <dtype> definetype def_args etype default_delete deleted_definition explicit_default;
|
||||||
%type <dtype> expr exprnum exprcompound valexpr;
|
%type <dtype> expr exprnum exprcompound valexpr exprmem;
|
||||||
%type <id> ename ;
|
%type <id> ename ;
|
||||||
%type <id> less_valparms_greater;
|
%type <id> less_valparms_greater;
|
||||||
%type <str> type_qualifier;
|
%type <str> type_qualifier;
|
||||||
|
|
@ -6266,7 +6266,33 @@ expr : valexpr { $$ = $1; }
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
valexpr : exprnum { $$ = $1; }
|
/* simple member access expressions */
|
||||||
|
exprmem : ID ARROW ID {
|
||||||
|
$$.val = NewStringf("%s->%s", $1, $3);
|
||||||
|
$$.type = 0;
|
||||||
|
}
|
||||||
|
| exprmem ARROW ID {
|
||||||
|
$$ = $1;
|
||||||
|
Printf($$.val, "->%s", $3);
|
||||||
|
}
|
||||||
|
/* This generates a shift-reduce
|
||||||
|
| ID PERIOD ID {
|
||||||
|
$$.val = NewStringf("%s.%s", $1, $3);
|
||||||
|
$$.type = 0;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
| exprmem PERIOD ID {
|
||||||
|
$$ = $1;
|
||||||
|
Printf($$.val, ".%s", $3);
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
valexpr : exprnum {
|
||||||
|
$$ = $1;
|
||||||
|
}
|
||||||
|
| exprmem {
|
||||||
|
$$ = $1;
|
||||||
|
}
|
||||||
| string {
|
| string {
|
||||||
$$.val = $1;
|
$$.val = $1;
|
||||||
$$.type = T_STRING;
|
$$.type = T_STRING;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue