Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@adacore.com>
To: Simon Marchi <simark@simark.ca>
Cc: Tom Tromey <tromey@adacore.com>,  gdb-patches@sourceware.org
Subject: Re: [PATCH 3/7] Change some Ada parser functions into methods
Date: Fri, 20 Nov 2026 13:57:41 -0700	[thread overview]
Message-ID: <87pkvzxltm.fsf@tromey.com> (raw)
In-Reply-To: <7a117c30-a4fa-4d33-b89f-98f3baa8e7f0@simark.ca> (Simon Marchi's message of "Thu, 19 Nov 2026 13:48:58 -0500")

Simon> Do you plan on switching more functions to become methods and working
Simon> your way towards making ada-expt.y a "pure" parser?  Is that what you
Simon> mean by "resemble how the Rust parser works"?

Yeah, I would like to do that.

I personally find debugging and modifying recursive descent parsers much
easier than dealing with yacc.

That said who knows how long it will take.  It's kind of involved.
For Ada it would probably let us remove some lexing hacks though.

>> @@ -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)

Simon> Sounds like that should take a string_view.

I had tried this before, but it's a pain due to the inner part of the
loop.  I guess the loop could remain and just use .data(), but that
doesn't really seem like much of an improvement in the end.

>> +  int process_int (const char *base0, const char *num0, const char *exp0);

Simon> The names in the comment don't have the "0" suffix.  Does the 0 have a
Simon> meaning, like to indicate we expect this string to be null-terminated?

No idea, these were just leftovers.
I'll look and change them.

Tom

  reply	other threads:[~2026-11-20 20:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 17:58 [PATCH 0/7] More minor parser-related cleanups Tom Tromey
2026-11-19 17:58 ` [PATCH 1/7] Use compiled_regex in rust-parse.c Tom Tromey
2026-11-19 17:58 ` [PATCH 2/7] Move ada_tick_completer to ada-exp-parser.c Tom Tromey
2026-11-19 17:58 ` [PATCH 3/7] Change some Ada parser functions into methods Tom Tromey
2026-11-19 18:48   ` Simon Marchi
2026-11-20 20:57     ` Tom Tromey [this message]
2026-11-19 17:58 ` [PATCH 4/7] Simplify post-process-parser-output.sh Tom Tromey
2026-11-19 17:58 ` [PATCH 5/7] Remove fixed-sized buffer from ada_parse_state::lex_number Tom Tromey
2026-11-19 17:58 ` [PATCH 6/7] Hoist calls to canonicalize_numeral Tom Tromey
2026-11-19 17:58 ` [PATCH 7/7] Remove canonicalize_numeral Tom Tromey
2026-11-19 18:55 ` [PATCH 0/7] More minor parser-related cleanups Simon Marchi

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=87pkvzxltm.fsf@tromey.com \
    --to=tromey@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simark@simark.ca \
    /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