strscan 3.1.1 → 3.1.2

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: 45d46129cae1a1b9273f5500d6d15279e592946173312c034fb54387faef9d0d
4
- data.tar.gz: fc2d15f94f2e597d57dc89c44dddce16aa0096f02a6d268c22e1595ab9c5a00f
3
+ metadata.gz: 73c77caa81f5b813c59e442c9499b5a7ab4ea7b1150beb9ec2c74e77db6594df
4
+ data.tar.gz: 06cc976fa2b5da016adee87d62d306c96c64da26ff32cc38c01de113e20403f6
5
5
  SHA512:
6
- metadata.gz: 295727ce636512083608565f16c7675509143708abce6896da39fb0b3bad4d8e69538b6574a0ed6c6d7e0f85c14569c79cdc5901b55c7c5320c3d5a7af0cc61d
7
- data.tar.gz: 4bba01c59eb8e3062fb498d6e8468ed6def6fa36d7c5ef9a0bb24806f7d500def565e9598eb5b7958589b3145653b57991a270963d066486b4e1ba915cb3030f
6
+ metadata.gz: 68e02c4724557b03798d0c13761cc84c604278ad482c693208fc448459270faa6653069139757a9b4095c6d0fdecdff75982e8a47172e2602d1173dd6c7bf61c
7
+ data.tar.gz: f6df1e074a2a6330058d3c8f4b7961a1ab0b3f077860940feadc0515e95deab8fcae3c06fccb4d3482f2127a4479b12e0c1e0482fd638decd047f770331fad47
@@ -10,7 +10,7 @@ Display scanner's situation:
10
10
  - Character position (`#charpos`)
11
11
  - Target string (`#rest`) and size (`#rest_size`).
12
12
 
13
- ```
13
+ ```rb
14
14
  scanner = StringScanner.new('foobarbaz')
15
15
  scanner.scan(/foo/)
16
16
  put_situation(scanner)
@@ -25,7 +25,7 @@ put_situation(scanner)
25
25
 
26
26
  Display the scanner's match values:
27
27
 
28
- ```
28
+ ```rb
29
29
  scanner = StringScanner.new('Fri Dec 12 1975 14:39')
30
30
  pattern = /(?<wday>\w+) (?<month>\w+) (?<day>\d+) /
31
31
  scanner.match?(pattern)
@@ -53,7 +53,7 @@ put_match_values(scanner)
53
53
 
54
54
  Returns whether the scanner's match values are all properly cleared:
55
55
 
56
- ```
56
+ ```rb
57
57
  scanner = StringScanner.new('foobarbaz')
58
58
  match_values_cleared?(scanner) # => true
59
59
  put_match_values(scanner)
@@ -75,7 +75,7 @@ match_values_cleared?(scanner) # => false
75
75
 
76
76
  ## The Code
77
77
 
78
- ```
78
+ ```rb
79
79
  def put_situation(scanner)
80
80
  puts '# Situation:'
81
81
  puts "# pos: #{scanner.pos}"
@@ -83,9 +83,7 @@ def put_situation(scanner)
83
83
  puts "# rest: #{scanner.rest.inspect}"
84
84
  puts "# rest_size: #{scanner.rest_size}"
85
85
  end
86
- ```
87
86
 
88
- ```
89
87
  def put_match_values(scanner)
90
88
  puts '# Basic match values:'
91
89
  puts "# matched?: #{scanner.matched?}"
@@ -109,9 +107,7 @@ def put_match_values(scanner)
109
107
  end
110
108
  end
111
109
  end
112
- ```
113
110
 
114
- ```
115
111
  def match_values_cleared?(scanner)
116
112
  scanner.matched? == false &&
117
113
  scanner.matched_size.nil? &&
@@ -10,7 +10,7 @@ Returns the next byte, if available:
10
10
  - Increments the [byte position][2].
11
11
  - Adjusts the [character position][7].
12
12
 
13
- ```
13
+ ```rb
14
14
  scanner = StringScanner.new(HIRAGANA_TEXT)
15
15
  # => #<StringScanner 0/15 @ "\xE3\x81\x93\xE3\x82...">
