microsoft / microsoft/tolerant-php-parser

LHS of assignment must be variable

Open
#19 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug error-handling grammar
Dominant language
PHP
Stars
894
Forks
85
Avg merge
2d 13h
Merged PRs (30d)
3

Description

Noticed while looking at example 4:

In PHP an expression like $a == $b = $c is parsed as $a == ($b = $c), because this is the only valid way to parse the code under the constraint that the LHS of an assignment must be a variable. The parser currently treats this as ($a == $b) = $c instead.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read example 4 in docs/HowItWorks.md first, then trace how the parser handles $a == $b = $c and the constraint that an assignment's left-hand side must be a variable. Done means the expression is represented as $a == ($b = $c) rather than ($a == $b) = $c.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.