aboutsummaryrefslogtreecommitdiff
path: root/gdb/m2-exp.y
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2020-08-25 10:25:32 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2020-08-25 10:25:32 +0100
commit419cca029e5d4b9b648402f9da3c38f302ca7b0a (patch)
tree43b4857a5707aa1db9293a335b94c1d81df91995 /gdb/m2-exp.y
parent07758bdfa9e5a762f2ec0deeb51b11d6ad5fe376 (diff)
downloadgdb-419cca029e5d4b9b648402f9da3c38f302ca7b0a.zip
gdb-419cca029e5d4b9b648402f9da3c38f302ca7b0a.tar.gz
gdb-419cca029e5d4b9b648402f9da3c38f302ca7b0a.tar.bz2
Revert "Fix for Bug 26372 [Modula-2] Parsing of multi-subscript arrays"
This reverts commit 07758bdfa9e5a762f2ec0deeb51b11d6ad5fe376.
Diffstat (limited to 'gdb/m2-exp.y')
-rw-r--r--gdb/m2-exp.y45
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++; }
;