Path to this page:
Subject: CVS commit: pkgsrc/devel/ruby-regexp_parser
From: Takahiro Kambe
Date: 2023-04-27 16:13:07
Message id: 20230427141307.8A590FA87@cvs.NetBSD.org
Log Message:
devel/ruby-regexp_parser: update to 2.8.0
2.8.0 (2023-04-17)
Added
o Regexp::Expression::Shared#ends_at
* e.g. parse(/a +/x)[0].ends_at # => 3
* e.g. parse(/a +/x)[0].ends_at(include_quantifier = false) # => 1
o Regexp::Expression::Shared#{capturing?,comment?}
* previously only available on capturing and comment groups
o Regexp::Expression::Shared#{decorative?}
* true for decorations: comment groups as well as comments and whitespace
in x-mode
o Regexp::Expression::Shared#parent
o new format argument :original for Regexp::Expression::Base#to_s
* includes decorative elements between node and its quantifier
* e.g. parse(/a (?#comment) +/x)[0].to_s(:original) # => "a \
(?#comment) +"
* using it is not needed when calling Root#to_s as Root can't be
quantified
o support calling Subexpression#{each_expression,flat_map} with a
one-argument block
* in this case, only the expressions are passed to the block, no indices
o support calling test methods at Expression class level
* capturing?, comment?, decorative?, referential?, terminal?
* e.g. Regexp::Expression::CharacterSet.terminal? # => false
Fixed
o Regexp::Expression::Shared#full_length with whitespace before quantifier
* e.g. parse(/a +/x)[0].full_length used to yield 2, now it yields 3
o Subexpression#to_s output with children with whitespace before their
quantifier
* e.g. parse(/a + /x).to_s used to yield "a+ ", now it yields \
"a + "
* calling #to_s on sub-nodes still omits such decorative interludes by
default
- use new #to_s format :original to include it
- e.g. parse(/a + /x)[0].to_s(:original) # => "a +"
o fixed Subexpression#te behaving differently from other expressions
* only Subexpression#te used to include the quantifier
* now #te is the end index without quantifier, as for other expressions
o fixed NoMethodError when calling #starts_at or #ts on empty sequences
* e.g. Regexp::Parser.parse(/|/)[0].starts_at
* e.g. Regexp::Parser.parse(/[&&]/)[0][0].starts_at
o fixed nested comment groups breaking local x-options
* e.g. in /(?x:(?#hello)) /, the x-option wrongly applied to the
whitespace
o fixed nested comment groups breaking conditionals
* e.g. in /(a)(?(1)b|c(?#hello)d)e/, the 2nd conditional branch included
"e"
o fixed quantifiers after comment groups being mis-assigned to that group
* e.g. in /a(?#foo){3}/ (matches 'aaa')
o fixed Scanner accepting two cases of invalid Regexp syntax
* unmatched closing parentheses ()) and k-backrefs with number 0 (\k<0>)
* these are a SyntaxError in Ruby, so could only be passed as a String
* they now raise a Regexp::Scanner::ScannerError
o fixed some scanner errors not inheriting from
Regexp::Scanner::ScannerError
o reduced verbosity of inspect / pretty print output
Files: