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

Right-associative operators are parsed left-associative #74

Closed
mohe2015 opened this issue Feb 9, 2022 · 0 comments · Fixed by #75
Closed

Right-associative operators are parsed left-associative #74

mohe2015 opened this issue Feb 9, 2022 · 0 comments · Fixed by #75
Assignees
Labels
bug Something isn't working
Milestone

Comments

@mohe2015
Copy link

mohe2015 commented Feb 9, 2022

Describe the bug

According to https://nixos.org/manual/nix/unstable/expressions/language-operators.html and to testing
-> and ++ and // should be parsed right-associative but are not currently.

Code Snippet to reproduce

echo "false -> true -> false" | cargo run --quiet --example from-stdin
NODE_ROOT 0..23 {
  NODE_BIN_OP 0..22 {
    NODE_BIN_OP 0..13 {
      TOKEN_IDENT("false") 0..5
      TOKEN_IMPLICATION("->") 6..8
      TOKEN_IDENT("true") 9..13
    }
    TOKEN_IMPLICATION("->") 14..16
    TOKEN_IDENT("false") 17..22
  }
}
# nix repl
false -> true -> false
true

(false -> true) -> false
false

Expected behavior

Additional context

I think this only matters for implies and not the other two.

@mohe2015 mohe2015 added the bug Something isn't working label Feb 9, 2022
@Ma27 Ma27 self-assigned this Feb 12, 2022
@Ma27 Ma27 added this to the 0.11.0 milestone Feb 12, 2022
@Ma27 Ma27 closed this as completed in #75 Jul 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants