Skip to content

scan_num: Reformat/fix comments#24247

Merged
khwilliamson merged 1 commit intoPerl:bleadfrom
khwilliamson:scan_num_comments
Mar 31, 2026
Merged

scan_num: Reformat/fix comments#24247
khwilliamson merged 1 commit intoPerl:bleadfrom
khwilliamson:scan_num_comments

Conversation

@khwilliamson
Copy link
Copy Markdown
Contributor

These comments that gave complicated regex patterns that show the syntax of the various types of numerical constants recognized by this function had some oversights in them, and were hard to read.

  • This set of changes does not require a perldelta entry.

Comment thread toke.c Outdated
Comment on lines +12703 to +12705
(\x below stands for a hexademical character [0-9A-Fa-f]
underscores may separate any two digits. Multiple sequential underscores
are tolerated, but warned about)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are multiple sentences, so consistently terminate with . and capitalize first letter:

Suggested change
(\x below stands for a hexademical character [0-9A-Fa-f]
underscores may separate any two digits. Multiple sequential underscores
are tolerated, but warned about)
(\x below stands for a hexademical character [0-9A-Fa-f].
Underscores may separate any two digits. Multiple sequential underscores
are tolerated, but warned about.)

Copy link
Copy Markdown
Contributor Author

@khwilliamson khwilliamson Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took your suggestions, but am resisting adding a dot after the character class because it might be confused as a metacharacter

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like it. You have (within the same pair of parentheses) a significant newline (terminates the sentence after [0-9A-Fa-f]) and a newline that readers should ignore because a sentence spans two lines ("underscores ... are tolerated"). I think that's more confusing than a dot after [...].

I see two workarounds. You could reorder the sentences:

  (Underscores may separate any two digits.  Multiple sequential underscores
   are tolerated, but warned about.  \x below stands for a hexadecimal
   character [0-9A-Fa-f])

Or you could format it as a bullet list without any dots:

  - \x below stands for a hexadecimal character [0-9A-Fa-f])
  - underscores may separate any two digits
  - multiple sequential underscores are tolerated, but warned about

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did some more rearranging

Comment thread toke.c Outdated
Comment thread toke.c Outdated
0o?[0-7](_?[0-7])* octal integers
0x[0-9A-Fa-f](_?[0-9A-Fa-f])* hexadecimal integers
0x[0-9A-Fa-f](_?[0-9A-Fa-f])*(?:\.\d*)?p[+-]?[0-9]+ hexadecimal floats
(\x below stands for a hexademical character [0-9A-Fa-f]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/hexademical/hexadecimal/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@khwilliamson could you respond to @mauke and then give us an update on the status of this ticket? Thanks.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo was fixed in last push

These comments that gave complicated regex patterns that show the syntax
of the various types of numerical constants recognized by this function
had some oversights in them, and were hard to read.
@khwilliamson khwilliamson merged commit a7fdbfe into Perl:blead Mar 31, 2026
33 checks passed
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