From: Andrew Burgess <andrew.burgess@embecosm.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>, Simon Marchi <simark@simark.ca>,
jimw@sifive.com, jhb@FreeBSD.org, palmer@sifive.com,
Andrew Burgess <andrew.burgess@embecosm.com>
Subject: [PATCHv2 3/4] gdb: Add new parser rule for structure field names
Date: Tue, 18 Dec 2018 22:40:00 -0000 [thread overview]
Message-ID: <cb6c1de899e25f5ec7c3283f7d495b84cb2e0fc4.1545172667.git.andrew.burgess@embecosm.com> (raw)
In-Reply-To: <cover.1545172667.git.andrew.burgess@embecosm.com>
In-Reply-To: <cover.1545172667.git.andrew.burgess@embecosm.com>
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 | 5 +++++
gdb/c-exp.y | 13 ++++++++-----
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index d2198b1fdf7..b6b57c8c4d4 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -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);
@@ -1644,6 +1644,9 @@ oper: OPERATOR NEW
;
+field_name
+ : name
+ ;
name : NAME { $$ = $1.stoken; }
| BLOCKNAME { $$ = $1.stoken; }
--
2.14.5
next prev parent reply other threads:[~2018-12-18 22:40 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-15 23:25 [PATCH] gdb: Allow struct fields named double Andrew Burgess
2018-12-16 16:23 ` Simon Marchi
2018-12-16 16:42 ` Tom Tromey
2018-12-18 22:40 ` [PATCHv2 0/4] " Andrew Burgess
2018-12-24 17:30 ` Andrew Burgess
2018-12-18 22:40 ` Andrew Burgess [this message]
2018-12-21 16:38 ` [PATCHv2 3/4] gdb: Add new parser rule for structure field names Tom Tromey
2018-12-18 22:40 ` [PATCHv2 1/4] gdb: Extend the comments in c-exp.y Andrew Burgess
2018-12-21 15:44 ` Tom Tromey
2018-12-18 22:40 ` [PATCHv2 4/4] gdb: Allow struct fields named double Andrew Burgess
2018-12-21 17:19 ` Tom Tromey
2018-12-18 22:40 ` [PATCHv2 2/4] gdb: Resolve 49 reduce/reduce conflicts in c-exp.y Andrew Burgess
2018-12-21 16:37 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cb6c1de899e25f5ec7c3283f7d495b84cb2e0fc4.1545172667.git.andrew.burgess@embecosm.com \
--to=andrew.burgess@embecosm.com \
--cc=gdb-patches@sourceware.org \
--cc=jhb@FreeBSD.org \
--cc=jimw@sifive.com \
--cc=palmer@sifive.com \
--cc=simark@simark.ca \
--cc=tom@tromey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox