From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 72237 invoked by alias); 18 Dec 2018 22:40:32 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 72073 invoked by uid 89); 18 Dec 2018 22:40:30 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1998, classname X-HELO: mail-wm1-f50.google.com Received: from mail-wm1-f50.google.com (HELO mail-wm1-f50.google.com) (209.85.128.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 18 Dec 2018 22:40:28 +0000 Received: by mail-wm1-f50.google.com with SMTP id d15so4234344wmb.3 for ; Tue, 18 Dec 2018 14:40:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=rRE4YpHqiUC+m1OVEclQp9CG9TztNV+U37nj9xQ05jo=; b=AGLr9i8lXWQ+jqwmuJuvwB7Xm9y01wYitVwkVnUt/ZtArkOaVCeOEbAOS9sxCcCnE5 v1cdXhNwyWPlBzfSaDTZra4+C9ofncz5lyRR/eFFENyk9je+N6czQEMdaFEPEahJtDZU eA0fSS/dikidWa3tehhkkZpozm5roEu8d9Uy9+QCX3nLLHYFgBKdZGRyiAOcaXJMTkrg Dkg8cSNOkzWiO3IMA7zmqF5YB7w8I+qYYCWXJ1YFQ04/IoCowxMLNtPgbXaf4BiLQcAl 6U5fs4UsjkblF44kQ6s82H4dDwyasdpFZV1oQM/rlna4X+W055WehmiMaa72GJfYs2nL wutA== Return-Path: Received: from localhost (host86-156-236-210.range86-156.btcentralplus.com. [86.156.236.210]) by smtp.gmail.com with ESMTPSA id v4sm4035328wme.6.2018.12.18.14.40.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 18 Dec 2018 14:40:25 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Tom Tromey , Simon Marchi , jimw@sifive.com, jhb@FreeBSD.org, palmer@sifive.com, Andrew Burgess Subject: [PATCHv2 3/4] gdb: Add new parser rule for structure field names Date: Tue, 18 Dec 2018 22:40:00 -0000 Message-Id: In-Reply-To: References: In-Reply-To: References: <87tvjd4e54.fsf@tromey.com> X-IsSubscribed: yes X-SW-Source: 2018-12/txt/msg00211.txt.bz2 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 COMPLETE %token TYPENAME %token CLASSNAME /* ObjC Class name */ -%type name +%type name field_name %type string_exp %type name_not_typename %type 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