Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/Parsing/Anchor.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,24 @@ class Anchor
/**
* @var int
*/
private $iPosition;
private $position;

/**
* @var ParserState
*/
private $parserState;

/**
* @param int $iPosition
* @param int $position
*/
public function __construct($iPosition, ParserState $parserState)
public function __construct($position, ParserState $parserState)
{
$this->iPosition = $iPosition;
$this->position = $position;
$this->parserState = $parserState;
}

public function backtrack(): void
{
$this->parserState->setPosition($this->iPosition);
$this->parserState->setPosition($this->position);
}
}
6 changes: 3 additions & 3 deletions src/Parsing/ParserState.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ public function anchor(): Anchor
}

/**
* @param int $iPosition
* @param int $position
*/
public function setPosition($iPosition): void
public function setPosition($position): void
{
$this->iCurrentPosition = $iPosition;
$this->iCurrentPosition = $position;
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/RuleSet/RuleSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ public function addRule(Rule $rule, ?Rule $oSibling = null): void
$this->aRules[$sRule] = [];
}

$iPosition = \count($this->aRules[$sRule]);
$position = \count($this->aRules[$sRule]);

if ($oSibling !== null) {
$iSiblingPos = \array_search($oSibling, $this->aRules[$sRule], true);
if ($iSiblingPos !== false) {
$iPosition = $iSiblingPos;
$position = $iSiblingPos;
$rule->setPosition($oSibling->getLineNo(), $oSibling->getColNo() - 1);
}
}
Expand All @@ -127,7 +127,7 @@ public function addRule(Rule $rule, ?Rule $oSibling = null): void
}
}

\array_splice($this->aRules[$sRule], $iPosition, 0, [$rule]);
\array_splice($this->aRules[$sRule], $position, 0, [$rule]);
}

/**
Expand Down