Minor code cleanup
All checks were successful
timw4mail/php-kilo/pipeline/head This commit looks good
All checks were successful
timw4mail/php-kilo/pipeline/head This commit looks good
This commit is contained in:
parent
c8be79d2d8
commit
26ea12883a
@ -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.
|
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
|
## Requirements
|
||||||
* PHP 8
|
* PHP 8.1
|
||||||
* FFI enabled
|
* FFI enabled
|
||||||
|
|
||||||
## Implementation notes:
|
## Implementation notes:
|
||||||
|
@ -186,9 +186,6 @@ enum Highlight implements JsonSerializable {
|
|||||||
T_STRING_CAST,
|
T_STRING_CAST,
|
||||||
T_UNSET_CAST => Highlight::Keyword2,
|
T_UNSET_CAST => Highlight::Keyword2,
|
||||||
|
|
||||||
// Invalid syntax
|
|
||||||
T_BAD_CHARACTER => Highlight::Invalid,
|
|
||||||
|
|
||||||
// Comments
|
// Comments
|
||||||
T_DOC_COMMENT => Highlight::MultiLineComment,
|
T_DOC_COMMENT => Highlight::MultiLineComment,
|
||||||
|
|
||||||
|
@ -61,15 +61,15 @@ class Row {
|
|||||||
/**
|
/**
|
||||||
* The document that this row belongs to
|
* 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,
|
private string $chars,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int The line number of the current row
|
* The line number of the current row
|
||||||
*/
|
*/
|
||||||
public int $idx,
|
public int $idx,
|
||||||
) {}
|
) {}
|
||||||
|
@ -66,7 +66,7 @@ class PHP8 extends PhpToken {
|
|||||||
return $this->tokens;
|
return $this->tokens;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function processObjectToken(\PhpToken $token): void
|
protected function processObjectToken(PhpToken $token): void
|
||||||
{
|
{
|
||||||
$currentLine = $token->line;
|
$currentLine = $token->line;
|
||||||
$char = tabs_to_spaces($token->text);
|
$char = tabs_to_spaces($token->text);
|
||||||
|
Loading…
Reference in New Issue
Block a user