lib/rouge/lexers/tcl.rb in rouge-4.2.1 vs lib/rouge/lexers/tcl.rb in rouge-4.3.0
- old
+ new
@@ -55,14 +55,14 @@
rule %r/#{NOT_CHARS[END_WORD]}+?(?=#{CHARS[OPEN+['\\\\']]})/, Text
end
def self.gen_command_state(name='')
state(:"command#{name}") do
+ rule %r/#/, Comment, :comment
+
mixin :word
- rule %r/##{NOT_CHARS[END_LINE]}+/, Comment::Single
-
rule %r/(?=#{CHARS[END_WORD]})/ do
push :"params#{name}"
end
rule %r/#{NOT_CHARS[END_WORD]}+/ do |m|
@@ -159,9 +159,14 @@
# escape sequences
rule %r/\\[0-7]{3}/, Str::Escape
rule %r/\\x[0-9a-f]{2}/i, Str::Escape
rule %r/\\u[0-9a-f]{4}/i, Str::Escape
rule %r/\\./m, Str::Escape
+ end
+
+ state :comment do
+ rule %r/.*[^\\]\n/, Comment, :pop!
+ rule %r/.*\\\n/, Comment
end
state :string do
rule %r/"/, Str::Double, :pop!
mixin :interp