Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stylus preprocessor has problems with "?" quantifier in regexp #2841

Open
Atexor opened this issue Nov 16, 2023 · 4 comments
Open

Stylus preprocessor has problems with "?" quantifier in regexp #2841

Atexor opened this issue Nov 16, 2023 · 4 comments

Comments

@Atexor
Copy link

Atexor commented Nov 16, 2023

Hello,
I am using Stylus addon for Firefox to implement css for style (for Chrome issue appears too).
When I changed preprocessor to stylus I got issues with my regex. Author of same-named addon confirmed that it is related with preprocessor.

To reproduce:

Stylus has issues with ? quantifiers. Create any userCSS style on addon. Use regex with ? quantifier, e.g.:

@-moz-document regexp("https:\/\/(www\.)?((((console.)?)developers)|(explorer\.apis))\.google\.(com|([a-z]{2}))(\.[a-z]{2})?\/.*") {/*...*/}

obraz

Current behavior:

Regex not working, unable to save style.

Expected behavior:

On regex101 no errors found and the same should be with Stylus.

283271921-ce8d75af-d486-4764-b618-5c4298d03272

Environment information:

  • stylus version: 0.60.0 (not sure of version used in addon).
  • nodejs version: n/a
@iChenLei
Copy link
Member

maybe you can use @css as a workaround.

@Atexor
Copy link
Author

Atexor commented Nov 16, 2023

It is not supported.
obraz

edit: my bad, wrong usage. Looks working at first glimpse. Will test.

@Atexor
Copy link
Author

Atexor commented Nov 16, 2023

Okay, checked by creating new style and by copy and paste one-few sections. Regex issues disappeared despite styles were exactly the same (compared with Notepad++ compare plugin) in the end (when I replaced meta-data in both styles to default to exclude issues with it). I don't know why it happens, some underhood issues?

I had also few parsing issues, but resolved by putting them into @css {} workaround as you said. Almost all of them were related to semicolons in attributes in #2842.

@Atexor
Copy link
Author

Atexor commented Nov 17, 2023

I found another issue related with preprocessor related with attributes and comma. Please see my issue reported there. Escaping with \ helps but it should be fixed on preprocessor level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants