lib/rouge/lexers/terraform.rb in rouge-3.4.1 vs lib/rouge/lexers/terraform.rb in rouge-3.5.0
- old
+ new
@@ -36,38 +36,38 @@
def self.builtins
@builtins ||= %w()
end
state :strings do
- rule /\\./, Str::Escape
- rule /\$\{/ do
+ rule %r/\\./, Str::Escape
+ rule %r/\$\{/ do
token Keyword
push :interpolation
end
end
state :dq do
- rule /[^\\"\$]+/, Str::Double
+ rule %r/[^\\"\$]+/, Str::Double
mixin :strings
- rule /"/, Str::Double, :pop!
+ rule %r/"/, Str::Double, :pop!
end
state :sq do
- rule /[^\\'\$]+/, Str::Single
+ rule %r/[^\\'\$]+/, Str::Single
mixin :strings
- rule /'/, Str::Single, :pop!
+ rule %r/'/, Str::Single, :pop!
end
state :heredoc do
- rule /\n/, Str::Heredoc, :heredoc_nl
- rule /[^$\n\$]+/, Str::Heredoc
- rule /[$]/, Str::Heredoc
+ rule %r/\n/, Str::Heredoc, :heredoc_nl
+ rule %r/[^$\n]+/, Str::Heredoc
+ rule %r/[$]/, Str::Heredoc
mixin :strings
end
state :interpolation do
- rule /\}/ do
+ rule %r/\}/ do
token Keyword
pop!
end
mixin :expression
@@ -75,15 +75,15 @@
id = /[$a-z_\-][a-z0-9_\-]*/io
state :expression do
mixin :primitives
- rule /\s+/, Text
+ rule %r/\s+/, Text
rule %r(\+\+ | -- | ~ | && | \|\| | \\(?=\n) | << | >>>? | == | != )x, Operator
rule %r([-<>+*%&|\^/!=?:]=?), Operator
- rule /[(\[,]/, Punctuation
- rule /[)\].]/, Punctuation
+ rule %r/[(\[,]/, Punctuation
+ rule %r/[)\].]/, Punctuation
rule id do |m|
if self.class.keywords.include? m[0]
token Keyword
elsif self.class.declarations.include? m[0]