You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a possibility to extend PPI recognised grammar. I know there is PPI::Transform and I looked at it, but it seems more of a post-processing api.
What I have in mind is a way to have something like:
async sub hello
{
print( "Hello world\n" );
}
be recognised as a PPI::Statement::Sub object and not as a PPI::Statement object.
The text was updated successfully, but these errors were encountered:
At least for that specific case (specialised syntax for sub-like blocks), I believe it would be a case of augmenting the lexer. In the past I have added keywords defined by Function::Parameters (e.g., method) by adding to the %PPI::Lexer::STATEMENT_CLASSES hash.
If you are willing to use PPR + Babble instead, it is pretty easy to extend the grammar by using pieces of the existing grammar. I have an example of this in this PR that adds a class keyword in the tests.
I can imagine a plugin that takes
async sub { ... }
and turns it into
sub :async { ... }
then processes it with the PPI interface and then transforms back into
Is there a possibility to extend PPI recognised grammar. I know there is
PPI::Transform
and I looked at it, but it seems more of a post-processing api.What I have in mind is a way to have something like:
be recognised as a
PPI::Statement::Sub
object and not as aPPI::Statement
object.The text was updated successfully, but these errors were encountered: