Registry / serialization / doctrine-lexer

doctrine-lexer

JSON →
library3.0.1phppackagistunverified

PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.

composer require doctrine/lexer
INSTALL
IMPORT
SIG · DOCTRINE-LEXER
D
doctrine-lexer
serializationphpv3.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AbstractLexer
✓ use Doctrine\Common\Lexer\AbstractLexer;

Create a custom lexer by extending AbstractLexer.

use Doctrine\Common\Lexer\AbstractLexer; class MyLexer extends AbstractLexer { protected function getCatchablePatterns() { return ['[a-zA-Z]+', '\d+']; } protected function getNonCatchablePatterns() { return ["\s+"]; } protected function getType(&$value) { if (ctype_alpha($value)) return 'T_WORD'; if (is_numeric($value)) return 'T_NUMBER'; return null; } }
Debug
Known issues
breakingVersion 3.x requires PHP 8.1 or higher.
fix
Upgrade PHP to 8.1+ or use version 2.x for older PHP versions.
affects: >=3.0.0
Upgrade
Version history
3.0.1latest on Packagist
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
10
Resources
doctrine-lexer — pip install doctrine-lexer · libregistry