Compare commits

..

2 Commits

Author SHA1 Message Date
ba50934005 Set more flags in regex 2024-08-08 08:37:23 -03:00
d293ec8d76 Set more flags in regex 2024-08-08 08:31:01 -03:00
2 changed files with 3 additions and 2 deletions

View File

@ -2,4 +2,4 @@ require "./**"
lexer = Tartrazine.lexer("crystal")
theme = Tartrazine.theme(ARGV[1])
puts Tartrazine::Ansi.new.format(File.read(ARGV[0]), lexer, theme)
puts Tartrazine::Html.new.format(File.read(ARGV[0]), lexer, theme)

View File

@ -97,7 +97,7 @@ module Tartrazine
class Re2 < Regex
@source = "fa"
@options = Regex::Options::None
@jit = true
@jit = true
def initialize(pattern : String, multiline = false, dotall = false, ignorecase = false, anchored = false)
flags = LibPCRE2::UTF | LibPCRE2::DUPNAMES |
@ -106,6 +106,7 @@ module Tartrazine
flags |= LibPCRE2::DOTALL if dotall
flags |= LibPCRE2::CASELESS if ignorecase
flags |= LibPCRE2::ANCHORED if anchored
flags |= LibPCRE2::NO_UTF_CHECK | LibPCRE2::JIT_PARTIAL_SOFT
@re = Regex::PCRE2.compile(pattern, flags) do |error_message|
raise Exception.new(error_message)
end