lib/rouge/lexers/java.rb in rouge-0.4.0 vs lib/rouge/lexers/java.rb in rouge-0.5.0

- old
+ new

@@ -27,48 +27,48 @@ ([a-zA-Z_][a-zA-Z0-9_]*) # method name (\s*)(\() # signature start )mx do |m| # TODO: do this better, this shouldn't need a delegation delegate Java, m[1] - token 'Name.Function', m[2] - token 'Text', m[3] - token 'Punctuation', m[4] + token Name::Function, m[2] + token Text, m[3] + token Punctuation, m[4] end - rule /\s+/, 'Text' - rule %r(//.*?$), 'Comment.Single' - rule %r(/\*.*?\*/)m, 'Comment.Multiline' - rule /@#{id}/, 'Name.Decorator' - rule /(?:#{keywords.join('|')})\b/, 'Keyword' - rule /(?:#{declarations.join('|')})\b/, 'Keyword.Declaration' - rule /(?:#{types.join('|')})/, 'Keyword.Type' - rule /package\b/, 'Keyword.Namespace' - rule /(?:true|false|null)\b/, 'Keyword.Constant' - rule /(?:class|interface)\b/, 'Keyword.Declaration', :class - rule /import\b/, 'Keyword.Namespace', :import - rule /"(\\\\|\\"|[^"])*"/, 'Literal.String' - rule /'(?:\\.|[^\\]|\\u[0-9a-f]{4})'/, 'Literal.String.Char' + rule /\s+/, Text + rule %r(//.*?$), Comment::Single + rule %r(/\*.*?\*/)m, Comment::Multiline + rule /@#{id}/, Name::Decorator + rule /(?:#{keywords.join('|')})\b/, Keyword + rule /(?:#{declarations.join('|')})\b/, Keyword::Declaration + rule /(?:#{types.join('|')})/, Keyword::Type + rule /package\b/, Keyword::Namespace + rule /(?:true|false|null)\b/, Keyword::Constant + rule /(?:class|interface)\b/, Keyword::Declaration, :class + rule /import\b/, Keyword::Namespace, :import + rule /"(\\\\|\\"|[^"])*"/, Str + rule /'(?:\\.|[^\\]|\\u[0-9a-f]{4})'/, Str::Char rule /(\.)(#{id})/ do - group 'Operator' - group 'Name.Attribute' + group Operator + group Name::Attribute end - rule /#{id}:/, 'Name.Label' - rule /\$?#{id}/, 'Name' - rule /[~^*!%&\[\](){}<>\|+=:;,.\/?-]/, 'Operator' - rule /[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?/, 'Literal.Number.Float' - rule /0x[0-9a-f]+/, 'Literal.Number.Hex' - rule /[0-9]+L?/, 'Literal.Number.Integer' - # rule /\n/, 'Text' + rule /#{id}:/, Name::Label + rule /\$?#{id}/, Name + rule /[~^*!%&\[\](){}<>\|+=:;,.\/?-]/, Operator + rule /[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?/, Num::Float + rule /0x[0-9a-f]+/, Num::Hex + rule /[0-9]+L?/, Num::Integer + # rule /\n/, Text end state :class do - rule /\s+/m, 'Text' - rule id, 'Name.Class', :pop! + rule /\s+/m, Text + rule id, Name::Class, :pop! end state :import do - rule /\s+/m, 'Text' - rule /[a-z0-9_.]+\*?/i, 'Name.Namespace', :pop! + rule /\s+/m, Text + rule /[a-z0-9_.]+\*?/i, Name::Namespace, :pop! end end end end