16
16
  scanner.string # => "こんにちは"
@@ -24,7 +24,7 @@ Returns the next byte, if available:
24
24
 
25
25
  - Otherwise, returns `nil`, and does not change the positions.
26
26
 
27
- ```
27
+ ```rb
28
28
  scanner.terminate
29
29
  [scanner.get_byte, scanner.pos, scanner.charpos] # => [nil, 15, 5]
30
30
  ```
@@ -5,7 +5,7 @@ Returns the [character position][7] (initially zero),
5
5
  which may be different from the [byte position][2]
6
6
  given by method #pos:
7
7
 
8
- ```
8
+ ```rb
9
9
  scanner = StringScanner.new(HIRAGANA_TEXT)
10
10
  scanner.string # => "こんにちは"
11
11
  scanner.getch # => "こ" # 3-byte character.
@@ -4,7 +4,7 @@ call-seq:
4
4
  Returns the integer [byte position][2],
5
5
  which may be different from the [character position][7]:
6
6
 
7
- ```
7
+ ```rb
8
8
  scanner = StringScanner.new(HIRAGANA_TEXT)
9
9
  scanner.string # => "こんにちは"
10
10
  scanner.pos # => 0
@@ -12,7 +12,7 @@ if available:
12
12
  - Increments the [byte position][2]
13
13
  by the size (in bytes) of the character.
14
14
 
15
- ```
15
+ ```rb
16
16
  scanner = StringScanner.new(HIRAGANA_TEXT)
17
17
  scanner.string # => "こんにちは"
18
18
  [scanner.getch, scanner.pos, scanner.charpos] # => ["こ", 3, 1]
@@ -27,7 +27,7 @@ if available:
27
27
  (that is, not at its beginning),
28
28
  behaves like #get_byte (returns a 1-byte character):
29
29
 
30
- ```
30
+ ```rb
31
31
  scanner.pos = 1
32
32
  [scanner.getch, scanner.pos, scanner.charpos] # => ["\x81", 2, 2]
33
33
  [scanner.getch, scanner.pos, scanner.charpos] # => ["\x93", 3, 1]
@@ -37,7 +37,7 @@ if available:
37
37
  - If the [position][2] is at the end of the [stored string][1],
38
38
  returns `nil` and does not modify the positions:
39
39
 
40
- ```
40
+ ```rb
41
41
  scanner.terminate
42
42
  [scanner.getch, scanner.pos, scanner.charpos] # => [nil, 15, 5]
43
43
  ```
@@ -11,7 +11,7 @@ If the match succeeds:
11
11
  and may increment the [character position][7].
12
12
  - Sets [match values][9].
13
13
 
14
- ```
14
+ ```rb
15
15
  scanner = StringScanner.new(HIRAGANA_TEXT)
16
16
  scanner.string # => "こんにちは"
17
17
  scanner.pos = 6
@@ -45,7 +45,7 @@ If the match fails:
45
45
  - Does not increment byte and character positions.
46
46
  - Clears match values.
47
47
 
48
- ```
48
+ ```rb
49
49
  scanner.scan(/nope/) # => nil
50
50
  match_values_cleared?(scanner) # => true
51
51
  ```
@@ -12,7 +12,7 @@ If the match attempt succeeds:
12
12
  - Returns the matched substring.
13
13
 
14
14
 
15
- ```
15
+ ```rb
16
16
  scanner = StringScanner.new(HIRAGANA_TEXT)
17
17
  scanner.string # => "こんにちは"
18
18
  scanner.pos = 6
@@ -46,7 +46,7 @@ If the match attempt fails:
46
46
  - Returns `nil`.
47
47
  - Does not update positions.
48
48
 
49
- ```
49
+ ```rb
50
50
  scanner.scan_until(/nope/) # => nil
51
51
  match_values_cleared?(scanner) # => true
52
52
  ```
@@ -9,7 +9,7 @@ Does not affect [match values][9].
9
9
 
10
10
  For non-negative `n`, sets the position to `n`:
11
11
 
12
- ```
12
+ ```rb
13
13
  scanner = StringScanner.new(HIRAGANA_TEXT)
