PrismJS / PrismJS/prism

Prism C++ incorrectly colors overloaded operator< and operator> in sequence

Open
#3,686 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
13k
Forks
1.4k
Avg merge
15h 36m
Merged PRs (30d)
3

Description

Repro steps:

bool operator< (const Foo& f1, const Foo& f2)
{
    return f1.foo < f2.foo;
}

bool operator> (const Foo& f1, const Foo& f2)
{
    return f1.foo > f2.foo;
}

Note that foo < f2.foo from the top function and the > in operator> in the bottom function are the wrong color.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open the C++ example in prismjs.com/test.html and reproduce the highlighting with the two overloaded operators shown in the issue. Trace the Prism C++ grammar entry point responsible for these tokens, then verify that both comparison expressions and operator< and operator> receive the intended colors in the test page.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, javascript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.