2019-10-24 16:58:52 -04:00
|
|
|
<?php declare(strict_types=1);
|
|
|
|
|
2019-11-08 16:27:08 -05:00
|
|
|
namespace Aviat\Kilo;
|
2019-10-24 16:58:52 -04:00
|
|
|
|
|
|
|
class Syntax {
|
|
|
|
public const HIGHLIGHT_NUMBERS = (1 << 0);
|
2019-10-25 11:49:04 -04:00
|
|
|
public const HIGHLIGHT_STRINGS = (1 << 1);
|
2019-10-24 16:58:52 -04:00
|
|
|
|
|
|
|
public string $filetype = '';
|
|
|
|
public array $filematch = [];
|
2019-10-25 16:36:03 -04:00
|
|
|
|
2019-10-25 12:08:21 -04:00
|
|
|
public string $singleLineCommentStart = '//';
|
2019-10-25 16:36:03 -04:00
|
|
|
public string $multiLineCommentStart = '/*';
|
|
|
|
public string $multiLineCommentEnd = '*/';
|
2019-10-25 12:08:21 -04:00
|
|
|
|
2019-10-25 14:49:34 -04:00
|
|
|
public array $keywords1 = [];
|
|
|
|
public array $keywords2 = [];
|
|
|
|
|
2019-10-29 17:02:03 -04:00
|
|
|
// Tokens for PHP files
|
|
|
|
public array $tokens = [];
|
|
|
|
|
2019-10-24 16:58:52 -04:00
|
|
|
public int $flags = 0;
|
|
|
|
|
2019-10-25 16:36:03 -04:00
|
|
|
public static function new(string $name, array $extList, array $keywords1, array $keywords2, string $slcs, string $mcs, string $mce, int $flags): self
|
2019-10-24 16:58:52 -04:00
|
|
|
{
|
|
|
|
$self = new self();
|
|
|
|
|
|
|
|
$self->filetype = $name;
|
|
|
|
$self->filematch = $extList;
|
2019-10-25 12:08:21 -04:00
|
|
|
|
2019-10-25 14:49:34 -04:00
|
|
|
$self->keywords1 = $keywords1;
|
|
|
|
$self->keywords2 = $keywords2;
|
|
|
|
|
|
|
|
$self->singleLineCommentStart = $slcs;
|
2019-10-25 16:36:03 -04:00
|
|
|
$self->multiLineCommentStart = $mcs;
|
|
|
|
$self->multiLineCommentEnd = $mce;
|
2019-10-25 12:08:21 -04:00
|
|
|
|
2019-10-24 16:58:52 -04:00
|
|
|
$self->flags = $flags;
|
|
|
|
|
|
|
|
return $self;
|
|
|
|
}
|
|
|
|
|
|
|
|
private function __construct() {}
|
|
|
|
}
|