Phrep is a macro preprocessor for PHP. It handles C-style #define, #if, #else, #include, #pragma directives to conjoin sources files and sections conditionally. It substitutes constants and macros per tokenizer only in code sections, keeps structure and comments intact. Besides standard macros it also supports complex@ syntax transformation callbacks.
Homepage
Download
Recent Releases
0.3.030 May 2015 06:45
cleanup:
Fix array += adjoining for pragma options.
Only redirect STDOUT for failing tests.
A few more development tests were added.
Add `qw@` macro for simple list generation from literal words.
Document special -i and -o flag values, and new --target.php flag.
Cleanup allowed function checks in expression evaluator,
slightly stricter interpretation of operators, reworked precedences,
add ternary ?: conditional support.
Built in some io Token macro helper functions.
Made regex mode speedier with prejoined list of (MACRO AND CONST NAMES@).
Add new #pragma(php_strip_tags=1).
Simplify NULLSAFE@ expression.
Reworked tokenizer macro processing and interfaces. Key and substition
code lookup now internal to replacement logic. Parenthesis are now
recognized as part of token list for both token and regex modes.
Argument lists for complex macros are no longer pre-split on, commas.
0.2.027 Feb 2015 06:45
minor feature:
Added `multipass` support for constants and macro-in-macro expansion.
Introduced `#include CONSTANT_NAME_H` constructs.
New pragmas to disable either constants, macros or complex replacing.
Added a few sample config files, a trivial Makefile, Phing binding
and composer-phrep.sh wrapper for testing.
Changed ConditionState tracking.
Reworked ## glue and # stringify operators for basic and complex macros.
Fixed varargs... support, C-inline comment stripping, RX_MACROS word
boundary check, #include backslash assertion.
Made accessors for library usage more readable.
Complex macro/token stream helpers are in a sample config file for now.
0.1.923 Feb 2015 01:05
major feature:
First public release. Support for basic and complex macros is completed.
Command line tool works well from makefiles. Added glue ## and # stringify
operators, configuration file support, largely working #if expressions,
and preliminary documentation.