lib/rouge/lexers/apache.rb in rouge-3.4.1 vs lib/rouge/lexers/apache.rb in rouge-3.5.0
- old
+ new
@@ -13,11 +13,11 @@
class << self
attr_reader :keywords
end
# Load Apache keywords from separate YML file
- @keywords = ::YAML.load_file(Pathname.new(__FILE__).dirname.join('apache/keywords.yml')).tap do |h|
+ @keywords = ::YAML.load_file(File.join(__dir__, 'apache/keywords.yml')).tap do |h|
h.each do |k,v|
h[k] = Set.new v
end
end
@@ -28,44 +28,44 @@
Text
end
end
state :whitespace do
- rule /\#.*/, Comment
- rule /\s+/m, Text
+ rule %r/\#.*/, Comment
+ rule %r/\s+/m, Text
end
state :root do
mixin :whitespace
- rule /(<\/?)(\w+)/ do |m|
+ rule %r/(<\/?)(\w+)/ do |m|
groups Punctuation, name_for_token(m[2].downcase, :sections, Name::Label)
push :section
end
- rule /\w+/ do |m|
+ rule %r/\w+/ do |m|
token name_for_token(m[0].downcase, :directives, Name::Class)
push :directive
end
end
state :section do
# Match section arguments
- rule /([^>]+)?(>(?:\r\n?|\n)?)/ do |m|
+ rule %r/([^>]+)?(>(?:\r\n?|\n)?)/ do |m|
groups Literal::String::Regex, Punctuation
pop!
end
mixin :whitespace
end
state :directive do
# Match value literals and other directive arguments
- rule /\r\n?|\n/, Text, :pop!
+ rule %r/\r\n?|\n/, Text, :pop!
mixin :whitespace
- rule /\S+/ do |m|
+ rule %r/\S+/ do |m|
token name_for_token(m[0], :values, Literal::String::Symbol)
end
end
end
end