lib/rouge/lexers/apache.rb in rouge-3.18.0 vs lib/rouge/lexers/apache.rb in rouge-3.19.0
- old
+ new
@@ -10,18 +10,32 @@
tag 'apache'
mimetypes 'text/x-httpd-conf', 'text/x-apache-conf'
filenames '.htaccess', 'httpd.conf'
# self-modifying method that loads the keywords file
- def self.keywords
- load File.join(Lexers::BASE_DIR, 'apache/keywords.rb')
- keywords
+ def self.directives
+ Kernel::load File.join(Lexers::BASE_DIR, 'apache/keywords.rb')
+ directives
end
- def name_for_token(token, kwtype, tktype)
- if self.class.keywords[kwtype].include? token
+ def self.sections
+ Kernel::load File.join(Lexers::BASE_DIR, 'apache/keywords.rb')
+ sections
+ end
+
+ def self.values
+ Kernel::load File.join(Lexers::BASE_DIR, 'apache/keywords.rb')
+ values
+ end
+
+ def name_for_token(token, tktype)
+ if self.class.sections.include? token
tktype
+ elsif self.class.directives.include? token
+ tktype
+ elsif self.class.values.include? token
+ tktype
else
Text
end
end
@@ -32,16 +46,16 @@
state :root do
mixin :whitespace
rule %r/(<\/?)(\w+)/ do |m|
- groups Punctuation, name_for_token(m[2].downcase, :sections, Name::Label)
+ groups Punctuation, name_for_token(m[2].downcase, Name::Label)
push :section
end
rule %r/\w+/ do |m|
- token name_for_token(m[0].downcase, :directives, Name::Class)
+ token name_for_token(m[0].downcase, Name::Class)
push :directive
end
end
state :section do
@@ -59,10 +73,10 @@
rule %r/\r\n?|\n/, Text, :pop!
mixin :whitespace
rule %r/\S+/ do |m|
- token name_for_token(m[0], :values, Literal::String::Symbol)
+ token name_for_token(m[0].downcase, Literal::String::Symbol)
end
end
end
end
end