regexp_parser 2.11.0 → 2.11.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.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/Rakefile +5 -3
- data/lib/regexp_parser/error.rb +2 -0
- data/lib/regexp_parser/expression/base.rb +2 -0
- data/lib/regexp_parser/expression/classes/alternation.rb +2 -0
- data/lib/regexp_parser/expression/classes/anchor.rb +2 -0
- data/lib/regexp_parser/expression/classes/backreference.rb +2 -0
- data/lib/regexp_parser/expression/classes/character_set/intersection.rb +2 -0
- data/lib/regexp_parser/expression/classes/character_set/range.rb +2 -0
- data/lib/regexp_parser/expression/classes/character_set.rb +2 -0
- data/lib/regexp_parser/expression/classes/character_type.rb +2 -0
- data/lib/regexp_parser/expression/classes/conditional.rb +2 -0
- data/lib/regexp_parser/expression/classes/escape_sequence.rb +2 -0
- data/lib/regexp_parser/expression/classes/free_space.rb +2 -0
- data/lib/regexp_parser/expression/classes/group.rb +2 -0
- data/lib/regexp_parser/expression/classes/keep.rb +2 -0
- data/lib/regexp_parser/expression/classes/literal.rb +2 -0
- data/lib/regexp_parser/expression/classes/posix_class.rb +2 -0
- data/lib/regexp_parser/expression/classes/root.rb +2 -0
- data/lib/regexp_parser/expression/classes/unicode_property.rb +2 -0
- data/lib/regexp_parser/expression/methods/construct.rb +2 -0
- data/lib/regexp_parser/expression/methods/escape_sequence_char.rb +2 -0
- data/lib/regexp_parser/expression/methods/escape_sequence_codepoint.rb +2 -0
- data/lib/regexp_parser/expression/methods/human_name.rb +2 -0
- data/lib/regexp_parser/expression/methods/match.rb +2 -0
- data/lib/regexp_parser/expression/methods/match_length.rb +2 -0
- data/lib/regexp_parser/expression/methods/negative.rb +2 -0
- data/lib/regexp_parser/expression/methods/options.rb +2 -0
- data/lib/regexp_parser/expression/methods/parts.rb +2 -0
- data/lib/regexp_parser/expression/methods/printing.rb +2 -0
- data/lib/regexp_parser/expression/methods/referenced_expressions.rb +2 -0
- data/lib/regexp_parser/expression/methods/strfregexp.rb +2 -0
- data/lib/regexp_parser/expression/methods/tests.rb +2 -0
- data/lib/regexp_parser/expression/methods/traverse.rb +2 -0
- data/lib/regexp_parser/expression/quantifier.rb +3 -1
- data/lib/regexp_parser/expression/sequence.rb +2 -0
- data/lib/regexp_parser/expression/sequence_operation.rb +2 -0
- data/lib/regexp_parser/expression/shared.rb +6 -3
- data/lib/regexp_parser/expression/subexpression.rb +2 -0
- data/lib/regexp_parser/expression.rb +2 -0
- data/lib/regexp_parser/lexer.rb +2 -0
- data/lib/regexp_parser/parser.rb +2 -0
- data/lib/regexp_parser/scanner/errors/premature_end_error.rb +2 -0
- data/lib/regexp_parser/scanner/errors/scanner_error.rb +2 -0
- data/lib/regexp_parser/scanner/errors/validation_error.rb +2 -0
- data/lib/regexp_parser/scanner/properties/long.csv +19 -0
- data/lib/regexp_parser/scanner/properties/short.csv +8 -0
- data/lib/regexp_parser/scanner/scanner.rl +15 -6
- data/lib/regexp_parser/scanner.rb +17 -8
- data/lib/regexp_parser/syntax/any.rb +2 -0
- data/lib/regexp_parser/syntax/base.rb +2 -0
- data/lib/regexp_parser/syntax/token/anchor.rb +5 -3
- data/lib/regexp_parser/syntax/token/assertion.rb +4 -2
- data/lib/regexp_parser/syntax/token/backreference.rb +8 -6
- data/lib/regexp_parser/syntax/token/character_set.rb +3 -1
- data/lib/regexp_parser/syntax/token/character_type.rb +6 -4
- data/lib/regexp_parser/syntax/token/conditional.rb +5 -3
- data/lib/regexp_parser/syntax/token/escape.rb +9 -7
- data/lib/regexp_parser/syntax/token/group.rb +8 -6
- data/lib/regexp_parser/syntax/token/keep.rb +3 -1
- data/lib/regexp_parser/syntax/token/meta.rb +4 -2
- data/lib/regexp_parser/syntax/token/posix_class.rb +4 -2
- data/lib/regexp_parser/syntax/token/quantifier.rb +8 -6
- data/lib/regexp_parser/syntax/token/unicode_property.rb +62 -47
- data/lib/regexp_parser/syntax/token/virtual.rb +5 -3
- data/lib/regexp_parser/syntax/token.rb +5 -3
- data/lib/regexp_parser/syntax/version_lookup.rb +4 -2
- data/lib/regexp_parser/syntax/versions/1.8.6.rb +2 -0
- data/lib/regexp_parser/syntax/versions/1.9.1.rb +2 -0
- data/lib/regexp_parser/syntax/versions/1.9.3.rb +2 -0
- data/lib/regexp_parser/syntax/versions/2.0.0.rb +2 -0
- data/lib/regexp_parser/syntax/versions/2.2.0.rb +2 -0
- data/lib/regexp_parser/syntax/versions/2.3.0.rb +2 -0
- data/lib/regexp_parser/syntax/versions/2.4.0.rb +2 -0
- data/lib/regexp_parser/syntax/versions/2.4.1.rb +2 -0
- data/lib/regexp_parser/syntax/versions/2.5.0.rb +2 -0
- data/lib/regexp_parser/syntax/versions/2.6.0.rb +2 -0
- data/lib/regexp_parser/syntax/versions/2.6.2.rb +2 -0
- data/lib/regexp_parser/syntax/versions/2.6.3.rb +2 -0
- data/lib/regexp_parser/syntax/versions/3.1.0.rb +2 -0
- data/lib/regexp_parser/syntax/versions/3.2.0.rb +2 -0
- data/lib/regexp_parser/syntax/versions/3.5.0.rb +4 -0
- data/lib/regexp_parser/syntax/versions.rb +2 -0
- data/lib/regexp_parser/syntax.rb +2 -0
- data/lib/regexp_parser/token.rb +2 -0
- data/lib/regexp_parser/version.rb +3 -1
- data/lib/regexp_parser.rb +2 -0
- data/regexp_parser.gemspec +2 -0
- metadata +4 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a040acf8a74a8fba3bb10e289258195ecfbd78a0708da8757230fc6d6e9fe23
|
4
|
+
data.tar.gz: 2c444d8dcb5f24d752e00eca09adb0c2c9b1f4612accf3356b923b19c47cae57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57021cd49ca2c5db4b62de77b6e929e717f44520eeff6d39a195f15b8a5b2e9bdb98eb74e849465dd2648a24a2c8c0102c38b9f938b41bc4ca40059925d038c4
|
7
|
+
data.tar.gz: 0e03ce414e29548f4923c98396262297f61260a1960b9849ffb24ed6da32788fd728cc42e0949b176fa9e1404790d4b3f788219f345607c187f81c0b9352ea3c
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'bundler'
|
2
4
|
require 'rubygems'
|
3
5
|
require 'rubygems/package_task'
|
@@ -14,10 +16,10 @@ RSpec::Core::RakeTask.new(:spec)
|
|
14
16
|
task :default => [:'test:full']
|
15
17
|
|
16
18
|
namespace :test do
|
17
|
-
task full: [:
|
19
|
+
task full: [:ragel, :spec]
|
18
20
|
end
|
19
21
|
|
20
22
|
# Add ragel task as a prerequisite for building the gem to ensure that the
|
21
23
|
# latest scanner code is generated and included in the build.
|
22
|
-
desc "Runs ragel
|
23
|
-
task :
|
24
|
+
desc "Runs ragel before building the gem"
|
25
|
+
task build: :ragel
|
data/lib/regexp_parser/error.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Regexp::Expression
|
2
4
|
# TODO: in v3.0.0, maybe put Shared back into Base, and inherit from Base and
|
3
5
|
# call super in #initialize, but raise in #quantifier= and #quantify,
|
@@ -6,7 +8,7 @@ module Regexp::Expression
|
|
6
8
|
class Quantifier
|
7
9
|
include Regexp::Expression::Shared
|
8
10
|
|
9
|
-
MODES = %i[greedy possessive reluctant]
|
11
|
+
MODES = %i[greedy possessive reluctant].freeze
|
10
12
|
|
11
13
|
def initialize(*args)
|
12
14
|
deprecated_old_init(*args) and return if args.count == 4 || args.count == 5
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Regexp::Expression
|
2
4
|
module Shared
|
3
5
|
module ClassMethods; end # filled in ./methods/*.rb
|
@@ -70,11 +72,12 @@ module Regexp::Expression
|
|
70
72
|
# lit.to_s(:original) # => 'a +' # with quantifier AND intermittent decorations
|
71
73
|
#
|
72
74
|
def to_s(format = :full)
|
73
|
-
base =
|
75
|
+
base = ''.dup
|
76
|
+
parts.each do |part|
|
74
77
|
if part.instance_of?(String)
|
75
|
-
|
78
|
+
base << part
|
76
79
|
elsif !part.custom_to_s_handling
|
77
|
-
|
80
|
+
base << part.to_s(:original)
|
78
81
|
end
|
79
82
|
end
|
80
83
|
"#{base}#{pre_quantifier_decoration(format)}#{quantifier_affix(format)}"
|
data/lib/regexp_parser/lexer.rb
CHANGED
data/lib/regexp_parser/parser.rb
CHANGED
@@ -9,6 +9,7 @@ age=13.0,age=13.0
|
|
9
9
|
age=14.0,age=14.0
|
10
10
|
age=15.0,age=15.0
|
11
11
|
age=15.1,age=15.1
|
12
|
+
age=16.0,age=16.0
|
12
13
|
age=2.0,age=2.0
|
13
14
|
age=2.1,age=2.1
|
14
15
|
age=3.0,age=3.0
|
@@ -103,6 +104,7 @@ extendedpictographic,extended_pictographic
|
|
103
104
|
extender,extender
|
104
105
|
finalpunctuation,final_punctuation
|
105
106
|
format,format
|
107
|
+
garay,garay
|
106
108
|
georgian,georgian
|
107
109
|
glagolitic,glagolitic
|
108
110
|
gothic,gothic
|
@@ -128,6 +130,7 @@ greek,greek
|
|
128
130
|
gujarati,gujarati
|
129
131
|
gunjalagondi,gunjala_gondi
|
130
132
|
gurmukhi,gurmukhi
|
133
|
+
gurungkhema,gurung_khema
|
131
134
|
han,han
|
132
135
|
hangul,hangul
|
133
136
|
hanifirohingya,hanifi_rohingya
|
@@ -241,6 +244,7 @@ induployan,in_duployan
|
|
241
244
|
inearlydynasticcuneiform,in_early_dynastic_cuneiform
|
242
245
|
inegyptianhieroglyphformatcontrols,in_egyptian_hieroglyph_format_controls
|
243
246
|
inegyptianhieroglyphs,in_egyptian_hieroglyphs
|
247
|
+
inegyptianhieroglyphsextendeda,in_egyptian_hieroglyphs_extended_a
|
244
248
|
inelbasan,in_elbasan
|
245
249
|
inelymaic,in_elymaic
|
246
250
|
inemoticons,in_emoticons
|
@@ -253,6 +257,7 @@ inethiopicextended,in_ethiopic_extended
|
|
253
257
|
inethiopicextendeda,in_ethiopic_extended_a
|
254
258
|
inethiopicextendedb,in_ethiopic_extended_b
|
255
259
|
inethiopicsupplement,in_ethiopic_supplement
|
260
|
+
ingaray,in_garay
|
256
261
|
ingeneralpunctuation,in_general_punctuation
|
257
262
|
ingeometricshapes,in_geometric_shapes
|
258
263
|
ingeometricshapesextended,in_geometric_shapes_extended
|
@@ -268,6 +273,7 @@ ingreekextended,in_greek_extended
|
|
268
273
|
ingujarati,in_gujarati
|
269
274
|
ingunjalagondi,in_gunjala_gondi
|
270
275
|
ingurmukhi,in_gurmukhi
|
276
|
+
ingurungkhema,in_gurung_khema
|
271
277
|
inhalfwidthandfullwidthforms,in_halfwidth_and_fullwidth_forms
|
272
278
|
inhangulcompatibilityjamo,in_hangul_compatibility_jamo
|
273
279
|
inhanguljamo,in_hangul_jamo
|
@@ -309,6 +315,7 @@ inkhmer,in_khmer
|
|
309
315
|
inkhmersymbols,in_khmer_symbols
|
310
316
|
inkhojki,in_khojki
|
311
317
|
inkhudawadi,in_khudawadi
|
318
|
+
inkiratrai,in_kirat_rai
|
312
319
|
inlao,in_lao
|
313
320
|
inlatin1supplement,in_latin_1_supplement
|
314
321
|
inlatinextendeda,in_latin_extended_a
|
@@ -364,6 +371,7 @@ inmusicalsymbols,in_musical_symbols
|
|
364
371
|
inmyanmar,in_myanmar
|
365
372
|
inmyanmarextendeda,in_myanmar_extended_a
|
366
373
|
inmyanmarextendedb,in_myanmar_extended_b
|
374
|
+
inmyanmarextendedc,in_myanmar_extended_c
|
367
375
|
innabataean,in_nabataean
|
368
376
|
innagmundari,in_nag_mundari
|
369
377
|
innandinagari,in_nandinagari
|
@@ -385,6 +393,7 @@ inoldsogdian,in_old_sogdian
|
|
385
393
|
inoldsoutharabian,in_old_south_arabian
|
386
394
|
inoldturkic,in_old_turkic
|
387
395
|
inolduyghur,in_old_uyghur
|
396
|
+
inolonal,in_ol_onal
|
388
397
|
inopticalcharacterrecognition,in_optical_character_recognition
|
389
398
|
inoriya,in_oriya
|
390
399
|
inornamentaldingbats,in_ornamental_dingbats
|
@@ -424,6 +433,7 @@ inspacingmodifierletters,in_spacing_modifier_letters
|
|
424
433
|
inspecials,in_specials
|
425
434
|
insundanese,in_sundanese
|
426
435
|
insundanesesupplement,in_sundanese_supplement
|
436
|
+
insunuwar,in_sunuwar
|
427
437
|
insuperscriptsandsubscripts,in_superscripts_and_subscripts
|
428
438
|
insupplementalarrowsa,in_supplemental_arrows_a
|
429
439
|
insupplementalarrowsb,in_supplemental_arrows_b
|
@@ -437,6 +447,7 @@ insuttonsignwriting,in_sutton_signwriting
|
|
437
447
|
insylotinagri,in_syloti_nagri
|
438
448
|
insymbolsandpictographsextendeda,in_symbols_and_pictographs_extended_a
|
439
449
|
insymbolsforlegacycomputing,in_symbols_for_legacy_computing
|
450
|
+
insymbolsforlegacycomputingsupplement,in_symbols_for_legacy_computing_supplement
|
440
451
|
insyriac,in_syriac
|
441
452
|
insyriacsupplement,in_syriac_supplement
|
442
453
|
intagalog,in_tagalog
|
@@ -459,8 +470,10 @@ inthai,in_thai
|
|
459
470
|
intibetan,in_tibetan
|
460
471
|
intifinagh,in_tifinagh
|
461
472
|
intirhuta,in_tirhuta
|
473
|
+
intodhri,in_todhri
|
462
474
|
intoto,in_toto
|
463
475
|
intransportandmapsymbols,in_transport_and_map_symbols
|
476
|
+
intulutigalari,in_tulu_tigalari
|
464
477
|
inugaritic,in_ugaritic
|
465
478
|
inunifiedcanadianaboriginalsyllabics,in_unified_canadian_aboriginal_syllabics
|
466
479
|
inunifiedcanadianaboriginalsyllabicsextended,in_unified_canadian_aboriginal_syllabics_extended
|
@@ -491,6 +504,7 @@ khitansmallscript,khitan_small_script
|
|
491
504
|
khmer,khmer
|
492
505
|
khojki,khojki
|
493
506
|
khudawadi,khudawadi
|
507
|
+
kiratrai,kirat_rai
|
494
508
|
lao,lao
|
495
509
|
latin,latin
|
496
510
|
lepcha,lepcha
|
@@ -524,6 +538,7 @@ meroiticcursive,meroitic_cursive
|
|
524
538
|
meroitichieroglyphs,meroitic_hieroglyphs
|
525
539
|
miao,miao
|
526
540
|
modi,modi
|
541
|
+
modifiercombiningmark,modifier_combining_mark
|
527
542
|
modifierletter,modifier_letter
|
528
543
|
modifiersymbol,modifier_symbol
|
529
544
|
mongolian,mongolian
|
@@ -553,6 +568,7 @@ oldsogdian,old_sogdian
|
|
553
568
|
oldsoutharabian,old_south_arabian
|
554
569
|
oldturkic,old_turkic
|
555
570
|
olduyghur,old_uyghur
|
571
|
+
olonal,ol_onal
|
556
572
|
openpunctuation,open_punctuation
|
557
573
|
oriya,oriya
|
558
574
|
osage,osage
|
@@ -606,6 +622,7 @@ space,space
|
|
606
622
|
spaceseparator,space_separator
|
607
623
|
spacingmark,spacing_mark
|
608
624
|
sundanese,sundanese
|
625
|
+
sunuwar,sunuwar
|
609
626
|
surrogate,surrogate
|
610
627
|
sylotinagri,syloti_nagri
|
611
628
|
symbol,symbol
|
@@ -627,7 +644,9 @@ tibetan,tibetan
|
|
627
644
|
tifinagh,tifinagh
|
628
645
|
tirhuta,tirhuta
|
629
646
|
titlecaseletter,titlecase_letter
|
647
|
+
todhri,todhri
|
630
648
|
toto,toto
|
649
|
+
tulutigalari,tulu_tigalari
|
631
650
|
ugaritic,ugaritic
|
632
651
|
unassigned,unassigned
|
633
652
|
unifiedideograph,unified_ideograph
|
@@ -58,6 +58,7 @@ epres,emoji_presentation
|
|
58
58
|
ethi,ethiopic
|
59
59
|
ext,extender
|
60
60
|
extpict,extended_pictographic
|
61
|
+
gara,garay
|
61
62
|
geor,georgian
|
62
63
|
glag,glagolitic
|
63
64
|
gong,gunjala_gondi
|
@@ -69,6 +70,7 @@ grek,greek
|
|
69
70
|
grext,grapheme_extend
|
70
71
|
grlink,grapheme_link
|
71
72
|
gujr,gujarati
|
73
|
+
gukh,gurung_khema
|
72
74
|
guru,gurmukhi
|
73
75
|
hang,hangul
|
74
76
|
hani,han
|
@@ -97,6 +99,7 @@ khmr,khmer
|
|
97
99
|
khoj,khojki
|
98
100
|
kits,khitan_small_script
|
99
101
|
knda,kannada
|
102
|
+
krai,kirat_rai
|
100
103
|
kthi,kaithi
|
101
104
|
l,letter
|
102
105
|
lana,tai_tham
|
@@ -122,6 +125,7 @@ mand,mandaic
|
|
122
125
|
mani,manichaean
|
123
126
|
marc,marchen
|
124
127
|
mc,spacing_mark
|
128
|
+
mcm,modifier_combining_mark
|
125
129
|
me,enclosing_mark
|
126
130
|
medf,medefaidrin
|
127
131
|
mend,mende_kikakui
|
@@ -154,6 +158,7 @@ oids,other_id_start
|
|
154
158
|
olck,ol_chiki
|
155
159
|
olower,other_lowercase
|
156
160
|
omath,other_math
|
161
|
+
onao,ol_onal
|
157
162
|
orkh,old_turkic
|
158
163
|
orya,oriya
|
159
164
|
osge,osage
|
@@ -208,6 +213,7 @@ sora,sora_sompeng
|
|
208
213
|
soyo,soyombo
|
209
214
|
sterm,sentence_terminal
|
210
215
|
sund,sundanese
|
216
|
+
sunu,sunuwar
|
211
217
|
sylo,syloti_nagri
|
212
218
|
syrc,syriac
|
213
219
|
tagb,tagbanwa
|
@@ -225,6 +231,8 @@ thaa,thaana
|
|
225
231
|
tibt,tibetan
|
226
232
|
tirh,tirhuta
|
227
233
|
tnsa,tangsa
|
234
|
+
todr,todhri
|
235
|
+
tutg,tulu_tigalari
|
228
236
|
ugar,ugaritic
|
229
237
|
uideo,unified_ideograph
|
230
238
|
vaii,vai
|
@@ -263,7 +263,7 @@
|
|
263
263
|
# If not enough groups have been opened, there is a fallback to either an
|
264
264
|
# octal or literal interpretation for 2+ digit numerical escapes.
|
265
265
|
digits = text[1..-1]
|
266
|
-
if digits.size == 1 || digits.to_i <=
|
266
|
+
if digits.size == 1 || digits.to_i <= capturing_group_count
|
267
267
|
emit(:backref, :number, text)
|
268
268
|
elsif digits =~ /\A[0-7]{2,}\z/
|
269
269
|
emit(:escape, :octal, text)
|
@@ -537,7 +537,7 @@
|
|
537
537
|
};
|
538
538
|
|
539
539
|
group_open @group_opened {
|
540
|
-
self.capturing_group_count
|
540
|
+
self.capturing_group_count = capturing_group_count + 1
|
541
541
|
text = copy(data, ts, te)
|
542
542
|
emit(:group, :capture, text)
|
543
543
|
};
|
@@ -686,7 +686,7 @@ class Regexp::Scanner
|
|
686
686
|
|
687
687
|
input = input_object.is_a?(Regexp) ? input_object.source : input_object
|
688
688
|
self.free_spacing = free_spacing?(input_object, options)
|
689
|
-
self.regexp_encoding = input_object
|
689
|
+
self.regexp_encoding = extract_encoding(input_object, options)
|
690
690
|
self.spacing_stack = [{:free_spacing => free_spacing, :depth => 0}]
|
691
691
|
|
692
692
|
data = input.unpack("c*")
|
@@ -737,9 +737,11 @@ class Regexp::Scanner
|
|
737
737
|
File.read("#{__dir__}/scanner/properties/#{name}.csv").scan(/(.+),(.+)/).to_h
|
738
738
|
end
|
739
739
|
|
740
|
+
# Use each_with_object for required_ruby_version >= 2.2, or #to_h for >= 2.6
|
740
741
|
POSIX_CLASSES =
|
741
742
|
%w[alnum alpha ascii blank cntrl digit graph
|
742
|
-
lower print punct space upper word xdigit]
|
743
|
+
lower print punct space upper word xdigit]
|
744
|
+
.inject({}) { |o, e| o.merge(e => true) }.freeze
|
743
745
|
|
744
746
|
# Emits an array with the details of the scanned pattern
|
745
747
|
def emit(type, token, text)
|
@@ -767,7 +769,7 @@ class Regexp::Scanner
|
|
767
769
|
end
|
768
770
|
end
|
769
771
|
|
770
|
-
attr_accessor :literal_run # only public for #||= to work on ruby <= 2.5
|
772
|
+
attr_accessor :capturing_group_count, :literal_run # only public for #||= to work on ruby <= 2.5
|
771
773
|
|
772
774
|
private
|
773
775
|
|
@@ -776,9 +778,16 @@ class Regexp::Scanner
|
|
776
778
|
:free_spacing, :spacing_stack,
|
777
779
|
:regexp_encoding,
|
778
780
|
:group_depth, :set_depth, :conditional_stack,
|
779
|
-
:capturing_group_count,
|
780
781
|
:char_pos
|
781
782
|
|
783
|
+
def extract_encoding(input_object, options)
|
784
|
+
if input_object.is_a?(::Regexp)
|
785
|
+
input_object.encoding
|
786
|
+
elsif options && (options & Regexp::NOENCODING)
|
787
|
+
Encoding::BINARY
|
788
|
+
end
|
789
|
+
end
|
790
|
+
|
782
791
|
def free_spacing?(input_object, options)
|
783
792
|
if options && !input_object.is_a?(String)
|
784
793
|
raise ArgumentError, 'options cannot be supplied unless scanning a String'
|