PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers. This lexer is used in Doctrine Annotations and in Doctrine ORM (DQL). To write your own parser you just need to extend Doctrine\Common\Lexer\AbstractLexer and implement three abstract methods. These methods define the lexical catchable and non-catchable patterns and a method for returning the type of a token and filtering the value if necessary. The Lexer is responsible for giving you an API to walk across a string one character at a time and analyze the type of each character, value and position of each token in the string. The low level API of the lexer is pretty simple. The setInput($input) option sets the input data to be tokenized. The Lexer is immediately reset and the new input tokenized. And the option glimpse(), peeks at the next token, returns it and immediately resets the peek.

Features

  • You can write your own parser
  • It's possible to reset the Lexer and the peek pointer to 0
  • You can check whether a given token matches the current lookahead
  • You can also check whether any of the given tokens matches the current lookahead
  • You have the option to tell the lexer to skip input tokens until it sees a token with the given value
  • You can extract an array of upper case characters

Project Samples

Project Activity

See All Activity >

Categories

Libraries

License

MIT License

Follow Doctrine Lexer

Doctrine Lexer Web Site

Other Useful Business Software
Deploy Apps in Seconds with Cloud Run Icon
Deploy Apps in Seconds with Cloud Run

Host and run your applications without the need to manage infrastructure. Scales up from and down to zero automatically.

Cloud Run is the fastest way to deploy containerized apps. Push your code in Go, Python, Node.js, Java, or any language and Cloud Run builds and deploys it automatically. Get fast autoscaling, pay only when your code runs, and skip the infrastructure headaches. Two million requests free per month. And new customers get $300 in free credit.
Try Cloud Run Free
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of Doctrine Lexer!

Additional Project Details

Programming Language

PHP

Related Categories

PHP Libraries

Registered

2021-06-03