-
Notifications
You must be signed in to change notification settings - Fork 592
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JavaScript] Fix regression with ternary operators (#4025)
* [JavaScript] Fix ternary operator regression This commit fixes a regression, introduced by #3986, which breaks syntax highlighting in objects, as comma is no longer consumed as key-value-pair separator. It's not the ternary expression, which allows commas, but the for statement, which allows multiple expressions, separated by comma after `in` keyword. for (var in <expr>, <expr>, ...) expr: any valid expression, maybe ternary, maybe function-call The change to ternary expressions is reverted and for-condition context is modified instead to allow multiple expressions after `in` keyword. Also scope `;` invalid if there are too many. * [JavaScript] Tweak for-conditon context switching This commit... 1. adds a `pop: 1` to the pattern of `for-condition` to make sure at most one opening parenthesis after for is consumed as loop condition. The following may have happened before. for (...) (...) 2. Tweaks how `meta.group` is applied as it sometimes makes a difference, whether a scope is a `meta_scope` or not, especially related with `clear_scopes` keyword.
- Loading branch information
Showing
3 changed files
with
55 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters