404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@3.141.32.16: ~ $
<?php

declare(strict_types=1);

namespace Doctrine\Tests\Common\Lexer;

use Doctrine\Common\Lexer\AbstractLexer;

use function in_array;
use function is_numeric;

/** @extends AbstractLexer<string, string|int> */
class ConcreteLexer extends AbstractLexer
{
    final public const INT = 'int';

    /**
     * {@inheritDoc}
     */
    protected function getCatchablePatterns(): array
    {
        return [
            '=|<|>',
            '[a-z]+',
            '\d+',
        ];
    }

    /**
     * {@inheritDoc}
     */
    protected function getNonCatchablePatterns(): array
    {
        return [
            '\s+',
            '(.)',
        ];
    }

    protected function getType(string|int|float &$value): string
    {
        if (is_numeric($value)) {
            $value = (int) $value;

            return 'int';
        }

        if (in_array($value, ['=', '<', '>'])) {
            return 'operator';
        }

        return 'string';
    }
}

Filemanager

Name Type Size Permission Actions
AbstractLexerTest.php File 9.66 KB 0644
ConcreteLexer.php File 962 B 0644
EnumLexer.php File 944 B 0644
MutableLexer.php File 754 B 0644
TokenTest.php File 488 B 0644
TokenType.php File 142 B 0644