flex
flex copied to clipboard
Documentation bugs about character class details
Responding to a question on stackoverflow (https://stackoverflow.com/questions/66548254/rule-patterns-used-by-flexers), I believe that the questioner identified two long-standing errors in the flex documentation.
-
flex/flex.lexi line 927
[[:alpha:][0-9]]
This should read
[[:alpha:]0-9]
. As written, it has a completely different meaning. -
flex/flex.lexi line 846:
Note that inside of a character class, all regular expression operators lose their special meaning except escape (@samp{}) and the character class operators, @samp{-}, @samp{]]}, and, at the beginning of the class, @samp{^}.
The exception should be a single
]
, not two of them. Also, it should be noted that-
and]
are not considered special if they immediately follow the[
or[^
which start the class, and that-
is not considered special if it immediately precedes the]
which closes the character class.