Skip to content

C++ lexer thinks that : can only follow a label name #1996

@Golovanov399

Description

@Golovanov399

This is a copy of some old issue: gpoore/minted#195

Briefly: the token right before the comma is highlighted incorrectly in ternary operators (see image below) and range-based for loops. Right now the lexer is not aware of any other usage of : except indicating a label.

I have created a pull-request 3 years ago, but it has not been merged. All its details are lost, but as far as I remember, I have added a rule or two before or after this line:

(r'(' + _ident + r')(\s*)(:)(?!:)', bygroups(Name.Label, Whitespace, Punctuation)),

It was probably not the best solution and just a workaround, but I didn't feel like digging in.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions