Re: pure parsers and reentrant scanners

Andreas Karlsson <andreas@proxel.se>

From: Andreas Karlsson <andreas@proxel.se>
To: Peter Eisentraut <peter@eisentraut.org>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2024-12-17T00:46:18Z
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

Attachments

On 12/16/24 8:39 AM, Peter Eisentraut wrote:
> I'll leave it at this for now and wait for some reviews.

I really like this work since it makes the code cleaner to read on top 
of paving the way for threading.

Reviewed the patches and found a couple of issues.

- Shouldn't yyext in syncrep_scanner_init() be allocated on the heap? Or 
at least on the stack but by the caller?

- I think you have flipped the parameters of replication_yyerror(), see 
attached fixup patch.

- Some white space issues fixed in an attached fixup patch.

- Also fixed the static remaining variables in the replication parser in 
an attached patch.

- There seems to be a lot left to do to make the plpgsql scanner 
actually re-entrant so I do not think it would makes sense to commit the 
patch which sets the re-entrant option before that is done.

Andreas