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

Implement all of PHP's operators #19

Closed
32 tasks done
ryangjchandler opened this issue Aug 6, 2022 · 3 comments · Fixed by #102
Closed
32 tasks done

Implement all of PHP's operators #19

ryangjchandler opened this issue Aug 6, 2022 · 3 comments · Fixed by #102
Labels
enhancement New feature or request parser

Comments

@ryangjchandler
Copy link
Collaborator

ryangjchandler commented Aug 6, 2022

https://www.php.net/manual/en/language.operators.precedence.php provides a list of operators ordered by their precedence. We support quite a few of these already but there's some things like bitwise ops and casts that still need to be implemented.

Unary

  • All casts ((int), (bool), etc.)
  • Plus (+)
  • Bitwise not (~)
  • Prefix decrement (--$i)
  • Prefix increment (++$i)
  • Error control (@)
  • Print (print)

Binary

  • Modulo (%)
  • Left shift (<<)
  • Right shift (>>)
  • Bitwise and (&)
  • Bitwise or (|)
  • Bitwise xor (^)
  • Not equal (<>)
  • Spaceship (<=>)
  • Logical and (and)
  • Logical or (or)
  • Logical xor (xor)

Assignment

  • Assign =
  • Add assign +=
  • Sub assign -=
  • Mul assign *=
  • Pow assign **=
  • Div assign /=
  • Concat assign .=
  • Mod assign %=
  • Bitwise and assign &=
  • Bitwise or assign |=
  • Bitwise xor assign ^=
  • Left shift assign <<=
  • Right shift assign >>=
  • Null coalesce assign ??=
@ryangjchandler ryangjchandler added enhancement New feature or request parser labels Aug 6, 2022
@ryangjchandler ryangjchandler added this to the Parser v0.1.0 milestone Aug 6, 2022
@edsrzf
Copy link
Contributor

edsrzf commented Sep 12, 2022

Here's a list of operators I've found that still need to be implemented:

See description.

@ryangjchandler
Copy link
Collaborator Author

Before implementing some of these, the precedence system needs some improvements I think. I'm not a huge fan of the binding power system I've got in place right now and would ideally like to move to a Precedence enum and then an Associativity enum too.. I think.

@ryangjchandler
Copy link
Collaborator Author

@edsrzf Moved your list into the issue description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request parser
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants