phug-php/phug

View on GitHub
src/Phug/Lexer/Lexer/Scanner/DoctypeScanner.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
<?php

/**
 * @example doctype html
 */

namespace Phug\Lexer\Scanner;

use Phug\Lexer\ScannerInterface;
use Phug\Lexer\State;
use Phug\Lexer\Token\DoctypeToken;

class DoctypeScanner implements ScannerInterface
{
    public function scan(State $state)
    {
        return $state->scanToken(DoctypeToken::class, "(doctype|!!!)(?!\S)(?: (?<name>[^\n]*))?");
    }
}