Skip to content

Commit

Permalink
Avoid multiple interpolations in regexpes and replace %r/./ by
Browse files Browse the repository at this point in the history
`%r/.+?(?=#{close})|.+/mo` to handle comments
  • Loading branch information
julp committed Aug 19, 2019
1 parent 99cc6f4 commit e5fcc3d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/rouge/lexers/eex.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@ def initialize(opts={})

rule open, Comment::Preproc, :elixir

rule %r/.+?(?=#{open})|.+/m do
rule %r/.+?(?=#{open})|.+/mo do
delegate parent
end
end

state :comment do
rule close, Comment, :pop!
rule %r/./, Comment
rule /.+?(?=#{close})|.+/mo, Comment
end

state :elixir do
rule close, Comment::Preproc, :pop!

rule %r/.+?(?=#{close})|.+/m do
rule %r/.+?(?=#{close})|.+/mo do
delegate @elixir_lexer
end
end
Expand Down

0 comments on commit e5fcc3d

Please sign in to comment.