Skip to content

Commit f33540c

Browse files
committed
added TagParser::isFollowedByWhitespace() [WIP]
1 parent 043428a commit f33540c

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/Latte/Compiler/TagParser.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,7 @@ public function parseType(): ?Node\SuperiorTypeNode
121121
*/
122122
public function tryConsumeSeparatedToken(string ...$kind): ?Token
123123
{
124-
$token = $this->stream->peek();
125-
return $token->is(...$kind) // is followed by whitespace
126-
&& $this->stream->peek(1)->position->offset > $token->position->offset + strlen($token->text)
124+
return $this->stream->is(...$kind) && $this->isFollowedByWhitespace()
127125
? $this->stream->consume()
128126
: null;
129127
}
@@ -135,6 +133,13 @@ public function isEnd(): bool
135133
}
136134

137135

136+
public function isFollowedByWhitespace(): bool
137+
{
138+
$token = $this->stream->peek();
139+
return $this->stream->peek(1)->position->offset > $token->position->offset + strlen($token->text);
140+
}
141+
142+
138143
/** @throws Latte\CompileException */
139144
private function parse(string $schema, bool $recovery = false): mixed
140145
{

0 commit comments

Comments
 (0)