scan_num: Reformat/fix comments#24247
Conversation
| (\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) |
There was a problem hiding this comment.
These are multiple sentences, so consistently terminate with . and capitalize first letter:
| (\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.) |
There was a problem hiding this comment.
I took your suggestions, but am resisting adding a dot after the character class because it might be confused as a metacharacter
There was a problem hiding this comment.
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
There was a problem hiding this comment.
I did some more rearranging
a4442b9 to
8c3c42b
Compare
| 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] |
There was a problem hiding this comment.
@khwilliamson could you respond to @mauke and then give us an update on the status of this ticket? Thanks.
There was a problem hiding this comment.
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.
8c3c42b to
4cf4234
Compare
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.