Skip to content

Typescript ambiguous regexp highlighting with normal division #3874

Description

@Neko-Box-Coder

In typescript (or javascript as well), regexp is part of the language and can be expressed like so

const myRe = /d(b+)d/g;

And we have the following rules to match it:

- constant: "/[^*]([^/]|(\\\\/))*[^\\\\]/[gim]*"

If you have the following

//My use case:
vec2.set(outVec, width / 2.0, height / 2.0);

//Or simply
const abc = 10 / 5 / 2;

Looks like this

Image

Funny enough, javascript doesn't have this problem since the line is commented out. Due to issue #901

But then it got a different issue, somehow (issue #2820), which got fixed later.

A proper fix (if we want to highlight it) requires lookahead as mentioned by @zyedidia in #901 ,unless there's a way to specify a pattern that excludes that type.

@JoeKar, any thoughts?

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions