regexp_parser 2.8.2 → 2.8.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5309aa54a7dc49b910246ad7efd9bf1e2f6b19917c41f2c4dd389568c7a1d0c5
4
- data.tar.gz: 0174ec36fcec3ca3696f7e5fbe2eeaa5e9d75b09d4e0891bd841da997101f123
3
+ metadata.gz: 53bc2105c4601ec650c24172f48b4dfa4ffa356f84f4de2a58cca4429cff45a4
4
+ data.tar.gz: 3cb580ee3db70e9490b350722fcd63b77640cc1cbaed4c7555b192f9ddcc341b
5
5
  SHA512:
6
- metadata.gz: b52cfb89d0cb55c63844fe5f808c8472c2987746e33d71fe2ede2b9759d3f572611679050a0ae407a391c0f2ba88e9049beb579c2ead9c037b711c9a0c62b18b
7
- data.tar.gz: 708e81a6463887e849ed1c560eb36abae556dc7b87c1f3fac30f74b1822a778b7d711c2fbba52ad9114db1ee5ba3a47f3898d17023de97b56799aed891e34c7f
6
+ metadata.gz: fcdf19c19bc62b11a3c8a22a75c54ef996635dfc3cbabf7512eee49090c0215b21c751a275923561a0be33bb0070e04ce57f49a5bc95bedb386afd763ba6d7ba
7
+ data.tar.gz: 5744e2e8baa4ecf52d87718a821c4ba69e8d2d1ced6deffca3224cf415a72714726f8465d50c0f504421fed5992c94519c3c8e0a0e7f79e24037a9fad5386347
@@ -364,6 +364,7 @@
364
364
  conditional_expression := |*
365
365
  group_lookup . ')' {
366
366
  text = copy(data, ts, te-1)
367
+ text =~ /[^0]/ or raise ValidationError.for(:backref, 'condition', 'invalid ref ID')
367
368
  emit(:conditional, :condition, text)
368
369
  emit(:conditional, :condition_close, ')')
369
370
  };
@@ -541,13 +542,13 @@
541
542
  case text = copy(data, ts, te)
542
543
  when /^\\k(.)[^0-9\-][^+\-]*['>]$/
543
544
  emit(:backref, $1 == '<' ? :name_ref_ab : :name_ref_sq, text)
544
- when /^\\k(.)[1-9]\d*['>]$/
545
+ when /^\\k(.)0*[1-9]\d*['>]$/
545
546
  emit(:backref, $1 == '<' ? :number_ref_ab : :number_ref_sq, text)
546
- when /^\\k(.)-[1-9]\d*['>]$/
547
+ when /^\\k(.)-0*[1-9]\d*['>]$/
547
548
  emit(:backref, $1 == '<' ? :number_rel_ref_ab : :number_rel_ref_sq, text)
548
549
  when /^\\k(.)[^0-9\-].*[+\-]\d+['>]$/
549
550
  emit(:backref, $1 == '<' ? :name_recursion_ref_ab : :name_recursion_ref_sq, text)
550
- when /^\\k(.)-?[1-9]\d*[+\-]\d+['>]$/
551
+ when /^\\k(.)-?0*[1-9]\d*[+\-]\d+['>]$/
551
552
  emit(:backref, $1 == '<' ? :number_recursion_ref_ab : :number_recursion_ref_sq, text)
552
553
  else
553
554
  raise ValidationError.for(:backref, 'backreference', 'invalid ref ID')
@@ -560,9 +561,9 @@
560
561
  case text = copy(data, ts, te)
561
562
  when /^\\g(.)[^0-9+\-].*['>]$/
562
563
  emit(:backref, $1 == '<' ? :name_call_ab : :name_call_sq, text)
563
- when /^\\g(.)\d+['>]$/
564
+ when /^\\g(.)(?:0|0*[1-9]\d*)['>]$/
564
565
  emit(:backref, $1 == '<' ? :number_call_ab : :number_call_sq, text)
565
- when /^\\g(.)[+-]\d+/
566
+ when /^\\g(.)[+-]0*[1-9]\d*/
566
567
  emit(:backref, $1 == '<' ? :number_rel_call_ab : :number_rel_call_sq, text)
567
568
  else
568
569
  raise ValidationError.for(:backref, 'subexpression call', 'invalid ref ID')
@@ -1570,6 +1570,7 @@ end
1570
1570
  te = p+1
1571
1571
  begin
1572
1572
  text = copy(data, ts, te-1)
1573
+ text =~ /[^0]/ or raise ValidationError.for(:backref, 'condition', 'invalid ref ID')
1573
1574
  emit(:conditional, :condition, text)
1574
1575
  emit(:conditional, :condition_close, ')')
1575
1576
  end
@@ -1750,13 +1751,13 @@ te = p+1
1750
1751
  case text = copy(data, ts, te)
1751
1752
  when /^\\k(.)[^0-9\-][^+\-]*['>]$/
1752
1753
  emit(:backref, $1 == '<' ? :name_ref_ab : :name_ref_sq, text)
1753
- when /^\\k(.)[1-9]\d*['>]$/
1754
+ when /^\\k(.)0*[1-9]\d*['>]$/
1754
1755
  emit(:backref, $1 == '<' ? :number_ref_ab : :number_ref_sq, text)
1755
- when /^\\k(.)-[1-9]\d*['>]$/
1756
+ when /^\\k(.)-0*[1-9]\d*['>]$/
1756
1757
  emit(:backref, $1 == '<' ? :number_rel_ref_ab : :number_rel_ref_sq, text)
1757
1758
  when /^\\k(.)[^0-9\-].*[+\-]\d+['>]$/
1758
1759
  emit(:backref, $1 == '<' ? :name_recursion_ref_ab : :name_recursion_ref_sq, text)
1759
- when /^\\k(.)-?[1-9]\d*[+\-]\d+['>]$/
1760
+ when /^\\k(.)-?0*[1-9]\d*[+\-]\d+['>]$/
1760
1761
  emit(:backref, $1 == '<' ? :number_recursion_ref_ab : :number_recursion_ref_sq, text)
1761
1762
  else
1762
1763
  raise ValidationError.for(:backref, 'backreference', 'invalid ref ID')
@@ -1770,9 +1771,9 @@ te = p+1
1770
1771
  case text = copy(data, ts, te)
1771
1772
  when /^\\g(.)[^0-9+\-].*['>]$/
1772
1773
  emit(:backref, $1 == '<' ? :name_call_ab : :name_call_sq, text)
1773
- when /^\\g(.)\d+['>]$/
1774
+ when /^\\g(.)(?:0|0*[1-9]\d*)['>]$/
1774
1775
  emit(:backref, $1 == '<' ? :number_call_ab : :number_call_sq, text)
1775
- when /^\\g(.)[+-]\d+/
1776
+ when /^\\g(.)[+-]0*[1-9]\d*/
1776
1777
  emit(:backref, $1 == '<' ? :number_rel_call_ab : :number_rel_call_sq, text)
1777
1778
  else
1778
1779
  raise ValidationError.for(:backref, 'subexpression call', 'invalid ref ID')
@@ -1,5 +1,5 @@
1
1
  class Regexp
2
2
  class Parser
3
- VERSION = '2.8.2'
3
+ VERSION = '2.8.3'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: regexp_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.2
4
+ version: 2.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ammar Ali
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-10-10 00:00:00.000000000 Z
12
+ date: 2023-12-04 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A library for tokenizing, lexing, and parsing Ruby regular expressions.
15
15
  email: