develooper Front page | perl.perl5.porters | Postings from May 2012

+1 for cv_set_call_parser

Thread Next
From:
Eric Brine
Date:
May 15, 2012 17:08
Subject:
+1 for cv_set_call_parser
Message ID:
CALJW-qEZEYR9kC7GiqJy6uHNEFt2vh946RK-2=T+Q8DQMC6gww@mail.gmail.com
Hi,

Based on my authorship of feature::qw_comments, on my attemps to use
CallParser and on recent discussions, I've come up with a list of abilities
that need to be provided by a mechanism to extend the language via prefix
keywords.

KP DC
-- --
Y  Y   1. Parse arbitrary grammars following the keyword.
N? Y   2. Determine whether the keyword is in a suitable spot for an
expression.
N? Y   3. Determine whether the keyword is in a suitable spot for a
statement.
Y  Y   4. Call the Perl parser to parse fundamental Perl grammars
structures (e.g. blocks).
N  N   5. Call the Perl parser to get next token, but only if it's an
identifier and only if it matches a list of identifiers. (Necessary to
create infix keywords such as "catch" without making them reserved words.)
Y  Y   6. Indicate whether a statement or expression is output by the
extender's parser.
Y  Y*  7. Limit the visibility of the prefix keyword to lexical scopes.
(Necessary to create pragmas like "feature say".)
Y  Y*  8. Output arbitrary opcodes.

KP = Keyword plugin
DC = Devel::CallParser

It's possible to achieve #7 with Devel::CallParser by using Lexical::Sub.
It's possible to achieve #8 with Devel::CallParser by using
cv_set_call_checker.

PS - I'm surprised cv_set_call_parser and cv_set_call_checker don't accept
NULL for their last argument.

- Eric

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About