这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@q60
Copy link
Contributor

@q60 q60 commented Sep 14, 2024

it works but help needed, i'm in love/hate relationships with tree-sitter specifically and parsers in general

before

image

after

image

@eclairevoyant
Copy link

eclairevoyant commented Sep 16, 2024

It's a good start, but this misses support for the <| operator

Copy link
Owner

@oxalica oxalica left a comment

Choose a reason for hiding this comment

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

Thanks, I just know that Nix got new experimental operators. It may worth referencing the source PR NixOS/nix#11131

CI failure is unrelated and is already fixed on main. A rebase should fix it.

HlTag::Operator(HlOperator::Comparison)
}
T![+] | T![-] | T![*] | T![/] => HlTag::Operator(HlOperator::Arithmetic),
T![++] | T!["//"] => HlTag::Operator(HlOperator::Aggregation),
Copy link
Owner

Choose a reason for hiding this comment

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

It's not a collection operator. It may need another HlOperator variant like Pipe.

lhs_ty
}
BinaryOpKind::Concat => {
BinaryOpKind::Concat | BinaryOpKind::Pipe => {
Copy link
Owner

Choose a reason for hiding this comment

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

We shouldn't unity arguments of pipe operators to be List.
They should follow the handling of Expr::Apply with two arguments flipped.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i don't quite follow this, need an example... speaking of the other threads, i can make the changes and push them right away
that's quite dumb, but i have basically zero experience in parsers 💀
this PR (plus patches in tree-sitter-nix, rnix-parser and alejandra) emerged from my need of using pipe operator w/o errors from the language server and with working formatter. then i showed all of this to friends and they kinda expected me to make PRs to the base repos 💀 💀 💀
btw i also opened a PR in tree-sitter-nix, but considering the status quo of rnix-parser and it being a dependency of alejandra, i am totally unsure how to work this out 😭
sorry for this silly venting in this thread

LT_EQ = [<=],
MINUS_GT = [->],
NOT_EQ = [!=],
PIPE = [|>],
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
PIPE = [|>],
OR_GT = [|>],

Here we name symbols syntactically, not semantically.

T![*] |
T![/] => (17, 18),
T![++] => (20, 19),
T![|>] => (21, 22),
Copy link
Owner

Choose a reason for hiding this comment

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

This precedence is incorrect. According to Nix, it should have a lower precedence than logic-imply ->. So it should goes above to be (-1, 0), which underflows u8... Unfortunately, we need to shift all other BP values up by +10 (for simplicity and more future proof), so |> becomes (9, 10), -> becomes (12, 11), and etc.

@viperML
Copy link
Contributor

viperML commented Nov 14, 2024

I hate to be that one that writes "any progress on this?", but I need to be that one

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.

4 participants