-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reverted: force separator around binary operators (#154)
This PR reverts this trick introduced by #149 : ```js /** * group operator and its preceding/succeeding whitespace/newline * @param {string} opr * @param {boolean} parenthesized */ function operator_with_separator(opr, parenthesized) { const sep = parenthesized ? choice(/[ \t]/, /\r?\n/) : /[ \t]/; return alias(token(seq(repeat1(sep), opr, repeat1(sep))), opr); } ``` It turns out that this will cause unwanted side effects of blurring boundaries of tokens around `binary_expression`: <img width="535" alt="image" src="https://github.com/user-attachments/assets/dce882b3-c07f-4980-b0be-7c05959400d7"> compared to the ideal result after this PR: <img width="535" alt="image" src="https://github.com/user-attachments/assets/fe8dc5b1-a4e6-432b-94a9-46929d8020fd"> Instead, `cmd_identifier` is tweaked to keep expressions like `1+1` away from being parsed as `binary_expression`.
- Loading branch information
Showing
5 changed files
with
342,159 additions
and
342,887 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
Oops, something went wrong.