CodeExplorer getHashPattern example
private TokenizerPatterns
$patterns;
private TokenizerEscaping
$escaping;
public function __construct(TokenizerPatterns
$patterns, TokenizerEscaping
$escaping) { $this->patterns =
$patterns;
$this->escaping =
$escaping;
} public function handle(Reader
$reader, TokenStream
$stream): bool
{ $match =
$reader->
findPattern($this->patterns->
getHashPattern());
if (!
$match) { return false;
} $value =
$this->escaping->
escapeUnicode($match[1
]);
$stream->
push(new Token(Token::TYPE_HASH,
$value,
$reader->
getPosition()));
$reader->
moveForward(\
strlen($match[0
]));
return true;
}}