lib/rouge/lexers/gherkin.rb in rouge-3.4.1 vs lib/rouge/lexers/gherkin.rb in rouge-3.5.0
- old
+ new
@@ -17,11 +17,11 @@
return true if text.shebang? 'cucumber'
end
# self-modifying method that loads the keywords file
def self.keywords
- load Pathname.new(__FILE__).dirname.join('gherkin/keywords.rb')
+ load File.join(__dir__, 'gherkin/keywords.rb')
keywords
end
def self.step_regex
# in Gherkin's config, keywords that end in < don't
@@ -39,11 +39,11 @@
rest_of_line = /.*?(?=[#\n])/
state :basic do
rule %r(#.*$), Comment
- rule /[ \r\t]+/, Text
+ rule %r/[ \r\t]+/, Text
end
state :root do
mixin :basic
rule %r(\n), Text
@@ -83,55 +83,55 @@
state :has_table do
rule(/(?=[|])/) { push :table_header }
end
state :table_header do
- rule /[^|\s]+/, Name::Variable
- rule /\n/ do
+ rule %r/[^|\s]+/, Name::Variable
+ rule %r/\n/ do
token Text
goto :table
end
mixin :table
end
state :table do
mixin :basic
- rule /\n/, Text, :table_bol
- rule /[|]/, Punctuation
- rule /[^|\s]+/, Name
+ rule %r/\n/, Text, :table_bol
+ rule %r/[|]/, Punctuation
+ rule %r/[^|\s]+/, Name
end
state :table_bol do
rule(/(?=\s*[^\s|])/) { reset_stack }
rule(//) { pop! }
end
state :description do
mixin :basic
mixin :has_examples
- rule /\n/, Text
+ rule %r/\n/, Text
rule rest_of_line, Text
end
state :feature_description do
mixin :basic
mixin :has_scenarios
- rule /\n/, Text
+ rule %r/\n/, Text
rule rest_of_line, Text
end
state :example_description do
mixin :basic
mixin :has_table
- rule /\n/, Text
+ rule %r/\n/, Text
rule rest_of_line, Text
end
state :step do
mixin :basic
- rule /<.*?>/, Name::Variable
- rule /".*?"/, Str
- rule /\S+/, Text
+ rule %r/<.*?>/, Name::Variable
+ rule %r/".*?"/, Str
+ rule %r/\S+/, Text
rule rest_of_line, Text, :pop!
end
end
end
end