Repository navigation
Changed
- The scanner and the parser are written by hand instead of being transliterated from cphalcon's re2c scanner and Lemon parser;
resources/files/parser.phpand the globalphvolt_*functions are gone. Phalcon\Volt\Parser\Parser::setDebug()andsetDebugFile()are deprecated; the debug file now receives a shift/reduce trace.Phalcon\Volt\Scanner\StateandPhalcon\Volt\Scanner\Tokenonly hold scanner state;Phalcon\Volt\Scanner\OpcodeandPhalcon\Volt\Parser\Statuswere removed.
Added
- Parity tests against ext-phalcon: a template corpus with goldens recorded from cphalcon (
tests/generate-golden.php),FixturesTest, andtests/differential.php, run in CI.
Fixed
Parsing now matches cphalcon exactly. Previously:
- syntax errors showed the previous token's value, and dropped empty,
"0"or blank values:unexpected token ~(id)instead ofunexpected token ~; - scanning errors quoted one character instead of the rest of the template;
- deeply nested templates were accepted instead of failing with "Parsing failed, the template expression is nested too deeply";
- blank text between the blocks of a child template was kept instead of dropped;
- a NUL byte did not end the template;
{# 0 #}ended the template.