lib/rouge/lexers/factor.rb in rouge-0.2.6 vs lib/rouge/lexers/factor.rb in rouge-0.2.7

- old
+ new

@@ -260,12 +260,19 @@ rule %r([-+/*=<>^](?=\s)), 'Operator' rule /(?:deprecated|final|foldable|flushable|inline|recursive)(?=\s)/, 'Keyword' - # words, to be postprocessed for builtins and things - rule /\S+/, 'Postprocess.Word' + rule /\S+/ do |m| + name = m[0] + + if self.class.builtins.values.any? { |b| b.include? name } + token 'Name.Builtin' + else + token 'Name' + end + end end state :stack_effect do rule /\s+/, 'Text' rule /\(/, 'Name.Function', :stack_effect @@ -283,19 +290,9 @@ state :import do rule /;(?=\s)/, 'Keyword', :pop! rule /\s+/, 'Text' rule /\S+/, 'Name.Namespace' - end - - postprocess 'Postprocess.Word' do |tok, val| - tok = if self.class.builtins.values.any? { |b| b.include? val } - 'Name.Builtin' - else - 'Name' - end - - token tok, val end end end end