mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-11-10 05:22:23 +00:00
Minor cleanup
This commit is contained in:
parent
b589726352
commit
cb09dff9f1
@ -3,7 +3,7 @@ module BytesRegex
|
|||||||
|
|
||||||
class Regex
|
class Regex
|
||||||
def initialize(pattern : String, multiline = false, dotall = false, ignorecase = false, anchored = false)
|
def initialize(pattern : String, multiline = false, dotall = false, ignorecase = false, anchored = false)
|
||||||
flags = LibPCRE2::UTF | LibPCRE2::DUPNAMES | LibPCRE2::UCP | LibPCRE2::NO_UTF_CHECK
|
flags = LibPCRE2::UTF | LibPCRE2::UCP | LibPCRE2::NO_UTF_CHECK
|
||||||
flags |= LibPCRE2::MULTILINE if multiline
|
flags |= LibPCRE2::MULTILINE if multiline
|
||||||
flags |= LibPCRE2::DOTALL if dotall
|
flags |= LibPCRE2::DOTALL if dotall
|
||||||
flags |= LibPCRE2::CASELESS if ignorecase
|
flags |= LibPCRE2::CASELESS if ignorecase
|
||||||
@ -40,9 +40,7 @@ module BytesRegex
|
|||||||
LibPCRE2::NO_UTF_CHECK,
|
LibPCRE2::NO_UTF_CHECK,
|
||||||
@match_data,
|
@match_data,
|
||||||
nil)
|
nil)
|
||||||
if rc < 0
|
if rc > 0
|
||||||
# No match, do nothing
|
|
||||||
else
|
|
||||||
ovector = LibPCRE2.get_ovector_pointer(@match_data)
|
ovector = LibPCRE2.get_ovector_pointer(@match_data)
|
||||||
(0...rc).each do |i|
|
(0...rc).each do |i|
|
||||||
m_start = ovector[2 * i]
|
m_start = ovector[2 * i]
|
||||||
|
Loading…
Reference in New Issue
Block a user