Skip to content

Commit d497274

Browse files
committed
Add field names for assignment statements
Querying is a bit easier if we have field names to distinguish the sides of an assignment: Code: $foo = $bar Before: (statement (variable (name)) (variable (name))) After: (statement lhs: (variable (name)) rhs: (variable (name)))
1 parent 9d20968 commit d497274

6 files changed

Lines changed: 5879 additions & 2441 deletions

File tree

grammar.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ module.exports = grammar({
128128
_assignment: $ => prec.right(choice(
129129
prec(PREC.LOW, $._relationship),
130130
prec.right(PREC.EQUALS, seq(
131-
$._relationship,
131+
field("lhs", $._relationship),
132132
field('operator', choice('=', '+=', '-=')),
133-
$._assignment,
133+
field("rhs", $._assignment),
134134
)),
135135
)),
136136

src/grammar.json

Lines changed: 12 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)