Skip to content

Conversation

demerphq
Copy link
Collaborator

@demerphq demerphq commented Jul 16, 2023

perlreapi.pod has a copy of the struct regexp from regexp.h, but over time the two copies have fallen out of sync with each other. When @nwc10 converted regexps to be first order SV types there were many changes that invalidated old structure members (typically replaced with RX_ macros), and there have been various other changes to the structure which were not captured in the docs.

This PR includes two commits. The first modifies t/porting/podcheck.t to support validating that a verbatim block can be found in the file it was copied from. This can be enabled by including the text "copied from: FILENAME" or "source file: FILENAME" on the first line of the verbatim text where the FILENAME actually exists on disk. This text can be commented however you like, or uncommented, whatever works for you, but must be on one line. If this special annotation is found then the podcheck logic will convert the verbatim block into a pattern (whitespace insensitve) and check to see if the named file contains the pattern. If it does not then it will throw an error. Thus we should notice if the docs and source get out of sync with each other. In this mode the normal verbatim text line length checks are disabled, as we want to be able to take the original source, copy it and then indent it into the pod file.

The second commit makes some minor changes to the structure in regexp.h, and copies the result into perlreapi.pod, following the convention established above. It also includes additional documentation on a few of the columns that were missing previously, and I also fixed some of the docs that were out of date, and added some that are new as of 5.38. For instance the old "precomp" value is now actually the pv value of the regexp, so the documentation for "precomp" is not documented as the macro RX_PRECOMP.

Thanks to @tonycoz for noticing this issue and calling my attention to it.

demerphq added 2 commits July 17, 2023 17:31
So we should check if it is still in sync with the source, and ignore
any line length issues as the source needs to be changed, not the copy.

To enable this simply put "file source: FILENAME" or
"copied from: FILENAME" in the first line of the verbatim text.
… source

and update the individual struct members documentation accordingly,
some time ago this structure was synchonize with the SV structure,
so some members that used to be documented are now actually macros.

This also includes a couple of field reordering to make the struct
easier to understand and also to cluster the 32 bit fields together
so that the structure is a minimal size.

Thanks to Tony C for noticing this and calling it to my attention.
@demerphq demerphq force-pushed the yves/fixup_perlreapi_pod branch from c129863 to cf5c279 Compare July 17, 2023 15:32
@demerphq demerphq merged commit a6d1013 into blead Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants