Minor code cleanup
timw4mail/php-kilo/pipeline/head This commit looks good Details

This commit is contained in:
Timothy Warren 2022-11-18 13:38:18 -05:00
parent c8be79d2d8
commit 26ea12883a
4 changed files with 5 additions and 8 deletions

View File

@ -5,7 +5,7 @@
A reimplementation of the [Kilo](https://viewsourcecode.org/snaptoken/kilo/index.html) tutorial in PHP. Also has some inspiration from the [Hecto](https://www.philippflenker.com/hecto/) text editor tutorial. Requires PHP 8 and FFI.
## Requirements
* PHP 8
* PHP 8.1
* FFI enabled
## Implementation notes:

View File

@ -186,9 +186,6 @@ enum Highlight implements JsonSerializable {
T_STRING_CAST,
T_UNSET_CAST => Highlight::Keyword2,
// Invalid syntax
T_BAD_CHARACTER => Highlight::Invalid,
// Comments
T_DOC_COMMENT => Highlight::MultiLineComment,

View File

@ -61,15 +61,15 @@ class Row {
/**
* The document that this row belongs to
*/
private Document $parent,
private readonly Document $parent,
/**
* @var string The raw characters in the row
* The raw characters in the row
*/
private string $chars,
/**
* @var int The line number of the current row
* The line number of the current row
*/
public int $idx,
) {}

View File

@ -66,7 +66,7 @@ class PHP8 extends PhpToken {
return $this->tokens;
}
protected function processObjectToken(\PhpToken $token): void
protected function processObjectToken(PhpToken $token): void
{
$currentLine = $token->line;
$char = tabs_to_spaces($token->text);