14
14
  scanner.string # => "こんにちは"
15
15
  scanner.pos = 3 # => 3
@@ -19,7 +19,7 @@ scanner.charpos # => 1
19
19
 
20
20
  For negative `n`, counts from the end of the [stored string][1]:
21
21
 
22
- ```
22
+ ```rb
23
23
  scanner.pos = -9 # => -9
24
24
  scanner.pos # => 6
25
25
  scanner.rest # => "にちは"
@@ -11,7 +11,7 @@ If the match succeeds:
11
11
  - Sets [match values][9].
12
12
  - Returns the size (bytes) of the matched substring.
13
13
 
14
- ```
14
+ ```rb
15
15
  scanner = StringScanner.new(HIRAGANA_TEXT)
16
16
  scanner.string # => "こんにちは"
17
17
  scanner.pos = 6
@@ -10,7 +10,7 @@ If the match attempt succeeds:
10
10
  - Sets [match values][9].
11
11
  - Returns the size of the matched substring.
12
12
 
13
- ```
13
+ ```rb
14
14
  scanner = StringScanner.new(HIRAGANA_TEXT)
15
15
  scanner.string # => "こんにちは"
16
16
  scanner.pos = 6
@@ -43,7 +43,7 @@ If the match attempt fails:
43
43
  - Clears match values.
44
44
  - Returns `nil`.
45
45
 
46
- ```
46
+ ```rb
47
47
  scanner.skip_until(/nope/) # => nil
48
48
  match_values_cleared?(scanner) # => true
49
49
  ```
@@ -7,7 +7,7 @@ returns +self+:
7
7
  - Sets both [positions][11] to end-of-stream.
8
8
  - Clears [match values][9].
9
9
 
10
- ```
10
+ ```rb
11
11
  scanner = StringScanner.new(HIRAGANA_TEXT)
12
12
  scanner.string # => "こんにちは"
13
13
  scanner.scan_until(/に/)
@@ -1,7 +1,7 @@
1
1
  \Class `StringScanner` supports processing a stored string as a stream;
2
2
  this code creates a new `StringScanner` object with string `'foobarbaz'`:
3
3
 
4
- ```
4
+ ```rb
5
5
  require 'strscan'
6
6
  scanner = StringScanner.new('foobarbaz')
7
7
  ```
@@ -10,13 +10,13 @@ scanner = StringScanner.new('foobarbaz')
10
10
 
11
11
  All examples here assume that `StringScanner` has been required:
12
12
 
13
- ```
13
+ ```rb
14
14
  require 'strscan'
