JUBELBUILD — DEVELOPER TOOLS
PHP Lexer
PHP-faithful lexer for JubelBuild — finds structural errors before deployment, entirely without a PHP binary.
Structural errors — caught before the build breaks
PHP Lexer is a PRO add-on for JubelBuild that — like Parallel Lint — hooks into the build automatically once active. On every build target (DEV, PRO, FREE) each .php file is run through a state-based, PHP-faithful lexer (vendor/ and node_modules/ are skipped). If it finds something, the build pauses and a review window opens — with a token view and an integrated editor.
Unlike php -l, the lexer needs no PHP binary, runs early, and understands the source structure — focusing precisely on the error classes a naive brace counter fails on.
What it detects
- PHP closing tag in a line comment: in PHP, a
?>inside a//or#comment ends the comment AND PHP mode — the rest of the file becomes HTML and braces stop counting, leading to a fatal "Unclosed '{'". This trap is the main reason for the add-on. - Unbalanced
{}/()/[]: counted only in real code — braces inside strings, comments and HTML regions are correctly ignored. - Unterminated constructs: strings, block comments or heredoc/nowdoc left open until the end of the file.
- Unbalanced
[PRO]markers: a JubelBuild-specific warning — the carve could otherwise remove half a block. - Real lexer states: the lexer models the actual PHP lexer — HTML / code / line and block comment / single and double quote (with correct escape rules) / heredoc-nowdoc and tag switching.
The review window
- Findings list: the left column lists every finding — file and line, type, and message.
- Detail & suggestions: the right column shows details plus auto-fix suggestions where possible — e.g. removing the closing tag from a comment.
- Editor with token view: source on the left, token view on the right (type + line per token, error lines highlighted).
- Re-Check & Save: "Re-Check" re-lexes the editor content; "Save" writes the file, followed by a server-side re-lex.
- Resume build: once all findings are fixed, the build continues right where it paused.
Requirements
- WordPress 5.8 or higher (tested up to 7.0).
- PHP 7.4 or higher.
- The active core plugin JubelBuild (Pro).
- Current version 1.0.10 · GPLv2 or later.
FAQ
Does it replace Parallel Lint?
No — the two complement each other. The lexer works early and structurally: it catches the closing-tag-in-comment trap and marker imbalances that php -l reports only late (as a fatal on activation) or not at all. php -l remains the final ground truth for the full syntax — the lexer simply reduces the cases where a broken build even reaches the lint stage.
Can I run both add-ons at the same time?
Yes. The lexer and Parallel Lint share the same maker integration point (build checkbox, pause mechanics, panel slot). It runs cleanest with one checker as the active panel provider — if both are active, the lexer findings flow additively into the build check, and the panel slot goes to the add-on loaded last.
Does it need a PHP binary or exec()?
No. The lexer is entirely state-based and runs inside WordPress — no PHP binary, no exec(). That's what lets it run early in the build, even on restrictive hosts.
Which builds are checked, and where are results logged?
All three pipeline targets — DEV, PRO and FREE. Findings are logged to /wp-content/bh-lexer-debug.log and surfaced in the review window during the build.
Stop the one-character fatal
A closing tag in a comment can silently break an entire plugin — the lexer catches it before the ZIP is ever built.
