Ruby namespacing operator not recognised

Tom Stuart avatarTom 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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.