Thus, it should probably not be construed as IDENTIFIER token.
Therefore, pm_byte_table has been adapted to accept those invalid regexp option values. Whether it is a valid regexp option or not is checked by pm_regular_expression_flags_create. For invalid regexp options, PM_ERR_REGEXP_UNKNOWN_OPTIONS is added to diagnostics.
[ruby/prism] Fix incorrect paring when using invalid regexp options
Fixes https://github.com/ruby/prism/pull/2617.
There was an issue with the lexer as follows.
The following are valid regexp options:
The following are invalid regexp options. Unnecessary the
IDENTIFIERtoken is appearing:As a behavior of Ruby, when given
AtoZandatoz, they act as invalid regexp options. e.g.,Thus, it should probably not be construed as
IDENTIFIERtoken.Therefore,
pm_byte_tablehas been adapted to accept those invalid regexp option values.Whether it is a valid regexp option or not is checked by
pm_regular_expression_flags_create.For invalid regexp options,
PM_ERR_REGEXP_UNKNOWN_OPTIONSis added to diagnostics.https://github.com/ruby/prism/commit/d2a6096fcf