15
15
  ```
16
16
 
17
17
  Some examples here assume that these constants are defined:
18
18
 
19
- ```
19
+ ```rb
20
20
  MULTILINE_TEXT = <<~EOT
21
21
  Go placidly amid the noise and haste,
22
22
  and remember what peace there may be in silence.
@@ -45,7 +45,7 @@ This code creates a `StringScanner` object
45
45
  (we'll call it simply a _scanner_),
46
46
  and shows some of its basic properties:
47
47
 
48
- ```
48
+ ```rb
49
49
  scanner = StringScanner.new('foobarbaz')
50
50
  scanner.string # => "foobarbaz"
51
51
  put_situation(scanner)
@@ -138,7 +138,7 @@ To get or set the byte position:
138
138
  Many methods use the byte position as the basis for finding matches;
139
139
  many others set, increment, or decrement the byte position:
140
140
 
141
- ```
141
+ ```rb
142
142
  scanner = StringScanner.new('foobar')
143
143
  scanner.pos # => 0
144
144
  scanner.scan(/foo/) # => "foo" # Match found.
@@ -176,7 +176,7 @@ see:
176
176
 
177
177
  Example (string includes multi-byte characters):
178
178
 
179
- ```
179
+ ```rb
180
180
  scanner = StringScanner.new(ENGLISH_TEXT) # Five 1-byte characters.
181
181
  scanner.concat(HIRAGANA_TEXT) # Five 3-byte characters
182
182
  scanner.string # => "Helloこんにちは" # Twenty bytes in all.
@@ -216,7 +216,7 @@ and its size is returned by method #rest_size.
216
216
 
217
217
  Examples:
218
218
 
219
- ```
219
+ ```rb
220
220
  scanner = StringScanner.new('foobarbaz')
221
221
  put_situation(scanner)
222
222
  # Situation:
@@ -430,7 +430,7 @@ See examples below.
430
430
 
431
431
  Successful basic match attempt (no captures):
432
432
 
433
- ```
433
+ ```rb
434
434
  scanner = StringScanner.new('foobarbaz')
435
435
  scanner.exist?(/bar/)
436
436
  put_match_values(scanner)
@@ -452,7 +452,7 @@ put_match_values(scanner)
452
452
 
453
453
  Failed basic match attempt (no captures);
454
454
 
455
- ```
455
+ ```rb
456
456
  scanner = StringScanner.new('foobarbaz')
457
457
  scanner.exist?(/nope/)
458
458
  match_values_cleared?(scanner) # => true
@@ -460,7 +460,7 @@ match_values_cleared?(scanner) # => true
460
460
 
461
461
  Successful unnamed capture match attempt:
462
462
 
463
- ```
463
+ ```rb
464
464
  scanner = StringScanner.new('foobarbazbatbam')
465
465
  scanner.exist?(/(foo)bar(baz)bat(bam)/)
466
466
  put_match_values(scanner)
@@ -486,7 +486,7 @@ put_match_values(scanner)
486
486
  Successful named capture match attempt;
487
487
  same as unnamed above, except for #named_captures:
488
488
 
489
- ```
489
+ ```rb
490
490
  scanner = StringScanner.new('foobarbazbatbam')
491
491
  scanner.exist?(/(?<x>foo)bar(?<y>baz)bat(?<z>bam)/)
492
492
  scanner.named_captures # => {"x"=>"foo", "y"=>"baz", "z"=>"bam"}
@@ -494,7 +494,7 @@ scanner.named_captures # => {"x"=>"foo", "y"=>"baz", "z"=>"bam"}
494
494
 
495
495
  Failed unnamed capture match attempt:
496
496
 
497
- ```
497
+ ```rb
498
498
  scanner = StringScanner.new('somestring')
499
499
  scanner.exist?(/(foo)bar(baz)bat(bam)/)
500
500
  match_values_cleared?(scanner) # => true
@@ -503,7 +503,7 @@ match_values_cleared?(scanner) # => true
503
503
  Failed named capture match attempt;
504
504
  same as unnamed above, except for #named_captures:
505
505
 
506
- ```
506
+ ```rb
507
507
  scanner = StringScanner.new('somestring')
508
508
  scanner.exist?(/(?<x>foo)bar(?<y>baz)bat(?<z>bam)/)
509
509
  match_values_cleared?(scanner) # => false
@@ -518,7 +518,7 @@ which determines the meaning of `'\A'`:
518
518
 
519
519
  * `false` (the default): matches the current byte position.
520
520
 
521
- ```
521
+ ```rb
522
522
  scanner = StringScanner.new('foobar')
523
523
  scanner.scan(/\A./) # => "f"
524
524
  scanner.scan(/\A./) # => "o"
@@ -529,7 +529,7 @@ which determines the meaning of `'\A'`:
529
529
  * `true`: matches the beginning of the target substring;
530
530
  never matches unless the byte position is zero:
531
531
 
532
- ```
532
+ ```rb
533
533
  scanner = StringScanner.new('foobar', fixed_anchor: true)
534
534
  scanner.scan(/\A./) # => "f"
535
535
  scanner.scan(/\A./) # => nil
@@ -22,7 +22,7 @@ extern size_t onig_region_memsize(const struct re_registers *regs);
22
22
 
23
23
  #include <stdbool.h>
24
24
 
25
- #define STRSCAN_VERSION "3.1.1"
25
+ #define STRSCAN_VERSION "3.1.2"
26
26
 
27
27
  /* =======================================================================
28
28
  Data Type Definitions
@@ -231,7 +231,7 @@ strscan_s_allocate(VALUE klass)
231
231
  * is the given `string`;
232
232
  * sets the [fixed-anchor property][10]:
233
233
  *
234
- * ```
234
+ * ```rb
235
235
  * scanner = StringScanner.new('foobarbaz')
236
236
  * scanner.string # => "foobarbaz"
237
237
  * scanner.fixed_anchor? # => false
@@ -339,7 +339,7 @@ strscan_s_mustc(VALUE self)
339
339
  * and clears [match values][9];
340
340
  * returns +self+:
341
341
  *
342
- * ```
342
+ * ```rb
343
343
  * scanner = StringScanner.new('foobarbaz')
344
344
  * scanner.exist?(/bar/) # => 6
345
345
  * scanner.reset # => #<StringScanner 0/9 @ "fooba...">
@@ -405,7 +405,7 @@ strscan_clear(VALUE self)
405
405
  *
406
406
  * Returns the [stored string][1]:
407
407
  *
408
- * ```
408
+ * ```rb
409
409
  * scanner = StringScanner.new('foobar')
410
410
  * scanner.string # => "foobar"
411
411
  * scanner.concat('baz')
@@ -435,7 +435,7 @@ strscan_get_string(VALUE self)
435
435
  * - Clears [match values][9].
436
436
  * - Returns `other_string`.
437
437
  *
438
- * ```
438
+ * ```rb
439
439
  * scanner = StringScanner.new('foobar')
440
440
  * scanner.scan(/foo/)
441
441
  * put_situation(scanner)
@@ -483,7 +483,7 @@ strscan_set_string(VALUE self, VALUE str)
483
483
  * or [match values][9].
484
484
  *
485
485
  *
486
- * ```
486
+ * ```rb
487
487
  * scanner = StringScanner.new('foo')
488
488
  * scanner.string # => "foo"
489
489
  * scanner.terminate
@@ -789,7 +789,7 @@ strscan_scan(VALUE self, VALUE re)
789
789
  * - Returns the size in bytes of the matched substring.
790
790
  *
791
791
  *
792
- * ```
792
+ * ```rb
793
793
  * scanner = StringScanner.new('foobarbaz')
794
794
  * scanner.pos = 3
795
795
  * scanner.match?(/bar/) => 3
@@ -822,7 +822,7 @@ strscan_scan(VALUE self, VALUE re)
822
822
  * - Returns `nil`.
823
823
  * - Does not increment positions.
824
824
  *
825
- * ```
825
+ * ```rb
826
826
  * scanner.match?(/nope/) # => nil
827
827
  * match_values_cleared?(scanner) # => true
828
828
  * ```
