This library module provides a recursive descent grammar parser to help analyze and modify a source code file. The goal is that, by organizing the source code based on the grammar of the programming language (as opposed to low-level tokens), complex changes to the code can be more readily made in a programmatic fashion (i.e. by other code using the parser engine).
This library handles PHP grammar, building on the tokenizer functions available in PHP.
Some of the applications for this library module are:
- writing upgrade routines for the Coder Upgrade (formerly Deadwood) module
- parsing source code for the API module used with the Drupal API site
- creating core patches (for example, this one for SimpleTest test files)
- rewriting code files in compliance with coding standards
Suggestions for other applications are welcome.
A few things to note:
- This project is a PHP code library available as a library using the Libraries API (2.x-dev) and also as a Drupal module (because the Drupal project API does not offer a library type).
- This code library is not specific to a Drupal version. It is more likely specific to a PHP library version. When used as a module, the download below labeled as a 7.x version can be used with any version of Drupal (simply by changing the version string in the info file).
- If used as a library, then install it in a libraries directory (e.g., "sites/all/libraries" or equivalent) but do not "enable" it as a module.
- If used as a module, then install it in a modules directory.
- A user interface is provided by the Grammar Parser UI module.
- A library interface is provided by the Grammar Parser Library module.
This project was part of the 2009 Google Summer of Code.
This project is sponsored by Boombatower Development.
Looking for 6.x support?
The Grammar Parser library module is not specific to a Drupal version. To run the Grammar Parser as a 6.x module, simply change the '7.x' references in the .info file to '6.x' (e.g., the 'core = 7.x' line becomes 'core = 6.x'). For use with Drush Make, see this issue.
- Maintenance status: Actively maintained
- Development status: Under active development
- Module categories: Developer, Utility
- Reported installs: 259 sites currently report using this module. View usage statistics.
- Downloads: 85,476
- Last modified: 2 December 2014
- Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.