From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id IE6bArRE/2rh6iAAWB0awg (envelope-from ) for ; Thu, 19 Nov 2026 13:49:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1795114163; bh=O21mx08q2M0swR+5YW9rylbQJAOH3fWYnbGzl2TYr7g=; h=Date:Subject:To:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=p0Bz0bGw9ary9EkH7heLwguuEzNadfHRHqtCUEEg9Ne7phwXMzZPWx3VcD8uKkz+r WaCJpjzI43JKc+TWmw5JzaexKhxifiBFu+jyLVJCWNUb4HSGTPLG11q6S8+8y0P+C1 0+H1Q7zh8sQHru+lZE9tTrtBlpQmpPewMzEofT/k= Received: by simark.ca (Postfix, from userid 112) id DFDB01E0BC; Thu, 19 Nov 2026 13:49:23 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=t9y9SEs3; dkim-atps=neutral Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 60AD11E023 for ; Thu, 19 Nov 2026 13:49:23 -0500 (EST) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E72254BA2E21 for ; Thu, 19 Nov 2026 18:49:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E72254BA2E21 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=t9y9SEs3 Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 6128A4BA2E36 for ; Thu, 19 Nov 2026 18:48:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6128A4BA2E36 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6128A4BA2E36 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1795114139; cv=none; b=RiOeEAdS7yI0aj1Aza1M0LyVyRqShsJuAI+czGiOp9/mtrinuy6gBF+YQlzsEHBH7EMAyUicoBCn2OZTCNk8QSxM395GLyaMWqOjTzd6UsfsHS/UMhCfvan3X/lxIQbY+0O8tvbqEn6EgNzQ8f/ESEsfolliYzuXhCwvWuPmv/o= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1795114139; c=relaxed/simple; bh=O21mx08q2M0swR+5YW9rylbQJAOH3fWYnbGzl2TYr7g=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=g5Yl0ZWC8FZnqDV9eGXepdGpBlI+KTDDKXHSZ4f3KBcQHBvIYsotIIejHfCQ7aOjlqinenWcR+P/TLK5gsQQCYNvyS7iH5hSf6kr+Larr/5BsCfvdDGZx7gxkFlKG6eN0QjRCN49L74prUBpNi+AvmqmF+TpMd1fa/eY/rndO50= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=t9y9SEs3 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6128A4BA2E36 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1795114138; bh=O21mx08q2M0swR+5YW9rylbQJAOH3fWYnbGzl2TYr7g=; h=Date:Subject:To:References:From:In-Reply-To:From; b=t9y9SEs3OqdOqKk2CcW2jssAhaoPDEIJm40Lxf6F9ki726RRkr9agBkeoqODbQgjb IvBelf6Rw4mzooSgcF5l46B/WcUGKkaniBoXykSY5hfxruCKPVX5a0grzG0tpt7vv1 SaY9LFMfrYOOVJBVKYrgruLV61gOkxCr4EAUq7nU= Received: by simark.ca (Postfix) id 953FB1E023; Thu, 19 Nov 2026 13:48:58 -0500 (EST) Message-ID: <7a117c30-a4fa-4d33-b89f-98f3baa8e7f0@simark.ca> Date: Thu, 19 Nov 2026 13:48:58 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 3/7] Change some Ada parser functions into methods To: Tom Tromey , gdb-patches@sourceware.org References: <20261119-more-parser-cleanups-v1-0-d85241f3fede@adacore.com> <20261119-more-parser-cleanups-v1-3-d85241f3fede@adacore.com> Content-Language: fr From: Simon Marchi In-Reply-To: <20261119-more-parser-cleanups-v1-3-d85241f3fede@adacore.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org On 11/19/26 12:58 PM, Tom Tromey wrote: > This turns a few Ada parser functions into methods of ada_parse_state. > This also renames some functions to conform to the gdb style. > > This approach is somewhat cleaner. Ultimately I think the Ada lexer > (and hopefully someday the parser) would more resemble how the Rust > parser works -- a self-contained class. I think this is a good direction. Do you plan on switching more functions to become methods and working your way towards making ada-expt.y a "pure" parser? Is that what you mean by "resemble how the Rust parser works"? I noted some minor comments below, the patch LGTM. > @@ -378,14 +378,13 @@ ada_parse_state::process_id (std::string_view name0) > /* See ada-exp-parser.h. */ > > struct stoken > -processString (const char *text, int len) > +ada_parse_state::process_string (const char *text, const char *lim) Sounds like that should take a string_view. > diff --git a/gdb/ada-exp-parser.h b/gdb/ada-exp-parser.h > index 4de2263ed6c..3d851e8fe7d 100644 > --- a/gdb/ada-exp-parser.h > +++ b/gdb/ada-exp-parser.h > @@ -137,6 +137,23 @@ struct ada_parse_state > */ > stoken process_id (std::string_view name0); > > + /* Return TEXT (up to LIM), a string literal without surrounding > + quotes, with special hex character notations replaced with > + characters. Result valid until the next call to ada_parse. */ > + struct stoken process_string (const char *text, const char *lim); > + > + /* Interprets the prefix of NUM that consists of digits of the given BASE > + as an integer of that BASE, with the string EXP as an exponent. > + Puts value in yylval, and returns INT, if the string is valid. Causes > + an error if the number is improperly formatted. BASE, if NULL, defaults > + to "10", and EXP to "1". The EXP does not contain a leading 'e' or 'E'. > + */ > + int process_int (const char *base0, const char *num0, const char *exp0); The names in the comment don't have the "0" suffix. Does the 0 have a meaning, like to indicate we expect this string to be null-terminated? Simon