1. Georg Brandl
  2. pygments-main
  3. Issues
Issue #860 resolved

Ruby namespacing operator not recognised

Tom Stuart
created an issue

The fix for #812 has the unfortunate side effect of breaking highlighting of Ruby’s :: namespacing operator:

pygments-main$ hg update 1813
pygments-main$ echo 'Net::HTTP' | ./pygmentize -l ruby -f raw
Token.Literal.String.Symbol u'Net'
Token.Punctuation           u':'
Token.Literal.String.Symbol u':HTTP'
Token.Text                  u'\n'

Here the reference to the Net::HTTP constant is being lexed as though it were the contents of the Ruby 1.9-style hash { Net: :HTTP }, i.e. with Net and :HTTP as symbols. That’s obviously not right; Net and HTTP are both constants, not symbols, and they’re separated by the :: operator, not : punctuation:

pygments-main$ hg update 1812
pygments-main$ echo 'Net::HTTP' | ./pygmentize -l ruby -f raw
Token.Name.Constant u'Net'
Token.Operator      u'::'
Token.Name.Constant u'HTTP'
Token.Text          u'\n'

Comments (1)

  1. Log in to comment