Skip to content
This repository has been archived by the owner on Sep 8, 2023. It is now read-only.

Commit

Permalink
Revert empty patterns in Ruby lexer (rouge-ruby#1624)
Browse files Browse the repository at this point in the history
The maintenance changes in rouge-ruby#1548 resulted in updates to two rules in
the Ruby lexer, one regarding regular expression flags and the other
regarding heredoc strings. However, these patterns should not have been
changed. The change in rouge-ruby#1548 was to prevent rules that matched an empty
string unless they contained a 'predicate' of some sort. Both rules in
the Ruby lexer contained such a predicate and so should not have been
changed. This commit fixes that error.
  • Loading branch information
pyrmont authored and mattt committed May 19, 2021
1 parent 4bac15a commit 651c229
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/rouge/lexers/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def self.detect?(text)
end

state :regex_flags do
rule %r/[mixounse]+/, Str::Regex, :pop!
rule %r/[mixounse]*/, Str::Regex, :pop!
end

# double-quoted string and symbol
Expand Down Expand Up @@ -267,7 +267,7 @@ def self.detect?(text)
end

state :test_heredoc do
rule %r/[^#\\\n]+$/ do |m|
rule %r/[^#\\\n]*$/ do |m|
tolerant, heredoc_name = @heredoc_queue.first
check = tolerant ? m[0].strip : m[0].rstrip

Expand Down

0 comments on commit 651c229

Please sign in to comment.