lib/rouge/lexers/smarty.rb in rouge-3.4.1 vs lib/rouge/lexers/smarty.rb in rouge-3.5.0

- old
+ new

@@ -31,13 +31,13 @@ state :root do rule(/\{\s+/) { delegate parent } # block comments - rule /\{\*.*?\*\}/m, Comment + rule %r/\{\*.*?\*\}/m, Comment - rule /\{\/?(?![\s*])/ do + rule %r/\{\/?(?![\s*])/ do token Keyword push :smarty end @@ -51,24 +51,24 @@ rule(/[^{}]+/m) { token Comment } end state :smarty do # allow nested tags - rule /\{\/?(?![\s*])/ do + rule %r/\{\/?(?![\s*])/ do token Keyword push :smarty end - rule /}/, Keyword, :pop! - rule /\s+/m, Text + rule %r/}/, Keyword, :pop! + rule %r/\s+/m, Text rule %r([~!%^&*()+=|\[\]:;,.<>/@?-]), Operator - rule /#[a-zA-Z_]\w*#/, Name::Variable - rule /\$[a-zA-Z_]\w*(\.\w+)*/, Name::Variable - rule /(true|false|null)\b/, Keyword::Constant - rule /[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?/, Num - rule /"(\\.|.)*?"/, Str::Double - rule /'(\\.|.)*?'/, Str::Single - rule /([a-zA-Z_]\w*)/ do |m| + rule %r/#[a-zA-Z_]\w*#/, Name::Variable + rule %r/\$[a-zA-Z_]\w*(\.\w+)*/, Name::Variable + rule %r/(true|false|null)\b/, Keyword::Constant + rule %r/[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?/, Num + rule %r/"(\\.|.)*?"/, Str::Double + rule %r/'(\\.|.)*?'/, Str::Single + rule %r/([a-zA-Z_]\w*)/ do |m| if self.class.builtins.include? m[0] token Name::Builtin else token Name::Attribute end