ruby/strscan

Anchor behavior change breaks RDoc

kou opened this issue · 5 comments

kou commented

#6 breaks RDoc. It uses \A. So we should keep the previous behavior by default.

kou commented

1.0.1 with #6 is yanked for now.

jneen commented

Hi @kou! Could you provide a link to the parser that this breaks? Perhaps an option like relative_anchors: true to the constructor (or a method like use_relative_anchors!) could resolve the issue?

kou commented

I misunderstood.
It's not general Racc breakage. It just breaks RDoc.
https://github.com/ruby/rdoc/blob/master/lib/rdoc/rd/inline_parser.ry#L362

I'll add fixed_anchor option to the constructor.

jneen commented

Okay! With that change, it would also be nice to add some way to feature-detect this, maybe by adding a #fixed_anchor? message to the scanner object, such that we could test #respond_to??

kou commented

You can use StringScanner.method_defined?(:fixed_anchor?).