Skip to content

Remove separate syntax heads for each operator #575

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

Open
wants to merge 1 commit into
base: kf/dots
Choose a base branch
from

Conversation

Keno
Copy link
Member

@Keno Keno commented Jul 11, 2025

This replaces all the specialized operator heads by a single K"Operator" head that encodes the precedence level in its flags (except for operators that are also used for non-operator purposes). The operators are already K"Identifier" in the final parse tree. There is very little reason to spend all of the extra effort separating them into separate heads only to undo this later. Moreover, I think it's actively misleading, because it makes people think that they can query things about an operator by looking at the head, which doesn't work for suffixed operators.

Additionally, this removes the op= token, replacing it by two tokens, one K"Operator" with a special precendence level and one =. This then removes the last use of bump_split (since this PR is on top of #573).

As a free bonus this prepares us for having compound assignment syntax for suffixed operators, which was infeasible in the flips parser. That syntax change is not part of this PR but would be trivial (this PR makes it an explicit error).

Fixes #334

Copy link

codecov bot commented Jul 11, 2025

Codecov Report

Attention: Patch coverage is 98.11321% with 4 lines in your changes missing coverage. Please review.

Please upload report for BASE (kf/dots@daf52ca). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/julia/kinds.jl 85.00% 3 Missing ⚠️
src/julia/tokenize.jl 99.12% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             kf/dots     #575   +/-   ##
==========================================
  Coverage           ?   95.41%           
==========================================
  Files              ?       16           
  Lines              ?     4578           
  Branches           ?        0           
==========================================
  Hits               ?     4368           
  Misses             ?      210           
  Partials           ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This replaces all the specialized operator heads by a single K"Operator"
head that encodes the precedence level in its flags (except for operators
that are also used for non-operator purposes). The operators are
already K"Identifier" in the final parse tree. There is very little
reason to spend all of the extra effort separating them into separate
heads only to undo this later. Moreover, I think it's actively misleading,
because it makes people think that they can query things about an operator
by looking at the head, which doesn't work for suffixed operators.

Additionally, this removes the `op=` token, replacing it by two tokens,
one K"Operator" with a special precendence level and one `=`. This then
removes the last use of `bump_split` (since this PR is on top of #573).

As a free bonus this prepares us for having compound assignment syntax
for suffixed operators, which was infeasible in the flips parser. That
syntax change is not part of this PR but would be trivial (this PR
makes it an explicit error).

Fixes #334
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