Back to multiline regexes

This commit is contained in:
Roberto Alsina 2024-08-04 11:59:34 -03:00
parent 25b7097ee4
commit 12498624a2

View File

@ -225,7 +225,7 @@ module Tartrazine
matched = false matched = false
while pos < text.size while pos < text.size
state = states[@state_stack.last] state = states[@state_stack.last]
puts "Stack is #{@state_stack} State is #{state.name}, pos is #{pos}" puts "Stack is #{@state_stack} State is #{state.name}, pos is #{pos}, text is #{text[pos..pos+10]}"
p! state_stack.last, pos p! state_stack.last, pos
state.rules.each do |rule| state.rules.each do |rule|
matched, new_pos, new_tokens = rule.match(text, pos, self) matched, new_pos, new_tokens = rule.match(text, pos, self)
@ -295,7 +295,7 @@ module Tartrazine
begin begin
rule.pattern = Regex.new( rule.pattern = Regex.new(
rule_node["pattern"], rule_node["pattern"],
Regex::Options::ANCHORED #| Regex::Options::MULTILINE Regex::Options::ANCHORED | Regex::Options::MULTILINE
) )
state.rules << rule state.rules << rule
rescue ex : Exception rescue ex : Exception
@ -407,10 +407,10 @@ def collapse_tokens(tokens : Array(Tartrazine::Token))
end end
# test_file( test_file(
# "tests/qbasic/test_keywords_with_dollar.txt", "tests/properties/test_comments.txt",
# lexers["qbasic"]) lexers["properties"])
# exit 0 exit 0