Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

From PL_keyword_plugin, an opcode tree must always be generated. Whatever code is generated, even a single no-op, perl should resume parsing the (possibly modified) code remaining in the source stream.

In the example in Keyword::Simple, the provided keyword was consumed by the parser and the keyword handler called. The handler "stuffed" if in front of the current content of the source stream, "generated" a no-op then returned KEYWORD_PLUGIN_STMT, leaving the rest of the statement for perl to finish parsing.

For a keyword in an expression, a similar series of steps should also work.

In the case of XS::APItest::KeywordRPN*, the handler would have had to parse the expression itself, consuming the expression. At that point, the handler could have either generated an op-code tree for the parsed expression, or stuffed the source stream with an equivalent expression that perl could parse and generated a no-op.

In theory, a no-op should no have effect (other than consuming time), even in the middle of an expression. When XS::APItest::KeywordRPN was working, it may be that it was generating an actual op-code tree for the RPN expression. In which case, that could be what's necessary to implement an "expression keyword". If it regenerated the expression for perl to parse, then probably something changed in the Plug-able Keyword API that XS::APItest::KeywordRPN was never updated to comply with.


* Other than downloading the source distribution for perl (which I have no inclination to do), I have not found the XS source for XS::APItest::KeywordRPN, so I can only theorize on how it worked.

In reply to Re^5: Devel::Declare is deprecated, what’s instead? (Keyword::Simple) by RonW
in thread Devel::Declare is deprecated, what’s instead? by dk

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others perusing the Monastery: (6)
    As of 2019-07-16 16:45 GMT
    Find Nodes?
      Voting Booth?

      No recent polls found