Skip to content

Commit

Permalink
Fix scanning of comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeckerson committed Oct 27, 2024
1 parent 3dc9ebd commit cd2ec3b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Scanner/Scanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ public function scanForToken(): int
$next = $this->state->getNext();
$doubleNext = $this->state->getNext(2);

if ($cursor === "\n") {
$this->state->incrementActiveLine();
}

if ($cursor === null || ($cursor === '{' && ($next === '%' || $next === '{' || $next === '#'))) {
if ($next !== '#') {
$this->state->setMode(Compiler::PHVOLT_MODE_CODE);
Expand Down Expand Up @@ -71,6 +75,7 @@ public function scanForToken(): int
while ($next = $this->state->incrementStart()->getStart()) {
$doubleNext = $this->state->getNext();
if ($next === '#' && $doubleNext === '}') {
$this->state->incrementStart(2);
$this->token->setOpcode(Compiler::PHVOLT_T_IGNORE);
return 0;
} elseif ($next === "\n") {
Expand All @@ -84,10 +89,6 @@ public function scanForToken(): int
return 0;
}

if ($cursor === "\n") {
$this->state->incrementActiveLine();
}

$this->state->rawFragment .= $cursor;
$this->state->incrementStart();
} else {
Expand Down

0 comments on commit cd2ec3b

Please sign in to comment.