Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/treetrek.git

Adds class keyword to php

AuthorDave Jarvis <email>
Date2026-02-14 19:23:32 GMT-0800
Commit49f12cacd937fc98b7f97de94b0f487f002a07f4
Parent08a4774
Delta3 lines added, 8 lines removed, 5-line decrease
render/Highlighter.php
$patterns[] = "(?P<punctuation>[\\{\\}\\(\\)\\[\\]\\;\\,])";
-
- $combined = '/' . implode('|', $patterns) . '/msu';
+ $combined = '/' . implode('|', $patterns) . '/msu';
- $result = preg_replace_callback($combined, function ($matches) {
+ return preg_replace_callback($combined, function ($matches) {
foreach ($matches as $key => $value) {
if (!is_numeric($key) && $value !== '') {
if ($key === 'string_interp') {
return $this->renderInterpolatedString($value);
}
-
return '<span class="hl-' . $key . '">' . htmlspecialchars($value) . '</span>';
}
}
-
return htmlspecialchars($matches[0]);
}, $this->content);
-
- return $result ?? htmlspecialchars($this->content);
}
render/LanguageDefinitions.php
'string' => '/(\'.*?\')/',
'comment' => '/((?-s:\/\/.*$)|(?-s:#.*$)|(?s:\/\*.*?\*\/))/m',
- 'keyword' => '/\b(abstract|and|array|as|break|callable|case|catch|class|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|new|or|print|private|protected|public|require|require_once|return|static|switch|throw|trait|try|unset|use|var|while|xor|yield)\b/',
+ 'keyword' => '/\b(class|abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|new|or|print|private|protected|public|require|require_once|return|static|switch|throw|trait|try|unset|use|var|while|xor|yield)\b/',
'variable' => '/(\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)/',
'number' => '/' . $int . '/',