@@ -861,7 +861,7 @@ strscan_skip(VALUE self, VALUE re)
861
861
  * - Returns the matched substring.
862
862
  * - Sets all [match values][9].
863
863
  *
864
- * ```
864
+ * ```rb
865
865
  * scanner = StringScanner.new('foobarbaz')
866
866
  * scanner.pos = 3
867
867
  * scanner.check('bar') # => "bar"
@@ -894,7 +894,7 @@ strscan_skip(VALUE self, VALUE re)
894
894
  * - Returns `nil`.
895
895
  * - Clears all [match values][9].
896
896
  *
897
- * ```
897
+ * ```rb
898
898
  * scanner.check(/nope/) # => nil
899
899
  * match_values_cleared?(scanner) # => true
900
900
  * ```
@@ -961,7 +961,7 @@ strscan_scan_until(VALUE self, VALUE re)
961
961
  * and the end of the matched substring.
962
962
  * - Sets all [match values][9].
963
963
  *
964
- * ```
964
+ * ```rb
965
965
  * scanner = StringScanner.new('foobarbazbatbam')
966
966
  * scanner.pos = 6
967
967
  * scanner.exist?(/bat/) # => 6
@@ -993,7 +993,7 @@ strscan_scan_until(VALUE self, VALUE re)
993
993
  * - Returns `nil`.
994
994
  * - Clears all [match values][9].
995
995
  *
996
- * ```
996
+ * ```rb
997
997
  * scanner.exist?(/nope/) # => nil
998
998
  * match_values_cleared?(scanner) # => true
999
999
  * ```
