46 lines
1.2 KiB
PHP
46 lines
1.2 KiB
PHP
<?php declare(strict_types=1);
|
|
|
|
namespace Aviat\Kilo;
|
|
|
|
class Syntax {
|
|
public const HIGHLIGHT_NUMBERS = (1 << 0);
|
|
public const HIGHLIGHT_STRINGS = (1 << 1);
|
|
|
|
// Tokens for PHP files
|
|
public array $tokens = [];
|
|
|
|
public static function new(
|
|
string $name,
|
|
array $keywords1 = [],
|
|
array $keywords2 = [],
|
|
string $slcs = '//',
|
|
string $mcs = '/*',
|
|
string $mce = '*/',
|
|
int $flags = self::HIGHLIGHT_NUMBERS | self::HIGHLIGHT_STRINGS,
|
|
): self
|
|
{
|
|
return new self($name, $keywords1, $keywords2, $slcs, $mcs, $mce, $flags);
|
|
}
|
|
|
|
public static function default(): self
|
|
{
|
|
return self::new('No filetype', slcs: '', mcs: '', mce: '', flags: 0);
|
|
}
|
|
|
|
private function __construct(
|
|
/** The name of the programming language */
|
|
public string $filetype,
|
|
/** Primary set of language keywords */
|
|
public array $keywords1,
|
|
/** Secondary set of language keywords */
|
|
public array $keywords2,
|
|
/** Syntax to start a single line comment */
|
|
public string $singleLineCommentStart,
|
|
/** Syntax to start a multi-line comment */
|
|
public string $multiLineCommentStart,
|
|
/** Syntax to end a multi-line commment */
|
|
public string $multiLineCommentEnd,
|
|
/** Bitflags configuring the specified language syntax */
|
|
public int $flags,
|
|
) {}
|
|
} |