php8.5
Home/ Manual/ parle / lexer/ Parle\Lexer::push

Parle\Lexer::push

PHP function Edit on GitHub ✎

(PECL parle >= 0.5.1)

Add a lexer rule

Description

Parle\Lexer::push(string $regex, int $id): void

Push a pattern for lexeme recognition.

Parameters

regex

Regular expression used for token matching.

id

Token id. If the lexer instance is meant to be used standalone, this can be an arbitrary number. If the lexer instance is going to be passed to the parser, it has to be an id returned by Parle\Parser::tokenid.

Return Values

Void

Source: reference/parle/parle/lexer/push.xml · from the official PHP manual (php/doc-en)