diff options
Diffstat (limited to 'gdb/m2-exp.y')
-rw-r--r-- | gdb/m2-exp.y | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/gdb/m2-exp.y b/gdb/m2-exp.y index dba331f..70a3d9c 100644 --- a/gdb/m2-exp.y +++ b/gdb/m2-exp.y @@ -293,18 +293,21 @@ set : '{' arglist '}' ; -/* Modula-2 array subscript notation [a,b,c...]. */ -exp : exp '[' ArgumentList ']' %prec DOT - { - if (pstate->arglist_len > 1) - { - write_exp_elt_opcode (pstate, MULTI_SUBSCRIPT); - write_exp_elt_longcst (pstate, pstate->arglist_len); - write_exp_elt_opcode (pstate, MULTI_SUBSCRIPT); - } - else - write_exp_elt_opcode (pstate, BINOP_SUBSCRIPT); - } +/* Modula-2 array subscript notation [a,b,c...] */ +exp : exp '[' + /* This function just saves the number of arguments + that follow in the list. It is *not* specific to + function types */ + { pstate->start_arglist(); } + non_empty_arglist ']' %prec DOT + { write_exp_elt_opcode (pstate, MULTI_SUBSCRIPT); + write_exp_elt_longcst (pstate, + pstate->end_arglist()); + write_exp_elt_opcode (pstate, MULTI_SUBSCRIPT); } + ; + +exp : exp '[' exp ']' + { write_exp_elt_opcode (pstate, BINOP_SUBSCRIPT); } ; exp : exp '(' @@ -318,22 +321,24 @@ exp : exp '(' write_exp_elt_opcode (pstate, OP_FUNCALL); } ; -/* Non empty argument list. */ -ArgumentList: - exp +arglist : + ; + +arglist : exp { pstate->arglist_len = 1; } -| ArgumentList ',' exp - { pstate->arglist_len++; } ; -arglist : +arglist : arglist ',' exp %prec ABOVE_COMMA + { pstate->arglist_len++; } ; -arglist : exp +non_empty_arglist + : exp { pstate->arglist_len = 1; } ; -arglist : arglist ',' exp %prec ABOVE_COMMA +non_empty_arglist + : non_empty_arglist ',' exp %prec ABOVE_COMMA { pstate->arglist_len++; } ; |