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

PlusCal parser appears to treat := as an infix operator sometimes #109

Open
ahelwer opened this issue Apr 11, 2024 · 1 comment
Open

PlusCal parser appears to treat := as an infix operator sometimes #109

ahelwer opened this issue Apr 11, 2024 · 1 comment
Labels
bug Something isn't working pluscal Related to PlusCal parsing

Comments

@ahelwer
Copy link
Contributor

ahelwer commented Apr 11, 2024

See neovim highlighting on this line.

@ahelwer ahelwer added bug Something isn't working pluscal Related to PlusCal parsing labels Apr 22, 2024
@ahelwer
Copy link
Contributor Author

ahelwer commented Apr 22, 2024

Failing test:

=============|||
Multiple Assignments in Single Step
=============|||

---- MODULE Test ----
(*
--algorithm Test {
  variables x, y, z;
  {
    x := 0 || y := 0 || z := 0
  }
}
*)
====

--------------|||

(source_file (module (header_line) name: (identifier) (header_line)
  (block_comment (pcal_algorithm name: (identifier)
    (pcal_var_decls
      (pcal_var_decl (identifier))
      (pcal_var_decl (identifier))
      (pcal_var_decl (identifier))
    )
    (pcal_algorithm_body (pcal_assign
      (pcal_lhs (identifier_ref)) (assign) (nat_number)
      (vertvert) (pcal_lhs (identifier_ref)) (assign) (nat_number)
      (vertvert) (pcal_lhs (identifier_ref)) (assign) (nat_number)
    ))
  ))
(double_line)))

The first := is parsed as a pluscal assign operator but all subsequent || and := tokens are parsed as infix operators in an expression.

Work currently lives in pcal-multiassign branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pluscal Related to PlusCal parsing
Projects
None yet
Development

No branches or pull requests

1 participant