php-rust-tools / parser

A handwritten fault-tolerant, recursive-descent parser for PHP written in Rust.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow semi-colon-less 1 liners in PHP tags.

ryangjchandler opened this issue · comments

Example from Laravel framework:

<div class="w-full mx-2 py-1 mt-1 bg-yellow text-black text-center uppercase">
    <?php echo htmlspecialchars($content) ?>
</div>

Omitting the semicolon at the end of this statement is allowed. We should probably do a lookahead to see if the next token is a closing tag and if it is, skip the semicolon check.

this is actually easy, in semi() function, expect either a semi-colon or ?>.

another thing to note that ;;;;;;;;;;;;;;;;; is same as ;.