Skip to content

Conversation

@codervipul775
Copy link

… literals

The eachOf regex was incorrectly matching the word 'of' inside string values when parsing 'each...in' loops, causing syntax errors for valid code.

Example that previously failed:
each link in ['Terms of service', 'Privacy policy', 'License']
a= link

Changed the regex from /^(?:each|for) (.*?) of *([^\n]+)/ to require:

  • Explicit whitespace around the 'of' keyword
  • Valid variable patterns (identifier or [key, value] destructuring)

This ensures 'of' is recognized as a keyword only when used as such, not when it appears within string literals in the iterable expression.

… literals

The eachOf regex was incorrectly matching the word 'of' inside string values
when parsing 'each...in' loops, causing syntax errors for valid code.

Example that previously failed:
  each link in ['Terms of service', 'Privacy policy', 'License']
    a= link

Changed the regex from /^(?:each|for) (.*?) of *([^\n]+)/ to require:
- Explicit whitespace around the 'of' keyword
- Valid variable patterns (identifier or [key, value] destructuring)

This ensures 'of' is recognized as a keyword only when used as such,
not when it appears within string literals in the iterable expression.
@rollingversions
Copy link

There is no change log for this pull request yet.

Create a changelog

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

Successfully merging this pull request may close these issues.

1 participant