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

Allow leading logical operators #5407

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Allow leading logical operators #5407

wants to merge 8 commits into from

Conversation

STRd6
Copy link
Contributor

@STRd6 STRd6 commented Apr 5, 2022

Rebased #5279

Comment on lines +757 to +760
# Returns `yes` if standing in front of what will become a LEADING_AND or
# LEADING_OR, ie TERMINATOR followed by && or ||
isLeadingLogical: (i) ->
@tag(i) is 'TERMINATOR' and @tag(i + 1) in LEADING_LOGICAL
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would think that you shouldn’t need to use the rewriter for this. The regular lexer often looks multiple tokens ahead; whenever it sees an and/or token followed by a terminator, it could create it as LEADING_AND or LEADING_OR in the first place rather than needing the rewriter to make another pass.

In general everything in rewriter.coffee is hacks that are unfortunate workarounds, and we want to avoid adding to the rewriter if at all possible. Each rewrite pass adds a performance hit to compilation.

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.

3 participants