@@ -1035,7 +1035,7 @@ strscan_skip_until(VALUE self, VALUE re)
1035
1035
  * which extends from the current [position][2]
1036
1036
  * to the end of the matched substring.
1037
1037
  *
1038
- * ```
1038
+ * ```rb
1039
1039
  * scanner = StringScanner.new('foobarbazbatbam')
1040
1040
  * scanner.pos = 6
1041
1041
  * scanner.check_until(/bat/) # => "bazbat"
@@ -1067,7 +1067,7 @@ strscan_skip_until(VALUE self, VALUE re)
1067
1067
  * - Clears all [match values][9].
1068
1068
  * - Returns `nil`.
1069
1069
  *
1070
- * ```
1070
+ * ```rb
1071
1071
  * scanner.check_until(/nope/) # => nil
1072
1072
  * match_values_cleared?(scanner) # => true
1073
1073
  * ```
@@ -1239,7 +1239,7 @@ strscan_getbyte(VALUE self)
1239
1239
  * Returns the substring `string[pos, length]`;
1240
1240
  * does not update [match values][9] or [positions][11]:
1241
1241
  *
1242
- * ```
1242
+ * ```rb
1243
1243
  * scanner = StringScanner.new('foobarbaz')
1244
1244
  * scanner.pos = 3
1245
1245
  * scanner.peek(3) # => "bar"
@@ -1403,7 +1403,7 @@ strscan_scan_base16_integer(VALUE self)
1403
1403
  * Sets the [position][2] to its value previous to the recent successful
1404
1404
  * [match][17] attempt:
1405
1405
  *
1406
- * ```
1406
+ * ```rb
1407
1407
  * scanner = StringScanner.new('foobarbaz')
1408
1408
  * scanner.scan(/foo/)
1409
1409
  * put_situation(scanner)
@@ -1424,7 +1424,7 @@ strscan_scan_base16_integer(VALUE self)
1424
1424
  *
1425
1425
  * Raises an exception if match values are clear:
1426
1426
  *
1427
- * ```
1427
+ * ```rb
1428
1428
  * scanner.scan(/nope/) # => nil
1429
1429
  * match_values_cleared?(scanner) # => true
1430
1430
  * scanner.unscan # Raises StringScanner::Error.
@@ -1498,7 +1498,7 @@ strscan_bol_p(VALUE self)
1498
1498
  * Returns whether the [position][2]
1499
1499
  * is at the end of the [stored string][1]:
1500
1500
  *
1501
- * ```
1501
+ * ```rb
1502
1502
  * scanner = StringScanner.new('foobarbaz')
1503
1503
  * scanner.eos? # => false
1504
1504
  * pos = 3
@@ -1567,7 +1567,7 @@ strscan_rest_p(VALUE self)
1567
1567
  * `false` otherwise;
1568
1568
  * see [Basic Matched Values][18]:
1569
1569
  *
1570
- * ```
1570
+ * ```rb
1571
1571
  * scanner = StringScanner.new('foobarbaz')
1572
1572
  * scanner.matched? # => false
1573
1573
  * scanner.pos = 3
@@ -1599,7 +1599,7 @@ strscan_matched_p(VALUE self)
1599
1599
  * or `nil` otherwise;
1600
1600
  * see [Basic Matched Values][18]:
1601
1601
  *
1602
- * ```
1602
+ * ```rb
1603
1603
  * scanner = StringScanner.new('foobarbaz')
1604
1604
  * scanner.matched # => nil
1605
1605
  * scanner.pos = 3
@@ -1634,7 +1634,7 @@ strscan_matched(VALUE self)
1634
1634
  * or `nil` otherwise;
1635
1635
  * see [Basic Matched Values][18]:
1636
1636
  *
1637
- * ```
1637
+ * ```rb
1638
1638
  * scanner = StringScanner.new('foobarbaz')
1639
1639
  * scanner.matched_size # => nil
1640
1640
  *
@@ -1688,14 +1688,14 @@ name_to_backref_number(struct re_registers *regs, VALUE regexp, const char* name
1688
1688
  *
1689
1689
  * When there are captures:
1690
1690
  *
1691
- * ```
1691
+ * ```rb
1692
1692
  * scanner = StringScanner.new('Fri Dec 12 1975 14:39')
1693
1693
  * scanner.scan(/(?<wday>\w+) (?<month>\w+) (?<day>\d+) /)
1694
1694
  * ```
