diff --git a/app/Contexts/Variable.php b/app/Contexts/Variable.php new file mode 100644 index 0000000..4b691fc --- /dev/null +++ b/app/Contexts/Variable.php @@ -0,0 +1,22 @@ + $this->name, + ]; + } +} diff --git a/app/Parsers/VariableParser.php b/app/Parsers/VariableParser.php new file mode 100644 index 0000000..e0fd7bc --- /dev/null +++ b/app/Parsers/VariableParser.php @@ -0,0 +1,43 @@ +context->name = $node->getName(); + + if (Settings::$capturePosition) { + $range = PositionUtilities::getRangeFromPosition( + $node->getStartPosition(), + mb_strlen($node->getText()), + $node->getRoot()->getFullText(), + ); + + if (Settings::$calculatePosition !== null) { + $range = Settings::adjustPosition($range); + } + + $this->context->setPosition($range); + } + + return $this->context; + } + + public function initNewContext(): ?AbstractContext + { + return new VariableContext; + } +}