From 5adf6b3107873d0fb8d73645f40774b80614e74a Mon Sep 17 00:00:00 2001 From: Dustin Wilson Date: Sun, 15 Aug 2021 22:28:55 -0500 Subject: [PATCH] A bit more --- lib/Tokenizer.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/Tokenizer.php b/lib/Tokenizer.php index d6bfbab..249bc7d 100644 --- a/lib/Tokenizer.php +++ b/lib/Tokenizer.php @@ -89,7 +89,6 @@ class Tokenizer { $currentRules = end($this->ruleStack)->patterns; $currentRulesCount = count($currentRules); - for ($i = 0; $i < $currentRulesCount; $i++) { while (true) { $rule = $currentRules[$i]; @@ -248,15 +247,12 @@ class Tokenizer { if ($this->activeInjection === null && $this->grammar->injections !== null) { foreach ($this->grammar->injections as $selector => $injection) { $selector = ScopeParser::parseSelector($selector); - if ($selector->matches($this->scopeStack)) { - $prefix = $selector->getPrefix($this->scopeStack); - if ($prefix !== Filter::PREFIX_LEFT) { - $this->ruleStack[] = $injection; - $this->activeInjection = $injection; - - if ($this->offset < $lineLength) { - continue 2; - } + if ($selector->matches($this->scopeStack) && $selector->getPrefix($this->scopeStack) !== Filter::PREFIX_LEFT) { + $this->ruleStack[] = $injection; + $this->activeInjection = $injection; + + if ($this->offset < $lineLength) { + continue 2; } } }