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

Fix: variable names beginning with a keyword and dash #2634

Merged
merged 2 commits into from Sep 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/lexer.js
Expand Up @@ -448,7 +448,7 @@ Lexer.prototype = {
keyword: function() {
var captures
, tok;
if (captures = /^(return|if|else|unless|for|in)\b[ \t]*/.exec(this.str)) {
if (captures = /^(return|if|else|unless|for|in)\b(?!-)[ \t]*/.exec(this.str)) {
var keyword = captures[1];
this.skip(captures);
if (this.isPartOfSelector()) {
Expand Down
13 changes: 13 additions & 0 deletions test/cases/regression.2422.css
@@ -0,0 +1,13 @@
.foobar {
border-radius: 4px;
columns: 5;
foo: 1;
foo: 2;
foo: 3;
}
@media (min-width: 600px) {
.foobar {
columns: 1;
font-weight: 700;
}
}
18 changes: 18 additions & 0 deletions test/cases/regression.2422.styl
@@ -0,0 +1,18 @@
forsooth = 4px
for-something = 5
if_bar = 700

for-tablet-portrait-up()
@media (min-width: 600px)
{block}

.foobar
border-radius: forsooth
columns: for-something

for --num in 1 2 3
foo: --num

+for-tablet-portrait-up()
columns: 1
font-weight: if_bar