nqp

How to override the NQPMatch.Str function

爷,独闯天下 提交于 2020-04-13 03:55:31
问题 ... Or how to change $<sigil>.Str value from token sigil { ... } idependently from the matched text . Yes I'm asking how to cheat grammars above (i.e. calling) me. I am trying to write a Slang for Raku without sigil. So I want the nogil token, matching anything <?> to return NqpMatch that stringifies: $<sigil>.Str to '$'. Currently, my token sigil look like that token sigil { | <[$@%&]> | <nogil> { say "Nogil returned: ", lk($/, 'nogil').Str; # Here It should print "$" } } token nogil-proxy {

Is there a way to deal with Unix sockets in Perl 6?

天大地大妈咪最大 提交于 2019-12-08 16:47:35
问题 I'd like to communicate with mpv using Unix sockets, but Perl 6 doesn't offer any high level interface for doing that. So I thought I could write a little module for that, started digging deeper, found the implementation of IO::Socket::INET , and learned about the NQP ops nqp::socket and nqp::connect . However, I couldn't find any mention of those in the NQP operations list, and they seem to be quite distinct from the traditional BSD socket API. Hence I'd like to ask: are those two able to

Obtaining the Pod of a module without explicitly exporting it

℡╲_俬逩灬. 提交于 2019-12-01 15:58:04
问题 The documentation in Perl 6 programs, using the Pod 6 DSL, are actually parsed as part of the code; this makes that documentation available, inside the program, as the $=pod variable. However, I'd like to have access to that variable in order to process it from, say, tests. In this example I wrote for the Perl 6 Advent Calendar it's simply exported as a class (grammar, in this case) variable: our $pod = $=pod[0]; I can then use it this way: use Data::Dump; use MONKEY-SEE-NO-EVAL; sub MAIN(