lib/rouge/lexers/rust.rb in rouge-2.0.7 vs lib/rouge/lexers/rust.rb in rouge-2.1.0

- old
+ new

@@ -56,21 +56,22 @@ state :start_line do mixin :whitespace rule /\s+/, Text rule /#\[/ do - token Comment::Preproc; push :attribute + token Name::Decorator; push :attribute end rule(//) { pop! } + rule /#\s[^\n]*/, Comment::Preproc end state :attribute do mixin :whitespace mixin :has_literals - rule /[(,)=]/, Comment::Preproc - rule /\]/, Comment::Preproc, :pop! - rule id, Comment::Preproc + rule /[(,)=]/, Name::Decorator + rule /\]/, Name::Decorator, :pop! + rule id, Name::Decorator end state :whitespace do rule /\s+/, Text rule %r(//[^\n]*), Comment @@ -84,11 +85,11 @@ mixin :has_literals rule %r([=-]>), Keyword rule %r(<->), Keyword rule /[()\[\]{}|,:;]/, Punctuation - rule /[*!@~&+%^<>=-\?]/, Operator + rule /[*!@~&+%^<>=-\?]|\.{2,3}/, Operator rule /([.]\s*)?#{id}(?=\s*[(])/m, Name::Function rule /[.]\s*#{id}/, Name::Property rule /(#{id})(::)/m do groups Name::Namespace, Punctuation @@ -96,9 +97,10 @@ # macros rule /\bmacro_rules!/, Name::Decorator, :macro_rules rule /#{id}!/, Name::Decorator, :macro + rule /'#{id}/, Name::Variable rule /#{id}/ do |m| name = m[0] if self.class.builtins.include? name token Name::Builtin else