regexp_parser 2.6.0 → 2.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +5 -5
  3. data/LICENSE +1 -1
  4. data/lib/regexp_parser/expression/base.rb +0 -7
  5. data/lib/regexp_parser/expression/classes/alternation.rb +1 -1
  6. data/lib/regexp_parser/expression/classes/backreference.rb +5 -10
  7. data/lib/regexp_parser/expression/classes/character_set/range.rb +2 -7
  8. data/lib/regexp_parser/expression/classes/character_set.rb +4 -8
  9. data/lib/regexp_parser/expression/classes/conditional.rb +2 -20
  10. data/lib/regexp_parser/expression/classes/escape_sequence.rb +21 -91
  11. data/lib/regexp_parser/expression/classes/free_space.rb +3 -1
  12. data/lib/regexp_parser/expression/classes/group.rb +0 -22
  13. data/lib/regexp_parser/expression/classes/keep.rb +1 -1
  14. data/lib/regexp_parser/expression/classes/posix_class.rb +5 -5
  15. data/lib/regexp_parser/expression/classes/unicode_property.rb +11 -11
  16. data/lib/regexp_parser/expression/methods/construct.rb +2 -4
  17. data/lib/regexp_parser/expression/methods/escape_sequence_char.rb +5 -0
  18. data/lib/regexp_parser/expression/methods/escape_sequence_codepoint.rb +68 -0
  19. data/lib/regexp_parser/expression/methods/match_length.rb +8 -4
  20. data/lib/regexp_parser/expression/methods/negative.rb +20 -0
  21. data/lib/regexp_parser/expression/methods/parts.rb +23 -0
  22. data/lib/regexp_parser/expression/methods/printing.rb +26 -0
  23. data/lib/regexp_parser/expression/methods/referenced_expressions.rb +28 -0
  24. data/lib/regexp_parser/expression/methods/tests.rb +40 -3
  25. data/lib/regexp_parser/expression/methods/traverse.rb +35 -19
  26. data/lib/regexp_parser/expression/quantifier.rb +30 -17
  27. data/lib/regexp_parser/expression/sequence.rb +5 -10
  28. data/lib/regexp_parser/expression/sequence_operation.rb +4 -9
  29. data/lib/regexp_parser/expression/shared.rb +37 -20
  30. data/lib/regexp_parser/expression/subexpression.rb +20 -15
  31. data/lib/regexp_parser/expression.rb +37 -31
  32. data/lib/regexp_parser/lexer.rb +76 -36
  33. data/lib/regexp_parser/parser.rb +107 -103
  34. data/lib/regexp_parser/scanner/errors/premature_end_error.rb +8 -0
  35. data/lib/regexp_parser/scanner/errors/scanner_error.rb +6 -0
  36. data/lib/regexp_parser/scanner/errors/validation_error.rb +63 -0
  37. data/lib/regexp_parser/scanner/properties/long.csv +29 -0
  38. data/lib/regexp_parser/scanner/properties/short.csv +3 -0
  39. data/lib/regexp_parser/scanner/property.rl +2 -2
  40. data/lib/regexp_parser/scanner/scanner.rl +101 -172
  41. data/lib/regexp_parser/scanner.rb +1171 -1365
  42. data/lib/regexp_parser/syntax/token/backreference.rb +3 -0
  43. data/lib/regexp_parser/syntax/token/character_set.rb +3 -0
  44. data/lib/regexp_parser/syntax/token/escape.rb +3 -1
  45. data/lib/regexp_parser/syntax/token/meta.rb +9 -2
  46. data/lib/regexp_parser/syntax/token/unicode_property.rb +35 -1
  47. data/lib/regexp_parser/syntax/token/virtual.rb +11 -0
  48. data/lib/regexp_parser/syntax/token.rb +13 -13
  49. data/lib/regexp_parser/syntax/version_lookup.rb +0 -8
  50. data/lib/regexp_parser/syntax/versions.rb +3 -1
  51. data/lib/regexp_parser/syntax.rb +1 -1
  52. data/lib/regexp_parser/version.rb +1 -1
  53. data/lib/regexp_parser.rb +6 -6
  54. data/regexp_parser.gemspec +5 -5
  55. metadata +17 -8
  56. data/CHANGELOG.md +0 -601
  57. data/README.md +0 -503
data/CHANGELOG.md DELETED
@@ -1,601 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
-
8
- ## [Unreleased]
9
-
10
- ## [2.6.0] - 2022-09-26 - [Janosch Müller](mailto:janosch84@gmail.com)
11
-
12
- ### Fixed
13
-
14
- - fixed `#referenced_expression` for `\g<0>` (was `nil`, is now the `Root` exp)
15
- - fixed `#reference`, `#referenced_expression` for recursion level backrefs
16
- * e.g. `(a)(b)\k<-1+1>`
17
- * `#referenced_expression` was `nil`, now it is the correct `Group` exp
18
- - detect and raise for two more syntax errors when parsing String input
19
- * quantification of option switches (e.g. `(?i)+`)
20
- * invalid references (e.g. `/\k<1>/`)
21
- * these are a `SyntaxError` in Ruby, so could only be passed as a String
22
-
23
- ### Added
24
-
25
- - `Regexp::Expression::Base#human_name`
26
- * returns a nice, human-readable description of the expression
27
- - `Regexp::Expression::Base#optional?`
28
- * returns `true` if the expression is quantified accordingly (e.g. with `*`, `{,n}`)
29
- - added a deprecation warning when calling `#to_re` on set members
30
-
31
- ## [2.5.0] - 2022-05-27 - [Janosch Müller](mailto:janosch84@gmail.com)
32
-
33
- ### Added
34
-
35
- - `Regexp::Expression::Base.construct` and `.token_class` methods
36
- * see the [wiki](https://github.com/ammar/regexp_parser/wiki) for details
37
-
38
- ## [2.4.0] - 2022-05-09 - [Janosch Müller](mailto:janosch84@gmail.com)
39
-
40
- ### Fixed
41
-
42
- - fixed interpretation of `+` and `?` after interval quantifiers (`{n,n}`)
43
- * they used to be treated as reluctant or possessive mode indicators
44
- * however, Ruby does not support these modes for interval quantifiers
45
- * they are now treated as chained quantifiers instead, as Ruby does it
46
- * c.f. [#3](https://github.com/ammar/regexp_parser/issues/3)
47
- - fixed `Expression::Base#nesting_level` for some tree rewrite cases
48
- * e.g. the alternatives in `/a|[b]/` had an inconsistent nesting_level
49
- - fixed `Scanner` accepting invalid posix classes, e.g. `[[:foo:]]`
50
- * they raise a `SyntaxError` when used in a Regexp, so could only be passed as String
51
- * they now raise a `Regexp::Scanner::ValidationError` in the `Scanner`
52
-
53
- ### Added
54
-
55
- - added `Expression::Base#==` for (deep) comparison of expressions
56
- - added `Expression::Base#parts`
57
- * returns the text elements and subexpressions of an expression
58
- * e.g. `parse(/(a)/)[0].parts # => ["(", #<Literal @text="a"...>, ")"]`
59
- - added `Expression::Base#te` (a.k.a. token end index)
60
- * `Expression::Subexpression` always had `#te`, only terminal nodes lacked it so far
61
- - made some `Expression::Base` methods available on `Quantifier` instances, too
62
- * `#type`, `#type?`, `#is?`, `#one_of?`, `#options`, `#terminal?`
63
- * `#base_length`, `#full_length`, `#starts_at`, `#te`, `#ts`, `#offset`
64
- * `#conditional_level`, `#level`, `#nesting_level` , `#set_level`
65
- * this allows a more unified handling with `Expression::Base` instances
66
- - allowed `Quantifier#initialize` to take a token and options Hash like other nodes
67
- - added a deprecation warning for initializing Quantifiers with 4+ arguments:
68
-
69
- Calling `Expression::Base#quantify` or `Quantifier.new` with 4+ arguments
70
- is deprecated.
71
-
72
- It will no longer be supported in regexp_parser v3.0.0.
73
-
74
- Please pass a Regexp::Token instead, e.g. replace `token, text, min, max, mode`
75
- with `::Regexp::Token.new(:quantifier, token, text)`. min, max, and mode
76
- will be derived automatically.
77
-
78
- Or do `exp.quantifier = Quantifier.construct(token: token, text: str)`.
79
-
80
- This is consistent with how Expression::Base instances are created.
81
-
82
-
83
- ## [2.3.1] - 2022-04-24 - [Janosch Müller](mailto:janosch84@gmail.com)
84
-
85
- ### Fixed
86
-
87
- - removed five inexistent unicode properties from `Syntax#features`
88
- * these were never supported by Ruby or the `Regexp::Scanner`
89
- * thanks to [Markus Schirp](https://github.com/mbj) for the report
90
-
91
- ## [2.3.0] - 2022-04-08 - [Janosch Müller](mailto:janosch84@gmail.com)
92
-
93
- ### Added
94
-
95
- - improved parsing performance through `Syntax` refactoring
96
- * instead of fresh `Syntax` instances, pre-loaded constants are now re-used
97
- * this approximately doubles the parsing speed for simple regexps
98
- - added methods to `Syntax` classes to show relative feature sets
99
- * e.g. `Regexp::Syntax::V3_2_0.added_features`
100
- - support for new unicode properties of Ruby 3.2 / Unicode 14.0
101
-
102
- ## [2.2.1] - 2022-02-11 - [Janosch Müller](mailto:janosch84@gmail.com)
103
-
104
- ### Fixed
105
-
106
- - fixed Syntax version of absence groups (`(?~...)`)
107
- * the lexer accepted them for any Ruby version
108
- * now they are only recognized for Ruby >= 2.4.1 in which they were introduced
109
- - reduced gem size by excluding specs from package
110
- - removed deprecated `test_files` gemspec setting
111
- - no longer depend on `yaml`/`psych` (except for Ruby <= 2.4)
112
- - no longer depend on `set`
113
- * `set` was removed from the stdlib and made a standalone gem as of Ruby 3
114
- * this made it a hidden/undeclared dependency of `regexp_parser`
115
-
116
- ## [2.2.0] - 2021-12-04 - [Janosch Müller](mailto:janosch84@gmail.com)
117
-
118
- ### Added
119
-
120
- - added support for 13 new unicode properties introduced in Ruby 3.1.0
121
-
122
- ## [2.1.1] - 2021-02-23 - [Janosch Müller](mailto:janosch84@gmail.com)
123
-
124
- ### Fixed
125
-
126
- - fixed `NameError` when requiring only `'regexp_parser/scanner'` in v2.1.0
127
- * thanks to [Jared White and Sam Ruby](https://github.com/ruby2js/ruby2js) for the report
128
-
129
- ## [2.1.0] - 2021-02-22 - [Janosch Müller](mailto:janosch84@gmail.com)
130
-
131
- ### Added
132
-
133
- - common ancestor for all scanning/parsing/lexing errors
134
- * `Regexp::Parser::Error` can now be rescued as a catch-all
135
- * the following errors (and their many descendants) now inherit from it:
136
- - `Regexp::Expression::Conditional::TooManyBranches`
137
- - `Regexp::Parser::ParserError`
138
- - `Regexp::Scanner::ScannerError`
139
- - `Regexp::Scanner::ValidationError`
140
- - `Regexp::Syntax::SyntaxError`
141
- * it replaces `ArgumentError` in some rare cases (`Regexp::Parser.parse('?')`)
142
- * thanks to [sandstrom](https://github.com/sandstrom) for the cue
143
-
144
- ### Fixed
145
-
146
- - fixed scanning of whole-pattern recursion calls `\g<0>` and `\g'0'`
147
- * a regression in v2.0.1 had caused them to be scanned as literals
148
- - fixed scanning of some backreference and subexpression call edge cases
149
- * e.g. `\k<+1>`, `\g<x-1>`
150
- - fixed tokenization of some escapes in character sets
151
- * `.`, `|`, `{`, `}`, `(`, `)`, `^`, `$`, `?`, `+`, `*`
152
- * all of these correctly emitted `#type` `:literal` and `#token` `:literal` if *not* escaped
153
- * if escaped, they emitted e.g. `#type` `:escape` and `#token` `:group_open` for `[\(]`
154
- * the escaped versions now correctly emit `#type` `:escape` and `#token` `:literal`
155
- - fixed handling of control/metacontrol escapes in character sets
156
- * e.g. `[\cX]`, `[\M-\C-X]`
157
- * they were misread as bunch of individual literals, escapes, and ranges
158
- - fixed some cases where calling `#dup`/`#clone` on expressions led to shared state
159
-
160
- ## [2.0.3] - 2020-12-28 - [Janosch Müller](mailto:janosch84@gmail.com)
161
-
162
- ### Fixed
163
-
164
- - fixed error when scanning some unlikely and redundant but valid charset patterns
165
- * e.g. `/[[.a-b.]]/`, `/[[=e=]]/`,
166
- - fixed ancestry of some error classes related to syntax version lookup
167
- * `NotImplementedError`, `InvalidVersionNameError`, `UnknownSyntaxNameError`
168
- * they now correctly inherit from `Regexp::Syntax::SyntaxError` instead of Rubys `::SyntaxError`
169
-
170
- ## [2.0.2] - 2020-12-25 - [Janosch Müller](mailto:janosch84@gmail.com)
171
-
172
- ### Fixed
173
-
174
- - fixed `FrozenError` when calling `#to_s` on a frozen `Group::Passive`
175
- * thanks to [Daniel Gollahon](https://github.com/dgollahon)
176
-
177
- ## [2.0.1] - 2020-12-20 - [Janosch Müller](mailto:janosch84@gmail.com)
178
-
179
- ### Fixed
180
-
181
- - fixed error when scanning some group names
182
- * this affected names containing hyphens, digits or multibyte chars, e.g. `/(?<a1>a)/`
183
- * thanks to [Daniel Gollahon](https://github.com/dgollahon) for the report
184
- - fixed error when scanning hex escapes with just one hex digit
185
- * e.g. `/\x0A/` was scanned correctly, but the equivalent `/\xA/` was not
186
- * thanks to [Daniel Gollahon](https://github.com/dgollahon) for the report
187
-
188
- ## [2.0.0] - 2020-11-25 - [Janosch Müller](mailto:janosch84@gmail.com)
189
-
190
- ### Changed
191
-
192
- - some methods that used to return byte-based indices now return char-based indices
193
- * the returned values have only changed for Regexps that contain multibyte chars
194
- * this is only a breaking change if you used such methods directly AND relied on them pointing to bytes
195
- * affected methods:
196
- * `Regexp::Token` `#length`, `#offset`, `#te`, `#ts`
197
- * `Regexp::Expression::Base` `#full_length`, `#offset`, `#starts_at`, `#te`, `#ts`
198
- * thanks to [Akinori MUSHA](https://github.com/knu) for the report
199
- - removed some deprecated methods/signatures
200
- * these are rarely used and have been showing deprecation warnings for a long time
201
- * `Regexp::Expression::Subexpression.new` with 3 arguments
202
- * `Regexp::Expression::Root.new` without a token argument
203
- * `Regexp::Expression.parsed`
204
-
205
- ### Added
206
-
207
- - `Regexp::Expression::Base#base_length`
208
- * returns the character count of an expression body, ignoring any quantifier
209
- - pragmatic, experimental support for chained quantifiers
210
- * e.g.: `/^a{10}{4,6}$/` matches exactly 40, 50 or 60 `a`s
211
- * successive quantifiers used to be silently dropped by the parser
212
- * they are now wrapped with passive groups as if they were written `(?:a{10}){4,6}`
213
- * thanks to [calfeld](https://github.com/calfeld) for reporting this a while back
214
-
215
- ### Fixed
216
-
217
- - incorrect encoding output for non-ascii comments
218
- * this led to a crash when calling `#to_s` on parse results containing such comments
219
- * thanks to [Michael Glass](https://github.com/michaelglass) for the report
220
- - some crashes when scanning contrived patterns such as `'\😋'`
221
-
222
- ### [1.8.2] - 2020-10-11 - [Janosch Müller](mailto:janosch84@gmail.com)
223
-
224
- ### Fixed
225
-
226
- - fix `FrozenError` in `Expression::Base#repetitions` on Ruby 3.0
227
- * thanks to [Thomas Walpole](https://github.com/twalpole)
228
- - removed "unknown future version" warning on Ruby 3.0
229
-
230
- ### [1.8.1] - 2020-09-28 - [Janosch Müller](mailto:janosch84@gmail.com)
231
-
232
- ### Fixed
233
-
234
- - fixed scanning of comment-like text in normal mode
235
- * this was an old bug, but had become more prevalent in v1.8.0
236
- * thanks to [Tietew](https://github.com/Tietew) for the report
237
- - specified correct minimum Ruby version in gemspec
238
- * it said 1.9 but really required 2.0 as of v1.8.0
239
-
240
- ### [1.8.0] - 2020-09-20 - [Janosch Müller](mailto:janosch84@gmail.com)
241
-
242
- ### Changed
243
-
244
- - dropped support for running on Ruby 1.9.x
245
-
246
- ### Added
247
-
248
- - regexp flags can now be passed when parsing a `String` as regexp body
249
- * see the [README](/README.md#usage) for details
250
- * thanks to [Owen Stephens](https://github.com/owst)
251
- - bare occurrences of `\g` and `\k` are now allowed and scanned as literal escapes
252
- * matches Onigmo behavior
253
- * thanks for the report to [Marc-André Lafortune](https://github.com/marcandre)
254
-
255
- ### Fixed
256
-
257
- - fixed parsing comments without preceding space or trailing newline in x-mode
258
- * thanks to [Owen Stephens](https://github.com/owst)
259
-
260
- ### [1.7.1] - 2020-06-07 - [Ammar Ali](mailto:ammarabuali@gmail.com)
261
-
262
- ### Fixed
263
-
264
- - Support for literals that include the unescaped delimiters `{`, `}`, and `]`. These
265
- delimiters are informally supported by various regexp engines.
266
-
267
- ### [1.7.0] - 2020-02-23 - [Janosch Müller](mailto:janosch84@gmail.com)
268
-
269
- ### Added
270
-
271
- - `Expression::Base#each_expression` and `#traverse` can now be called without a block
272
- * this returns an `Enumerator` and allows chaining, e.g. `each_expression.select`
273
- * thanks to [Masataka Kuwabara](https://github.com/pocke)
274
-
275
- ### Fixed
276
-
277
- - `MatchLength#each` no longer ignores the given `limit:` when called without a block
278
-
279
- ### [1.6.0] - 2019-06-16 - [Janosch Müller](mailto:janosch84@gmail.com)
280
-
281
- ### Added
282
-
283
- - Added support for 16 new unicode properties introduced in Ruby 2.6.2 and 2.6.3
284
-
285
- ### [1.5.1] - 2019-05-23 - [Janosch Müller](mailto:janosch84@gmail.com)
286
-
287
- ### Fixed
288
-
289
- - Fixed `#options` (and thus `#i?`, `#u?` etc.) not being set for some expressions:
290
- * this affected posix classes as well as alternation, conditional, and intersection branches
291
- * `#options` was already correct for all child expressions of such branches
292
- * this only made an operational difference for posix classes as they respect encoding flags
293
- - Fixed `#options` not respecting all negative options in weird cases like '(?u-m-x)'
294
- - Fixed `Group#option_changes` not accounting for indirectly disabled (overridden) encoding flags
295
- - Fixed `Scanner` allowing negative encoding options if there were no positive options, e.g. '(?-u)'
296
- - Fixed `ScannerError` for some valid meta/control sequences such as '\\C-\\\\'
297
- - Fixed `Expression::Base#match` and `#=~` not working with a single argument
298
-
299
- ### [1.5.0] - 2019-05-14 - [Janosch Müller](mailto:janosch84@gmail.com)
300
-
301
- ### Added
302
-
303
- - Added `#referenced_expression` for backrefs, subexp calls and conditionals
304
- * returns the `Group` expression that is being referenced via name or number
305
- - Added `Expression::Base#repetitions`
306
- * returns a `Range` of allowed repetitions (`1..1` if there is no quantifier)
307
- * like `#quantity` but with a more uniform interface
308
- - Added `Expression::Base#match_length`
309
- * allows to inspect and iterate over String lengths matched by the Expression
310
-
311
- ### Fixed
312
-
313
- - Fixed `Expression::Base#clone` "direction"
314
- * it used to dup ivars onto the callee, leaving only the clone referencing the original objects
315
- * this will affect you if you call `#eql?`/`#equal?` on expressions or use them as Hash keys
316
- - Fixed `#clone` results for `Sequences`, e.g. alternations and conditionals
317
- * the inner `#text` was cloned onto the `Sequence` and thus duplicated
318
- * e.g. `Regexp::Parser.parse(/(a|bc)/).clone.to_s # => (aa|bcbc)`
319
- - Fixed inconsistent `#to_s` output for `Sequences`
320
- * it used to return only the "specific" text, e.g. "|" for an alternation
321
- * now it includes nested expressions as it does for all other `Subexpressions`
322
- - Fixed quantification of codepoint lists with more than one entry (`\u{62 63 64}+`)
323
- * quantifiers apply only to the last entry, so this token is now split up if quantified
324
-
325
- ### [1.4.0] - 2019-04-02 - [Janosch Müller](mailto:janosch84@gmail.com)
326
-
327
- ### Added
328
-
329
- - Added support for 19 new unicode properties introduced in Ruby 2.6.0
330
-
331
- ### [1.3.0] - 2018-11-14 - [Janosch Müller](mailto:janosch84@gmail.com)
332
-
333
- ### Added
334
-
335
- - `Syntax#features` returns a `Hash` of all types and tokens supported by a given `Syntax`
336
-
337
- ### Fixed
338
-
339
- - Thanks to [Akira Matsuda](https://github.com/amatsuda)
340
- * eliminated warning "assigned but unused variable - testEof"
341
-
342
- ## [1.2.0] - 2018-09-28 - [Janosch Müller](mailto:janosch84@gmail.com)
343
-
344
- ### Added
345
-
346
- - `Subexpression` (branch node) includes `Enumerable`, allowing to `#select` children etc.
347
-
348
- ### Fixed
349
-
350
- - Fixed missing quantifier in `Conditional::Expression` methods `#to_s`, `#to_re`
351
- - `Conditional::Condition` no longer lives outside the recursive `#expressions` tree
352
- * it used to be the only expression stored in a custom ivar, complicating traversal
353
- * its setter and getter (`#condition=`, `#condition`) still work as before
354
-
355
- ## [1.1.0] - 2018-09-17 - [Janosch Müller](mailto:janosch84@gmail.com)
356
-
357
- ### Added
358
-
359
- - Added `Quantifier` methods `#greedy?`, `#possessive?`, `#reluctant?`/`#lazy?`
360
- - Added `Group::Options#option_changes`
361
- * shows the options enabled or disabled by the given options group
362
- * as with all other expressions, `#options` shows the overall active options
363
- - Added `Conditional#reference` and `Condition#reference`, indicating the determinative group
364
- - Added `Subexpression#dig`, acts like [`Array#dig`](http://ruby-doc.org/core-2.5.0/Array.html#method-i-dig)
365
-
366
- ### Fixed
367
-
368
- - Fixed parsing of quantified conditional expressions (quantifiers were assigned to the wrong expression)
369
- - Fixed scanning and parsing of forward-referring subexpression calls (e.g. `\g<+1>`)
370
- - `Root` and `Sequence` expressions now support the same constructor signature as all other expressions
371
-
372
- ## [1.0.0] - 2018-09-01 - [Janosch Müller](mailto:janosch84@gmail.com)
373
-
374
- This release includes several breaking changes, mostly to character sets, #map and properties.
375
-
376
- ### Changed
377
-
378
- - Changed handling of sets (a.k.a. character classes or "bracket expressions")
379
- * see PR [#55](https://github.com/ammar/regexp_parser/pull/55) / issue [#47](https://github.com/ammar/regexp_parser/issues/47) for details
380
- * sets are now parsed to expression trees like other nestable expressions
381
- * `#scan` now emits the same tokens as outside sets (no longer `:set, :member`)
382
- * `CharacterSet#members` has been removed
383
- * new `Range` and `Intersection` classes represent corresponding syntax features
384
- * a new `PosixClass` expression class represents e.g. `[[:ascii:]]`
385
- * `PosixClass` instances behave like `Property` ones, e.g. support `#negative?`
386
- * `#scan` emits `:(non)posixclass, :<type>` instead of `:set, :char_(non)<type>`
387
- - Changed `Subexpression#map` to act like regular `Enumerable#map`
388
- * the old behavior is available as `Subexpression#flat_map`
389
- * e.g. `parse(/[a]/).map(&:to_s) == ["[a]"]`; used to be `["[a]", "a"]`
390
- - Changed expression emissions for some escape sequences
391
- * `EscapeSequence::Codepoint`, `CodepointList`, `Hex` and `Octal` are now all used
392
- * they already existed, but were all parsed as `EscapeSequence::Literal`
393
- * e.g. `\x97` is now `EscapeSequence::Hex` instead of `EscapeSequence::Literal`
394
- - Changed naming of many property tokens (emitted for `\p{...}`)
395
- * if you work with these tokens, see PR [#56](https://github.com/ammar/regexp_parser/pull/56) for details
396
- * e.g. `:punct_dash` is now `:dash_punctuation`
397
- - Changed `(?m)` and the likes to emit as `:options_switch` token (@4ade4d1)
398
- * allows differentiating from group-local `:options`, e.g. `(?m:.)`
399
- - Changed name of `Backreference::..NestLevel` to `..RecursionLevel` (@4184339)
400
- - Changed `Backreference::Number#number` from `String` to `Integer` (@40a2231)
401
-
402
- ### Added
403
-
404
- - Added support for all previously missing properties (about 250)
405
- - Added `Expression::UnicodeProperty#shortcut` (e.g. returns "m" for `\p{mark}`)
406
- - Added `#char(s)` and `#codepoint(s)` methods to all `EscapeSequence` expressions
407
- - Added `#number`/`#name`/`#recursion_level` to all backref/call expressions (@174bf21)
408
- - Added `#number` and `#number_at_level` to capturing group expressions (@40a2231)
409
-
410
- ### Fixed
411
-
412
- - Fixed Ruby version mapping of some properties
413
- - Fixed scanning of some property spellings, e.g. with dashes
414
- - Fixed some incorrect property alias normalizations
415
- - Fixed scanning of codepoint escapes with 6 digits (e.g. `\u{10FFFF}`)
416
- - Fixed scanning of `\R` and `\X` within sets; they act as literals there
417
-
418
- ## [0.5.0] - 2018-04-29 - [Janosch Müller](mailto:janosch84@gmail.com)
419
-
420
- ### Changed
421
-
422
- - Changed handling of Ruby versions (PR [#53](https://github.com/ammar/regexp_parser/pull/53))
423
- * New Ruby versions are now supported by default
424
- * Some deep-lying APIs have changed, which should not affect most users:
425
- * `Regexp::Syntax::VERSIONS` is gone
426
- * Syntax version names have changed from `Regexp::Syntax::Ruby::Vnnn`
427
- to `Regexp::Syntax::Vn_n_n`
428
- * Syntax version classes for Ruby versions without regex feature changes
429
- are no longer predefined and are now only created on demand / lazily
430
- * `Regexp::Syntax::supported?` returns true for any argument >= 1.8.6
431
-
432
- ### Fixed
433
-
434
- - Fixed some use cases of Expression methods #strfregexp and #to_h (@e738107)
435
-
436
- ### Added
437
-
438
- - Added full signature support to collection methods of Expressions (@aa7c55a)
439
-
440
- ## [0.4.13] - 2018-04-04 - [Ammar Ali](mailto:ammarabuali@gmail.com)
441
-
442
- - Added ruby version files for 2.2.10 and 2.3.7
443
-
444
- ## [0.4.12] - 2018-03-30 - [Janosch Müller](mailto:janosch84@gmail.com)
445
-
446
- - Added ruby version files for 2.4.4 and 2.5.1
447
-
448
- ## [0.4.11] - 2018-03-04 - [Janosch Müller](mailto:janosch84@gmail.com)
449
-
450
- - Fixed UnknownSyntaxNameError introduced in v0.4.10 if
451
- the gems parent dir tree included a 'ruby' dir
452
-
453
- ## [0.4.10] - 2018-03-04 - [Janosch Müller](mailto:janosch84@gmail.com)
454
-
455
- - Added ruby version file for 2.6.0
456
- - Added support for Emoji properties (available in Ruby since 2.5.0)
457
- - Added support for XPosixPunct and Regional_Indicator properties
458
- - Fixed parsing of Unicode 6.0 and 7.0 script properties
459
- - Fixed parsing of the special Assigned property
460
- - Fixed scanning of InCyrillic_Supplement property
461
-
462
- ## [0.4.9] - 2017-12-25 - [Ammar Ali](mailto:ammarabuali@gmail.com)
463
-
464
- - Added ruby version file for 2.5.0
465
-
466
- ## [0.4.8] - 2017-12-18 - [Janosch Müller](mailto:janosch84@gmail.com)
467
-
468
- - Added ruby version files for 2.2.9, 2.3.6, and 2.4.3
469
-
470
- ## [0.4.7] - 2017-10-15 - [Janosch Müller](mailto:janosch84@gmail.com)
471
-
472
- - Fixed a thread safety issue (issue #45)
473
- - Some public class methods that were only reliable for
474
- internal use are now private instance methods (PR #46)
475
- - Improved the usefulness of Expression::Base#options (issue #43) -
476
- #options and derived methods such as #i?, #m? and #x? are now
477
- defined for all Expressions that are affected by such flags.
478
- - Fixed scanning of whitespace following (?x) (commit 5c94bd2)
479
- - Fixed a Parser bug where the #number attribute of traditional
480
- numerical backreferences was not set correctly (commit 851b620)
481
-
482
- ## [0.4.6] - 2017-09-18 - [Janosch Müller](mailto:janosch84@gmail.com)
483
-
484
- - Added Parser support for hex escapes in sets (PR #36)
485
- - Added Parser support for octal escapes (PR #37)
486
- - Added support for cluster types \R and \X (PR #38)
487
- - Added support for more metacontrol notations (PR #39)
488
-
489
- ## [0.4.5] - 2017-09-17 - [Ammar Ali](mailto:ammarabuali@gmail.com)
490
-
491
- - Thanks to [Janosch Müller](https://github.com/janosch-x):
492
- * Support ruby 2.2.7 (PR #42)
493
- - Added ruby version files for 2.2.8, 2.3.5, and 2.4.2
494
-
495
- ## [0.4.4] - 2017-07-10 - [Ammar Ali](mailto:ammarabuali@gmail.com)
496
-
497
- - Thanks to [Janosch Müller](https://github.com/janosch-x):
498
- * Add support for new absence operator (PR #33)
499
- - Thanks to [Bartek Bułat](https://github.com/barthez):
500
- * Add support for Ruby 2.3.4 version (PR #40)
501
-
502
- ## [0.4.3] - 2017-03-24 - [Ammar Ali](mailto:ammarabuali@gmail.com)
503
-
504
- - Added ruby version file for 2.4.1
505
-
506
- ## [0.4.2] - 2017-01-10 - [Ammar Ali](mailto:ammarabuali@gmail.com)
507
-
508
- - Thanks to [Janosch Müller](https://github.com/janosch-x):
509
- * Support ruby 2.4 (PR #30)
510
- * Improve codepoint handling (PR #27)
511
-
512
- ## [0.4.1] - 2016-11-22 - [Ammar Ali](mailto:ammarabuali@gmail.com)
513
-
514
- - Updated ruby version file for 2.3.3
515
-
516
- ## [0.4.0] - 2016-11-20 - [Ammar Ali](mailto:ammarabuali@gmail.com)
517
-
518
- - Added Syntax.supported? method
519
- - Updated ruby versions for latest releases; 2.1.10, 2.2.6, and 2.3.2
520
-
521
- ## [0.3.6] - 2016-06-08 - [Ammar Ali](mailto:ammarabuali@gmail.com)
522
-
523
- - Thanks to [John Backus](https://github.com/backus):
524
- * Remove warnings (PR #26)
525
-
526
- ## [0.3.5] - 2016-05-30 - [Ammar Ali](mailto:ammarabuali@gmail.com)
527
-
528
- - Thanks to [John Backus](https://github.com/backus):
529
- * Fix parsing of /\xFF/n (hex:escape) (PR #24)
530
-
531
- ## [0.3.4] - 2016-05-25 - [Ammar Ali](mailto:ammarabuali@gmail.com)
532
-
533
- - Thanks to [John Backus](https://github.com/backus):
534
- * Fix warnings (PR #19)
535
- - Thanks to [Dana Scheider](https://github.com/danascheider):
536
- * Correct error in README (PR #20)
537
- - Fixed mistyped \h and \H character types (issue #21)
538
- - Added ancestry syntax files for latest rubies (issue #22)
539
-
540
- ## [0.3.3] - 2016-04-26 - [Ammar Ali](mailto:ammarabuali@gmail.com)
541
-
542
- - Thanks to [John Backus](https://github.com/backus):
543
- * Fixed scanning of zero length comments (PR #12)
544
- * Fixed missing escape:codepoint_list syntax token (PR #14)
545
- * Fixed to_s for modified interval quantifiers (PR #17)
546
-
547
- ## [0.3.2] - 2016-01-01 - [Ammar Ali](mailto:ammarabuali@gmail.com)
548
-
549
- - Updated ruby versions for latest releases; 2.1.8, 2.2.4, and 2.3.0
550
- - Fixed class name for UnknownSyntaxNameError exception
551
- - Added UnicodeBlocks support to the parser.
552
- - Added UnicodeBlocks support to the scanner.
553
- - Added expand_members method to CharacterSet, returns traditional
554
- or unicode property forms of shothands (\d, \W, \s, etc.)
555
- - Improved meaning and output of %t and %T in strfregexp.
556
- - Added syntax versions for ruby 2.1.4 and 2.1.5 and updated
557
- latest 2.1 version.
558
- - Added to_h methods to Expression, Subexpression, and Quantifier.
559
- - Added traversal methods; traverse, each_expression, and map.
560
- - Added token/type test methods; type?, is?, and one_of?
561
- - Added printing method strfregexp, inspired by strftime.
562
- - Added scanning and parsing of free spacing (x mode) expressions.
563
- - Improved handling of inline options (?mixdau:...)
564
- - Added conditional expressions. Ruby 2.0.
565
- - Added keep (\K) markers. Ruby 2.0.
566
- - Added d, a, and u options. Ruby 2.0.
567
- - Added missing meta sequences to the parser. They were supported by the scanner only.
568
- - Renamed Lexer's method to lex, added an alias to the old name (scan)
569
- - Use #map instead of #each to run the block in Lexer.lex.
570
- - Replaced VERSION.yml file with a constant.
571
- - Update tokens and scanner with new additions in Unicode 7.0.
572
-
573
- ## [0.1.6] - 2014-10-06 - [Ammar Ali](mailto:ammarabuali@gmail.com)
574
-
575
- - Fixed test and gem building rake tasks and extracted the gem
576
- specification from the Rakefile into a .gemspec file.
577
- - Added syntax files for missing ruby 2.x versions. These do not add
578
- extra syntax support, they just make the gem work with the newer
579
- ruby versions.
580
- - Fixed a parser bug where an alternation sequence that contained nested expressions was incorrectly being appended to the parent expression when the nesting was exited. e.g. in /a|(b)c/, c was appended to the root.
581
- - Fixed a bug where character types were not being correctly scanned within character sets. e.g. in [\d], two tokens were scanned; one for the backslash '\' and one for the 'd'
582
-
583
- ## [0.1.5] - 2014-01-14 - [Ammar Ali](mailto:ammarabuali@gmail.com)
584
-
585
- - Added syntax stubs for ruby versions 2.0 and 2.1
586
- - Added clone methods for deep copying expressions.
587
- - Added optional format argument for to_s on expressions to return the text of the expression with (:full, the default) or without (:base) its quantifier.
588
- - Renamed the :beginning_of_line and :end_of_line tokens to :bol and :eol.
589
- - Fixed a bug where alternations with more than two alternatives and one of them ending in a group were being incorrectly nested.
590
- - Improved EOF handling in general and especially from sequences like hex and control escapes.
591
- - Fixed a bug where named groups with an empty name would return a blank token [].
592
- - Fixed a bug where member of a parent set where being added to its last subset.
593
- - Fixed a few mutable string bugs by calling dup on the originals.
594
- - Made ruby 1.8.6 the base for all 1.8 syntax, and the 1.8 name a pointer to the latest (1.8.7 at this time)
595
- - Removed look-behind assertions (positive and negative) from 1.8 syntax
596
- - Added control (\cc and \C-c) and meta (\M-c) escapes to 1.8 syntax
597
- - The default syntax is now the one of the running ruby version in both the lexer and the parser.
598
-
599
- ## [0.1.0] - 2010-11-21 - [Ammar Ali](mailto:ammarabuali@gmail.com)
600
-
601
- - Initial release