regexp_parser 2.7.0 → 2.9.2

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