]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: Add new parser rule for structure field names
authorAndrew Burgess <andrew.burgess@embecosm.com>
Mon, 17 Dec 2018 13:51:05 +0000 (13:51 +0000)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Mon, 24 Dec 2018 17:25:25 +0000 (17:25 +0000)
Introduces a new rule in c-exp.y for matching structure field names.

This is a restructure in preparation for the next commit, this commit
shouldn't result in any user visible changes.

gdb/ChangeLog:

* c-exp.y (field_name): New %token, and new rule.
(exp): Replace uses of 'name' with 'field_name' where appropriate.

gdb/ChangeLog
gdb/c-exp.y

index ced5180ac27359852716ecb29fb09390ea4591db..5c5699e75780fe7928024799ea2550e72d1a54e3 100644 (file)
@@ -1,3 +1,8 @@
+2018-12-24  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * c-exp.y (field_name): New %token, and new rule.
+       (exp): Replace uses of 'name' with 'field_name' where appropriate.
+
 2018-12-24  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        PR gdb/13368
index 447ac78eee19a8a2ad34736ae38813a8cc3d2a2c..98a0df3e190640f6764d75a6126cfd33de0b646d 100644 (file)
@@ -156,7 +156,7 @@ static void c_print_token (FILE *file, int type, YYSTYPE value);
 %token <voidval> COMPLETE
 %token <tsym> TYPENAME
 %token <theclass> CLASSNAME    /* ObjC Class name */
-%type <sval> name
+%type <sval> name field_name
 %type <svec> string_exp
 %type <ssym> name_not_typename
 %type <tsym> type_name
@@ -312,13 +312,13 @@ exp       :       ALIGNOF '(' type_exp ')'        %prec UNARY
                        { write_exp_elt_opcode (pstate, UNOP_ALIGNOF); }
        ;
 
-exp    :       exp ARROW name
+exp    :       exp ARROW field_name
                        { write_exp_elt_opcode (pstate, STRUCTOP_PTR);
                          write_exp_string (pstate, $3);
                          write_exp_elt_opcode (pstate, STRUCTOP_PTR); }
        ;
 
-exp    :       exp ARROW name COMPLETE
+exp    :       exp ARROW field_name COMPLETE
                        { mark_struct_expression (pstate);
                          write_exp_elt_opcode (pstate, STRUCTOP_PTR);
                          write_exp_string (pstate, $3);
@@ -360,13 +360,13 @@ exp       :       exp ARROW_STAR exp
                        { write_exp_elt_opcode (pstate, STRUCTOP_MPTR); }
        ;
 
-exp    :       exp '.' name
+exp    :       exp '.' field_name
                        { write_exp_elt_opcode (pstate, STRUCTOP_STRUCT);
                          write_exp_string (pstate, $3);
                          write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); }
        ;
 
-exp    :       exp '.' name COMPLETE
+exp    :       exp '.' field_name COMPLETE
                        { mark_struct_expression (pstate);
                          write_exp_elt_opcode (pstate, STRUCTOP_STRUCT);
                          write_exp_string (pstate, $3);
@@ -1646,6 +1646,9 @@ oper:     OPERATOR NEW
        ;
 
 
+field_name
+       :       name
+       ;
 
 name   :       NAME { $$ = $1.stoken; }
        |       BLOCKNAME { $$ = $1.stoken; }