1695
1695
  *
1696
1696
  * - `specifier` zero: returns the entire matched substring:
1697
1697
  *
1698
- * ```
1698
+ * ```rb
1699
1699
  * scanner[0] # => "Fri Dec 12 "
1700
1700
  * scanner.pre_match # => ""
1701
1701
  * scanner.post_match # => "1975 14:39"
@@ -1703,7 +1703,7 @@ name_to_backref_number(struct re_registers *regs, VALUE regexp, const char* name
1703
1703
  *
1704
1704
  * - `specifier` positive integer. returns the `n`th capture, or `nil` if out of range:
1705
1705
  *
1706
- * ```
1706
+ * ```rb
1707
1707
  * scanner[1] # => "Fri"
1708
1708
  * scanner[2] # => "Dec"
1709
1709
  * scanner[3] # => "12"
@@ -1712,7 +1712,7 @@ name_to_backref_number(struct re_registers *regs, VALUE regexp, const char* name
1712
1712
  *
1713
1713
  * - `specifier` negative integer. counts backward from the last subgroup:
1714
1714
  *
1715
- * ```
1715
+ * ```rb
1716
1716
  * scanner[-1] # => "12"
1717
1717
  * scanner[-4] # => "Fri Dec 12 "
1718
1718
  * scanner[-5] # => nil
@@ -1720,7 +1720,7 @@ name_to_backref_number(struct re_registers *regs, VALUE regexp, const char* name
1720
1720
  *
1721
1721
  * - `specifier` symbol or string. returns the named subgroup, or `nil` if no such:
1722
1722
  *
1723
- * ```
1723
+ * ```rb
1724
1724
  * scanner[:wday] # => "Fri"
1725
1725
  * scanner['wday'] # => "Fri"
1726
1726
  * scanner[:month] # => "Dec"
@@ -1730,7 +1730,7 @@ name_to_backref_number(struct re_registers *regs, VALUE regexp, const char* name
1730
1730
  *
1731
1731
  * When there are no captures, only `[0]` returns non-`nil`:
1732
1732
  *
1733
- * ```
1733
+ * ```rb
1734
1734
  * scanner = StringScanner.new('foobarbaz')
1735
1735
  * scanner.exist?(/bar/)
1736
1736
  * scanner[0] # => "bar"
@@ -1739,7 +1739,7 @@ name_to_backref_number(struct re_registers *regs, VALUE regexp, const char* name
1739
1739
  *
1740
1740
  * For a failed match, even `[0]` returns `nil`:
1741
1741
  *
1742
- * ```
1742
+ * ```rb
1743
1743
  * scanner.scan(/nope/) # => nil
1744
1744
  * scanner[0] # => nil
1745
1745
  * scanner[1] # => nil
@@ -1790,7 +1790,7 @@ strscan_aref(VALUE self, VALUE idx)
1790
1790
  * Returns the count of captures if the most recent match attempt succeeded, `nil` otherwise;
1791
1791
  * see [Captures Match Values][13]:
1792
1792
  *
1793
- * ```
1793
+ * ```rb
1794
1794
  * scanner = StringScanner.new('Fri Dec 12 1975 14:39')
1795
1795
  * scanner.size # => nil
1796
1796
  *
@@ -1824,7 +1824,7 @@ strscan_size(VALUE self)
1824
1824
  * Returns the array of [captured match values][13] at indexes `(1..)`
1825
1825
  * if the most recent match attempt succeeded, or `nil` otherwise:
1826
1826
  *
1827
- * ```
1827
+ * ```rb
1828
1828
  * scanner = StringScanner.new('Fri Dec 12 1975 14:39')
1829
1829
  * scanner.captures # => nil
1830
1830
  *
@@ -1879,7 +1879,7 @@ strscan_captures(VALUE self)
1879
1879
  * For each `specifier`, the returned substring is `[specifier]`;
1880
1880
  * see #[].
1881
1881
  *
1882
- * ```
1882
+ * ```rb
1883
1883
  * scanner = StringScanner.new('Fri Dec 12 1975 14:39')
1884
1884
  * pattern = /(?<wday>\w+) (?<month>\w+) (?<day>\d+) /
1885
1885
  * scanner.match?(pattern)
@@ -1919,7 +1919,7 @@ strscan_values_at(int argc, VALUE *argv, VALUE self)
1919
1919
  * or `nil` otherwise;
1920
1920
  * see [Basic Match Values][18]:
1921
1921
  *
1922
- * ```
1922
+ * ```rb
1923
1923
  * scanner = StringScanner.new('foobarbaz')
1924
1924
  * scanner.pre_match # => nil
1925
1925
  *
@@ -1956,7 +1956,7 @@ strscan_pre_match(VALUE self)
1956
1956
  * or `nil` otherwise;
1957
1957
  * see [Basic Match Values][18]:
1958
1958
  *
1959
- * ```
1959
+ * ```rb
1960
1960
  * scanner = StringScanner.new('foobarbaz')
1961
1961
  * scanner.post_match # => nil
1962
1962
  *
@@ -1991,7 +1991,7 @@ strscan_post_match(VALUE self)
1991
1991
  * Returns the 'rest' of the [stored string][1] (all after the current [position][2]),
1992
1992
  * which is the [target substring][3]:
1993
1993
  *
1994
- * ```
1994
+ * ```rb
1995
1995
  * scanner = StringScanner.new('foobarbaz')
1996
1996
  * scanner.rest # => "foobarbaz"
1997
1997
  * scanner.pos = 3
@@ -2022,7 +2022,7 @@ strscan_rest(VALUE self)
2022
2022
  *
2023
2023
  * Returns the size (in bytes) of the #rest of the [stored string][1]:
2024
2024
  *
2025
- * ```
2025
+ * ```rb
2026
2026
  * scanner = StringScanner.new('foobarbaz')
2027
2027
  * scanner.rest # => "foobarbaz"
2028
2028
  * scanner.rest_size # => 9
@@ -2081,7 +2081,7 @@ strscan_restsize(VALUE self)
2081
2081
  * 3. The substring preceding the current position.
2082
2082
  * 4. The substring following the current position (which is also the [target substring][3]).
2083
2083
  *
2084
- * ```
2084
+ * ```rb
2085
2085
  * scanner = StringScanner.new("Fri Dec 12 1975 14:39")
2086
2086
  * scanner.pos = 11
2087
2087
  * scanner.inspect # => "#<StringScanner 11/21 \"...c 12 \" @ \"1975 ...\">"
@@ -2089,14 +2089,14 @@ strscan_restsize(VALUE self)
2089
2089
  *
2090
2090
  * If at beginning-of-string, item 4 above (following substring) is omitted:
2091
2091
  *
2092
- * ```
2092
+ * ```rb
2093
2093
  * scanner.reset
2094
2094
  * scanner.inspect # => "#<StringScanner 0/21 @ \"Fri D...\">"
2095
2095
  * ```
2096
2096
  *
2097
2097
  * If at end-of-string, all items above are omitted:
2098
2098
  *
2099
- * ```
2099
+ * ```rb
2100
2100
  * scanner.terminate
2101
2101
  * scanner.inspect # => "#<StringScanner fin>"
2102
2102
  * ```
@@ -2224,7 +2224,7 @@ named_captures_iter(const OnigUChar *name,
2224
2224
  * if the most recent match attempt succeeded, or nil otherwise;
2225
2225
  * see [Captured Match Values][13]:
2226
2226
  *
2227
- * ```
2227
+ * ```rb
2228
2228
  * scanner = StringScanner.new('Fri Dec 12 1975 14:39')
2229
2229
  * scanner.named_captures # => {}
2230
2230
  *
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strscan
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Minero Aoki
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2024-12-12 00:00:00.000000000 Z
13
+ date: 2024-12-15 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: Provides lexical scanning operations on a String.
16
16
  email: