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 v2] Rewrite the Ada lexer
Date: Thu, 19 Nov 2026 09:59:42 -0700	[thread overview]
Message-ID: <87jym8zri9.fsf@tromey.com> (raw)
In-Reply-To: <ba17c01e-cb6a-4766-9eec-74ae610ec7d2@simark.ca> (Simon Marchi's message of "Thu, 19 Nov 2026 00:00:37 -0500")

>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:

Simon> Some cleanup that could be part of this patch, of a later one:

Simon>  - remove ada-lex-gen.{c,h} from .gitignore
Simon>  - ECHO_LEX can be removed from silent-rules.mk

I did this.

Simon>  - post-process-parser-output.sh can be simplified

But not this.

>> +/* The number of subexpressions to allocate space for, including the
>> +   "0th" whole match subexpression.  */
>> +#define NUM_OPER_SUBEXPRESSIONS 2

Simon> NUM_OPER_SUBEXPRESSIONS is unused, I don't know if it should?

Yes, I fixed this oversight.

>> +  while (!name0.empty () && c_isspace (name0.back ()))
>> +    name0 = name0.substr (0, name0.size () - 1);

Simon> Can use name0.remove_suffix(1).

Done.

>> ada_yylval.sval.ptr = obstack_strndup (&ada_parser->temp_space,

Simon> Should be just temp_space (or this->temp_space), instead of going
Simon> through the `ada_parser` global.  There is another instance at line 280
Simon> in ada_parse_state::process_id.

Fixed.

Simon> This predates the patch, so maybe a TODO cleanup, we can overflow this
Simon> static buffer:

Yeah.  I intentionally left this alone since it's already there.

>> +  error (_("Invalid character '%s' in expression."), pstate->lexptr);

Simon> %s or %c?

I thought this was also pre-existing though I suppose yytext is \0
terminated, so I will change it.

...
Simon> Indentation is off for the first element.

Fixed.

>> +  code = regcomp (&operator_regex, operator_regex_text,
>> +		  REG_EXTENDED | REG_ICASE);
>> +  gdb_assert (code == 0);

Simon> Can these use compiled_regex?

Yeah, I did this.

Tom

  reply	other threads:[~2026-11-19 17:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 19:18 Tom Tromey
2026-11-18 11:03 ` Tom de Vries
2026-11-18 15:58   ` Tom Tromey
2026-11-19  5:00 ` Simon Marchi
2026-11-19 16:59   ` Tom Tromey [this message]
2026-11-19 17:31   ` 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=87jym8zri9.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