php-extended / php-parser-lexer
This library is an implementation of the php-extended/php-parser-interface based on a lexer for handling its data
Installs: 177 620
Dependents: 17
Suggesters: 0
Security: 0
Stars: 0
Forks: 0
pkg:composer/php-extended/php-parser-lexer
Requires
- php: >=8.1
 - php-extended/php-lexer-object: ^8
 - php-extended/php-parser-object: ^8
 
Requires (Dev)
- dev-master
 - 8.0.9
 - 8.0.8
 - 8.0.7
 - 8.0.6
 - 8.0.5
 - 8.0.4
 - 8.0.3
 - 8.0.2
 - 8.0.1
 - 8.0.0
 - 7.0.9
 - 7.0.8
 - 7.0.7
 - 7.0.6
 - 7.0.5
 - 7.0.4
 - 7.0.3
 - 7.0.2
 - 7.0.1
 - 7.0.0
 - 6.0.8
 - 6.0.7
 - 6.0.6
 - 6.0.5
 - 6.0.4
 - 6.0.3
 - 6.0.2
 - 6.0.1
 - 6.0.0
 - 5.0.1
 - 5.0.0
 - 4.0.1
 - 4.0.0
 - 3.1.6
 - 3.1.5
 - 3.1.4
 - 3.1.3
 - 3.1.2
 - 3.1.1
 - 3.1.0
 - 3.0.15
 - 3.0.14
 - 3.0.13
 - 3.0.12
 - 3.0.11
 - 3.0.10
 - 3.0.9
 - 3.0.8
 - 3.0.7
 - 3.0.6
 - 3.0.5
 - 3.0.4
 - 3.0.3
 - 3.0.2
 - 3.0.1
 - 3.0.0
 
This package is auto-updated.
Last update: 2025-10-12 14:05:39 UTC
README
This library is an implementation of the php-extended/php-parser-interface based on a lexer for handling its data.
Installation
The installation of this library is made via composer and the autoloading of all classes of this library is made through their autoloader.
- Download 
composer.pharfrom their website. - Then run the following command to install this library as dependency :
 php composer.phar php-extended/php-parser-lexer ^8
Basic Usage
This library provide a single class, the AbstractParserLexer which is
made to be implemented. Its parseLexer method must return a single object
from the whole string that its given, and throw a ParseException if it is
impossible to do so.
It is advised that the parseLexer method use a combination of :
public function parseLexer(LexerInterface $lexer)
{
	$lexer->rewind(); // do not forget !
	$token = $this->expectOneOf($lexer, [<tokenids>]);
	$this->expectEof($lexer, $token);
	
	return MyObject($token->getData());
}
As the LexerInterface is an \Iterable, you may as well use it
into a foreach loop.
License
MIT (See license file).