Re: pure parsers and reentrant scanners

Heikki Linnakangas <hlinnaka@iki.fi>

From: Heikki Linnakangas <hlinnaka@iki.fi>
To: Peter Eisentraut <peter@eisentraut.org>, Andreas Karlsson <andreas@proxel.se>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2024-12-27T09:19:27Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Return yyparse() result not via global variable

  2. Remove flex version checks

  3. Drop warning-free support for Flex 2.5.35

  4. plpgsql: pure parser and reentrant scanner

  5. flex code modernization: Replace YY_EXTRA_TYPE define with flex option

  6. guc: reentrant scanner

  7. jsonpath scanner: reentrant scanner

  8. syncrep parser: pure parser and reentrant scanner

  9. replication parser: pure parser and reentrant scanner

  10. bootstrap: pure parser and reentrant scanner

  11. Small whitespace improvement

  12. Prevent redeclaration of typedef yyscan_t

  13. seg: pure parser and reentrant scanner

  14. cube: pure parser and reentrant scanner

On 26/12/2024 20:27, Peter Eisentraut wrote:
> On 22.12.24 22:43, Andreas Karlsson wrote:
>> On 12/19/24 9:57 PM, Peter Eisentraut wrote:
>>> Here is an updated patch set on top of what has been committed so 
>>> far, with all the issues you pointed out addressed.
>>
>> Other than the discussion of how old versions of flex we should 
>> support I think this set of patches is ready to be committed. I looked 
>> at it again and everything looks good.
> 
> I have committed these except the plpgsql one, which was still work in 
> progress.  But I have progressed on this now and also converted the 
> parser and put the local state into yyextra.  This gets rid of all 
> internal global state now.  The patches for this are attached.  It's a 
> lot of churn, but otherwise pretty standard stuff.

Looks good to me.

> Along the way I noticed that the flex documentation now recommends a 
> different way to set the yyextra type.  So I have changed the ones we 
> already have to that newer style.  I inspected the generated C code and 
> there wasn't any significant difference, so I'm not sure, but I figure 
> if we're making changes in this area we might as well use the modern style.

+1. According to the flex NEWS file, this syntax was added in flex 
2.5.34, and we already require 2.5.35.

-- 
Heikki Linnakangas
Neon (https://neon.tech)