Skip to content

Commit 7ffb814

Browse files
author
Nico
committed
Fix minor issues
1 parent 71c81b1 commit 7ffb814

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ $highlighter = new Rules\Highlighter(new Rules\Tokenizer());
173173

174174
// Optional custom styles
175175
$highlighter->setStyle(
176-
Rules\Constants::GROUP_VARIABLE,
177-
'color: #007694; font-weight: 900;'
176+
Rules\Constants::GROUP_VARIABLE,
177+
'color: #007694; font-weight: 900;'
178178
);
179179

180180
echo $highlighter->highlightString($ruleStr);

src/nicoSWD/Rules/Tokenizer.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ final class Tokenizer implements TokenizerInterface
4848

4949
private $regex = '';
5050

51-
private $regexRequiresReassambly = false;
51+
private $regexRequiresReassembly = false;
5252

5353
public function __construct()
5454
{
@@ -108,13 +108,13 @@ public function tokenize(string $string) : Stack
108108

109109
public function registerToken(string $class, string $regex, int $priority = null)
110110
{
111-
$token = new StdClass();
111+
$token = new stdClass();
112112
$token->class = $class;
113113
$token->regex = $regex;
114114
$token->priority = $priority ?? $this->getPriority($class);
115115

116116
$this->internalTokens[$class] = $token;
117-
$this->regexRequiresReassambly = true;
117+
$this->regexRequiresReassembly = true;
118118
}
119119

120120
private function getMatchedToken(array $matches) : string
@@ -130,15 +130,15 @@ private function getMatchedToken(array $matches) : string
130130

131131
private function getRegex() : string
132132
{
133-
if (!$this->regex || $this->regexRequiresReassambly) {
133+
if (!$this->regex || $this->regexRequiresReassembly) {
134134
$regex = [];
135135

136136
foreach ($this->getQueue() as $token) {
137137
$regex[] = "(?<$token->class>$token->regex)";
138138
}
139139

140140
$this->regex = sprintf('~(%s)~As', implode('|', $regex));
141-
$this->regexRequiresReassambly = false;
141+
$this->regexRequiresReassembly = false;
142142
}
143143

144144
return $this->regex;
@@ -157,6 +157,6 @@ private function getQueue() : SplPriorityQueue
157157

158158
private function getPriority(string $class) : int
159159
{
160-
return $this->internalTokens[$class] ?? 10;
160+
return $this->internalTokens[$class]->priority ?? 10;
161161
}
162162
}

0 commit comments

Comments
 (0)